From buildbot at python.org Sat Nov 1 02:39:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 01 Nov 2008 01:39:22 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20081101013922.3DB691E4002@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/41 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: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From nnorwitz at gmail.com Sat Nov 1 07:22:26 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 1 Nov 2008 01:22:26 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081101062226.GA30819@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie make[1]: *** [build] Killed make[1]: Leaving directory `/home/neal/python/r26/Doc' make: *** [dist] Error 2 From python-checkins at python.org Sat Nov 1 15:40:03 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 1 Nov 2008 15:40:03 +0100 (CET) Subject: [Python-checkins] r67071 - in doctools/trunk: sphinx/latexwriter.py sphinx/textwriter.py tests/root/markup.txt Message-ID: <20081101144003.341FC1E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 1 15:40:02 2008 New Revision: 67071 Log: Improve node coverage for latex/text writers. Modified: doctools/trunk/sphinx/latexwriter.py doctools/trunk/sphinx/textwriter.py doctools/trunk/tests/root/markup.txt Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Sat Nov 1 15:40:02 2008 @@ -358,6 +358,15 @@ self.in_title = 0 self.body.append(self.context.pop()) + def visit_subtitle(self, node): + if isinstance(node.parent, nodes.sidebar): + self.body.append('~\\\\\n\\textbf{') + self.context.append('}\n\\smallskip\n') + else: + self.context.append('') + def depart_subtitle(self, node): + self.body.append(self.context.pop()) + desc_map = { 'function' : 'funcdesc', 'class': 'classdesc', Modified: doctools/trunk/sphinx/textwriter.py ============================================================================== --- doctools/trunk/sphinx/textwriter.py (original) +++ doctools/trunk/sphinx/textwriter.py Sat Nov 1 15:40:02 2008 @@ -126,6 +126,16 @@ self.add_text(' ]-') self.end_state() + def visit_sidebar(self, node): + pass + def depart_sidebar(self, node): + pass + + def visit_compound(self, node): + pass + def depart_compound(self, node): + pass + def visit_glossary(self, node): pass def depart_glossary(self, node): @@ -145,6 +155,16 @@ self.stateindent.pop() self.states[-1].append((0, ['', text, '%s' % (char * len(text)), ''])) + def visit_subtitle(self, node): + pass + def depart_subtitle(self, node): + pass + + def visit_attribution(self, node): + self.add_text('-- ') + def depart_attribution(self, node): + pass + def visit_module(self, node): if node.has_key('platform'): self.new_state(0) Modified: doctools/trunk/tests/root/markup.txt ============================================================================== --- doctools/trunk/tests/root/markup.txt (original) +++ doctools/trunk/tests/root/markup.txt Sat Nov 1 15:40:02 2008 @@ -31,6 +31,41 @@ Tip text. +Body directives +--------------- + +.. topic:: Title + + Topic body. + +.. sidebar:: Sidebar + :subtitle: Sidebar subtitle + + Sidebar body. + +.. rubric:: Test rubric + +.. epigraph:: Epigraph title + + Epigraph body. + + -- Author + +.. highlights:: Highlights + + Highlights body. + +.. pull-quote:: Pull-quote + + Pull quote body. + +.. compound:: + + a + + b + + Tables ------ From python-checkins at python.org Sat Nov 1 15:54:52 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 1 Nov 2008 15:54:52 +0100 (CET) Subject: [Python-checkins] r67072 - doctools/trunk/doc/ext/ifconfig.rst Message-ID: <20081101145452.369B21E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 1 15:54:51 2008 New Revision: 67072 Log: Bring up to date and link to add_config_value(). Modified: doctools/trunk/doc/ext/ifconfig.rst Modified: doctools/trunk/doc/ext/ifconfig.rst ============================================================================== --- doctools/trunk/doc/ext/ifconfig.rst (original) +++ doctools/trunk/doc/ext/ifconfig.rst Sat Nov 1 15:54:51 2008 @@ -12,10 +12,22 @@ Include content of the directive only if the Python expression given as an argument is ``True``, evaluated in the namespace of the project's - configuration (that is, all variables from :file:`conf.py` are available). + configuration (that is, all registered variables from :file:`conf.py` are + available). For example, one could write :: .. ifconfig:: releaselevel in ('alpha', 'beta', 'rc') This stuff is only included in the built docs for unstable versions. + + To make a custom config value known to Sphinx, use + :func:`~sphinx.application.Sphinx.add_config_value` in the setup function in + :file:`conf.py`, e.g.:: + + def setup(app): + app.add_config_value('releaselevel', '', True) + + The second argument is the default value, the third should always be ``True`` + for such values (it selects if Sphinx re-reads the documents if the value + changes). From nnorwitz at gmail.com Sun Nov 2 07:22:14 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 01:22:14 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081102062214.GA28171@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile make[1]: *** [build] Killed make[1]: Leaving directory `/home/neal/python/r26/Doc' make: *** [dist] Error 2 From python-checkins at python.org Sun Nov 2 11:41:39 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 2 Nov 2008 11:41:39 +0100 (CET) Subject: [Python-checkins] r67073 - doctools/trunk/doc/rest.rst Message-ID: <20081102104139.11E6E1E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 2 11:41:38 2008 New Revision: 67073 Log: Clarification. Modified: doctools/trunk/doc/rest.rst Modified: doctools/trunk/doc/rest.rst ============================================================================== --- doctools/trunk/doc/rest.rst (original) +++ doctools/trunk/doc/rest.rst Sun Nov 2 11:41:38 2008 @@ -98,7 +98,8 @@ ----------- Literal code blocks are introduced by ending a paragraph with the special marker -``::``. The literal block must be indented, to be able to include blank lines:: +``::``. The literal block must be indented (and, like all paragraphs, separated +from the surrounding ones by blank lines):: This is a normal text paragraph. The next paragraph is a code sample:: From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12756@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12832@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12769@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12822@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12797@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6445@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6475@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6479@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6498@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6503@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12750@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12783@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12775@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12763@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12817@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6460@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12789@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6465@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12828@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6484@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6488@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6430@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6440@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081102112338.GA12807@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6450@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6493@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6508@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 11:15:01 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 05:15:01 -0500 Subject: [Python-checkins] Python Regression Test Failures opt (2) Message-ID: <20081102101501.GA11047@python.psfb.org> 326 tests OK. 2 tests failed: test_anydbm test_builtin 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl test_grammar test_opcodes test_dict test_builtin test test_builtin failed --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_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ 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 ; run in verbose mode for details 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 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 [17006 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_fileio 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_future5 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 [12826 refs] [12826 refs] [21355 refs] test_imageop 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_lib2to3 skipped -- No module named myfixes 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_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! 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 /tmp/python-test/local/lib/python2.7/os.py:759: DeprecationWarning: integer argument expected, got float bs += read(_urandomfd, n - len(bs)) 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 [14481 refs] [14481 refs] test_plistlib test_poll test_popen [12831 refs] [12831 refs] [12831 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 [17360 refs] test_pyexpat test_queue test_quopri [15351 refs] [15351 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 [12826 refs] [12826 refs] [12829 refs] [12826 refs] test_slice test_smtplib test_socket 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 [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [14726 refs] [13041 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] . [12826 refs] [12826 refs] this bit of output is from a test of stdout in a different process ... [12826 refs] [12826 refs] [13041 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry /tmp/python-test/local/lib/python2.7/test/test_sundry.py:67: DeprecationWarning: The posixfile module is deprecated; fcntl.lockf() provides better locking import posixfile test_symtable test_syntax test_sys [12826 refs] [12826 refs] [13055 refs] [12849 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12829 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [16318 refs] [15967 refs] [15783 refs] [15783 refs] [15783 refs] [15783 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. 2 tests failed: test_anydbm test_builtin 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl [649747 refs] From nnorwitz at gmail.com Sun Nov 2 12:59:51 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:59:51 -0500 Subject: [Python-checkins] Python Regression Test Failures all (5) Message-ID: <20081102115951.GA17222@python.psfb.org> 328 tests OK. 5 tests failed: test_optparse test_os test_platform test_urllibnet test_zipfile 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 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-12627 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... 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_fileio 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_future5 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 [12826 refs] [12826 refs] [21355 refs] test_imageop 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_lib2to3 skipped -- No module named myfixes 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_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! test_mutants test_mutex test_netrc test_new test_nis test_normalization test_ntpath test_old_mailbox test_openpty test_operator test_optparse test test_optparse failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.7/test/test_optparse.py", line 1049, in test_filetype_noexist test_support.TESTFN) File "/tmp/python-test/local/lib/python2.7/test/test_optparse.py", line 157, in assertParseFail self.assertFalse("expected parse failure") AssertionError test_os /tmp/python-test/local/lib/python2.7/os.py:759: DeprecationWarning: integer argument expected, got float bs += read(_urandomfd, n - len(bs)) test test_os failed -- errors occurred; run in verbose mode for details 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 test_platform failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.7/test/test_platform.py", line 22, in test_architecture_via_symlink os.symlink(real, link) OSError: [Errno 17] File exists test_plistlib test_poll test_popen [12831 refs] [12831 refs] [12831 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 [17360 refs] test_pyexpat test_queue test_quopri [15351 refs] [15351 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 [12826 refs] [12826 refs] [12829 refs] [12826 refs] test_slice test_smtplib test_socket 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 [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [14726 refs] [13041 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] . [12826 refs] [12826 refs] this bit of output is from a test of stdout in a different process ... [12826 refs] [12826 refs] [13041 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry /tmp/python-test/local/lib/python2.7/test/test_sundry.py:67: DeprecationWarning: The posixfile module is deprecated; fcntl.lockf() provides better locking import posixfile test_symtable test_syntax test_sys [12826 refs] [12826 refs] [13055 refs] [12849 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12829 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [16318 refs] [16812 refs] [15783 refs] [15783 refs] [15783 refs] [15783 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 test_urllibnet failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.7/test/test_urllibnet.py", line 166, in test_specified_path self.assert_(os.path.exists(file_location)) AssertionError 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 test_zipfile failed -- Traceback (most recent call last): File "/tmp/python-test/local/lib/python2.7/test/test_zipfile.py", line 763, in testComments zipfr = zipfile.ZipFile(TESTFN, mode="r") File "/tmp/python-test/local/lib/python2.7/zipfile.py", line 698, in __init__ self._GetContents() File "/tmp/python-test/local/lib/python2.7/zipfile.py", line 718, in _GetContents self._RealGetContents() File "/tmp/python-test/local/lib/python2.7/zipfile.py", line 730, in _RealGetContents raise BadZipfile, "File is not a zip file" BadZipfile: File is not a zip file test_zipfile64 test_zipfile64 skipped -- test requires loads of disk-space bytes and a long time to run test_zipimport test_zlib 328 tests OK. 5 tests failed: test_optparse test_os test_platform test_urllibnet test_zipfile 25 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_cd test_cl test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_macos test_macostools test_multiprocessing test_pep277 test_py3kwarn test_scriptpackages test_startfile test_sunaudiodev test_tcl test_unicode_file test_winreg test_winsound test_zipfile64 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl [665380 refs] From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6470@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From nnorwitz at gmail.com Sun Nov 2 12:23:38 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 06:23:38 -0500 Subject: [Python-checkins] Python Regression Test Failures opt (2) Message-ID: <20081102112337.GA12630@python.psfb.org> 326 tests OK. 2 tests failed: test_anydbm test_builtin 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl test_grammar test_opcodes test_dict test_builtin test test_builtin failed --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_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ 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 ; run in verbose mode for details 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 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_fileio 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_future5 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 test_imageop 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_lib2to3 skipped -- No module named myfixes 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_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! 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 /tmp/python-test/local/lib/python2.7/os.py:759: DeprecationWarning: integer argument expected, got float bs += read(_urandomfd, n - len(bs)) 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 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 test_pyexpat test_queue test_quopri 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 test_slice test_smtplib test_socket 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 . this bit of output is from a test of stdout in a different process ... test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry /tmp/python-test/local/lib/python2.7/test/test_sundry.py:67: DeprecationWarning: The posixfile module is deprecated; fcntl.lockf() provides better locking import posixfile test_symtable test_syntax test_sys test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading test_threading_local test_threadsignals test_time test_timeout test_timeout skipped -- Use of the `network' resource not enabled test_tokenize test_trace test_traceback test_transformer test_tuple test_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. 2 tests failed: test_anydbm test_builtin 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl 326 tests OK. 2 tests failed: test_anydbm test_builtin 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl test_grammar test_opcodes test_dict test_builtin test test_builtin failed --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_doctest2 test_MimeWriter test_SimpleHTTPServer test_StringIO test___all__ test___future__ 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 ; run in verbose mode for details 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 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 [17006 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_fileio 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_future5 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 [12826 refs] [12826 refs] [21355 refs] test_imageop 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_lib2to3 skipped -- No module named myfixes 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_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! 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 /tmp/python-test/local/lib/python2.7/os.py:759: DeprecationWarning: integer argument expected, got float bs += read(_urandomfd, n - len(bs)) 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 [14481 refs] [14481 refs] test_plistlib test_poll test_popen [12831 refs] [12831 refs] [12831 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 [17360 refs] test_pyexpat test_queue test_quopri [15351 refs] [15351 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 [12826 refs] [12826 refs] [12829 refs] [12826 refs] test_slice test_smtplib test_socket 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 [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [14726 refs] [13041 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] . [12826 refs] [12826 refs] this bit of output is from a test of stdout in a different process ... [12826 refs] [12826 refs] [13041 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry /tmp/python-test/local/lib/python2.7/test/test_sundry.py:67: DeprecationWarning: The posixfile module is deprecated; fcntl.lockf() provides better locking import posixfile test_symtable test_syntax test_sys [12826 refs] [12826 refs] [13055 refs] [12849 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12829 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [16318 refs] [15967 refs] [15783 refs] [15783 refs] [15783 refs] [15783 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. 2 tests failed: test_anydbm test_builtin 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl [649747 refs] From nnorwitz at gmail.com Sun Nov 2 10:05:41 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 2 Nov 2008 04:05:41 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak () Message-ID: <20081102090541.GA6435@python.psfb.org> More important issues: ---------------------- Less important issues: ---------------------- From python-checkins at python.org Sun Nov 2 21:04:25 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 2 Nov 2008 21:04:25 +0100 (CET) Subject: [Python-checkins] r67074 - in doctools/trunk: CHANGES doc/ext/autodoc.rst sphinx/ext/autodoc.py Message-ID: <20081102200425.875CB1E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 2 21:04:24 2008 New Revision: 67074 Log: Allow skipping members by event. 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 Sun Nov 2 21:04:24 2008 @@ -94,9 +94,12 @@ creates links to Sphinx documentation of Python objects in other projects. - - sphinx.doc.autodoc has a new event ``autodoc-process-signature`` + - sphinx.ext.autodoc has a new event ``autodoc-process-signature`` that allows tuning function signature introspection. + - sphinx.ext.autodoc has a new event ``autodoc-skip-member`` that allows + tuning which members are included in the generated content. + - Respect __all__ when autodocumenting module members. - The `automodule` directive now supports the ``synopsis``, Modified: doctools/trunk/doc/ext/autodoc.rst ============================================================================== --- doctools/trunk/doc/ext/autodoc.rst (original) +++ doctools/trunk/doc/ext/autodoc.rst Sun Nov 2 21:04:24 2008 @@ -240,3 +240,31 @@ .. autofunction:: cut_lines .. autofunction:: between + + +Skipping members +---------------- + +autodoc allows the user to define a custom method for determining whether a +member should be included in the documentation by using the following event: + +.. event:: autodoc-skip-member (app, what, name, obj, skip, options) + + .. versionadded:: 0.5 + + Emitted when autodoc has to decide whether a member should be included in the + documentation. The member is excluded if a handler returns ``True``. It is + included if the handler returns ``False``. + + :param app: the Sphinx application object + :param what: the type of the object which the docstring belongs to (one of + ``"module"``, ``"class"``, ``"exception"``, ``"function"``, ``"method"``, + ``"attribute"``) + :param name: the fully qualified name of the object + :param obj: the object itself + :param skip: a boolean indicating if autodoc will skip this member if the user + handler does not override the decision + :param options: the options given to the directive: an object with attributes + ``inherited_members``, ``undoc_members``, ``show_inheritance`` and + ``noindex`` that are true if the flag option of same name was given to the + auto directive Modified: doctools/trunk/sphinx/ext/autodoc.py ============================================================================== --- doctools/trunk/sphinx/ext/autodoc.py (original) +++ doctools/trunk/sphinx/ext/autodoc.py Sun Nov 2 21:04:24 2008 @@ -7,7 +7,7 @@ the doctree, thus avoiding duplication between docstrings and documentation for those who like elaborate docstrings. - :copyright: 2008 by Georg Brandl, Pauli Virtanen. + :copyright: 2008 by Georg Brandl, Pauli Virtanen, Martin Hans. :license: BSD. """ @@ -526,10 +526,20 @@ # 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 self.options.undoc_members and not doc: + skip = not self.options.undoc_members and not doc + # give the user a chance to decide whether this member should be skipped + if self.env.app: + # let extensions preprocess docstrings + skip_user = self.env.app.emit_firstresult( + 'autodoc-skip-member', what, membername, member, skip, self.options) + if skip_user is not None: + skip = skip_user + if skip: continue + if what == 'module': if isinstance(member, types.FunctionType): memberwhat = 'function' @@ -645,3 +655,4 @@ app.add_config_value('autoclass_content', 'class', True) app.add_event('autodoc-process-docstring') app.add_event('autodoc-process-signature') + app.add_event('autodoc-skip-member') From python-checkins at python.org Sun Nov 2 22:49:06 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 2 Nov 2008 22:49:06 +0100 (CET) Subject: [Python-checkins] r67075 - doctools/trunk/THIS_REPO_IS_OUTDATED Message-ID: <20081102214906.70F511E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 2 22:49:01 2008 New Revision: 67075 Log: Add note that this repo is outdated. Added: doctools/trunk/THIS_REPO_IS_OUTDATED Added: doctools/trunk/THIS_REPO_IS_OUTDATED ============================================================================== --- (empty file) +++ doctools/trunk/THIS_REPO_IS_OUTDATED Sun Nov 2 22:49:01 2008 @@ -0,0 +1,5 @@ +This repository is outdated! Please refer to the new Mercurial repository at + +http://www.bitbucket.org/birkenfeld/sphinx/ + +for newest code. From python-checkins at python.org Mon Nov 3 02:12:18 2008 From: python-checkins at python.org (thomas.lee) Date: Mon, 3 Nov 2008 02:12:18 +0100 (CET) Subject: [Python-checkins] r67076 - in python/branches/tlee-ast-optimize: Doc/ACKS.txt Doc/library/2to3.rst Doc/library/codecs.rst Doc/library/collections.rst Doc/library/cookielib.rst Doc/library/dis.rst Doc/library/functions.rst Doc/library/heapq.rst Doc/library/multiprocessing.rst Doc/library/stdtypes.rst Doc/library/tempfile.rst Doc/reference/compound_stmts.rst Doc/reference/datamodel.rst Doc/reference/lexical_analysis.rst Doc/whatsnew/2.6.rst Doc/whatsnew/index.rst Include/compile.h Lib/antigravity.py Lib/ast.py Lib/bdb.py Lib/idlelib/PyShell.py Lib/idlelib/run.py Lib/inspect.py Lib/json/tests/test_scanstring.py Lib/lib2to3 Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_set_literal.py Lib/lib2to3/main.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/data/README Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_pytree.py Lib/lib2to3/tests/test_refactor.py Lib/modulefinder.py Lib/pdb.py Lib/platform.py Lib/test/pickletester.py Lib/test/test_bytes.py Lib/test/test_descr.py Lib/test/test_future.py Lib/test/test_future5.py Lib/test/test_io.py Lib/test/test_modulefinder.py Lib/test/test_parser.py Lib/test/test_platform.py Lib/test/test_py3kwarn.py Lib/test/test_urllib.py Lib/test/test_xrange.py Makefile.pre.in Misc/NEWS Modules/_fileio.c Modules/_json.c Modules/cPickle.c Modules/parsermodule.c Modules/posixmodule.c Parser/asdl_c.py Parser/parser.c Python/Python-ast.c Python/ast.c Python/future.c Python/pythonrun.c Tools/msi/msi.py Tools/scripts/findnocoding.py Tools/scripts/reindent.py Message-ID: <20081103011218.B0EFD1E4002@bag.python.org> Author: thomas.lee Date: Mon Nov 3 02:12:16 2008 New Revision: 67076 Log: Merged revisions 66898-67075 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r66902 | skip.montanaro | 2008-10-15 22:49:10 +1100 (Wed, 15 Oct 2008) | 1 line easter egg ................ r66903 | benjamin.peterson | 2008-10-16 07:34:09 +1100 (Thu, 16 Oct 2008) | 1 line don't recurse into directories that start with '.' ................ r66905 | benjamin.peterson | 2008-10-16 08:05:55 +1100 (Thu, 16 Oct 2008) | 1 line support the optional line argument for idle ................ r66906 | benjamin.peterson | 2008-10-16 08:58:46 +1100 (Thu, 16 Oct 2008) | 1 line add a much requested newline ................ r66911 | benjamin.peterson | 2008-10-16 10:10:28 +1100 (Thu, 16 Oct 2008) | 41 lines Merged revisions 66805,66841,66860,66884-66886,66893,66907,66910 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r66805 | benjamin.peterson | 2008-10-04 20:11:02 -0500 (Sat, 04 Oct 2008) | 1 line mention what the fixes directory is for ........ r66841 | benjamin.peterson | 2008-10-07 17:48:12 -0500 (Tue, 07 Oct 2008) | 1 line use assertFalse and assertTrue ........ r66860 | benjamin.peterson | 2008-10-08 16:05:07 -0500 (Wed, 08 Oct 2008) | 1 line instead of abusing the pattern matcher, use start_tree to find a next binding ........ r66884 | benjamin.peterson | 2008-10-13 15:50:30 -0500 (Mon, 13 Oct 2008) | 1 line don't print tokens to stdout when -v is given ........ r66885 | benjamin.peterson | 2008-10-13 16:28:57 -0500 (Mon, 13 Oct 2008) | 1 line add the -x option to disable fixers ........ r66886 | benjamin.peterson | 2008-10-13 16:33:53 -0500 (Mon, 13 Oct 2008) | 1 line cut down on some crud ........ r66893 | benjamin.peterson | 2008-10-14 17:16:54 -0500 (Tue, 14 Oct 2008) | 1 line add an optional set literal fixer ........ r66907 | benjamin.peterson | 2008-10-15 16:59:41 -0500 (Wed, 15 Oct 2008) | 1 line don't write backup files by default ........ r66910 | benjamin.peterson | 2008-10-15 17:43:10 -0500 (Wed, 15 Oct 2008) | 1 line add the -n option; it stops backupfiles from being written ........ ................ r66912 | hirokazu.yamamoto | 2008-10-16 17:25:25 +1100 (Thu, 16 Oct 2008) | 2 lines removed unused _PyUnicode_FromFileSystemEncodedObject. made win32_chdir, win32_wchdir static. ................ r66913 | benjamin.peterson | 2008-10-17 05:52:14 +1100 (Fri, 17 Oct 2008) | 1 line document that deque indexing is O(n) #4123 ................ r66922 | benjamin.peterson | 2008-10-17 06:40:14 +1100 (Fri, 17 Oct 2008) | 1 line use new showwarnings signature for idle #3391 ................ r66927 | andrew.kuchling | 2008-10-17 07:15:47 +1100 (Fri, 17 Oct 2008) | 1 line Fix wording (2.6.1 backport candidate) ................ r66928 | georg.brandl | 2008-10-17 07:20:56 +1100 (Fri, 17 Oct 2008) | 2 lines Add more TOC to the whatsnew index page. ................ r66932 | benjamin.peterson | 2008-10-17 08:09:28 +1100 (Fri, 17 Oct 2008) | 1 line check for error conditions in _json #3623 ................ r66936 | georg.brandl | 2008-10-17 08:20:15 +1100 (Fri, 17 Oct 2008) | 2 lines #4131: FF3 doesn't write cookies.txt files. ................ r66938 | benjamin.peterson | 2008-10-17 08:27:54 +1100 (Fri, 17 Oct 2008) | 1 line fix possible ref leak ................ r66939 | georg.brandl | 2008-10-17 08:36:39 +1100 (Fri, 17 Oct 2008) | 2 lines part of #4012: kill off old name "processing". ................ r66940 | georg.brandl | 2008-10-17 08:38:48 +1100 (Fri, 17 Oct 2008) | 2 lines #4083: add "as" to except handler grammar as per PEP 3110. ................ r66942 | benjamin.peterson | 2008-10-17 08:48:06 +1100 (Fri, 17 Oct 2008) | 1 line fix more possible ref leaks in _json and use Py_CLEAR ................ r66958 | martin.v.loewis | 2008-10-18 00:43:01 +1100 (Sat, 18 Oct 2008) | 1 line Issue #4091: Install pythonxy.dll in system32 again. ................ r66962 | benjamin.peterson | 2008-10-18 07:01:01 +1100 (Sat, 18 Oct 2008) | 1 line clarify CALL_FUNCTION #4141 ................ r66964 | georg.brandl | 2008-10-18 08:41:49 +1100 (Sat, 18 Oct 2008) | 2 lines Fix duplicate word. ................ r66973 | armin.ronacher | 2008-10-19 19:27:43 +1100 (Sun, 19 Oct 2008) | 3 lines Fixed #4067 by implementing _attributes and _fields for the AST root node. ................ r66974 | benjamin.peterson | 2008-10-20 00:59:01 +1100 (Mon, 20 Oct 2008) | 1 line fix compiler warning ................ r66977 | benjamin.peterson | 2008-10-20 06:39:16 +1100 (Mon, 20 Oct 2008) | 1 line mention -n ................ r66984 | armin.ronacher | 2008-10-21 08:29:08 +1100 (Tue, 21 Oct 2008) | 3 lines Fixed #4062, added import for _ast.__version__ to ast to match the documented behavior. ................ r66989 | matthias.klose | 2008-10-21 20:12:25 +1100 (Tue, 21 Oct 2008) | 2 lines - install versioned manpage ................ r66992 | benjamin.peterson | 2008-10-22 07:51:13 +1100 (Wed, 22 Oct 2008) | 1 line make sure to call iteritems() ................ r66994 | amaury.forgeotdarc | 2008-10-22 09:01:38 +1100 (Wed, 22 Oct 2008) | 6 lines #4157 move two test functions out of platform.py. Turn them into unit tests, and correct an obvious typo: (("a", "b") ("c", "d") ("e", "f")) compiles even with the missing commas, but does not execute very well... ................ r66995 | benjamin.peterson | 2008-10-22 09:18:29 +1100 (Wed, 22 Oct 2008) | 1 line return ArgInfo from inspect.getargvalues #4092 ................ r66996 | benjamin.peterson | 2008-10-22 09:20:31 +1100 (Wed, 22 Oct 2008) | 1 line add NEWs note for last change ................ r66998 | benjamin.peterson | 2008-10-23 07:57:43 +1100 (Thu, 23 Oct 2008) | 1 line fix a few typos ................ r66999 | benjamin.peterson | 2008-10-23 08:05:30 +1100 (Thu, 23 Oct 2008) | 1 line and another typo... ................ r67000 | benjamin.peterson | 2008-10-23 08:16:34 +1100 (Thu, 23 Oct 2008) | 1 line fix #4150: pdb's up command didn't work for generators in post-mortem ................ r67002 | hirokazu.yamamoto | 2008-10-23 11:37:33 +1100 (Thu, 23 Oct 2008) | 1 line Issue #4183: Some tests didn't run with pickle.HIGHEST_PROTOCOL. ................ r67005 | walter.doerwald | 2008-10-24 00:11:39 +1100 (Fri, 24 Oct 2008) | 2 lines Use the correct names of the stateless codec functions (Fixes issue 4178). ................ r67007 | benjamin.peterson | 2008-10-24 08:43:48 +1100 (Fri, 24 Oct 2008) | 1 line only nonempty __slots__ don't work ................ r67013 | benjamin.peterson | 2008-10-25 13:53:28 +1100 (Sat, 25 Oct 2008) | 1 line give a py3k warning when 'nonlocal' is used as a variable name ................ r67015 | georg.brandl | 2008-10-25 18:00:52 +1100 (Sat, 25 Oct 2008) | 2 lines Typo fix. ................ r67028 | benjamin.peterson | 2008-10-26 10:27:07 +1100 (Sun, 26 Oct 2008) | 1 line don't use a catch-all ................ r67030 | benjamin.peterson | 2008-10-27 07:21:13 +1100 (Mon, 27 Oct 2008) | 1 line fix __future__ imports when multiple features are given ................ r67031 | benjamin.peterson | 2008-10-27 07:33:19 +1100 (Mon, 27 Oct 2008) | 1 line add forgotten test for r67030 ................ r67040 | armin.rigo | 2008-10-29 04:01:21 +1100 (Wed, 29 Oct 2008) | 5 lines Fix one of the tests: it relied on being present in an "output test" in order to actually test what it was supposed to test, i.e. that the code in the __del__ method did not crash. Use instead the new helper test_support.captured_output(). ................ r67041 | benjamin.peterson | 2008-10-30 07:33:00 +1100 (Thu, 30 Oct 2008) | 1 line mention the version gettempdir() was added ................ r67044 | amaury.forgeotdarc | 2008-10-30 10:15:57 +1100 (Thu, 30 Oct 2008) | 3 lines Correct error message in io.open(): closefd=True is the only accepted value with a file name. ................ r67046 | thomas.heller | 2008-10-31 07:18:13 +1100 (Fri, 31 Oct 2008) | 2 lines Fixed a modulefinder crash on certain relative imports. ................ r67049 | amaury.forgeotdarc | 2008-10-31 08:18:34 +1100 (Fri, 31 Oct 2008) | 8 lines Issue #4176: Pickle would crash the interpreter when a __reduce__ function does not return an iterator for the 4th and 5th items. (sequence-like and mapping-like state) A list is not an iterator... Will backport to 2.6 and 2.5. ................ r67052 | christian.heimes | 2008-10-31 08:26:15 +1100 (Fri, 31 Oct 2008) | 1 line Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members. ................ r67060 | benjamin.peterson | 2008-10-31 09:39:25 +1100 (Fri, 31 Oct 2008) | 1 line backport bin() documentation ................ r67061 | benjamin.peterson | 2008-10-31 09:44:18 +1100 (Fri, 31 Oct 2008) | 1 line finish backporting binary literals and new octal literals docs ................ r67065 | benjamin.peterson | 2008-10-31 10:59:18 +1100 (Fri, 31 Oct 2008) | 1 line move unprefixed error into .c file ................ r67066 | benjamin.peterson | 2008-10-31 13:16:05 +1100 (Fri, 31 Oct 2008) | 5 lines make sure the parser flags and passed onto the compiler This fixes "from __future__ import unicode_literals" in an exec statment See #4225 ................ r67070 | benjamin.peterson | 2008-11-01 07:41:44 +1100 (Sat, 01 Nov 2008) | 1 line rephrase has_key doc ................ Added: python/branches/tlee-ast-optimize/Lib/antigravity.py - copied unchanged from r67070, /python/trunk/Lib/antigravity.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_set_literal.py - copied unchanged from r67070, /python/trunk/Lib/lib2to3/fixes/fix_set_literal.py python/branches/tlee-ast-optimize/Lib/test/test_future5.py - copied unchanged from r67070, /python/trunk/Lib/test/test_future5.py Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/ACKS.txt python/branches/tlee-ast-optimize/Doc/library/2to3.rst python/branches/tlee-ast-optimize/Doc/library/codecs.rst python/branches/tlee-ast-optimize/Doc/library/collections.rst python/branches/tlee-ast-optimize/Doc/library/cookielib.rst python/branches/tlee-ast-optimize/Doc/library/dis.rst python/branches/tlee-ast-optimize/Doc/library/functions.rst python/branches/tlee-ast-optimize/Doc/library/heapq.rst python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst python/branches/tlee-ast-optimize/Doc/library/stdtypes.rst python/branches/tlee-ast-optimize/Doc/library/tempfile.rst python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst python/branches/tlee-ast-optimize/Doc/reference/lexical_analysis.rst python/branches/tlee-ast-optimize/Doc/whatsnew/2.6.rst python/branches/tlee-ast-optimize/Doc/whatsnew/index.rst python/branches/tlee-ast-optimize/Include/compile.h python/branches/tlee-ast-optimize/Lib/ast.py python/branches/tlee-ast-optimize/Lib/bdb.py python/branches/tlee-ast-optimize/Lib/idlelib/PyShell.py python/branches/tlee-ast-optimize/Lib/idlelib/run.py python/branches/tlee-ast-optimize/Lib/inspect.py python/branches/tlee-ast-optimize/Lib/json/tests/test_scanstring.py python/branches/tlee-ast-optimize/Lib/lib2to3/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_next.py python/branches/tlee-ast-optimize/Lib/lib2to3/main.py python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/README python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_pytree.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py python/branches/tlee-ast-optimize/Lib/modulefinder.py python/branches/tlee-ast-optimize/Lib/pdb.py python/branches/tlee-ast-optimize/Lib/platform.py python/branches/tlee-ast-optimize/Lib/test/pickletester.py python/branches/tlee-ast-optimize/Lib/test/test_bytes.py python/branches/tlee-ast-optimize/Lib/test/test_descr.py python/branches/tlee-ast-optimize/Lib/test/test_future.py python/branches/tlee-ast-optimize/Lib/test/test_io.py python/branches/tlee-ast-optimize/Lib/test/test_modulefinder.py python/branches/tlee-ast-optimize/Lib/test/test_parser.py python/branches/tlee-ast-optimize/Lib/test/test_platform.py python/branches/tlee-ast-optimize/Lib/test/test_py3kwarn.py python/branches/tlee-ast-optimize/Lib/test/test_urllib.py python/branches/tlee-ast-optimize/Lib/test/test_xrange.py python/branches/tlee-ast-optimize/Makefile.pre.in python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_fileio.c python/branches/tlee-ast-optimize/Modules/_json.c python/branches/tlee-ast-optimize/Modules/cPickle.c python/branches/tlee-ast-optimize/Modules/parsermodule.c python/branches/tlee-ast-optimize/Modules/posixmodule.c python/branches/tlee-ast-optimize/Parser/asdl_c.py python/branches/tlee-ast-optimize/Parser/parser.c python/branches/tlee-ast-optimize/Python/Python-ast.c python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/future.c python/branches/tlee-ast-optimize/Python/pythonrun.c python/branches/tlee-ast-optimize/Tools/msi/msi.py python/branches/tlee-ast-optimize/Tools/scripts/findnocoding.py python/branches/tlee-ast-optimize/Tools/scripts/reindent.py 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 Mon Nov 3 02:12:16 2008 @@ -16,6 +16,7 @@ * A. Amoroso * Pehr Anderson * Oliver Andrich + * Heidi Annexstad * Jes?s Cea Avi?n * Daniel Barclay * Chris Barker @@ -189,6 +190,7 @@ * Reuben Sumner * Kalle Svensson * Jim Tittsler + * David Turner * Ville Vainio * Martijn Vries * Charles G. Waldman Modified: python/branches/tlee-ast-optimize/Doc/library/2to3.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/2to3.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/2to3.rst Mon Nov 3 02:12:16 2008 @@ -37,8 +37,8 @@ A diff against the original source file is printed. 2to3 can also write the needed modifications right back to the source file. (Of course, a backup of the -original is also be made.) Writing the changes back is enabled with the -:option:`-w` flag:: +original is also be made unless :option:`-n` is also given.) Writing the +changes back is enabled with the :option:`-w` flag:: $ 2to3 -w example.py @@ -50,11 +50,10 @@ name = input() greet(name) -Comments and and exact indentation are preserved throughout the translation -process. +Comments and exact indentation are preserved throughout the translation process. By default, 2to3 runs a set of predefined fixers. The :option:`-l` flag lists -all avaible fixers. An explicit set of fixers to run can be given with +all available fixers. An explicit set of fixers to run can be given with :option:`-f`. Likewise the :option:`-x` explicitly disables a fixer. The following example runs only the ``imports`` and ``has_key`` fixers:: @@ -64,7 +63,7 @@ $ 2to3 -x apply example.py -Some fixers are *explicit*, meaning they aren't run be default and must be +Some fixers are *explicit*, meaning they aren't run by default and must be listed on the command line to be run. Here, in addition to the default fixers, the ``idioms`` fixer is run:: @@ -72,10 +71,10 @@ Notice how passing ``all`` enables all default fixers. -Sometimes 2to3 will find will find a place in your source code that needs to be -changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a -warning beneath the diff for a file. You should address the warning in order to -have compliant 3.x code. +Sometimes 2to3 will find a place in your source code that needs to be changed, +but 2to3 cannot fix automatically. In this case, 2to3 will print a warning +beneath the diff for a file. You should address the warning in order to have +compliant 3.x code. 2to3 can also refactor doctests. To enable this mode, use the :option:`-d` flag. Note that *only* doctests will be refactored. This also doesn't require @@ -89,7 +88,7 @@ a statement. This is useful when ``from __future__ import print_function`` is being used. If this option is not given, the print fixer will surround print calls in an extra set of parentheses because it cannot differentiate between the -and print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a +print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a true function call. 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 Mon Nov 3 02:12:16 2008 @@ -32,9 +32,9 @@ * ``name`` The name of the encoding; - * ``encoder`` The stateless encoding function; + * ``encode`` The stateless encoding function; - * ``decoder`` The stateless decoding function; + * ``decode`` The stateless decoding function; * ``incrementalencoder`` An incremental encoder class or factory function; @@ -46,7 +46,7 @@ The various functions or classes take the following arguments: - *encoder* and *decoder*: These must be functions or methods which have the same + *encode* and *decode*: These must be functions or methods which have the same interface as the :meth:`encode`/:meth:`decode` methods of Codec instances (see Codec Interface). The functions/methods are expected to work in a stateless mode. 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 Nov 3 02:12:16 2008 @@ -247,7 +247,9 @@ In addition to the above, deques support iteration, pickling, ``len(d)``, ``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with -the :keyword:`in` operator, and subscript references such as ``d[-1]``. +the :keyword:`in` operator, and subscript references such as ``d[-1]``. Indexed +access is O(1) at both ends but slows to O(n) in the middle. For fast random +access, use lists instead. Example: 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 Mon Nov 3 02:12:16 2008 @@ -324,6 +324,11 @@ .. note:: + Version 3 of the Firefox web browser no longer writes cookies in the + ``cookies.txt`` file format. + + .. note:: + This loses information about RFC 2965 cookies, and also about newer or non-standard cookie-attributes such as ``port``. Modified: python/branches/tlee-ast-optimize/Doc/library/dis.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/dis.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/dis.rst Mon Nov 3 02:12:16 2008 @@ -755,7 +755,8 @@ opcode finds the keyword parameters first. For each keyword argument, the value is on top of the key. Below the keyword parameters, the positional parameters are on the stack, with the right-most parameter on top. Below the parameters, - the function object to call is on the stack. + the function object to call is on the stack. Pops all function arguments, and + the function itself off the stack, and pushes the return value. .. opcode:: MAKE_FUNCTION (argc) Modified: python/branches/tlee-ast-optimize/Doc/library/functions.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/functions.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/functions.rst Mon Nov 3 02:12:16 2008 @@ -112,6 +112,15 @@ .. versionadded:: 2.3 +.. function:: bin(x) + + Convert an integer number to a binary string. The result is a valid Python + expression. If *x* is not a Python :class:`int` object, it has to define an + :meth:`__index__` method that returns an integer. + + .. versionadded:: 2.6 + + .. function:: bool([x]) Convert a value to a Boolean, using the standard truth testing procedure. If @@ -908,7 +917,8 @@ best explained with an example:: class C(object): - def __init__(self): self._x = None + def __init__(self): + self._x = None @property def x(self): Modified: python/branches/tlee-ast-optimize/Doc/library/heapq.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/heapq.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/heapq.rst Mon Nov 3 02:12:16 2008 @@ -95,7 +95,7 @@ Merge multiple sorted inputs into a single sorted output (for example, merge timestamped entries from multiple log files). Returns an :term:`iterator` - over over the sorted values. + over the sorted values. Similar to ``sorted(itertools.chain(*iterables))`` but returns an iterable, does not pull the data into memory all at once, and assumes that each of the input Modified: python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst Mon Nov 3 02:12:16 2008 @@ -378,8 +378,8 @@ Example usage of some of the methods of :class:`Process`:: - >>> import processing, time, signal - >>> p = processing.Process(target=time.sleep, args=(1000,)) + >>> import multiprocessing, time, signal + >>> p = multiprocessing.Process(target=time.sleep, args=(1000,)) >>> print p, p.is_alive() False >>> p.start() @@ -1781,12 +1781,12 @@ Below is an example session with logging turned on:: - >>> import processing, logging - >>> logger = processing.getLogger() + >>> import multiprocessing, logging + >>> logger = multiprocessing.getLogger() >>> logger.setLevel(logging.INFO) >>> logger.warning('doomed') [WARNING/MainProcess] doomed - >>> m = processing.Manager() + >>> m = multiprocessing.Manager() [INFO/SyncManager-1] child process calling self.run() [INFO/SyncManager-1] manager bound to '\\\\.\\pipe\\pyc-2776-0-lj0tfa' >>> del m 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 Nov 3 02:12:16 2008 @@ -246,14 +246,15 @@ pair: octal; literals Numbers are created by numeric literals or as the result of built-in functions -and operators. Unadorned integer literals (including hex and octal numbers) -yield plain integers unless the value they denote is too large to be represented -as a plain integer, in which case they yield a long integer. Integer literals -with an ``'L'`` or ``'l'`` suffix yield long integers (``'L'`` is preferred -because ``1l`` looks too much like eleven!). Numeric literals containing a -decimal point or an exponent sign yield floating point numbers. Appending -``'j'`` or ``'J'`` to a numeric literal yields a complex number with a zero real -part. A complex numeric literal is the sum of a real and an imaginary part. +and operators. Unadorned integer literals (including binary, hex, and octal +numbers) yield plain integers unless the value they denote is too large to be +represented as a plain integer, in which case they yield a long integer. +Integer literals with an ``'L'`` or ``'l'`` suffix yield long integers (``'L'`` +is preferred because ``1l`` looks too much like eleven!). Numeric literals +containing a decimal point or an exponent sign yield floating point numbers. +Appending ``'j'`` or ``'J'`` to a numeric literal yields a complex number with a +zero real part. A complex numeric literal is the sum of a real and an imaginary +part. .. index:: single: arithmetic @@ -1923,7 +1924,8 @@ .. method:: has_key(key) - ``dict.has_key(key)`` is equivalent to ``key in d``, but deprecated. + Test for the presence of *key* in the dictionary. :meth:`has_key` is + deprecated in favor of ``key in d``. .. method:: items() Modified: python/branches/tlee-ast-optimize/Doc/library/tempfile.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/tempfile.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/tempfile.rst Mon Nov 3 02:12:16 2008 @@ -224,6 +224,8 @@ :data:`tempdir` is not ``None``, this simply returns its contents; otherwise, the search described above is performed, and the result returned. + .. versionadded:: 2.3 + .. data:: template Modified: python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/compound_stmts.rst Mon Nov 3 02:12:16 2008 @@ -221,7 +221,7 @@ .. productionlist:: try_stmt: try1_stmt | try2_stmt try1_stmt: "try" ":" `suite` - : ("except" [`expression` ["," `target`]] ":" `suite`)+ + : ("except" [`expression` [("as" | ",") `target`]] ":" `suite`)+ : ["else" ":" `suite`] : ["finally" ":" `suite`] try2_stmt: "try" ":" `suite` Modified: python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst Mon Nov 3 02:12:16 2008 @@ -1663,8 +1663,8 @@ defined. As a result, subclasses will have a *__dict__* unless they also define *__slots__*. -* *__slots__* do not work for classes derived from "variable-length" built-in - types such as :class:`long`, :class:`str` and :class:`tuple`. +* Nonempty *__slots__* does not work for classes derived from "variable-length" + built-in types such as :class:`long`, :class:`str` and :class:`tuple`. * Any non-string iterable may be assigned to *__slots__*. Mappings may also be used; however, in the future, special meaning may be assigned to the values Modified: python/branches/tlee-ast-optimize/Doc/reference/lexical_analysis.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/lexical_analysis.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/lexical_analysis.rst Mon Nov 3 02:12:16 2008 @@ -605,6 +605,7 @@ single: long integer literal single: floating point literal single: hexadecimal literal + single: binary literal single: octal literal single: decimal literal single: imaginary literal @@ -629,12 +630,14 @@ .. productionlist:: longinteger: `integer` ("l" | "L") - integer: `decimalinteger` | `octinteger` | `hexinteger` + integer: `decimalinteger` | `octinteger` | `hexinteger` | `bininteger` decimalinteger: `nonzerodigit` `digit`* | "0" - octinteger: "0" `octdigit`+ + octinteger: "0" ("o" | "O") `octdigit`+ | "0" `octdigit`+ hexinteger: "0" ("x" | "X") `hexdigit`+ + bininteger: "0" ("b" | "B") `bindigit`+ nonzerodigit: "1"..."9" octdigit: "0"..."7" + bindigit: "0" | "1" hexdigit: `digit` | "a"..."f" | "A"..."F" Although both lower case ``'l'`` and upper case ``'L'`` are allowed as suffix 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 Mon Nov 3 02:12:16 2008 @@ -179,7 +179,7 @@ lot of effort into importing existing bugs and patches from SourceForge; his scripts for this import operation are at http://svn.python.org/view/tracker/importer/ and may be useful to -other projects wished to move from SourceForge to Roundup. +other projects wishing to move from SourceForge to Roundup. .. seealso:: @@ -3282,5 +3282,6 @@ The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy, -Jim Jewett, Kent Johnson, Chris Lambacher, Antoine Pitrou, Brian Warner. +Jim Jewett, Kent Johnson, Chris Lambacher, Martin Michlmayr, +Antoine Pitrou, Brian Warner. Modified: python/branches/tlee-ast-optimize/Doc/whatsnew/index.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/whatsnew/index.rst (original) +++ python/branches/tlee-ast-optimize/Doc/whatsnew/index.rst Mon Nov 3 02:12:16 2008 @@ -9,7 +9,7 @@ anyone wishing to stay up-to-date after a new release. .. toctree:: - :maxdepth: 1 + :maxdepth: 2 2.7.rst 2.6.rst 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 Mon Nov 3 02:12:16 2008 @@ -41,8 +41,6 @@ PyCompilerInfo *, PyArena *); PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); -#define ERR_LATE_FUTURE \ -"from __future__ imports must occur at the beginning of the file" #ifdef __cplusplus } Modified: python/branches/tlee-ast-optimize/Lib/ast.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/ast.py (original) +++ python/branches/tlee-ast-optimize/Lib/ast.py Mon Nov 3 02:12:16 2008 @@ -26,6 +26,7 @@ :license: Python License. """ from _ast import * +from _ast import __version__ def parse(expr, filename='', mode='exec', optimize=True): Modified: python/branches/tlee-ast-optimize/Lib/bdb.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/bdb.py (original) +++ python/branches/tlee-ast-optimize/Lib/bdb.py Mon Nov 3 02:12:16 2008 @@ -320,6 +320,8 @@ while t is not None: stack.append((t.tb_frame, t.tb_lineno)) t = t.tb_next + if f is None: + i = max(0, len(stack) - 1) return stack, i # Modified: python/branches/tlee-ast-optimize/Lib/idlelib/PyShell.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/idlelib/PyShell.py (original) +++ python/branches/tlee-ast-optimize/Lib/idlelib/PyShell.py Mon Nov 3 02:12:16 2008 @@ -55,18 +55,22 @@ except ImportError: pass else: - def idle_showwarning(message, category, filename, lineno): + def idle_showwarning(message, category, filename, lineno, + file=None, line=None): file = warning_stream try: - file.write(warnings.formatwarning(message, category, filename, lineno)) + file.write(warnings.formatwarning(message, category, filename,\ + lineno, file=file, line=line)) except IOError: pass ## file (probably __stderr__) is invalid, warning dropped. warnings.showwarning = idle_showwarning - def idle_formatwarning(message, category, filename, lineno): + def idle_formatwarning(message, category, filename, lineno, + file=None, line=None): """Format warnings the IDLE way""" s = "\nWarning (from warnings module):\n" s += ' File \"%s\", line %s\n' % (filename, lineno) - line = linecache.getline(filename, lineno).strip() + line = linecache.getline(filename, lineno).strip() \ + if line is None else line if line: s += " %s\n" % line s += "%s: %s\n>>> " % (category.__name__, message) Modified: python/branches/tlee-ast-optimize/Lib/idlelib/run.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/idlelib/run.py (original) +++ python/branches/tlee-ast-optimize/Lib/idlelib/run.py Mon Nov 3 02:12:16 2008 @@ -24,11 +24,13 @@ except ImportError: pass else: - def idle_formatwarning_subproc(message, category, filename, lineno): + def idle_formatwarning_subproc(message, category, filename, lineno, + file=None, line=None): """Format warnings the IDLE way""" s = "\nWarning (from warnings module):\n" s += ' File \"%s\", line %s\n' % (filename, lineno) - line = linecache.getline(filename, lineno).strip() + line = linecache.getline(filename, lineno).strip() \ + if line is None else line if line: s += " %s\n" % line s += "%s: %s\n" % (category.__name__, message) 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 Mon Nov 3 02:12:16 2008 @@ -819,7 +819,7 @@ 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'locals' is the locals dictionary of the given frame.""" args, varargs, varkw = getargs(frame.f_code) - return args, varargs, varkw, frame.f_locals + return ArgInfo(args, varargs, varkw, frame.f_locals) def joinseq(seq): if len(seq) == 1: Modified: python/branches/tlee-ast-optimize/Lib/json/tests/test_scanstring.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/json/tests/test_scanstring.py (original) +++ python/branches/tlee-ast-optimize/Lib/json/tests/test_scanstring.py Mon Nov 3 02:12:16 2008 @@ -2,6 +2,7 @@ import decimal from unittest import TestCase +import json import json.decoder class TestScanString(TestCase): @@ -100,3 +101,9 @@ self.assertEquals( scanstring('["Bad value", truth]', 2, None, True), (u'Bad value', 12)) + + def test_issue3623(self): + self.assertRaises(ValueError, json.decoder.scanstring, b"xxx", 1, + "xxx") + self.assertRaises(UnicodeDecodeError, + json.encoder.encode_basestring_ascii, b"xx\xff") 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 Mon Nov 3 02:12:16 2008 @@ -28,15 +28,19 @@ any* > > | global=global_stmt< 'global' any* 'next' any* > - | - mod=file_input< any+ > """ order = "pre" # Pre-order tree traversal def start_tree(self, tree, filename): super(FixNext, self).start_tree(tree, filename) - self.shadowed_next = False + + n = find_binding('next', tree) + if n: + self.warning(n, bind_warning) + self.shadowed_next = True + else: + self.shadowed_next = False def transform(self, node, results): assert results @@ -69,11 +73,6 @@ elif "global" in results: self.warning(node, bind_warning) self.shadowed_next = True - elif mod: - n = find_binding('next', mod) - if n: - self.warning(n, bind_warning) - self.shadowed_next = True ### The following functions help test if node is part of an assignment Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/main.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/main.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/main.py Mon Nov 3 02:12:16 2008 @@ -15,10 +15,31 @@ Prints output to stdout. """ + def __init__(self, fixers, options, explicit, nobackups): + self.nobackups = nobackups + super(StdoutRefactoringTool, self).__init__(fixers, options, explicit) + def log_error(self, msg, *args, **kwargs): self.errors.append((msg, args, kwargs)) self.logger.error(msg, *args, **kwargs) + def write_file(self, new_text, filename, old_text): + if not self.nobackups: + # Make backup + backup = filename + ".bak" + if os.path.lexists(backup): + try: + os.remove(backup) + except os.error, err: + self.log_message("Can't remove backup %s", backup) + try: + os.rename(filename, backup) + except os.error, err: + self.log_message("Can't rename %s to %s", filename, backup) + # Actually write the new file + super(StdoutRefactoringTool, self).write_file(new_text, + filename, old_text) + def print_output(self, lines): for line in lines: print line @@ -39,7 +60,9 @@ parser.add_option("-d", "--doctests_only", action="store_true", help="Fix up doctests only") parser.add_option("-f", "--fix", action="append", default=[], - help="Each FIX specifies a transformation; default all") + help="Each FIX specifies a transformation; default: all") + parser.add_option("-x", "--nofix", action="append", default=[], + help="Prevent a fixer from being run.") parser.add_option("-l", "--list-fixes", action="store_true", help="List available transformations (fixes/fix_*.py)") parser.add_option("-p", "--print-function", action="store_true", @@ -48,10 +71,14 @@ help="More verbose logging") parser.add_option("-w", "--write", action="store_true", help="Write back modified files") + parser.add_option("-n", "--nobackups", action="store_true", default=False, + help="Don't write backups for modified files.") # Parse command line arguments refactor_stdin = False options, args = parser.parse_args(args) + if not options.write and options.nobackups: + parser.error("Can't use -n without -w") if options.list_fixes: print "Available transformations for the -f/--fix option:" for fixname in refactor.get_all_fix_names(fixer_pkg): @@ -74,15 +101,22 @@ # Initialize the refactoring tool rt_opts = {"print_function" : options.print_function} - avail_names = refactor.get_fixers_from_package(fixer_pkg) - explicit = [] + avail_fixes = set(refactor.get_fixers_from_package(fixer_pkg)) + unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix) + explicit = set() if options.fix: - explicit = [fixer_pkg + ".fix_" + fix - for fix in options.fix if fix != "all"] - fixer_names = avail_names if "all" in options.fix else explicit + all_present = False + for fix in options.fix: + if fix == "all": + all_present = True + else: + explicit.add(fixer_pkg + ".fix_" + fix) + requested = avail_fixes.union(explicit) if all_present else explicit else: - fixer_names = avail_names - rt = StdoutRefactoringTool(fixer_names, rt_opts, explicit=explicit) + requested = avail_fixes.union(explicit) + fixer_names = requested.difference(unwanted_fixes) + rt = StdoutRefactoringTool(sorted(fixer_names), rt_opts, sorted(explicit), + options.nobackups) # Refactor all files and directories passed as arguments if not rt.errors: 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 Mon Nov 3 02:12:16 2008 @@ -36,9 +36,7 @@ pkg = __import__(fixer_pkg, [], [], ["*"]) fixer_dir = os.path.dirname(pkg.__file__) fix_names = [] - names = os.listdir(fixer_dir) - names.sort() - for name in names: + for name in sorted(os.listdir(fixer_dir)): if name.startswith("fix_") and name.endswith(".py"): if remove_prefix: name = name[4:] @@ -253,7 +251,7 @@ there were errors during the parse. """ try: - tree = self.driver.parse_string(data,1) + tree = self.driver.parse_string(data) except Exception, err: self.log_error("Can't parse %s: %s: %s", name, err.__class__.__name__, err) @@ -352,23 +350,13 @@ else: self.log_debug("Not writing changes to %s", filename) - def write_file(self, new_text, filename, old_text=None): + def write_file(self, new_text, filename, old_text): """Writes a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. """ - backup = filename + ".bak" - if os.path.lexists(backup): - try: - os.remove(backup) - except os.error, err: - self.log_message("Can't remove backup %s", backup) - try: - os.rename(filename, backup) - except os.error, err: - self.log_message("Can't rename %s to %s", filename, backup) try: f = open(filename, "w") except os.error, err: Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/README ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/README (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/README Mon Nov 3 02:12:16 2008 @@ -1,5 +1,6 @@ -Files in this directory: +In this directory: - py2_test_grammar.py -- test file that exercises most/all of Python 2.x's grammar. - py3_test_grammar.py -- test file that exercises most/all of Python 3.x's grammar. - infinite_recursion.py -- test file that causes lib2to3's faster recursive pattern matching scheme to fail, but passes when lib2to3 falls back to iterative pattern matching. +- fixes/ -- for use by test_refactor.py 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 Mon Nov 3 02:12:16 2008 @@ -3385,6 +3385,134 @@ """ self.check_both(b, a) + +class Test_set_literal(FixerTestCase): + + fixer = "set_literal" + + def test_basic(self): + b = """set([1, 2, 3])""" + a = """{1, 2, 3}""" + self.check(b, a) + + b = """set((1, 2, 3))""" + a = """{1, 2, 3}""" + self.check(b, a) + + b = """set((1,))""" + a = """{1}""" + self.check(b, a) + + b = """set([1])""" + self.check(b, a) + + b = """set((a, b))""" + a = """{a, b}""" + self.check(b, a) + + b = """set([a, b])""" + self.check(b, a) + + b = """set((a*234, f(args=23)))""" + a = """{a*234, f(args=23)}""" + self.check(b, a) + + b = """set([a*23, f(23)])""" + a = """{a*23, f(23)}""" + self.check(b, a) + + b = """set([a-234**23])""" + a = """{a-234**23}""" + self.check(b, a) + + def test_listcomps(self): + b = """set([x for x in y])""" + a = """{x for x in y}""" + self.check(b, a) + + b = """set([x for x in y if x == m])""" + a = """{x for x in y if x == m}""" + self.check(b, a) + + b = """set([x for x in y for a in b])""" + a = """{x for x in y for a in b}""" + self.check(b, a) + + b = """set([f(x) - 23 for x in y])""" + a = """{f(x) - 23 for x in y}""" + self.check(b, a) + + def test_whitespace(self): + b = """set( [1, 2])""" + a = """{1, 2}""" + self.check(b, a) + + b = """set([1 , 2])""" + a = """{1 , 2}""" + self.check(b, a) + + b = """set([ 1 ])""" + a = """{ 1 }""" + self.check(b, a) + + b = """set( [1] )""" + a = """{1}""" + self.check(b, a) + + b = """set([ 1, 2 ])""" + a = """{ 1, 2 }""" + self.check(b, a) + + b = """set([x for x in y ])""" + a = """{x for x in y }""" + self.check(b, a) + + b = """set( + [1, 2] + ) + """ + a = """{1, 2}\n""" + self.check(b, a) + + def test_comments(self): + b = """set((1, 2)) # Hi""" + a = """{1, 2} # Hi""" + self.check(b, a) + + # This isn't optimal behavior, but the fixer is optional. + b = """ + # Foo + set( # Bar + (1, 2) + ) + """ + a = """ + # Foo + {1, 2} + """ + self.check(b, a) + + def test_unchanged(self): + s = """set()""" + self.unchanged(s) + + s = """set(a)""" + self.unchanged(s) + + s = """set(a, b, c)""" + self.unchanged(s) + + # Don't transform generators because they might have to be lazy. + s = """set(x for x in y)""" + self.unchanged(s) + + s = """set(x for x in y if z)""" + self.unchanged(s) + + s = """set(a*823-23**2 + f(23))""" + self.unchanged(s) + + class Test_sys_exc(FixerTestCase): fixer = "sys_exc" Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_pytree.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_pytree.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_pytree.py Mon Nov 3 02:12:16 2008 @@ -353,29 +353,29 @@ # Build a pattern matching a leaf pl = pytree.LeafPattern(100, "foo", name="pl") r = {} - self.assertEqual(pl.match(root, results=r), False) + self.assertFalse(pl.match(root, results=r)) self.assertEqual(r, {}) - self.assertEqual(pl.match(n1, results=r), False) + self.assertFalse(pl.match(n1, results=r)) self.assertEqual(r, {}) - self.assertEqual(pl.match(n2, results=r), False) + self.assertFalse(pl.match(n2, results=r)) self.assertEqual(r, {}) - self.assertEqual(pl.match(l1, results=r), True) + self.assertTrue(pl.match(l1, results=r)) self.assertEqual(r, {"pl": l1}) r = {} - self.assertEqual(pl.match(l2, results=r), False) + self.assertFalse(pl.match(l2, results=r)) self.assertEqual(r, {}) # Build a pattern matching a node pn = pytree.NodePattern(1000, [pl], name="pn") - self.assertEqual(pn.match(root, results=r), False) + self.assertFalse(pn.match(root, results=r)) self.assertEqual(r, {}) - self.assertEqual(pn.match(n1, results=r), False) + self.assertFalse(pn.match(n1, results=r)) self.assertEqual(r, {}) - self.assertEqual(pn.match(n2, results=r), True) + self.assertTrue(pn.match(n2, results=r)) self.assertEqual(r, {"pn": n2, "pl": l3}) r = {} - self.assertEqual(pn.match(l1, results=r), False) + self.assertFalse(pn.match(l1, results=r)) self.assertEqual(r, {}) - self.assertEqual(pn.match(l2, results=r), False) + self.assertFalse(pn.match(l2, results=r)) self.assertEqual(r, {}) def testWildcardPatterns(self): @@ -391,11 +391,11 @@ pn = pytree.NodePattern(1000, [pl], name="pn") pw = pytree.WildcardPattern([[pn], [pl, pl]], name="pw") r = {} - self.assertEqual(pw.match_seq([root], r), False) + self.assertFalse(pw.match_seq([root], r)) self.assertEqual(r, {}) - self.assertEqual(pw.match_seq([n1], r), False) + self.assertFalse(pw.match_seq([n1], r)) self.assertEqual(r, {}) - self.assertEqual(pw.match_seq([n2], r), True) + self.assertTrue(pw.match_seq([n2], r)) # These are easier to debug self.assertEqual(sorted(r.keys()), ["pl", "pn", "pw"]) self.assertEqual(r["pl"], l1) @@ -404,7 +404,7 @@ # But this is equivalent self.assertEqual(r, {"pl": l1, "pn": n2, "pw": [n2]}) r = {} - self.assertEqual(pw.match_seq([l1, l3], r), True) + self.assertTrue(pw.match_seq([l1, l3], r)) self.assertEqual(r, {"pl": l3, "pw": [l1, l3]}) self.assert_(r["pl"] is l3) r = {} Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py Mon Nov 3 02:12:16 2008 @@ -123,7 +123,6 @@ def test_refactor_file(self): test_file = os.path.join(FIXER_DIR, "parrot_example.py") - backup = test_file + ".bak" old_contents = open(test_file, "r").read() rt = self.rt() @@ -133,14 +132,8 @@ rt.refactor_file(test_file, True) try: self.assertNotEqual(old_contents, open(test_file, "r").read()) - self.assertTrue(os.path.exists(backup)) - self.assertEqual(old_contents, open(backup, "r").read()) finally: open(test_file, "w").write(old_contents) - try: - os.unlink(backup) - except OSError: - pass def test_refactor_docstring(self): rt = self.rt() Modified: python/branches/tlee-ast-optimize/Lib/modulefinder.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/modulefinder.py (original) +++ python/branches/tlee-ast-optimize/Lib/modulefinder.py Mon Nov 3 02:12:16 2008 @@ -309,7 +309,10 @@ def _add_badmodule(self, name, caller): if name not in self.badmodules: self.badmodules[name] = {} - self.badmodules[name][caller.__name__] = 1 + if caller: + self.badmodules[name][caller.__name__] = 1 + else: + self.badmodules[name]["-"] = 1 def _safe_import_hook(self, name, caller, fromlist, level=-1): # wrapper for self.import_hook() that won't raise ImportError Modified: python/branches/tlee-ast-optimize/Lib/pdb.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/pdb.py (original) +++ python/branches/tlee-ast-optimize/Lib/pdb.py Mon Nov 3 02:12:16 2008 @@ -1224,9 +1224,7 @@ p = Pdb() p.reset() - while t.tb_next is not None: - t = t.tb_next - p.interaction(t.tb_frame, t) + p.interaction(None, t) def pm(): post_mortem(sys.last_traceback) @@ -1289,9 +1287,7 @@ print "Uncaught exception. Entering post mortem debugging" print "Running 'cont' or 'step' will restart the program" t = sys.exc_info()[2] - while t.tb_next is not None: - t = t.tb_next - pdb.interaction(t.tb_frame,t) + pdb.interaction(None, t) print "Post mortem debugger finished. The "+mainpyfile+" will be restarted" 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 Mon Nov 3 02:12:16 2008 @@ -268,24 +268,6 @@ id = '' return '', version, id -def _test_parse_release_file(): - - for input, output in ( - # Examples of release file contents: - ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64')) - ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64')) - ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586')) - ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux')) - ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche')) - ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike')) - ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')) - ('CentOS release 4', ('CentOS', '4', None)) - ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')) - ): - parsed = _parse_release_file(input) - if parsed != output: - print (input, parsed) - def linux_distribution(distname='', version='', id='', supported_dists=_supported_dists, @@ -1381,21 +1363,6 @@ _sys_version_cache[sys_version] = result return result -def _test_sys_version(): - - _sys_version_cache.clear() - for input, output in ( - ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]', - ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')), - ('IronPython 1.0.60816 on .NET 2.0.50727.42', - ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')), - ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42', - ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), - ): - parsed = _sys_version(input) - if parsed != output: - print (input, parsed) - def python_implementation(): """ Returns a string identifying the Python implementation. Modified: python/branches/tlee-ast-optimize/Lib/test/pickletester.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/pickletester.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/pickletester.py Mon Nov 3 02:12:16 2008 @@ -849,6 +849,29 @@ y = self.loads(s) self.assertEqual(y._reduce_called, 1) + def test_reduce_bad_iterator(self): + # Issue4176: crash when 4th and 5th items of __reduce__() + # are not iterators + class C(object): + def __reduce__(self): + # 4th item is not an iterator + return list, (), None, [], None + class D(object): + def __reduce__(self): + # 5th item is not an iterator + return dict, (), None, None, [] + + # Protocol 0 is less strict and also accept iterables. + for proto in 0, 1, 2: + try: + self.dumps(C(), proto) + except (AttributeError, pickle.PickleError, cPickle.PickleError): + pass + try: + self.dumps(D(), proto) + except (AttributeError, pickle.PickleError, cPickle.PickleError): + pass + # Test classes for reduce_ex class REX_one(object): Modified: python/branches/tlee-ast-optimize/Lib/test/test_bytes.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_bytes.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_bytes.py Mon Nov 3 02:12:16 2008 @@ -397,7 +397,7 @@ self.assertEqual(b.rpartition(b'i'), (b'mississipp', b'i', b'')) def test_pickling(self): - for proto in range(pickle.HIGHEST_PROTOCOL): + for proto in range(pickle.HIGHEST_PROTOCOL + 1): for b in b"", b"a", b"abc", b"\xffab\x80", b"\0\0\377\0\0": b = self.type2test(b) ps = pickle.dumps(b, proto) @@ -947,7 +947,7 @@ a = ByteArraySubclass(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") - for proto in range(pickle.HIGHEST_PROTOCOL): + for proto in range(pickle.HIGHEST_PROTOCOL + 1): b = pickle.loads(pickle.dumps(a, proto)) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) Modified: python/branches/tlee-ast-optimize/Lib/test/test_descr.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_descr.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_descr.py Mon Nov 3 02:12:16 2008 @@ -1136,14 +1136,10 @@ def __del__(self_): self.assertEqual(self_.a, 1) self.assertEqual(self_.b, 2) - - save_stderr = sys.stderr - sys.stderr = sys.stdout - h = H() - try: + with test_support.captured_output('stderr') as s: + h = H() del h - finally: - sys.stderr = save_stderr + self.assertEqual(s.getvalue(), '') def test_slots_special(self): # Testing __dict__ and __weakref__ in __slots__... Modified: python/branches/tlee-ast-optimize/Lib/test/test_future.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_future.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_future.py Mon Nov 3 02:12:16 2008 @@ -89,19 +89,28 @@ # the parser hack disabled. If a new keyword is introduced in # 2.6, change this to refer to the new future import. try: - exec "from __future__ import division, with_statement; with = 0" + exec "from __future__ import print_function; print 0" except SyntaxError: pass else: self.fail("syntax error didn't occur") try: - exec "from __future__ import (with_statement, division); with = 0" + exec "from __future__ import (print_function); print 0" except SyntaxError: pass else: self.fail("syntax error didn't occur") + def test_multiple_features(self): + test_support.unload("test.test_future5") + from test import test_future5 + + def test_unicode_literals_exec(self): + scope = {} + exec "from __future__ import unicode_literals; x = ''" in scope + self.assertTrue(isinstance(scope["x"], unicode)) + def test_main(): test_support.run_unittest(FutureTest) Modified: python/branches/tlee-ast-optimize/Lib/test/test_io.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_io.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_io.py Mon Nov 3 02:12:16 2008 @@ -1236,6 +1236,13 @@ else: self.assert_(issubclass(obj, io.IOBase)) + def test_fileio_warnings(self): + with test_support.check_warnings() as w: + self.assertEqual(w.warnings, []) + self.assertRaises(TypeError, io.FileIO, []) + self.assertEqual(w.warnings, []) + self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt") + self.assertEqual(w.warnings, []) def test_main(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, Modified: python/branches/tlee-ast-optimize/Lib/test/test_modulefinder.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_modulefinder.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_modulefinder.py Mon Nov 3 02:12:16 2008 @@ -190,6 +190,19 @@ a/b/c/f.py """] +relative_import_test_3 = [ + "a.module", + ["a", "a.module"], + ["a.bar"], + [], + """\ +a/__init__.py + def foo(): pass +a/module.py + from . import foo + from . import bar +"""] + def open_file(path): ##print "#", os.path.abspath(path) dirname = os.path.dirname(path) @@ -256,6 +269,9 @@ def test_relative_imports_2(self): self._do_test(relative_import_test_2) + def test_relative_imports_3(self): + self._do_test(relative_import_test_3) + def test_main(): distutils.log.set_threshold(distutils.log.WARN) test_support.run_unittest(ModuleFinderTest) Modified: python/branches/tlee-ast-optimize/Lib/test/test_parser.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_parser.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_parser.py Mon Nov 3 02:12:16 2008 @@ -25,6 +25,15 @@ def check_expr(self, s): self.roundtrip(parser.expr, s) + def test_flags_passed(self): + # The unicode literals flags has to be passed from the paser to AST + # generation. + suite = parser.suite("from __future__ import unicode_literals; x = ''") + code = suite.compile() + scope = {} + exec code in scope + self.assertTrue(isinstance(scope["x"], unicode)) + def check_suite(self, s): self.roundtrip(parser.suite, s) 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 Mon Nov 3 02:12:16 2008 @@ -122,6 +122,40 @@ executable = executable + '.exe' res = platform.libc_ver(sys.executable) + def test_parse_release_file(self): + + for input, output in ( + # Examples of release file contents: + ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64')), + ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64')), + ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586')), + ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux')), + ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche')), + ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike')), + ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')), + ('CentOS release 4', ('CentOS', '4', None)), + ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')), + ): + self.assertEqual(platform._parse_release_file(input), output) + + def test_sys_version(self): + + platform._sys_version_cache.clear() + for input, output in ( + ('2.4.3 (#1, Jun 21 2006, 13:54:21) \n[GCC 3.3.4 (pre 3.3.5 20040809)]', + ('CPython', '2.4.3', '', '', '1', 'Jun 21 2006 13:54:21', 'GCC 3.3.4 (pre 3.3.5 20040809)')), + ('IronPython 1.0.60816 on .NET 2.0.50727.42', + ('IronPython', '1.0.60816', '', '', '', '', '.NET 2.0.50727.42')), + ('IronPython 1.0 (1.0.61005.1977) on .NET 2.0.50727.42', + ('IronPython', '1.0.0', '', '', '', '', '.NET 2.0.50727.42')), + ): + # branch and revision are not "parsed", but fetched + # from sys.subversion. Ignore them + (name, version, branch, revision, buildno, builddate, compiler) \ + = platform._sys_version(input) + self.assertEqual( + (name, version, '', '', buildno, builddate, compiler), output) + def test_main(): test_support.run_unittest( PlatformTest 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 Nov 3 02:12:16 2008 @@ -28,53 +28,35 @@ exec "`2`" in {} self.assertWarning(None, w, expected) - def test_bool_assign(self): + def test_forbidden_names(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 check_warnings() as w: - safe_exec("True = False") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("False = True") - self.assertWarning(None, w, expected) - w.reset() - try: - safe_exec("obj.False = True") - except NameError: pass - self.assertWarning(None, w, expected) - w.reset() - try: - safe_exec("obj.True = False") - except NameError: pass - self.assertWarning(None, w, expected) - w.reset() - safe_exec("def False(): pass") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("def True(): pass") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("class False: pass") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("class True: pass") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("def f(True=43): pass") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("def f(False=None): pass") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("f(False=True)") - self.assertWarning(None, w, expected) - w.reset() - safe_exec("f(True=1)") - self.assertWarning(None, w, expected) + tests = [("True", "assignment to True or False is forbidden in 3.x"), + ("False", "assignment to True or False is forbidden in 3.x"), + ("nonlocal", "nonlocal is a keyword in 3.x")] + with check_warnings() as w: + for keyword, expected in tests: + safe_exec("{0} = False".format(keyword)) + self.assertWarning(None, w, expected) + w.reset() + try: + safe_exec("obj.{0} = True".format(keyword)) + except NameError: + pass + self.assertWarning(None, w, expected) + w.reset() + safe_exec("def {0}(): pass".format(keyword)) + self.assertWarning(None, w, expected) + w.reset() + safe_exec("class {0}: pass".format(keyword)) + self.assertWarning(None, w, expected) + w.reset() + safe_exec("def f({0}=43): pass".format(keyword)) + self.assertWarning(None, w, expected) + w.reset() def test_type_inequality_comparisons(self): 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 Mon Nov 3 02:12:16 2008 @@ -98,7 +98,6 @@ class ProxyTests(unittest.TestCase): def setUp(self): - unittest.TestCase.setUp(self) # Save all proxy related env vars self._saved_environ = dict([(k, v) for k, v in os.environ.iteritems() if k.lower().find('proxy') >= 0]) @@ -107,9 +106,8 @@ del os.environ[k] def tearDown(self): - unittest.TestCase.tearDown(self) # Restore all proxy related env vars - for k, v in self._saved_environ: + for k, v in self._saved_environ.iteritems(): os.environ[k] = v def test_getproxies_environment_keep_no_proxies(self): 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 Mon Nov 3 02:12:16 2008 @@ -61,7 +61,7 @@ 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 proto in range(pickle.HIGHEST_PROTOCOL + 1): for t in testcases: r = xrange(*t) self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), 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 Nov 3 02:12:16 2008 @@ -792,7 +792,7 @@ fi; \ done $(INSTALL_DATA) $(srcdir)/Misc/python.man \ - $(DESTDIR)$(MANDIR)/man1/python.1 + $(DESTDIR)$(MANDIR)/man1/python$(VERSION).1 # Install the library PLATDIR= plat-$(MACHDEP) Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Mon Nov 3 02:12:16 2008 @@ -12,6 +12,18 @@ Core and Builtins ----------------- +- Issue #4225: ``from __future__ import unicode_literals`` didn't work in an + exec statement. + +- Issue #4176: Fixed a crash when pickling an object which ``__reduce__`` + method does not return iterators for the 4th and 5th items. + +- Issue #4209: Enabling unicode_literals and the print_function in the same + __future__ import didn't work. + +- Using ``nonlocal`` as a variable name will now raise a Py3k SyntaxWarning + because it is a reserved word in 3.x. + - On windows, os.chdir given unicode was not working if GetCurrentDirectoryW returned a path longer than MAX_PATH. (But It's doubtful this code path is really executed because I cannot move to such directory on win2k) @@ -24,6 +36,14 @@ Library ------- +- Fixed a modulefinder crash on certain relative imports. + +- Issue #4150: Pdb's "up" command now works for generator frames in post-mortem + debugging. + +- Issue #4092: Return ArgInfo as promised in the documentation from + inspect.getargvalues. + - Issue #3935: Properly support list subclasses in bisect's C implementation. - Issue #4014: Don't claim that Python has an Alpha release status, in addition @@ -32,6 +52,8 @@ Build ----- +- Issue #4091: Install pythonxy.dll in system32 again. + - Issue #4018: Disable "for me" installations on Vista. - Issue #3758: Add ``patchcheck`` build target to .PHONY. 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 Nov 3 02:12:16 2008 @@ -86,6 +86,10 @@ self = (PyFileIOObject *) type->tp_alloc(type, 0); if (self != NULL) { self->fd = -1; + self->readable = 0; + self->writable = 0; + self->seekable = -1; + self->closefd = 1; self->weakreflist = NULL; } @@ -179,8 +183,6 @@ } } - self->readable = self->writable = 0; - self->seekable = -1; s = mode; while (*s) { switch (*s++) { @@ -249,7 +251,7 @@ self->closefd = 1; if (!closefd) { PyErr_SetString(PyExc_ValueError, - "Cannot use closefd=True with file name"); + "Cannot use closefd=False with file name"); goto error; } 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 Nov 3 02:12:16 2008 @@ -179,11 +179,13 @@ errmsg_fn = PyObject_GetAttrString(decoder, "errmsg"); if (errmsg_fn == NULL) return; - Py_XDECREF(decoder); + Py_DECREF(decoder); } pymsg = PyObject_CallFunction(errmsg_fn, "(zOn)", msg, s, end); - PyErr_SetObject(PyExc_ValueError, pymsg); - Py_DECREF(pymsg); + if (pymsg) { + PyErr_SetObject(PyExc_ValueError, pymsg); + Py_DECREF(pymsg); + } /* def linecol(doc, pos): @@ -269,6 +271,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -370,6 +373,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -379,8 +383,7 @@ if (rval == NULL) { goto bail; } - Py_DECREF(chunks); - chunks = NULL; + Py_CLEAR(chunks); return Py_BuildValue("(Nn)", rval, end); bail: Py_XDECREF(chunks); @@ -429,6 +432,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -530,6 +534,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -539,8 +544,7 @@ if (rval == NULL) { goto bail; } - Py_DECREF(chunks); - chunks = NULL; + Py_CLEAR(chunks); return Py_BuildValue("(Nn)", rval, end); bail: Py_XDECREF(chunks); 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 Nov 3 02:12:16 2008 @@ -2206,13 +2206,14 @@ * appropriate __reduce__ method for ob. */ static int -save_reduce(Picklerobject *self, PyObject *args, PyObject *ob) +save_reduce(Picklerobject *self, PyObject *args, PyObject *fn, PyObject *ob) { PyObject *callable; PyObject *argtup; - PyObject *state = NULL; - PyObject *listitems = NULL; - PyObject *dictitems = NULL; + PyObject *state = NULL; + PyObject *listitems = Py_None; + PyObject *dictitems = Py_None; + Py_ssize_t size; int use_newobj = self->proto >= 2; @@ -2220,6 +2221,14 @@ static char build = BUILD; static char newobj = NEWOBJ; + size = PyTuple_Size(args); + if (size < 2 || size > 5) { + cPickle_ErrFormat(PicklingError, "tuple returned by " + "%s must contain 2 through 5 elements", + "O", fn); + return -1; + } + if (! PyArg_UnpackTuple(args, "save_reduce", 2, 5, &callable, &argtup, @@ -2229,17 +2238,32 @@ return -1; if (!PyTuple_Check(argtup)) { - PyErr_SetString(PicklingError, - "args from reduce() should be a tuple"); + cPickle_ErrFormat(PicklingError, "Second element of " + "tuple returned by %s must be a tuple", + "O", fn); return -1; } if (state == Py_None) state = NULL; + if (listitems == Py_None) listitems = NULL; + else if (!PyIter_Check(listitems)) { + cPickle_ErrFormat(PicklingError, "Fourth element of " + "tuple returned by %s must be an iterator, not %s", + "Os", fn, Py_TYPE(listitems)->tp_name); + return -1; + } + if (dictitems == Py_None) dictitems = NULL; + else if (!PyIter_Check(dictitems)) { + cPickle_ErrFormat(PicklingError, "Fifth element of " + "tuple returned by %s must be an iterator, not %s", + "Os", fn, Py_TYPE(dictitems)->tp_name); + return -1; + } /* Protocol 2 special case: if callable's name is __newobj__, use * NEWOBJ. This consumes a lot of code. @@ -2363,9 +2387,8 @@ { PyTypeObject *type; PyObject *py_ob_id = 0, *__reduce__ = 0, *t = 0; - PyObject *arg_tup; int res = -1; - int tmp, size; + int tmp; if (Py_EnterRecursiveCall(" while pickling an object")) return -1; @@ -2591,30 +2614,14 @@ goto finally; } - if (! PyTuple_Check(t)) { + if (!PyTuple_Check(t)) { cPickle_ErrFormat(PicklingError, "Value returned by " "%s must be string or tuple", "O", __reduce__); goto finally; } - size = PyTuple_Size(t); - if (size < 2 || size > 5) { - cPickle_ErrFormat(PicklingError, "tuple returned by " - "%s must contain 2 through 5 elements", - "O", __reduce__); - goto finally; - } - - arg_tup = PyTuple_GET_ITEM(t, 1); - if (!(PyTuple_Check(arg_tup) || arg_tup == Py_None)) { - cPickle_ErrFormat(PicklingError, "Second element of " - "tuple returned by %s must be a tuple", - "O", __reduce__); - goto finally; - } - - res = save_reduce(self, t, args); + res = save_reduce(self, t, __reduce__, args); finally: Py_LeaveRecursiveCall(); 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 Nov 3 02:12:16 2008 @@ -26,12 +26,20 @@ */ #include "Python.h" /* general Python API */ +#include "Python-ast.h" /* mod_ty */ #include "graminit.h" /* symbols defined in the grammar */ #include "node.h" /* internal parser structure */ #include "errcode.h" /* error codes for PyNode_*() */ #include "token.h" /* token definitions */ +#include "grammar.h" +#include "parsetok.h" /* ISTERMINAL() / ISNONTERMINAL() */ -#include "compile.h" /* PyNode_Compile() */ +#include "compile.h" +#undef Yield +#include "ast.h" +#include "pyarena.h" + +extern grammar _PyParser_Grammar; /* From graminit.c */ #ifdef lint #include @@ -156,6 +164,7 @@ PyObject_HEAD /* standard object header */ node* st_node; /* the node* returned by the parser */ int st_type; /* EXPR or SUITE ? */ + PyCompilerFlags st_flags; /* Parser and compiler flags */ } PyST_Object; @@ -260,6 +269,7 @@ if (o != 0) { o->st_node = st; o->st_type = type; + o->st_flags.cf_flags = 0; } else { PyNode_Free(st); @@ -394,6 +404,8 @@ parser_compilest(PyST_Object *self, PyObject *args, PyObject *kw) { PyObject* res = 0; + PyArena* arena; + mod_ty mod; char* str = ""; int ok; @@ -406,8 +418,16 @@ ok = PyArg_ParseTupleAndKeywords(args, kw, "|s:compile", &keywords[1], &str); - if (ok) - res = (PyObject *)PyNode_Compile(self->st_node, str); + if (ok) { + arena = PyArena_New(); + if (arena) { + mod = PyAST_FromNode(self->st_node, &(self->st_flags), str, arena); + if (mod) { + res = (PyObject *)PyAST_Compile(mod, str, &(self->st_flags), arena); + } + PyArena_Free(arena); + } + } return (res); } @@ -523,16 +543,25 @@ { char* string = 0; PyObject* res = 0; + int flags = 0; + perrdetail err; static char *keywords[] = {"source", NULL}; if (PyArg_ParseTupleAndKeywords(args, kw, argspec, keywords, &string)) { - node* n = PyParser_SimpleParseString(string, - (type == PyST_EXPR) - ? eval_input : file_input); + node* n = PyParser_ParseStringFlagsFilenameEx(string, NULL, + &_PyParser_Grammar, + (type == PyST_EXPR) + ? eval_input : file_input, + &err, &flags); - if (n) + if (n) { res = parser_newstobject(n, type); + if (res) + ((PyST_Object *)res)->st_flags.cf_flags = flags & PyCF_MASK; + } + else + PyParser_SetError(&err); } return (res); } 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 Nov 3 02:12:16 2008 @@ -474,10 +474,6 @@ return PyErr_SetFromWindowsErr(errno); } -static PyObject *_PyUnicode_FromFileSystemEncodedObject(register PyObject *obj) -{ -} - static int convert_to_unicode(PyObject **param) { @@ -688,7 +684,7 @@ chdir is essentially a wrapper around SetCurrentDirectory; however, it also needs to set "magic" environment variables indicating the per-drive current directory, which are of the form =: */ -BOOL __stdcall +static BOOL __stdcall win32_chdir(LPCSTR path) { char new_path[MAX_PATH+1]; @@ -713,7 +709,7 @@ /* The Unicode version differs from the ANSI version since the current directory might exceed MAX_PATH characters */ -BOOL __stdcall +static BOOL __stdcall win32_wchdir(LPCWSTR path) { wchar_t _new_path[MAX_PATH+1], *new_path = _new_path; 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 Nov 3 02:12:16 2008 @@ -830,12 +830,30 @@ return 0; } +static int add_ast_fields(void) +{ + PyObject *empty_tuple, *d; + if (PyType_Ready(&AST_type) < 0) + return -1; + d = AST_type.tp_dict; + empty_tuple = PyTuple_New(0); + if (!empty_tuple || + PyDict_SetItemString(d, "_fields", empty_tuple) < 0 || + PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) { + Py_XDECREF(empty_tuple); + return -1; + } + Py_DECREF(empty_tuple); + return 0; +} + """, 0, reflow=False) self.emit("static int init_types(void)",0) self.emit("{", 0) self.emit("static int initialized;", 1) self.emit("if (initialized) return 1;", 1) + self.emit("if (add_ast_fields() < 0) return 0;", 1) for dfn in mod.dfns: self.visit(dfn) self.emit("initialized = 1;", 1) Modified: python/branches/tlee-ast-optimize/Parser/parser.c ============================================================================== --- python/branches/tlee-ast-optimize/Parser/parser.c (original) +++ python/branches/tlee-ast-optimize/Parser/parser.c Mon Nov 3 02:12:16 2008 @@ -206,13 +206,10 @@ char *str_ch = STR(CHILD(cch, 0)); if (strcmp(str_ch, FUTURE_WITH_STATEMENT) == 0) { ps->p_flags |= CO_FUTURE_WITH_STATEMENT; - break; } else if (strcmp(str_ch, FUTURE_PRINT_FUNCTION) == 0) { ps->p_flags |= CO_FUTURE_PRINT_FUNCTION; - break; } else if (strcmp(str_ch, FUTURE_UNICODE_LITERALS) == 0) { ps->p_flags |= CO_FUTURE_UNICODE_LITERALS; - break; } } } 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 Nov 3 02:12:16 2008 @@ -619,11 +619,29 @@ return 0; } +static int add_ast_fields(void) +{ + PyObject *empty_tuple, *d; + if (PyType_Ready(&AST_type) < 0) + return -1; + d = AST_type.tp_dict; + empty_tuple = PyTuple_New(0); + if (!empty_tuple || + PyDict_SetItemString(d, "_fields", empty_tuple) < 0 || + PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) { + Py_XDECREF(empty_tuple); + return -1; + } + Py_DECREF(empty_tuple); + return 0; +} + static int init_types(void) { static int initialized; if (initialized) return 1; + if (add_ast_fields() < 0) return 0; mod_type = make_type("mod", &AST_type, NULL, 0); if (!mod_type) return 0; if (!add_attributes(mod_type, NULL, 0)) return 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 Nov 3 02:12:16 2008 @@ -131,9 +131,14 @@ { 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; + if (Py_Py3kWarningFlag) { + if (!(strcmp(x, "True") && strcmp(x, "False")) && + !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) + return 0; + if (!strcmp(x, "nonlocal") && + !ast_warn(c, n, "nonlocal is a keyword in 3.x")) + return 0; + } return 1; } 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 Nov 3 02:12:16 2008 @@ -8,6 +8,8 @@ #include "symtable.h" #define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined" +#define ERR_LATE_FUTURE \ +"from __future__ imports must occur at the beginning of the file" static int future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename) 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 Nov 3 02:12:16 2008 @@ -1459,16 +1459,19 @@ PyCompilerFlags *flags, PyArena *arena) { mod_ty mod; + PyCompilerFlags localflags; perrdetail err; int iflags = PARSER_FLAGS(flags); node *n = PyParser_ParseStringFlagsFilenameEx(s, filename, &_PyParser_Grammar, start, &err, &iflags); + if (flags == NULL) { + localflags.cf_flags = 0; + flags = &localflags; + } if (n) { - if (flags) { - flags->cf_flags |= iflags & PyCF_MASK; - } + flags->cf_flags |= iflags & PyCF_MASK; mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); return mod; @@ -1485,15 +1488,18 @@ PyArena *arena) { mod_ty mod; + PyCompilerFlags localflags; perrdetail err; int iflags = PARSER_FLAGS(flags); node *n = PyParser_ParseFileFlagsEx(fp, filename, &_PyParser_Grammar, start, ps1, ps2, &err, &iflags); + if (flags == NULL) { + localflags.cf_flags = 0; + flags = &localflags; + } if (n) { - if (flags) { - flags->cf_flags |= iflags & PyCF_MASK; - } + flags->cf_flags |= iflags & PyCF_MASK; mod = PyAST_FromNode(n, flags, filename, arena); PyNode_Free(n); return mod; 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 Mon Nov 3 02:12:16 2008 @@ -915,9 +915,7 @@ root.add_file("%s/pythonw.exe" % PCBUILD) # msidbComponentAttributesSharedDllRefCount = 8, see "Component Table" - #dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".") - #install python30.dll into root dir for now - dlldir = root + dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".") pydll = "python%s%s.dll" % (major, minor) pydllsrc = os.path.join(srcdir, PCBUILD, pydll) Modified: python/branches/tlee-ast-optimize/Tools/scripts/findnocoding.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/scripts/findnocoding.py (original) +++ python/branches/tlee-ast-optimize/Tools/scripts/findnocoding.py Mon Nov 3 02:12:16 2008 @@ -12,7 +12,7 @@ # our pysource module finds Python source files try: import pysource -except: +except ImportError: # emulate the module with a simple os.walk class pysource: has_python_ext = looks_like_python = can_be_compiled = None Modified: python/branches/tlee-ast-optimize/Tools/scripts/reindent.py ============================================================================== --- python/branches/tlee-ast-optimize/Tools/scripts/reindent.py (original) +++ python/branches/tlee-ast-optimize/Tools/scripts/reindent.py Mon Nov 3 02:12:16 2008 @@ -99,7 +99,8 @@ for name in names: fullname = os.path.join(file, name) if ((recurse and os.path.isdir(fullname) and - not os.path.islink(fullname)) + not os.path.islink(fullname) and + not os.path.split(fullname)[1].startswith(".")) or name.lower().endswith(".py")): check(fullname) return From nnorwitz at gmail.com Mon Nov 3 07:22:32 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 3 Nov 2008 01:22:32 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081103062232.GA22761@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex) ! Extra \fi. l.62 \fi\fi ? ! Emergency stop. l.62 \fi\fi No pages of output. Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Mon Nov 3 16:14:52 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 16:14:52 +0100 (CET) Subject: [Python-checkins] r67077 - in python/trunk: Lib/test/test_parser.py Misc/ACKS Misc/NEWS Modules/parsermodule.c Message-ID: <20081103151452.569A71E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 16:14:51 2008 New Revision: 67077 Log: #4048 make the parser module accept relative imports as valid Modified: python/trunk/Lib/test/test_parser.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS python/trunk/Modules/parsermodule.c Modified: python/trunk/Lib/test/test_parser.py ============================================================================== --- python/trunk/Lib/test/test_parser.py (original) +++ python/trunk/Lib/test/test_parser.py Mon Nov 3 16:14:51 2008 @@ -1,4 +1,5 @@ import parser +import os import unittest import sys from test import test_support @@ -179,6 +180,7 @@ "from sys.path import (dirname, basename as my_basename)") self.check_suite( "from sys.path import (dirname, basename as my_basename,)") + self.check_suite("from .bogus import x") def test_basic_import_statement(self): self.check_suite("import sys") Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Mon Nov 3 16:14:51 2008 @@ -62,6 +62,7 @@ Steven Bethard Stephen Bevan Ron Bickers +David Binger Dominic Binks Philippe Biondi Stuart Bishop Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Nov 3 16:14:51 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4048: The parser module now correctly validates relative imports. + - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an exec statement. Modified: python/trunk/Modules/parsermodule.c ============================================================================== --- python/trunk/Modules/parsermodule.c (original) +++ python/trunk/Modules/parsermodule.c Mon Nov 3 16:14:51 2008 @@ -1879,10 +1879,10 @@ count_from_dots(node *tree) { int i; - for (i = 0; i < NCH(tree); i++) + for (i = 1; i < NCH(tree); i++) if (TYPE(CHILD(tree, i)) != DOT) break; - return i; + return i-1; } /* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' | From python-checkins at python.org Mon Nov 3 16:18:30 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 16:18:30 +0100 (CET) Subject: [Python-checkins] r67078 - in python/branches/release26-maint: Lib/test/test_parser.py Misc/ACKS Misc/NEWS Modules/parsermodule.c Message-ID: <20081103151830.9FA8F1E4016@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 16:18:30 2008 New Revision: 67078 Log: Merged revisions 67077 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67077 | benjamin.peterson | 2008-11-03 09:14:51 -0600 (Mon, 03 Nov 2008) | 1 line #4048 make the parser module accept relative imports as valid ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_parser.py python/branches/release26-maint/Misc/ACKS python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/parsermodule.c Modified: python/branches/release26-maint/Lib/test/test_parser.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_parser.py (original) +++ python/branches/release26-maint/Lib/test/test_parser.py Mon Nov 3 16:18:30 2008 @@ -1,4 +1,5 @@ import parser +import os import unittest import sys from test import test_support @@ -179,6 +180,7 @@ "from sys.path import (dirname, basename as my_basename)") self.check_suite( "from sys.path import (dirname, basename as my_basename,)") + self.check_suite("from .bogus import x") def test_basic_import_statement(self): self.check_suite("import sys") Modified: python/branches/release26-maint/Misc/ACKS ============================================================================== --- python/branches/release26-maint/Misc/ACKS (original) +++ python/branches/release26-maint/Misc/ACKS Mon Nov 3 16:18:30 2008 @@ -62,6 +62,7 @@ Steven Bethard Stephen Bevan Ron Bickers +David Binger Dominic Binks Philippe Biondi Stuart Bishop Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Mon Nov 3 16:18:30 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4048: The parser module now correctly validates relative imports. + - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an exec statement. Modified: python/branches/release26-maint/Modules/parsermodule.c ============================================================================== --- python/branches/release26-maint/Modules/parsermodule.c (original) +++ python/branches/release26-maint/Modules/parsermodule.c Mon Nov 3 16:18:30 2008 @@ -1879,10 +1879,10 @@ count_from_dots(node *tree) { int i; - for (i = 0; i < NCH(tree); i++) + for (i = 1; i < NCH(tree); i++) if (TYPE(CHILD(tree, i)) != DOT) break; - return i; + return i-1; } /* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' | From python-checkins at python.org Mon Nov 3 16:19:35 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 16:19:35 +0100 (CET) Subject: [Python-checkins] r67079 - in python/branches/release25-maint: Lib/test/test_parser.py Misc/ACKS Misc/NEWS Modules/parsermodule.c Message-ID: <20081103151935.DEC5F1E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 16:19:35 2008 New Revision: 67079 Log: backport r67077 from the trunk: parser module now correctly validates relative imports Modified: python/branches/release25-maint/Lib/test/test_parser.py python/branches/release25-maint/Misc/ACKS python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/parsermodule.c Modified: python/branches/release25-maint/Lib/test/test_parser.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_parser.py (original) +++ python/branches/release25-maint/Lib/test/test_parser.py Mon Nov 3 16:19:35 2008 @@ -1,4 +1,5 @@ import parser +import os import unittest from test import test_support @@ -168,6 +169,7 @@ "from sys.path import (dirname, basename as my_basename)") self.check_suite( "from sys.path import (dirname, basename as my_basename,)") + self.check_suite("from .bogus import x") def test_basic_import_statement(self): self.check_suite("import sys") Modified: python/branches/release25-maint/Misc/ACKS ============================================================================== --- python/branches/release25-maint/Misc/ACKS (original) +++ python/branches/release25-maint/Misc/ACKS Mon Nov 3 16:19:35 2008 @@ -60,6 +60,7 @@ Steven Bethard Stephen Bevan Ron Bickers +David Binger Dominic Binks Philippe Biondi Stuart Bishop Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Nov 3 16:19:35 2008 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Issue #4048: The parser module now correctly validates relative imports. + - Issue #4176: Fixed a crash when pickling an object which ``__reduce__`` method does not return iterators for the 4th and 5th items. Modified: python/branches/release25-maint/Modules/parsermodule.c ============================================================================== --- python/branches/release25-maint/Modules/parsermodule.c (original) +++ python/branches/release25-maint/Modules/parsermodule.c Mon Nov 3 16:19:35 2008 @@ -1804,10 +1804,10 @@ count_from_dots(node *tree) { int i; - for (i = 0; i < NCH(tree); i++) + for (i = 1; i < NCH(tree); i++) if (TYPE(CHILD(tree, i)) != DOT) break; - return i; + return i-1; } /* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' | From buildbot at python.org Mon Nov 3 16:20:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 15:20:03 +0000 Subject: [Python-checkins] buildbot failure in hppa Ubuntu 3.0 Message-ID: <20081103152003.D78E51E4002@bag.python.org> The Buildbot has detected a new failure of hppa Ubuntu 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/hppa%20Ubuntu%203.0/builds/1 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-hppa Build Reason: The web-page 'force build' button was pressed by 'doko': setup of build slave Build Source Stamp: [branch trunk] HEAD Blamelist: BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Nov 3 16:28:02 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 16:28:02 +0100 (CET) Subject: [Python-checkins] r67080 - peps/trunk/pep-0306.txt Message-ID: <20081103152802.E9C791E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 16:28:02 2008 New Revision: 67080 Log: a few updates and clarifications Modified: peps/trunk/pep-0306.txt Modified: peps/trunk/pep-0306.txt ============================================================================== --- peps/trunk/pep-0306.txt (original) +++ peps/trunk/pep-0306.txt Mon Nov 3 16:28:02 2008 @@ -2,7 +2,7 @@ Title: How to Change Python's Grammar Version: $Revision$ Last-Modified: $Date$ -Author: Michael Hudson , Jack Diederich , Nick Coghlan +Author: Michael Hudson , Jack Diederich , Nick Coghlan , Benjamin Peterson Status: Active Type: Informational Content-Type: text/plain @@ -33,34 +33,36 @@ Checklist - __ Grammar/Grammar: OK, you'd probably worked this one out :) + __ Grammar/Grammar: OK, you'd probably worked this one out :) - __ Parser/Python.asdl may need changes to match the Grammar. - Use Parser/asdl_c.py to regenerate Include/Python-ast.h - - __ Python/Python-ast.c may need changes to create the AST - objects involved with the Grammar change. Lib/compiler/ast.py - will need matching changes to the pure-python AST objects. + __ Parser/Python.asdl may need changes to match the Grammar. Run + make to regenerate Include/Python-ast.h and + Python/Python-ast.c. + + __ Python/ast.c will need changes to create the AST objects + involved with the Grammar change. Lib/compiler/ast.py will + need matching changes to the pure-python AST objects. __ Parser/pgen needs to be rerun to regenerate Include/graminit.h - and Python/graminit.c + and Python/graminit.c. (make should handle this for you.) __ Python/symbtable.c: This handles the symbol collection pass - that happens immediately before the compilation pass + that happens immediately before the compilation pass. __ Python/compile.c: You will need to create or modify the - compiler_* functions for your productions. + compiler_* functions to generate opcodes for your productions. __ You may need to regenerate Lib/symbol.py and/or Lib/token.py - and/or Lib/keyword.py + and/or Lib/keyword.py. __ The parser module. Add some of your new syntax to test_parser, - bang on parsermodule.c until it passes. + bang on Modules/parsermodule.c until it passes. + + __ Add some usage of your new syntax to test_grammar.py __ The compiler package. A good test is to compile the standard library and test suite with the compiler package and then check - it runs. You did add some of your new syntax to the test - suite, didn't you? + it runs. Note that this only needs to be done in Python 2.x. __ If you've gone so far as to change the token structure of Python, then the Lib/tokenizer.py library module will need to From python-checkins at python.org Mon Nov 3 16:29:42 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 16:29:42 +0100 (CET) Subject: [Python-checkins] r67081 - peps/trunk/pep-0000.txt Message-ID: <20081103152942.F2CA51E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 16:29:42 2008 New Revision: 67081 Log: update authors Modified: peps/trunk/pep-0000.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Mon Nov 3 16:29:42 2008 @@ -63,7 +63,7 @@ I 287 reStructuredText Docstring Format Goodger I 290 Code Migration and Modernization Hettinger I 291 Backward Compatibility for Standard Library Norwitz - I 306 How to Change Python's Grammar Hudson + I 306 How to Change Python's Grammar Hudson, Diederich, Coghlan, Peterson IF 320 Python 2.4 Release Schedule Warsaw, et al I 333 Python Web Server Gateway Interface v1.0 Eby I 339 Design of the CPython Compiler Cannon From buildbot at python.org Mon Nov 3 16:31:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 15:31:34 +0000 Subject: [Python-checkins] buildbot failure in MIPSEL Debian 2.5 Message-ID: <20081103153134.92FF31E400C@bag.python.org> The Buildbot has detected a new failure of MIPSEL Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/MIPSEL%20Debian%202.5/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-mipsel Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed svn sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 16:44:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 15:44:25 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081103154425.E55F61E4002@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/305 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 ====================================================================== ERROR: testShutdown (test.test_socket.BasicTCPTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socket.py", line 120, in _tearDown self.fail(msg) AssertionError: [Errno 57] Socket is not connected make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 17:03:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 16:03:50 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 2.5 Message-ID: <20081103160350.679EC1E4002@bag.python.org> The Buildbot has detected a new failure of x86 osx.5 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%202.5/builds/45 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== ERROR: testShutdown (test.test_socket.BasicTCPTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/2.5.heller-x86-osx5/build/Lib/test/test_socket.py", line 122, in _tearDown self.fail(msg) AssertionError: (57, 'Socket is not connected') make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 17:06:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 16:06:25 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu trunk Message-ID: <20081103160625.F37A41E4059@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/700 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 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 Mon Nov 3 18:42:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 17:42:59 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 2.5 Message-ID: <20081103174259.5433B1E4002@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/229 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Mon Nov 3 19:03:07 2008 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 3 Nov 2008 19:03:07 +0100 (CET) Subject: [Python-checkins] r67082 - in python/trunk: Lib/lib-tk/Tkinter.py Misc/NEWS Message-ID: <20081103180307.56AEC1E4002@bag.python.org> Author: hirokazu.yamamoto Date: Mon Nov 3 19:03:06 2008 New Revision: 67082 Log: Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. Written by Guilherme Polo (gpolo). Modified: python/trunk/Lib/lib-tk/Tkinter.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/lib-tk/Tkinter.py ============================================================================== --- python/trunk/Lib/lib-tk/Tkinter.py (original) +++ python/trunk/Lib/lib-tk/Tkinter.py Mon Nov 3 19:03:06 2008 @@ -1921,6 +1921,8 @@ cnf = _cnfmerge((cnf, kw)) self.widgetName = widgetName BaseWidget._setup(self, master, cnf) + if self._tclCommands is None: + self._tclCommands = [] classes = [] for k in cnf.keys(): if type(k) is ClassType: @@ -2658,20 +2660,20 @@ """Add separator at INDEX.""" self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): - """Delete menu items between INDEX1 and INDEX2 (not included).""" + """Delete menu items between INDEX1 and INDEX2 (included).""" if index2 is None: index2 = index1 - cmds = [] - (num_index1, num_index2) = (self.index(index1), self.index(index2)) - if (num_index1 is not None) and (num_index2 is not None): - for i in range(num_index1, num_index2 + 1): - if 'command' in self.entryconfig(i): - c = str(self.entrycget(i, 'command')) - if c in self._tclCommands: - cmds.append(c) + + num_index1, num_index2 = self.index(index1), self.index(index2) + if (num_index1 is None) or (num_index2 is None): + num_index1, num_index2 = 0, -1 + + for i in range(num_index1, num_index2 + 1): + if 'command' in self.entryconfig(i): + c = str(self.entrycget(i, 'command')) + if c: + self.deletecommand(c) self.tk.call(self._w, 'delete', index1, index2) - for c in cmds: - self.deletecommand(c) def entrycget(self, index, option): """Return the resource value of an menu item for OPTION at INDEX.""" return self.tk.call(self._w, 'entrycget', index, '-' + option) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Nov 3 19:03:06 2008 @@ -38,6 +38,9 @@ Library ------- +- Issue #3774: Fixed an error when create a Tkinter menu item without command + and then remove it. + - Fixed a modulefinder crash on certain relative imports. - Issue #4150: Pdb's "up" command now works for generator frames in post-mortem From python-checkins at python.org Mon Nov 3 19:10:24 2008 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 3 Nov 2008 19:10:24 +0100 (CET) Subject: [Python-checkins] r67083 - in python/branches/release26-maint: Lib/lib-tk/Tkinter.py Misc/NEWS Message-ID: <20081103181024.7F2751E4002@bag.python.org> Author: hirokazu.yamamoto Date: Mon Nov 3 19:10:24 2008 New Revision: 67083 Log: Merged revisions 67082 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67082 | hirokazu.yamamoto | 2008-11-04 03:03:06 +0900 | 2 lines Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. Written by Guilherme Polo (gpolo). ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/lib-tk/Tkinter.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/release26-maint/Lib/lib-tk/Tkinter.py (original) +++ python/branches/release26-maint/Lib/lib-tk/Tkinter.py Mon Nov 3 19:10:24 2008 @@ -1921,6 +1921,8 @@ cnf = _cnfmerge((cnf, kw)) self.widgetName = widgetName BaseWidget._setup(self, master, cnf) + if self._tclCommands is None: + self._tclCommands = [] classes = [] for k in cnf.keys(): if type(k) is ClassType: @@ -2658,20 +2660,20 @@ """Add separator at INDEX.""" self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): - """Delete menu items between INDEX1 and INDEX2 (not included).""" + """Delete menu items between INDEX1 and INDEX2 (included).""" if index2 is None: index2 = index1 - cmds = [] - (num_index1, num_index2) = (self.index(index1), self.index(index2)) - if (num_index1 is not None) and (num_index2 is not None): - for i in range(num_index1, num_index2 + 1): - if 'command' in self.entryconfig(i): - c = str(self.entrycget(i, 'command')) - if c in self._tclCommands: - cmds.append(c) + + num_index1, num_index2 = self.index(index1), self.index(index2) + if (num_index1 is None) or (num_index2 is None): + num_index1, num_index2 = 0, -1 + + for i in range(num_index1, num_index2 + 1): + if 'command' in self.entryconfig(i): + c = str(self.entrycget(i, 'command')) + if c: + self.deletecommand(c) self.tk.call(self._w, 'delete', index1, index2) - for c in cmds: - self.deletecommand(c) def entrycget(self, index, option): """Return the resource value of an menu item for OPTION at INDEX.""" return self.tk.call(self._w, 'entrycget', index, '-' + option) Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Mon Nov 3 19:10:24 2008 @@ -38,6 +38,9 @@ Library ------- +- Issue #3774: Fixed an error when create a Tkinter menu item without command + and then remove it. + - Fixed a modulefinder crash on certain relative imports. - Issue #4150: Pdb's "up" command now works for generator frames in post-mortem From python-checkins at python.org Mon Nov 3 19:18:09 2008 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 3 Nov 2008 19:18:09 +0100 (CET) Subject: [Python-checkins] r67084 - in python/branches/release25-maint: Lib/lib-tk/Tkinter.py Misc/NEWS Message-ID: <20081103181809.69B151E4031@bag.python.org> Author: hirokazu.yamamoto Date: Mon Nov 3 19:18:08 2008 New Revision: 67084 Log: Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. Written by Guilherme Polo (gpolo). Backport of r67082. Modified: python/branches/release25-maint/Lib/lib-tk/Tkinter.py python/branches/release25-maint/Misc/NEWS 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 Mon Nov 3 19:18:08 2008 @@ -1931,6 +1931,8 @@ cnf = _cnfmerge((cnf, kw)) self.widgetName = widgetName BaseWidget._setup(self, master, cnf) + if self._tclCommands is None: + self._tclCommands = [] classes = [] for k in cnf.keys(): if type(k) is ClassType: @@ -2668,20 +2670,20 @@ """Add separator at INDEX.""" self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): - """Delete menu items between INDEX1 and INDEX2 (not included).""" + """Delete menu items between INDEX1 and INDEX2 (included).""" if index2 is None: index2 = index1 - cmds = [] - (num_index1, num_index2) = (self.index(index1), self.index(index2)) - if (num_index1 is not None) and (num_index2 is not None): - for i in range(num_index1, num_index2 + 1): - if 'command' in self.entryconfig(i): - c = str(self.entrycget(i, 'command')) - if c in self._tclCommands: - cmds.append(c) + + num_index1, num_index2 = self.index(index1), self.index(index2) + if (num_index1 is None) or (num_index2 is None): + num_index1, num_index2 = 0, -1 + + for i in range(num_index1, num_index2 + 1): + if 'command' in self.entryconfig(i): + c = str(self.entrycget(i, 'command')) + if c: + self.deletecommand(c) self.tk.call(self._w, 'delete', index1, index2) - for c in cmds: - self.deletecommand(c) def entrycget(self, index, option): """Return the resource value of an menu item for OPTION at INDEX.""" return self.tk.call(self._w, 'entrycget', index, '-' + option) Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Mon Nov 3 19:18:08 2008 @@ -97,6 +97,9 @@ Library ------- +- Issue #3774: Fixed an error when create a Tkinter menu item without command + and then remove it. + - Assigning methods to ctypes.Structure and ctypes.Union subclasses after creation of the class does now work correctly. See Issue #1700288. From buildbot at python.org Mon Nov 3 19:27:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 18:27:11 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20081103182711.E49081E4002@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/4273 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: hirokazu.yamamoto 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 Mon Nov 3 19:29:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 18:29:52 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 2.5 Message-ID: <20081103182952.3F58B1E4002@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/256 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_urllib2net test_urllibnet ====================================================================== FAIL: test_bad_address (test.test_urllib2net.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.5.bolen-windows\build\lib\test\test_urllib2net.py", line 147, in test_bad_address urllib2.urlopen, "http://www.python.invalid./") AssertionError: IOError not raised ====================================================================== FAIL: test_bad_address (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\2.5.bolen-windows\build\lib\test\test_urllibnet.py", line 113, in test_bad_address urllib.urlopen, "http://www.python.invalid./") AssertionError: IOError not raised sincerely, -The Buildbot From python-checkins at python.org Mon Nov 3 19:51:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 19:51:29 +0100 (CET) Subject: [Python-checkins] r67085 - peps/trunk/pep-0000.txt Message-ID: <20081103185129.8BB441E400C@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 19:51:29 2008 New Revision: 67085 Log: missed another place to update; the index really should be generated... Modified: peps/trunk/pep-0000.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Mon Nov 3 19:51:29 2008 @@ -411,7 +411,7 @@ SR 303 Extend divmod() for Multiple Divisors Bellman SW 304 Controlling Generation of Bytecode Files Montanaro SF 305 CSV File API Montanaro, et al - I 306 How to Change Python's Grammar Hudson + I 306 How to Change Python's Grammar Hudson, Diederich, Coghlan, Peterson SF 307 Extensions to the pickle protocol GvR, Peters SF 308 Conditional Expressions GvR, Hettinger SF 309 Partial Function Application Harris From buildbot at python.org Mon Nov 3 20:04:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 19:04:12 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 2.5 Message-ID: <20081103190412.A923D1E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%202.5/builds/5 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Mon Nov 3 20:06:58 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 20:06:58 +0100 (CET) Subject: [Python-checkins] r67086 - in peps/trunk: pep-0000.txt pep-0373.txt Message-ID: <20081103190658.D3EA81E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 20:06:58 2008 New Revision: 67086 Log: add a skeleton 2.7 release schedule pep Added: peps/trunk/pep-0373.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 Nov 3 20:06:58 2008 @@ -70,6 +70,7 @@ IF 356 Python 2.5 Release Schedule Norwitz, et al I 360 Externally Maintained Packages Cannon I 361 Python 2.6 and 3.0 Release Schedule Norwitz, et al + I 373 Python 2.7 Release Schedule Peterson I 3100 Python 3.0 Plans Cannon Accepted PEPs (accepted; may not be completely implemented yet) @@ -478,6 +479,7 @@ SA 370 Per user site-packages directory Heimes SA 371 Addition of the multiprocessing package Noller, Oudkerk S 372 Adding an ordered dictionary to collections Ronacher + I 373 Python 2.7 Release Schedule Peterson SR 666 Reject Foolish Indentation Creighton SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR Added: peps/trunk/pep-0373.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0373.txt Mon Nov 3 20:06:58 2008 @@ -0,0 +1,67 @@ +PEP: 373 +Title: Python 2.7 Release Schedule +Version: $Revision$ +Last-Modified: $Date$ +Author: Benjamin Peterson +Status: Draft +Type: Informational +Content-type: text/x-rst +Created: 3-Nov-2008 +Python-Version: 2.7 + + +Abstract +======== + +This document describes the development and release schedule for Python 2.7. +The schedule primarily concerns itself with PEP-sized items. Small features may +be added up to and including the first beta release. Bugs may be fixed until +the final release. + + +Release Manager and Crew +======================== + +=================== ================== +Position Name +=================== ================== +2.7 Release Manager Benjamin Peterson +Windows installers Martin v. Loewis +Mac installers Ronald Oussoren +=================== ================== + + +Release Schedule +================ + +Not yet finalized. + + +Possible features for 2.7 +========================= + +Nothing here. + + +References +========== + +None yet! + + + +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 python-checkins at python.org Mon Nov 3 20:19:51 2008 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 3 Nov 2008 20:19:51 +0100 (CET) Subject: [Python-checkins] r67087 - in tracker/instances/python-dev: html/issue.item.html schema.py Message-ID: <20081103191951.28BC71E4002@bag.python.org> Author: martin.v.loewis Date: Mon Nov 3 20:19:50 2008 New Revision: 67087 Log: Add stage field. Modified: tracker/instances/python-dev/html/issue.item.html tracker/instances/python-dev/schema.py Modified: tracker/instances/python-dev/html/issue.item.html ============================================================================== --- tracker/instances/python-dev/html/issue.item.html (original) +++ tracker/instances/python-dev/html/issue.item.html Mon Nov 3 20:19:50 2008 @@ -55,17 +55,10 @@ : type - - - - + + : + + components Modified: tracker/instances/python-dev/schema.py ============================================================================== --- tracker/instances/python-dev/schema.py (original) +++ tracker/instances/python-dev/schema.py Mon Nov 3 20:19:50 2008 @@ -45,6 +45,13 @@ order=Number()) priority.setkey('name') +# Stage +stage = Class(db, 'stage', + name = String(), + description = String(), + order = Number()) +stage.setkey('name') + # Status status = Class(db, "status", name=String(), @@ -125,7 +132,8 @@ status=Link('status'), resolution=Link('resolution'), superseder=Link('issue'), - keywords=Multilink("keyword")) + keywords=Multilink("keyword"), + stage=Link('stage')) # # TRACKER SECURITY SETTINGS @@ -152,7 +160,7 @@ ########################## for cl in ('issue_type', 'severity', 'component', - 'version', 'priority', 'status', 'resolution', + 'version', 'priority', 'stage', 'status', 'resolution', 'issue', 'keyword'): db.security.addPermissionToRole('User', 'View', cl) db.security.addPermissionToRole('Anonymous', 'View', cl) @@ -236,7 +244,7 @@ # Developer permissions ########################## for cl in ('issue_type', 'severity', 'component', - 'version', 'priority', 'status', 'resolution', + 'version', 'priority', 'stage', 'status', 'resolution', 'issue', 'file', 'msg', 'keyword'): db.security.addPermissionToRole('Developer', 'View', cl) @@ -249,7 +257,7 @@ # Coordinator permissions ########################## for cl in ('issue_type', 'severity', 'component', - 'version', 'priority', 'status', 'resolution', 'issue', 'file', 'msg'): + 'version', 'priority', 'stage', 'status', 'resolution', 'issue', 'file', 'msg'): db.security.addPermissionToRole('Coordinator', 'View', cl) db.security.addPermissionToRole('Coordinator', 'Edit', cl) db.security.addPermissionToRole('Coordinator', 'Create', cl) From buildbot at python.org Mon Nov 3 20:23:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 19:23:46 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian 2.5 Message-ID: <20081103192347.0262E1E4002@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%202.5/builds/299 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_urllib2net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Nov 3 21:43:21 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 21:43:21 +0100 (CET) Subject: [Python-checkins] r67089 - python/trunk/Doc/library/socket.rst Message-ID: <20081103204321.D32CC1E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 21:43:20 2008 New Revision: 67089 Log: clarify by splitting into multiple paragraphs Modified: python/trunk/Doc/library/socket.rst Modified: python/trunk/Doc/library/socket.rst ============================================================================== --- python/trunk/Doc/library/socket.rst (original) +++ python/trunk/Doc/library/socket.rst Mon Nov 3 21:43:20 2008 @@ -276,11 +276,15 @@ .. function:: gethostname() Return a string containing the hostname of the machine where the Python - interpreter is currently executing. If you want to know the current machine's IP - address, you may want to use ``gethostbyname(gethostname())``. This operation - assumes that there is a valid address-to-host mapping for the host, and the - assumption does not always hold. Note: :func:`gethostname` doesn't always return - the fully qualified domain name; use ``getfqdn()`` (see above). + interpreter is currently executing. + + If you want to know the current machine's IP address, you may want to use + ``gethostbyname(gethostname())``. This operation assumes that there is a + valid address-to-host mapping for the host, and the assumption does not + always hold. + + Note: :func:`gethostname` doesn't always return the fully qualified domain + name; use ``getfqdn()`` (see above). .. function:: gethostbyaddr(ip_address) From buildbot at python.org Mon Nov 3 21:50:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 20:50:21 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 3.0 Message-ID: <20081103205021.2FC601E4002@bag.python.org> The Buildbot has detected a new failure of OS X x86 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%203.0/builds/489 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 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_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.noller-osx86/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 21:55:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 20:55:05 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081103205505.421DB1E4002@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/1237 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_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 22:03:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 21:03:01 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20081103210301.87BAD1E4002@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/1655 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_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 22:07:14 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 21:07:14 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian 3.0 Message-ID: <20081103210715.184D91E4002@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%203.0/builds/1758 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 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_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 22:10:27 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 21:10:27 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20081103211028.D58521E4002@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/689 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_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 22:10:31 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 21:10:31 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081103211032.4B86C1E404C@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/540 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Nov 3 23:08:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 03 Nov 2008 22:08:13 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081103220813.A71C21E4002@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/724 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_descr ====================================================================== ERROR: test_slots (test.test_descr.ClassPropertiesAndMethods) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_descr.py", line 1023, in test_slots with test_support.captured_output('stderr') as s: NameError: global name 'test_support' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Nov 3 23:34:57 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 3 Nov 2008 23:34:57 +0100 (CET) Subject: [Python-checkins] r67091 - in python/trunk/Lib/test: test_fileio.py test_io.py Message-ID: <20081103223457.DC0331E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 3 23:34:57 2008 New Revision: 67091 Log: move a FileIO test to test_fileio Modified: python/trunk/Lib/test/test_fileio.py python/trunk/Lib/test/test_io.py Modified: python/trunk/Lib/test/test_fileio.py ============================================================================== --- python/trunk/Lib/test/test_fileio.py (original) +++ python/trunk/Lib/test/test_fileio.py Mon Nov 3 23:34:57 2008 @@ -7,7 +7,7 @@ from array import array from weakref import proxy -from test.test_support import TESTFN, findfile, run_unittest +from test.test_support import TESTFN, findfile, check_warnings, run_unittest from UserList import UserList import _fileio @@ -241,6 +241,14 @@ def testInvalidInit(self): self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) + def testWarnings(self): + with check_warnings() as w: + self.assertEqual(w.warnings, []) + self.assertRaises(TypeError, _fileio._FileIO, []) + self.assertEqual(w.warnings, []) + self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt") + self.assertEqual(w.warnings, []) + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. Modified: python/trunk/Lib/test/test_io.py ============================================================================== --- python/trunk/Lib/test/test_io.py (original) +++ python/trunk/Lib/test/test_io.py Mon Nov 3 23:34:57 2008 @@ -1236,13 +1236,6 @@ else: self.assert_(issubclass(obj, io.IOBase)) - def test_fileio_warnings(self): - with test_support.check_warnings() as w: - self.assertEqual(w.warnings, []) - self.assertRaises(TypeError, io.FileIO, []) - self.assertEqual(w.warnings, []) - self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt") - self.assertEqual(w.warnings, []) def test_main(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, From python-checkins at python.org Tue Nov 4 01:41:48 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 4 Nov 2008 01:41:48 +0100 (CET) Subject: [Python-checkins] r67094 - in sandbox/trunk/io-c: _bytesio.c _fileio.c build.py io.c io.py Message-ID: <20081104004148.8636F1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 4 01:41:47 2008 New Revision: 67094 Log: More progress on the C version of the io module: implemented IOBase, and all the Buffered* classes and methods. Many tests pass, a few failures remain with TextIOWrapper objects. Added: sandbox/trunk/io-c/_bytesio.c - copied, changed from r66490, /python/branches/py3k/Modules/_bytesio.c sandbox/trunk/io-c/_fileio.c - copied, changed from r66490, /python/branches/py3k/Modules/_fileio.c Modified: sandbox/trunk/io-c/build.py sandbox/trunk/io-c/io.c sandbox/trunk/io-c/io.py Copied: sandbox/trunk/io-c/_bytesio.c (from r66490, /python/branches/py3k/Modules/_bytesio.c) ============================================================================== --- /python/branches/py3k/Modules/_bytesio.c (original) +++ sandbox/trunk/io-c/_bytesio.c Tue Nov 4 01:41:47 2008 @@ -6,6 +6,8 @@ Py_ssize_t pos; Py_ssize_t string_size; size_t buf_size; + PyObject *dict; + PyObject *weakreflist; } BytesIOObject; #define CHECK_CLOSED(self) \ @@ -681,7 +683,7 @@ "Create a buffered I/O implementation using an in-memory bytes\n" "buffer, ready for reading and writing."); -static PyTypeObject BytesIO_Type = { +PyTypeObject PyBytesIO_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_bytesio._BytesIO", /*tp_name*/ sizeof(BytesIOObject), /*tp_basicsize*/ @@ -706,7 +708,7 @@ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ + offsetof(BytesIOObject, weakreflist), /*tp_weaklistoffset*/ PyObject_SelfIter, /*tp_iter*/ (iternextfunc)bytesio_iternext, /*tp_iternext*/ bytesio_methods, /*tp_methods*/ @@ -716,36 +718,8 @@ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ + offsetof(BytesIOObject, dict), /*tp_dictoffset*/ (initproc)bytesio_init, /*tp_init*/ 0, /*tp_alloc*/ bytesio_new, /*tp_new*/ }; - - -static struct PyModuleDef _bytesiomodule = { - PyModuleDef_HEAD_INIT, - "_bytesio", - NULL, - -1, - NULL, - NULL, - NULL, - NULL, - NULL -}; - -PyMODINIT_FUNC -PyInit__bytesio(void) -{ - PyObject *m; - - if (PyType_Ready(&BytesIO_Type) < 0) - return NULL; - m = PyModule_Create(&_bytesiomodule); - if (m == NULL) - return NULL; - Py_INCREF(&BytesIO_Type); - PyModule_AddObject(m, "_BytesIO", (PyObject *)&BytesIO_Type); - return m; -} Copied: sandbox/trunk/io-c/_fileio.c (from r66490, /python/branches/py3k/Modules/_fileio.c) ============================================================================== --- /python/branches/py3k/Modules/_fileio.c (original) +++ sandbox/trunk/io-c/_fileio.c Tue Nov 4 01:41:47 2008 @@ -7,6 +7,8 @@ #include #include /* For offsetof */ +extern PyObject *PyRawIOBase; + /* * Known likely problems: * @@ -35,6 +37,7 @@ int seekable : 2; /* -1 means unknown */ int closefd : 1; PyObject *weakreflist; + PyObject *dict; } PyFileIOObject; PyTypeObject PyFileIO_Type; @@ -73,7 +76,7 @@ return NULL; } - Py_RETURN_NONE; + return PyObject_CallMethod(PyRawIOBase, "close", "O", self); } static PyObject * @@ -831,7 +834,7 @@ }; PyTypeObject PyFileIO_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) + PyVarObject_HEAD_INIT(NULL, 0) "_FileIO", sizeof(PyFileIOObject), 0, @@ -855,7 +858,7 @@ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(PyFileIOObject, weakreflist), /* tp_weaklistoffset */ + offsetof(PyFileIOObject, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ fileio_methods, /* tp_methods */ @@ -865,40 +868,9 @@ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ + offsetof(PyFileIOObject, dict), /* tp_dictoffset */ fileio_init, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ fileio_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -static PyMethodDef module_methods[] = { - {NULL, NULL} + 0, /* tp_free */ }; - -static struct PyModuleDef fileiomodule = { - PyModuleDef_HEAD_INIT, - "_fileio", - "Fast implementation of io.FileIO.", - -1, - module_methods, - NULL, - NULL, - NULL, - NULL -}; - -PyMODINIT_FUNC -PyInit__fileio(void) -{ - PyObject *m; /* a module object */ - - m = PyModule_Create(&fileiomodule); - if (m == NULL) - return NULL; - if (PyType_Ready(&PyFileIO_Type) < 0) - return NULL; - Py_INCREF(&PyFileIO_Type); - PyModule_AddObject(m, "_FileIO", (PyObject *) &PyFileIO_Type); - return m; -} Modified: sandbox/trunk/io-c/build.py ============================================================================== --- sandbox/trunk/io-c/build.py (original) +++ sandbox/trunk/io-c/build.py Tue Nov 4 01:41:47 2008 @@ -3,8 +3,9 @@ from distutils.command.build_ext import build_ext def compile(): - io_c = os.path.join(os.path.dirname(__file__), 'io.c') - io_ext = Extension('_io', [io_c]) + sources = ['io.c', '_fileio.c', '_bytesio.c'] + sources = [os.path.join(os.path.dirname(__file__), s) for s in sources] + io_ext = Extension('_io', sources) dist = Distribution({'name': '_io', 'ext_modules': [io_ext]}) cmd = build_ext(dist) cmd.build_lib = os.path.dirname(__file__) @@ -21,11 +22,13 @@ env = os.environ.copy() env['PYTHONPATH'] = os.path.abspath(os.path.dirname(__file__)) + print("try importing module") p = subprocess.Popen([sys.executable, "-c", "import io; print(io)"], env=env) p.wait() + print("run the test suite") p = subprocess.Popen([sys.executable, "-c", "from test.test_io import test_main; test_main()"], env=env) Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Tue Nov 4 01:41:47 2008 @@ -1,5 +1,9 @@ #include #include "structmember.h" +#include "pythread.h" + +extern PyTypeObject PyFileIO_Type; +extern PyTypeObject PyBytesIO_Type; static PyObject *io_py_module; @@ -17,7 +21,7 @@ "allowed to throw an IOError if they do not support a given operation.\n" "\n" "Extending IOBase is RawIOBase which deals simply with the reading and\n" -"writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\n" +"writing of raw bytes to a stream. FileIO subc lasses RawIOBase to provide\n" "an interface to OS files.\n" "\n" "BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\n" @@ -53,15 +57,15 @@ PyObject *myerrno; PyObject *strerror; PyObject *filename; /* Not used, but part of the IOError object */ - Py_ssize_t *characters_written; + Py_ssize_t written; } PyBlockingIOErrorObject; static int BlockingIOError_init(PyBlockingIOErrorObject *self, PyObject *args, - PyObject *kwds) + PyObject *kwds) { - PyObject *myerrno = NULL, *strerror = NULL; + PyObject *myerrno = NULL, *strerror = NULL, *written; PyObject *baseargs = NULL; assert(PyTuple_Check(args)); @@ -71,27 +75,36 @@ baseargs = PyTuple_GetSlice(args, 0, 2); if (baseargs == NULL) - return -1; + return -1; if (((PyTypeObject*)PyExc_IOError)->tp_init( - (PyObject*)self, baseargs, kwds) == -1) { - Py_DECREF(baseargs); - return -1; + (PyObject*)self, baseargs, kwds) == -1) { + Py_DECREF(baseargs); + return -1; } Py_DECREF(baseargs); if (!PyArg_UnpackTuple(args, "BlockingIOError", 2, 3, - &myerrno, &strerror, &self->characters_written)) { + &myerrno, &strerror, &written)) { return -1; } + Py_INCREF(myerrno); + self->myerrno = myerrno; + + Py_INCREF(strerror); + self->strerror = strerror; + + self->written = PyNumber_AsSsize_t(written, PyExc_ValueError); + if(self->written == -1 && PyErr_Occurred()) + return -1; + return 0; } static PyMemberDef BlockingIOError_members[] = { - {"characters_written", T_OBJECT, offsetof(PyBlockingIOErrorObject, characters_written), 0, - PyDoc_STR("exception errno")}, + {"characters_written", T_PYSSIZET, offsetof(PyBlockingIOErrorObject, written), 0}, {NULL} /* Sentinel */ }; @@ -246,8 +259,8 @@ io_open(PyObject* self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"file", "mode", "buffering", - "encoding", "errors", "newline", - "closefd", NULL}; + "encoding", "errors", "newline", + "closefd", NULL}; PyObject *file; char *mode = "r"; int buffering = -1, closefd = 1; @@ -264,53 +277,53 @@ PyObject *raw, *modeobj = NULL, *buffer = NULL, *wrapper = NULL; if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist, - &file, &mode, &buffering, - &encoding, &errors, &newline, - &closefd)) { - return NULL; + &file, &mode, &buffering, + &encoding, &errors, &newline, + &closefd)) { + return NULL; } if (!PyUnicode_Check(file) && !PyNumber_Check(file)) { - PyErr_Format(PyExc_TypeError, "invalid file: %R", file); - return NULL; + PyErr_Format(PyExc_TypeError, "invalid file: %R", file); + return NULL; } /* Decode mode */ for (i = 0; i < strlen(mode); i++) { - char c = mode[i]; + char c = mode[i]; - switch (c) { - case 'r': - reading = 1; - break; - case 'w': - writing = 1; - break; - case 'a': - appending = 1; - break; - case '+': - updating = 1; - break; - case 't': - text = 1; - break; - case 'b': - binary = 1; - break; - case 'U': - universal = 1; - break; - default: - goto invalid_mode; - } - - /* c must not be duplicated */ - if (strchr(mode+i+1, c)) { - invalid_mode: - PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); - return NULL; - } + switch (c) { + case 'r': + reading = 1; + break; + case 'w': + writing = 1; + break; + case 'a': + appending = 1; + break; + case '+': + updating = 1; + break; + case 't': + text = 1; + break; + case 'b': + binary = 1; + break; + case 'U': + universal = 1; + break; + default: + goto invalid_mode; + } + + /* c must not be duplicated */ + if (strchr(mode+i+1, c)) { + invalid_mode: + PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); + return NULL; + } } @@ -323,180 +336,180 @@ /* Parameters validation */ if (universal) { - if (writing || appending) { - PyErr_SetString(PyExc_ValueError, - "can't use U and writing mode at once"); - return NULL; - } - reading = 1; + if (writing || appending) { + PyErr_SetString(PyExc_ValueError, + "can't use U and writing mode at once"); + return NULL; + } + reading = 1; } if (text && binary) { - PyErr_SetString(PyExc_ValueError, - "can't have text and binary mode at once"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "can't have text and binary mode at once"); + return NULL; } if (reading + writing + appending > 1) { - PyErr_SetString(PyExc_ValueError, - "must have exactly one of read/write/append mode"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "must have exactly one of read/write/append mode"); + return NULL; } if (binary && encoding != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take an encoding argument"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take an encoding argument"); + return NULL; } if (binary && errors != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take an errors argument"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take an errors argument"); + return NULL; } if (binary && newline != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take a newline argument"); - return NULL; + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take a newline argument"); + return NULL; } /* Create the Raw file stream */ FileIO_class = PyObject_GetAttrString(io_py_module, "FileIO"); if (!FileIO_class) - return NULL; + return NULL; raw = PyObject_CallFunction(FileIO_class, "Osi", file, rawmode, closefd); Py_DECREF(FileIO_class); if (raw == NULL) - return NULL; + return NULL; modeobj = PyUnicode_FromString(mode); if (modeobj == NULL) - goto error; + goto error; /* buffering */ { - PyObject *res = PyObject_CallMethod(raw, "isatty", NULL); - if (res == NULL) - goto error; - isatty = PyLong_AsLong(res); - Py_DECREF(res); - if (isatty == -1 && PyErr_Occurred()) - goto error; + PyObject *res = PyObject_CallMethod(raw, "isatty", NULL); + if (res == NULL) + goto error; + isatty = PyLong_AsLong(res); + Py_DECREF(res); + if (isatty == -1 && PyErr_Occurred()) + goto error; } if (buffering == 1 || (buffering < 0 && isatty)) { - buffering = -1; - line_buffering = 1; + buffering = -1; + line_buffering = 1; } else - line_buffering = 0; + line_buffering = 0; if (buffering < 0) { - buffering = DEFAULT_BUFFER_SIZE; + buffering = DEFAULT_BUFFER_SIZE; #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - { - struct stat st; - long fileno; - PyObject *res = PyObject_CallMethod(raw, "fileno", NULL); - if (res == NULL) - goto error; - - fileno = PyLong_AsLong(res); - Py_DECREF(res); - if (fileno == -1 && PyErr_Occurred()) - goto error; - - if (stat(fileno, &st) >= 0) - buffering = st->st_blksize; - } + { + struct stat st; + long fileno; + PyObject *res = PyObject_CallMethod(raw, "fileno", NULL); + if (res == NULL) + goto error; + + fileno = PyLong_AsLong(res); + Py_DECREF(res); + if (fileno == -1 && PyErr_Occurred()) + goto error; + + if (stat(fileno, &st) >= 0) + buffering = st->st_blksize; + } #endif } if (buffering < 0) { - PyErr_SetString(PyExc_ValueError, - "invalid buffering size"); - goto error; + PyErr_SetString(PyExc_ValueError, + "invalid buffering size"); + goto error; } /* if not buffering, returns the raw file object */ if (buffering == 0) { - if (!binary) { - PyErr_SetString(PyExc_ValueError, - "can't have unbuffered text I/O"); - goto error; - } - - if (PyObject_SetAttrString(raw, "_name", file) < 0) - goto error; - if (PyObject_SetAttrString(raw, "_mode", modeobj) < 0) - goto error; - Py_DECREF(modeobj); - return raw; + if (!binary) { + PyErr_SetString(PyExc_ValueError, + "can't have unbuffered text I/O"); + goto error; + } + + if (PyObject_SetAttrString(raw, "_name", file) < 0) + goto error; + if (PyObject_SetAttrString(raw, "_mode", modeobj) < 0) + goto error; + Py_DECREF(modeobj); + return raw; } /* wraps into a buffered file */ { - char *Buffered_class_name; - PyObject *Buffered_class; + char *Buffered_class_name; + PyObject *Buffered_class; - if (updating) - Buffered_class_name = "BufferedRandom"; - else if (writing || appending) - Buffered_class_name = "BufferedWriter"; - else if (reading) - Buffered_class_name = "BufferedReader"; - else { - PyErr_Format(PyExc_ValueError, - "unknown mode: '%s'", mode); - goto error; - } - - Buffered_class = PyObject_GetAttrString(io_py_module, - Buffered_class_name); - if (Buffered_class == NULL) - goto error; + if (updating) + Buffered_class_name = "BufferedRandom"; + else if (writing || appending) + Buffered_class_name = "BufferedWriter"; + else if (reading) + Buffered_class_name = "BufferedReader"; + else { + PyErr_Format(PyExc_ValueError, + "unknown mode: '%s'", mode); + goto error; + } + + Buffered_class = PyObject_GetAttrString(io_py_module, + Buffered_class_name); + if (Buffered_class == NULL) + goto error; - buffer = PyObject_CallFunction(Buffered_class, "Oi", raw, buffering); - Py_DECREF(Buffered_class); + buffer = PyObject_CallFunction(Buffered_class, "Oi", raw, buffering); + Py_DECREF(Buffered_class); } Py_CLEAR(raw); if (buffer == NULL) - goto error; + goto error; /* if binary, returns the buffered file */ if (binary) { - if (PyObject_SetAttrString(buffer, "_name", file) < 0) - goto error; - if (PyObject_SetAttrString(buffer, "_mode", modeobj) < 0) - goto error; - Py_DECREF(modeobj); - return buffer; + if (PyObject_SetAttrString(buffer, "_name", file) < 0) + goto error; + if (PyObject_SetAttrString(buffer, "_mode", modeobj) < 0) + goto error; + Py_DECREF(modeobj); + return buffer; } /* wraps into a TextIOWrapper */ { - PyObject *TextIOWrapper_class; - TextIOWrapper_class = PyObject_GetAttrString(io_py_module, - "TextIOWrapper"); - if (TextIOWrapper_class == NULL) - goto error; - - wrapper = PyObject_CallFunction(TextIOWrapper_class, "Osssi", - buffer, - encoding, errors, newline, - line_buffering); - Py_DECREF(TextIOWrapper_class); + PyObject *TextIOWrapper_class; + TextIOWrapper_class = PyObject_GetAttrString(io_py_module, + "TextIOWrapper"); + if (TextIOWrapper_class == NULL) + goto error; + + wrapper = PyObject_CallFunction(TextIOWrapper_class, "Osssi", + buffer, + encoding, errors, newline, + line_buffering); + Py_DECREF(TextIOWrapper_class); } Py_CLEAR(buffer); if (wrapper == NULL) - goto error; + goto error; if (PyObject_SetAttrString(wrapper, "name", file) < 0) - goto error; + goto error; if (PyObject_SetAttrString(wrapper, "mode", modeobj) < 0) - goto error; + goto error; Py_DECREF(modeobj); return wrapper; @@ -509,11 +522,614 @@ } +static PyObject* PyExc_UnsupportedOperation; + +/* + * IOBase class, an abstract class + */ + +PyDoc_STRVAR(IOBase_doc, + "The abstract base class for all I/O classes, acting on streams of\n" + "bytes. There is no public constructor.\n" + "\n" + "This class provides dummy implementations for many methods that\n" + "derived classes can override selectively; the default implementations\n" + "represent a file that cannot be read, written or seeked.\n" + "\n" + "Even though IOBase does not declare read, readinto, or write because\n" + "their signatures will vary, implementations and clients should\n" + "consider those methods part of the interface. Also, implementations\n" + "may raise a IOError when operations they do not support are called.\n" + "\n" + "The basic type used for binary data read from or written to a file is\n" + "bytes. bytearrays are accepted too, and in some cases (such as\n" + "readinto) needed. Text I/O classes work with str data.\n" + "\n" + "Note that calling any method (even inquiries) on a closed stream is\n" + "undefined. Implementations may raise IOError in this case.\n" + "\n" + "IOBase (and its subclasses) support the iterator protocol, meaning\n" + "that an IOBase object can be iterated over yielding the lines in a\n" + "stream.\n" + "\n" + "IOBase also supports the :keyword:`with` statement. In this example,\n" + "fp is closed after the suite of the with statment is complete:\n" + "\n" + "with open('spam.txt', 'r') as fp:\n" + " fp.write('Spam and eggs!')\n"); + +/* Internal methods */ +static PyObject * +IOBase_unsupported(const char* message) +{ + PyErr_SetString(PyExc_UnsupportedOperation, message); + return NULL; +} + +/* Positionning */ + +PyDoc_STRVAR(IOBase_seek_doc, + "Change stream position.\n" + "\n" + "Change the stream position to byte offset offset. offset is\n" + "interpreted relative to the position indicated by whence. Values\n" + "for whence are:\n" + "\n" + "* 0 -- start of stream (the default); offset should be zero or positive\n" + "* 1 -- current stream position; offset may be negative\n" + "* 2 -- end of stream; offset is usually negative\n" + "\n" + "Return the new absolute position."); + +static PyObject* +IOBase_seek(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("seek"); +} + +PyDoc_STRVAR(IOBase_tell_doc, + "Return current stream position."); + +static PyObject * +IOBase_tell(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "tell", "ii", 0, 1); +} + +PyDoc_STRVAR(IOBase_truncate_doc, + "Truncate file to size bytes.\n" + "\n" + "Size defaults to the current IO position as reported by tell(). Return\n" + "the new size."); + +static PyObject* +IOBase_truncate(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("seek"); +} + +/* Flush and close methods */ + +PyDoc_STRVAR(IOBase_flush_doc, + "Flush write buffers, if applicable.\n" + "\n" + "This is not implemented for read-only and non-blocking streams.\n"); + +static PyObject* +IOBase_flush(PyObject *self, PyObject *args) +{ + /* XXX Should this return the number of bytes written??? */ + Py_RETURN_NONE; +} + +PyDoc_STRVAR(IOBase_close_doc, + "Flush and close the IO object.\n" + "\n" + "This method has no effect if the file is already closed.\n"); + +static int +IOBase_closed(PyObject *self) +{ + return PyObject_HasAttrString(self, "__IOBase_closed"); +} + +static PyObject * +IOBase_closed_get(PyObject *self, void *context) +{ + return PyBool_FromLong(IOBase_closed(self)); +} + + +static int +IOBase_checkClosed(PyObject *self) +{ + if (IOBase_closed(self)) { + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); + return -1; + } + return 0; +} + +static PyObject* +IOBase_close(PyObject *self, PyObject *args) +{ + PyObject *res; + + if (IOBase_closed(self)) + Py_RETURN_NONE; + + PyObject_SetAttrString(self, "__IOBase_closed", Py_True); + + res = PyObject_CallMethod(self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + +static void +IOBase_del(PyObject *self) +{ + PyObject *res = PyObject_CallMethod(self, "flush", NULL); + if (res == NULL) { + /* At program exit time, it's possible that globals have already been + * deleted, and then the close() call might fail. Since there's + * nothing we can do about such failures and they annoy the end + * users, we suppress the traceback. + */ + PyErr_Clear(); + } +} + +/* Inquiry methods */ + +PyDoc_STRVAR(IOBase_seekable_doc, + "Return whether object supports random access.\n" + "\n" + "If False, seek(), tell() and truncate() will raise IOError.\n" + "This method may need to do a test seek()."); + +static PyObject* +IOBase_seekable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +static int +IOBase_checkSeekable(PyObject *self) +{ + int ret = 0; + PyObject *res = PyObject_CallMethod(self, "seekable", NULL); + if (res == NULL) + return -1; + if (res != Py_True) { + PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); + ret = -1; + } + Py_DECREF(res); + return ret; +} + +PyDoc_STRVAR(IOBase_readable_doc, + "Return whether object was opened for reading.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject* +IOBase_readable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +static int +IOBase_checkReadable(PyObject *self) +{ + int ret = 0; + PyObject *res = PyObject_CallMethod(self, "readable", NULL); + if (res == NULL) + return -1; + if (res != Py_True) { + PyErr_SetString(PyExc_IOError, "File or stream is not readable."); + ret = -1; + } + Py_DECREF(res); + return ret; +} + +PyDoc_STRVAR(IOBase_writable_doc, + "Return whether object was opened for writing.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject* +IOBase_writable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +static int +IOBase_checkWritable(PyObject *self) +{ + int ret = 0; + PyObject *res = PyObject_CallMethod(self, "writable", NULL); + if (res == NULL) + return -1; + if (res != Py_True) { + PyErr_SetString(PyExc_IOError, "File or stream is not writable."); + ret = -1; + } + Py_DECREF(res); + return ret; +} + +/* Context manager */ + +static PyObject * +IOBase_enter(PyObject *self, PyObject *args) +{ + if (IOBase_checkClosed(self) < 0) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +IOBase_exit(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "close", NULL); +} + +/* Lower-level APIs */ + +/* XXX Should these be present even if unimplemented? */ + +PyDoc_STRVAR(IOBase_fileno_doc, + "Returns underlying file descriptor if one exists.\n" + "\n" + "An IOError is raised if the IO object does not use a file descriptor.\n"); + +static PyObject * +IOBase_fileno(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("fileno"); +} + +PyDoc_STRVAR(IOBase_isatty_doc, + "Return whether this is an 'interactive' stream.\n" + "\n" + "Return False if it can't be determined.\n"); + +static PyObject * +IOBase_isatty(PyObject *self, PyObject *args) +{ + if (IOBase_checkClosed(self) < 0) + return NULL; + Py_RETURN_FALSE; +} + +/* Readline(s) and writelines */ + +PyDoc_STRVAR(IOBase_readline_doc, + "Read and return a line from the stream.\n" + "\n" + "If limit is specified, at most limit bytes will be read.\n" + "\n" + "The line terminator is always b'\n' for binary files; for text\n" + "files, the newlines argument to open can be used to select the line\n" + "terminator(s) recognized.\n"); + +static PyObject * +IOBase_readline(PyObject *self, PyObject *args) +{ + /* For backwards compatibility, a (slowish) readline(). */ + + Py_ssize_t limit = -1; + int has_peek = 0; + PyObject *buffer, *result; + Py_ssize_t old_size = -1; + + if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { + return NULL; + } + + if (IOBase_checkClosed(self) < 0) + return NULL; + + if (PyObject_HasAttrString(self, "peek")) + has_peek = 1; + + buffer = PyByteArray_FromStringAndSize(NULL, 0); + if (buffer == NULL) + return NULL; + + while (limit < 0 || Py_SIZE(buffer) < limit) { + Py_ssize_t nreadahead = 1; + PyObject *b; + + if (has_peek) { + PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); + + assert (PyBytes_Check(readahead)); + + if (readahead == NULL) + goto fail; + if (PyBytes_GET_SIZE(readahead) > 0) { + Py_ssize_t n = 0; + const char *buf = PyBytes_AS_STRING(readahead); + if (limit >= 0) { + do { + if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) + break; + if (buf[n] == '\n') + { + n++; + break; + } + n++; + } while (1); + } + else { + do { + if (n >= PyBytes_GET_SIZE(readahead)) + break; + if (buf[n] == '\n') + { + n++; + break; + } + n++; + } while (1); + } + nreadahead = n; + } + } + + b = PyObject_CallMethod(self, "read", "n", nreadahead); + + if (b == NULL) + goto fail; + + assert (PyBytes_Check(b)); + + if (Py_SIZE(b) == 0) + break; + + old_size = Py_SIZE(buffer); + PyByteArray_Resize(buffer, old_size + Py_SIZE(b)); + memcpy(PyByteArray_AS_STRING(buffer) + old_size, PyBytes_AS_STRING(b), Py_SIZE(b)); + + Py_DECREF(b); + + if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') + break; + } + + result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), + PyByteArray_GET_SIZE(buffer)); + Py_DECREF(buffer); + return result; + fail: + Py_DECREF(buffer); + return NULL; +} + +static PyObject * +IOBase_iter(PyObject *self, PyObject *args) +{ + if (IOBase_checkClosed(self) < 0) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +IOBase_next(PyObject *self, PyObject *args) +{ + PyObject *line = PyObject_CallMethod(self, "readline", NULL); + + if (line == NULL) + return NULL; + + assert (PyBytes_Check(line)); + + if (PyBytes_GET_SIZE(line) == 0) { + Py_DECREF(line); + return NULL; + } + + return line; +} + +PyDoc_STRVAR(IOBase_readlines_doc, + "Return a list of lines from the stream.\n" + "\n" + "hint can be specified to control the number of lines read: no more\n" + "lines will be read if the total size (in bytes/characters) of all\n" + "lines so far exceeds hint."); + +static PyObject * +IOBase_readlines(PyObject *self, PyObject *args) +{ + Py_ssize_t hint = -1, length = 0; + PyObject *line, *result; + + if (!PyArg_ParseTuple(args, "|n:readlines", &hint)) { + return NULL; + } + + result = PyList_New(0); + if (result == NULL) + return NULL; + + if (hint <= 0) { + PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); + if( ret == NULL) { + Py_DECREF(result); + return NULL; + } + Py_DECREF(ret); + return result; + } + + while (1) { + line = PyObject_CallMethod(self, "__next__", NULL); + if (line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } + else + break; /* SopIteration raised */ + } + assert (PyBytes_Check(line)); + + if (PyList_Append(result, line) < 0) { + Py_DECREF(line); + Py_DECREF(result); + return NULL; + } + length += Py_SIZE(line); + Py_DECREF(line); + + if (length > hint) + break; + } + return result; +} + +static PyObject * +IOBase_writelines(PyObject *self, PyObject *args) +{ + PyObject *lines, *iter, *res; + + if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { + return NULL; + } + + if (IOBase_checkClosed(self) < 0) + return NULL; + + iter = PyObject_GetIter(lines); + if (iter == NULL) + return NULL; + + while (1) { + PyObject *line = PyIter_Next(iter); + if(line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(iter); + return NULL; + } + else + break; /* Stop Iteration */ + } + + res = PyObject_CallMethod(self, "write", "O", line); + Py_DECREF(line); + if (res == NULL) { + Py_DECREF(iter); + return NULL; + } + Py_DECREF(res); + } + Py_RETURN_NONE; +} + +static PyMethodDef IOBase_methods[] = { + {"seek", IOBase_seek, METH_VARARGS}, + {"tell", IOBase_tell, METH_NOARGS}, + {"truncate", IOBase_truncate, METH_VARARGS}, + {"flush", IOBase_flush, METH_NOARGS}, + {"close", IOBase_close, METH_NOARGS}, + + {"seekable", IOBase_seekable, METH_NOARGS}, + {"readable", IOBase_readable, METH_NOARGS}, + {"writable", IOBase_writable, METH_NOARGS}, + {"fileno", IOBase_fileno, METH_NOARGS}, + {"isatty", IOBase_isatty, METH_NOARGS}, + + {"__enter__", IOBase_enter, METH_NOARGS}, + {"__exit__", IOBase_exit, METH_VARARGS}, + + {"__iter__", IOBase_iter, METH_NOARGS}, + {"__next__", IOBase_next, METH_NOARGS}, + + {"readline", IOBase_readline, METH_VARARGS}, + {"readlines", IOBase_readlines, METH_VARARGS}, + {"writelines", IOBase_readlines, METH_VARARGS}, + + {NULL, NULL} +}; + +static PyGetSetDef IOBase_getset[] = { + {"closed", (getter)IOBase_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject _IOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "IOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + IOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + IOBase_methods, /* tp_methods */ + 0, /* tp_members */ + IOBase_getset, /* 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 */ + PyType_GenericNew, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + IOBase_del, /* tp_del */ +}; +PyObject *PyIOBase = (PyObject*)&_IOBase_Type; + + + /* * RawIOBase class, Inherits from IOBase. */ PyDoc_STRVAR(RawIOBase_doc, - "Base class for raw binary I/O."); + "Base class for raw binary I/O."); /* * The read() method is implemented by calling readinto(); derived classes @@ -534,27 +1150,27 @@ PyObject *b, *res; if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; + return NULL; } if (n < 0) - return PyObject_CallMethod(self, "readall", NULL); + return PyObject_CallMethod(self, "readall", NULL); b = PyByteArray_FromStringAndSize(NULL, n); if (b == NULL) - return NULL; + return NULL; res = PyObject_CallMethod(self, "readinto", "O", b); if (res == NULL) { - Py_DECREF(b); - return NULL; + Py_DECREF(b); + return NULL; } n = PyNumber_AsSsize_t(res, PyExc_ValueError); Py_DECREF(res); if (n == -1 && PyErr_Occurred()) { - Py_DECREF(b); - return NULL; + Py_DECREF(b); + return NULL; } res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); @@ -564,47 +1180,47 @@ PyDoc_STRVAR(RawIOBase_readall_doc, - "Read until EOF, using multiple read() call."); + "Read until EOF, using multiple read() call."); static PyObject * RawIOBase_readall(PyObject *self, PyObject *args) { - PyObject *b, *res; + PyObject *b; Py_ssize_t cursize = 0; b = PyBytes_FromStringAndSize(NULL, 0); if (b == NULL) - return NULL; + return NULL; while (1) { - Py_ssize_t length; - PyObject *data = PyObject_CallMethod(self, "read", - "i", DEFAULT_BUFFER_SIZE); - - if (!data) { - Py_DECREF(b); - return NULL; - } - - if (!PyBytes_Check(b)) { - Py_DECREF(b); - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - length = Py_SIZE(data); - - if (length == 0) - break; - - _PyBytes_Resize(&b, cursize + length); - memcpy(PyBytes_AS_STRING(b) + cursize, - PyBytes_AS_STRING(data), length); - Py_DECREF(data); + Py_ssize_t length; + PyObject *data = PyObject_CallMethod(self, "read", + "i", DEFAULT_BUFFER_SIZE); + + if (!data) { + Py_DECREF(b); + return NULL; + } + + if (!PyBytes_Check(b)) { + Py_DECREF(b); + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + length = Py_SIZE(data); + + if (length == 0) + break; + + _PyBytes_Resize(&b, cursize + length); + memcpy(PyBytes_AS_STRING(b) + cursize, + PyBytes_AS_STRING(data), length); + Py_DECREF(data); } - return res; + return b; } @@ -614,7 +1230,7 @@ {NULL, NULL} }; -static PyTypeObject RawIOBase_Type = { +PyTypeObject _RawIOBase_Type = { PyVarObject_HEAD_INIT(NULL, 0) "RawIOBase", /*tp_name*/ 0, /*tp_basicsize*/ @@ -634,8 +1250,8 @@ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - RawIOBase_readall_doc, /* tp_doc */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + RawIOBase_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ @@ -645,7 +1261,7 @@ RawIOBase_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ - 0, /* tp_base */ + &_IOBase_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ @@ -654,64 +1270,1510 @@ 0, /* tp_alloc */ 0, /* tp_new */ }; +PyObject *PyRawIOBase = (PyObject*)&_RawIOBase_Type; /* - * Module definition + * BufferedIOBase class, inherits from IOBase. */ +PyDoc_STRVAR(BufferedIOBase_doc, + "Base class for buffered IO objects.\n" + "\n" + "The main difference with RawIOBase is that the read() method\n" + "supports omitting the size argument, and does not have a default\n" + "implementation that defers to readinto().\n" + "\n" + "In addition, read(), readinto() and write() may raise\n" + "BlockingIOError if the underlying raw stream is in non-blocking\n" + "mode and not ready; unlike their raw counterparts, they will never\n" + "return None.\n" + "\n" + "A typical implementation should not inherit from a RawIOBase\n" + "implementation, but wrap one.\n" + ); -static PyMethodDef module_methods[] = { - {"open", (PyCFunction)io_open, METH_VARARGS|METH_KEYWORDS, open_doc}, - {NULL, NULL} -}; +static PyObject * +BufferedIOBase_readinto(PyObject *self, PyObject *args) +{ + Py_buffer buf; + Py_ssize_t len; + PyObject *data; -static struct PyModuleDef iomodule = { - PyModuleDef_HEAD_INIT, - "io", - module_doc, - -1, - module_methods, - NULL, - NULL, - NULL, - NULL -}; + if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { + return NULL; + } -PyMODINIT_FUNC -PyInit__io() -{ - PyObject *m = PyModule_Create(&iomodule); - PyTypeObject *base; - if (m == NULL) - goto fail; + data = PyObject_CallMethod(self, "read", "n", buf.len); + if (data == NULL) + goto error; - io_py_module = PyImport_ImportModule("io"); - if (io_py_module == NULL) - goto fail; + if (!PyBytes_Check(data)) { + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + goto error; + } - /* BlockingIOError */ - base = (PyTypeObject*)PyExc_IOError; - _PyExc_BlockingIOError.tp_base = base; - if (PyType_Ready(&_PyExc_BlockingIOError) < 0) + len = Py_SIZE(data); + memcpy(buf.buf, PyBytes_AS_STRING(data), len); + + PyBuffer_Release(&buf); + Py_DECREF(data); + + return PyLong_FromSsize_t(len); + + error: + PyBuffer_Release(&buf); + return NULL; +} + +static PyMethodDef BufferedIOBase_methods[] = { + {"readinto", BufferedIOBase_readinto, METH_VARARGS}, + {NULL, NULL} +}; + +PyTypeObject _BufferedIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + BufferedIOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedIOBase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &_IOBase_Type, /* 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 */ +}; + + +typedef struct { + PyObject_HEAD + + PyObject *raw; + + PyObject *name; + PyObject *mode; + + PyObject *read_buf; + Py_ssize_t read_pos; + PyThread_type_lock read_lock; + + PyObject *write_buf; + PyThread_type_lock write_lock; + + Py_ssize_t buffer_size; + Py_ssize_t max_buffer_size; + + PyObject *dict; + PyObject *weakreflist; +} BufferedObject; + + +/* + * _BufferedIOMixin methods + * This is not a class, just a collection of methods that will be reused + * by BufferedReader and BufferedWriter + */ + +/* Positioning */ + +static PyObject* +BufferedIOMixin_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + /* Flush the stream. We're mixing buffered I/O with lower-level I/O, + * and a flush may be necessary to synch both views of the current + * file state. + */ + res = PyObject_CallMethod(self->raw, "flush", NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + + if (pos == Py_None) + pos = PyObject_CallMethod(self->raw, "tell", NULL); + else + Py_INCREF(pos); + + /* XXX: Should seek() be used, instead of passing the position + * XXX directly to truncate? + */ + res = PyObject_CallMethod(self->raw, "truncate", "O", pos); + Py_DECREF(pos); + + return res; +} + +/* Flush and close */ + +static PyObject* +BufferedIOMixin_flush(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "flush", NULL); +} + +static int +BufferedIOMixin_closed(BufferedObject *self) +{ + int closed; + PyObject *res = PyObject_GetAttrString(self->raw, "closed"); + if (res == NULL) + return 0; + closed = PyObject_IsTrue(res); + Py_DECREF(res); + return closed; +} + +static PyObject * +BufferedIOMixin_closed_get(BufferedObject *self, void *context) +{ + return PyObject_GetAttrString(self->raw, "closed"); +} + + +static PyObject* +BufferedIOMixin_close(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + if (BufferedIOMixin_closed(self)) + Py_RETURN_NONE; + + res = PyObject_CallMethod((PyObject *)self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + + return PyObject_CallMethod(self->raw, "close", NULL); +} + +/* Inquiries */ + +static PyObject* +BufferedIOMixin_seekable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "seekable", NULL); +} + +static PyObject* +BufferedIOMixin_readable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "readable", NULL); +} + +static PyObject* +BufferedIOMixin_writable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "writable", NULL); +} + +/* Lower-level APIs */ + +static PyObject* +BufferedIOMixin_fileno(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "fileno", NULL); +} + +static PyObject* +BufferedIOMixin_isatty(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "isatty", NULL); +} + + +/* + * class BufferedReader + */ + +PyDoc_STRVAR(BufferedReader_doc, + "Create a new buffered reader using the given readable raw IO object."); + +static int _BufferedReader_reset_read_buf(BufferedObject *self) +{ + PyObject *oldbuf = self->read_buf; + + self->read_buf = PyBytes_FromStringAndSize(NULL, 0); + self->read_pos = 0; + + Py_XDECREF(oldbuf); + + if (self->read_buf == NULL) + return -1; + + return 0; +} + +static int +BufferedReader_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, + &raw, &buffer_size)) { + return -1; + } + + if (IOBase_checkReadable(raw) < 0) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + self->buffer_size = buffer_size; + self->read_buf = NULL; + + if( _BufferedReader_reset_read_buf(self) < 0) + return -1; + + self->read_lock = PyThread_allocate_lock(); + if (self->read_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } + + return 0; +} + +static PyObject * +_BufferedReader_read_unlocked(BufferedObject *self, Py_ssize_t n) +{ + PyObject *nodata_val = NULL; + PyObject *empty_values = NULL; + + PyObject *buf = self->read_buf; + Py_ssize_t pos = self->read_pos; + PyObject *data, *chunks, *sep, *res; + Py_ssize_t current_size; + + /* Special case for when the number of bytes to read is unspecified. */ + if (n == -1) { + chunks = PyList_New(0); + if (chunks == NULL) + return NULL; + + Py_INCREF(buf); + if (_BufferedReader_reset_read_buf(self) < 0) + return NULL; + + /* Strip the consumed bytes */ + current_size = Py_SIZE(buf) - pos; + data = NULL; + if (current_size) { + data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); + if (data == NULL) { + Py_DECREF(buf); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(buf); + } + + while (1) { + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + /* Read until EOF or until read() would block. */ + data = PyObject_CallMethod(self->raw, "read", NULL); + + if (data == NULL) { + Py_DECREF(chunks); + return NULL; + } + + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (data == Py_None || Py_SIZE(data) == 0) { + if (current_size == 0) { + Py_DECREF(chunks); + return data; + } + else { + Py_DECREF(data); + sep = PyBytes_FromStringAndSize(NULL, 0); + + if (sep == NULL) { + Py_DECREF(chunks); + return NULL; + } + res =_PyBytes_Join(sep, chunks); + Py_DECREF(sep); + Py_DECREF(chunks); + + return res; + } + } + + current_size += Py_SIZE(data); + } + } + + /* The number of bytes to read is specified, return at most n bytes. */ + + current_size = Py_SIZE(buf) - pos; /* Length of the available buffered data. */ + if (n <= current_size) { + /* Fast path: the data to read is fully buffered. */ + self->read_pos += n; + return PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, n); + } + + /* Slow path: read from the stream until enough bytes are read, + * or until an EOF occurs or until read() would block. + */ + chunks = PyList_New(0); + if (chunks == NULL) + return NULL; + + data = NULL; + + if (current_size) + data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); + + while (1) { + Py_ssize_t wanted; + + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + if (current_size >= n) + break; + + wanted = n; + if (wanted < self->buffer_size) + wanted = self->buffer_size; + + data = PyObject_CallMethod(self->raw, "read", "n", wanted); + + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (data == Py_None || Py_SIZE(data) == 0) { + /* EOF occurred or read() would block. */ + + if (current_size == 0) { + Py_DECREF(chunks); + + if( _BufferedReader_reset_read_buf(self) < 0) { + Py_DECREF(data); + return NULL; + } + + return data; + } + else { + Py_DECREF(data); + break; + } + } + + current_size += Py_SIZE(data); + } + + sep = PyBytes_FromStringAndSize(NULL, 0); + + if (sep == NULL) { + Py_DECREF(chunks); + return NULL; + } + + res =_PyBytes_Join(sep, chunks); + Py_DECREF(sep); + Py_DECREF(chunks); + + if (Py_SIZE(res) > n) { + /* Save the extra data in the buffer. */ + self->read_pos = 0; + buf = self->read_buf; + self->read_buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res) + n, Py_SIZE(res) - n); + Py_DECREF(buf); + if (self->read_buf == NULL) { + Py_DECREF(res); + return NULL; + } + + /* Truncate the result to the desired length */ + buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res), n); + if (buf == NULL) { + Py_DECREF(res); + return NULL; + } + + Py_DECREF(res); + res = buf; + } + + return res; +} + +static PyObject * +BufferedReader_read(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_read_unlocked(self, n); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject * +_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t n) +{ + Py_ssize_t have; + + if (n > self->buffer_size) + n = self->buffer_size; + + have = Py_SIZE(self->read_buf) - self->read_pos; + + if (have < n) { + Py_ssize_t to_read = self->buffer_size - have; + PyObject *current = PyObject_CallMethod(self->raw, "read", "n", to_read); + + if (current == NULL) + return NULL; + + if (!PyBytes_Check(current)) { + Py_DECREF(current); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (Py_SIZE(current) > 0) { + PyObject *oldbuf = self->read_buf; + self->read_buf = PyBytes_FromStringAndSize(NULL, have + Py_SIZE(current)); + memcpy(PyBytes_AS_STRING(self->read_buf), PyBytes_AS_STRING(oldbuf) + self->read_pos, have); + memcpy(PyBytes_AS_STRING(self->read_buf) + have, PyBytes_AS_STRING(current), Py_SIZE(current)); + self->read_pos = 0; + } + Py_DECREF(current); + } + + if (self->read_pos == 0) { + Py_INCREF(self->read_buf); + return self->read_buf; + } + else { + return PyBytes_FromStringAndSize( + PyBytes_AS_STRING(self->read_buf) + self->read_pos, + Py_SIZE(self->read_buf) - self->read_pos); + } +} + +static PyObject * +BufferedReader_peek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:peek", &n)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_peek_unlocked(self, n); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject * +BufferedReader_read1(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n, have; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n:read1", &n)) { + return NULL; + } + + if (n <= 0) + return PyBytes_FromStringAndSize(NULL, 0); + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_peek_unlocked(self, 1); + if(res == NULL) + goto end; + Py_DECREF(res); + + have = Py_SIZE(self->read_buf) - self->read_pos; + if (n < have) + n = have; + + res = _BufferedReader_read_unlocked(self, n); + + end: + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject* +BufferedReader_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + if (whence == 1) { + pos -= Py_SIZE(self->read_buf) - self->read_pos; + } + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + if (res == NULL) + return NULL; + + if (_BufferedReader_reset_read_buf(self) < 0) + Py_CLEAR(res); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject* +BufferedReader_tell(BufferedObject *self, PyObject *args) +{ + PyObject *op1, *op2, *res; + + op1 = PyObject_CallMethod(self->raw, "tell", NULL); + + if (op1 == NULL) + return NULL; + + op2 = PyLong_FromSsize_t(Py_SIZE(self->read_buf) - self->read_pos); + if (op2 == NULL) { + Py_DECREF(op1); + return NULL; + } + + res = PyNumber_Subtract(op1, op2); + Py_DECREF(op1); + Py_DECREF(op2); + return res; +} + +static PyMethodDef BufferedReader_methods[] = { + /* BufferedIOMixin methods */ + {"truncate", (PyCFunction)BufferedIOMixin_truncate, METH_VARARGS}, + {"flush", (PyCFunction)BufferedIOMixin_flush, METH_NOARGS}, + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"read", (PyCFunction)BufferedReader_read, METH_VARARGS}, + {"peek", (PyCFunction)BufferedReader_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedReader_read1, METH_VARARGS}, + {"seek", (PyCFunction)BufferedReader_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedReader_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedReader_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedReader_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject BufferedReader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedReader", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + BufferedReader_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedReader_methods, /* tp_methods */ + BufferedReader_members, /* tp_members */ + BufferedReader_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedReader_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + +/* + * class BufferedWriter + */ +PyDoc_STRVAR(BufferedWriter_doc, + "A buffer for a writeable sequential RawIO object.\n" + "\n" + "The constructor creates a BufferedWriter for the given writeable raw\n" + "stream. If the buffer_size is not given, it defaults to\n" + "DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to\n" + "twice the buffer size.\n" + ); + +static int +BufferedWriter_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (IOBase_checkWritable(raw) < 0) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + if (max_buffer_size < 0) + max_buffer_size = buffer_size * 2; + self->buffer_size = buffer_size; + self->max_buffer_size = max_buffer_size; + + self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); + if (self->write_buf == NULL) + return -1; + + self->write_lock = PyThread_allocate_lock(); + if (self->write_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); + return -1; + } + + return 0; +} + +static PyObject * +_BufferedWriter_flush_unlocked(BufferedObject *self) +{ + Py_ssize_t written = 0; + + if (BufferedIOMixin_closed(self)) { + PyErr_SetString(PyExc_ValueError, "flush of closed file"); + return NULL; + } + + while (Py_SIZE(self->write_buf) > 0) { + PyObject *slice, *res; + Py_ssize_t w; + PyObject *n = PyObject_CallMethod(self->raw, "write", "O", self->write_buf); + + if (n == NULL) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value == NULL || + !PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + PyErr_Restore(type, value, traceback); + return NULL; + } + + w = ((PyBlockingIOErrorObject *)value)->written; + + /* del self->write_buf[:w] */ + slice = _PySlice_FromIndices(0, w); + if (slice == NULL) + return NULL; + res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); + Py_DECREF(slice); + if (res == NULL) + return NULL; + Py_DECREF(res); + + written += w; + ((PyBlockingIOErrorObject *)value)->written = written; + + PyErr_Restore(type, value, traceback); + return NULL; + } + + /* del self->write_buf[:w] */ + w = PyNumber_AsSsize_t(n, PyExc_ValueError); + Py_DECREF(n); + if (w == -1 && PyErr_Occurred()) + return NULL; + + slice = _PySlice_FromIndices(0, w); + if (slice == NULL) + return NULL; + res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); + Py_DECREF(slice); + if (res == NULL) + return NULL; + Py_DECREF(res); + + written += w; + } + + Py_RETURN_NONE; +} + +static PyObject * +BufferedWriter_write(BufferedObject *self, PyObject *args) +{ + PyObject *res; + Py_buffer buf; + Py_ssize_t before, written; + + if (!PyArg_ParseTuple(args, "y*:write", &buf)) { + return NULL; + } + + if (BufferedIOMixin_closed(self)) { + PyErr_SetString(PyExc_ValueError, "write to closed file"); + PyBuffer_Release(&buf); + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + /* XXX we can implement some more tricks to try and avoid + * partial writes + */ + + if (Py_SIZE(self->write_buf) > self->buffer_size) { + /* We're full, so let's pre-flush the buffer*/ + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) { + /* We can't accept anything else. */ + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value != NULL && + PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + ((PyBlockingIOErrorObject *)value)->written = 0; + } + + PyErr_Restore(type, value, traceback); + goto fail; + } + } + + written = buf.len; + + before = Py_SIZE(self->write_buf); + if (PyByteArray_Resize(self->write_buf, before + written) < 0) { + res = NULL; + goto fail; + } + memcpy(PyByteArray_AS_STRING(self->write_buf) + before, buf.buf, written); + + if (Py_SIZE(self->write_buf) > self->buffer_size) { + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value != NULL && + PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + + Py_ssize_t overage = + Py_SIZE(self->write_buf) - self->max_buffer_size; + + if (overage > 0) { + /* We've hit max_buffer_size. We have to accept a + * partial write and cut back our buffer. + */ + if (PyByteArray_Resize(self->write_buf, self->max_buffer_size) < 0) + goto fail; + ((PyBlockingIOErrorObject *)value)->written = overage; + } + else + { + Py_CLEAR(type); + Py_CLEAR(value); + Py_CLEAR(traceback); + goto end; + } + } + + PyErr_Restore(type, value, traceback); + goto fail; + } + } + + end: + res = PyLong_FromSsize_t(written); + + fail: + PyThread_release_lock(self->write_lock); + PyBuffer_Release(&buf); + return res; +} + +static PyObject * +BufferedWriter_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) + goto end; + Py_DECREF(res); + + res = BufferedIOMixin_truncate(self, args); + + end: + PyThread_release_lock(self->write_lock); + return res; +} + +static PyObject * +BufferedWriter_flush(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + + PyThread_release_lock(self->write_lock); + + return res; +} + +static PyObject * +BufferedWriter_tell(BufferedObject *self, PyObject *args) +{ + PyObject *op1, *op2, *res; + + op1 = PyObject_CallMethod(self->raw, "tell", NULL); + + op2 = PyLong_FromSsize_t(Py_SIZE(self->write_buf)); + if (op2 == NULL) { + Py_DECREF(op1); + return NULL; + } + + res = PyNumber_Add(op1, op2); + Py_DECREF(op1); + Py_DECREF(op2); + return res; +} + +static PyObject * +BufferedWriter_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) + goto end; + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + + end: + PyThread_release_lock(self->write_lock); + return res; +} + +static PyMethodDef BufferedWriter_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, + {"truncate", (PyCFunction)BufferedWriter_truncate, METH_VARARGS}, + {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, + {"seek", (PyCFunction)BufferedWriter_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedWriter_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedWriter_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedWriter_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject BufferedWriter_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedWriter", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + BufferedWriter_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedWriter_methods, /* tp_methods */ + BufferedWriter_members, /* tp_members */ + BufferedWriter_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedWriter_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + +/* + * BufferedRandom + */ + +PyDoc_STRVAR(BufferedRandom_doc, + "A buffered interface to random access streams.\n" + "\n" + "The constructor creates a reader and writer for a seekable stream,\n" + "raw, given in the first argument. If the buffer_size is omitted it\n" + "defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered\n" + "writer) defaults to twice the buffer size.\n" + ); + +static int +BufferedRandom_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (IOBase_checkSeekable(raw) < 0) + return -1; + if (IOBase_checkReadable(raw) < 0) + return -1; + if (IOBase_checkWritable(raw) < 0) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + if (max_buffer_size < 0) + max_buffer_size = buffer_size * 2; + self->buffer_size = buffer_size; + self->max_buffer_size = max_buffer_size; + + if( _BufferedReader_reset_read_buf(self) < 0) + return -1; + + self->read_lock = PyThread_allocate_lock(); + if (self->read_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } + + self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); + if (self->write_buf == NULL) + return -1; + + self->write_lock = PyThread_allocate_lock(); + if (self->write_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); + return -1; + } + + return 0; +} + +static PyObject * +BufferedRandom_tell(BufferedObject *self, PyObject *args) +{ + if (Py_SIZE(self->write_buf)) + return BufferedWriter_tell(self, args); + else + return BufferedReader_tell(self, args); +} + +static PyObject * +BufferedRandom_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + res = PyObject_CallMethod((PyObject*)self, "flush", NULL); + if (res == NULL) + return NULL; + + /* First do the raw seek, then empty the read buffer, so that + * if the raw seek fails, we don't lose buffered data forever. + */ + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + if (res == NULL) + return NULL; + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + if( _BufferedReader_reset_read_buf(self) < 0) + Py_CLEAR(res); + + PyThread_release_lock(self->read_lock); + return res; +} + +static PyObject * +BufferedRandom_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + if (pos == Py_None) + pos = PyObject_CallMethod(self->raw, "tell", NULL); + else + Py_INCREF(pos); + + /* Use seek to flush the read buffer. */ + res = PyObject_CallMethod((PyObject *)self, "seek", "O", pos); + Py_DECREF(pos); + if (res == NULL) + return NULL; + Py_DECREF(res); + + args = PyTuple_New(0); + if (args == NULL) + return NULL; + res = BufferedWriter_truncate(self, args); + Py_DECREF(args); + + return res; +} + +static PyObject * +BufferedRandom_read(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + + return BufferedReader_read(self, args); +} + +static PyObject * +BufferedRandom_readinto(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedIOBase_readinto((PyObject *)self, args); +} + +static PyObject * +BufferedRandom_peek(BufferedObject *self, PyObject *args) +{ + PyObject *res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedReader_peek(self, args); +} + +static PyObject * +BufferedRandom_read1(BufferedObject *self, PyObject *args) +{ + PyObject *res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedReader_read1(self, args); +} + +static PyObject * +BufferedRandom_write(BufferedObject *self, PyObject *args) +{ + if (Py_SIZE(self->read_buf) > 0) { + PyObject *res; + /* Undo readahead */ + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = PyObject_CallMethod(self->raw, "seek", "ni", + self->read_pos - Py_SIZE(self->read_buf), 1); + Py_XDECREF(res); + if (res != NULL) { + if( _BufferedReader_reset_read_buf(self) < 0) + res = NULL; + } + + PyThread_release_lock(self->read_lock); + + if (res == NULL) + return NULL; + } + + return BufferedWriter_write(self, args); +} + + +static PyMethodDef BufferedRandom_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, + + {"seek", (PyCFunction)BufferedRandom_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedRandom_tell, METH_NOARGS}, + {"truncate", (PyCFunction)BufferedRandom_truncate, METH_VARARGS}, + {"read", (PyCFunction)BufferedRandom_read, METH_VARARGS}, + {"readinto", (PyCFunction)BufferedRandom_readinto, METH_VARARGS}, + {"peek", (PyCFunction)BufferedRandom_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedRandom_read1, METH_VARARGS}, + {"write", (PyCFunction)BufferedRandom_write, METH_VARARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedRandom_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedRandom_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject BufferedRandom_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedRandom", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + BufferedRandom_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedRandom_methods, /* tp_methods */ + BufferedRandom_members, /* tp_members */ + BufferedRandom_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /*tp_dict*/ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /*tp_dictoffset*/ + (initproc)BufferedRandom_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + +/* + * Module definition + */ + +static PyMethodDef module_methods[] = { + {"open", (PyCFunction)io_open, METH_VARARGS|METH_KEYWORDS, open_doc}, + {NULL, NULL} +}; + +static struct PyModuleDef iomodule = { + PyModuleDef_HEAD_INIT, + "io", + module_doc, + -1, + module_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC +PyInit__io() +{ + PyObject *m = PyModule_Create(&iomodule); + PyTypeObject *base; + if (m == NULL) + goto fail; + + io_py_module = PyImport_ImportModule("io"); + if (io_py_module == NULL) + goto fail; + + /* UnsupportedOperation inherits from ValueError and IOError */ + PyExc_UnsupportedOperation = PyObject_CallFunction( + (PyObject*)&PyType_Type, "s(OO){}", + "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + if (PyExc_UnsupportedOperation == NULL) goto fail; + PyModule_AddObject(m, "UnsupportedOperation", + PyExc_UnsupportedOperation); + + /* BlockingIOError */ + base = (PyTypeObject*)PyExc_IOError; + _PyExc_BlockingIOError.tp_base = base; + if (PyType_Ready(&_PyExc_BlockingIOError) < 0) + goto fail; Py_INCREF(&_PyExc_BlockingIOError); PyModule_AddObject(m, "BlockingIOError", - (PyObject *)&_PyExc_BlockingIOError); + (PyObject *)&_PyExc_BlockingIOError); - /* RawIOBase */ - base = (PyTypeObject*)PyObject_GetAttrString(io_py_module, "IOBase"); - if (base == NULL) - return NULL; - RawIOBase_Type.tp_base = base; - RawIOBase_Type.tp_basicsize = base->tp_basicsize; - /* XXX next line is needed for multiple derivation */ - /* XXX try to remove it when FileIO is fully ported */ - RawIOBase_Type.tp_flags |= Py_TPFLAGS_HEAPTYPE; - if (PyType_Ready(&RawIOBase_Type) < 0) - goto fail; - Py_INCREF(&RawIOBase_Type); + if (PyType_Ready(&_IOBase_Type) < 0) + goto fail; + Py_INCREF(&_IOBase_Type); + PyModule_AddObject(m, "IOBase", + (PyObject *)&_IOBase_Type); + + if (PyType_Ready(&_RawIOBase_Type) < 0) + goto fail; + Py_INCREF(&_RawIOBase_Type); PyModule_AddObject(m, "RawIOBase", - (PyObject *)&RawIOBase_Type); + (PyObject *)&_RawIOBase_Type); + + /* FileIO */ + PyFileIO_Type.tp_base = &_RawIOBase_Type; + if (PyType_Ready(&PyFileIO_Type) < 0) + goto fail; + Py_INCREF(&PyFileIO_Type); + PyModule_AddObject(m, "FileIO", (PyObject *) &PyFileIO_Type); + + /* BufferedIOBase */ + if (PyType_Ready(&_BufferedIOBase_Type) < 0) + goto fail; + Py_INCREF(&_BufferedIOBase_Type); + PyModule_AddObject(m, "BufferedIOBase", (PyObject *) &_BufferedIOBase_Type); + + /* BytesIO */ + PyBytesIO_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&PyBytesIO_Type) < 0) + goto fail; + Py_INCREF(&PyBytesIO_Type); + PyModule_AddObject(m, "BytesIO", (PyObject *) &PyBytesIO_Type); + + /* BufferedReader */ + BufferedReader_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedReader_Type) < 0) + goto fail; + Py_INCREF(&BufferedReader_Type); + PyModule_AddObject(m, "BufferedReader", (PyObject *) &BufferedReader_Type); + + /* BufferedWriter */ + BufferedWriter_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedWriter_Type) < 0) + goto fail; + Py_INCREF(&BufferedWriter_Type); + PyModule_AddObject(m, "BufferedWriter", (PyObject *) &BufferedWriter_Type); + + /* BufferedRandom */ + BufferedRandom_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedRandom_Type) < 0) + goto fail; + Py_INCREF(&BufferedRandom_Type); + PyModule_AddObject(m, "BufferedRandom", (PyObject *) &BufferedRandom_Type); return m; Modified: sandbox/trunk/io-c/io.py ============================================================================== --- sandbox/trunk/io-c/io.py (original) +++ sandbox/trunk/io-c/io.py Tue Nov 4 01:41:47 2008 @@ -70,7 +70,7 @@ DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes -class BlockingIOError(IOError): +class unused_BlockingIOError(IOError): """Exception raised when I/O would block on a non-blocking I/O stream.""" @@ -79,7 +79,7 @@ self.characters_written = characters_written -def open(file, mode="r", buffering=None, encoding=None, errors=None, +def unused_open(file, mode="r", buffering=None, encoding=None, errors=None, newline=None, closefd=True): r"""Open file and return a stream. If the file cannot be opened, an IOError is @@ -260,8 +260,12 @@ text.name = file text.mode = mode return text +import _io +BlockingIOError = _io.BlockingIOError +UnsupportedOperation = _io.UnsupportedOperation +open = _io.open -class _DocDescriptor: +class unused_DocDescriptor: """Helper for builtins.open.__doc__ """ def __get__(self, obj, typ): @@ -270,7 +274,7 @@ "errors=None, newline=None, closefd=True)\n\n" + open.__doc__) -class OpenWrapper: +class unused_OpenWrapper: """Wrapper for builtins.open Trick so that open won't become a bound method when stored @@ -278,17 +282,18 @@ See initstdio() in Python/pythonrun.c. """ - __doc__ = _DocDescriptor() + __doc__ = unused_DocDescriptor() def __new__(cls, *args, **kwargs): return open(*args, **kwargs) +OpenWrapper = _io.open -class UnsupportedOperation(ValueError, IOError): +class unused_UnsupportedOperation(ValueError, IOError): pass -class IOBase(metaclass=abc.ABCMeta): +class unused_IOBase(metaclass=abc.ABCMeta): """The abstract base class for all I/O classes, acting on streams of bytes. There is no public constructor. @@ -378,6 +383,7 @@ except IOError: pass # If flush() fails, just give up self.__closed = True + print("__closed") def __del__(self) -> None: """Destructor. Calls close().""" @@ -551,13 +557,10 @@ self._checkClosed() for line in lines: self.write(line) - -import _io -BlockingIOError = _io.BlockingIOError -open = _io.open +IOBase = _io.IOBase -class RawIOBase(IOBase): +class unused_RawIOBase(IOBase): """Base class for raw binary I/O.""" @@ -613,7 +616,7 @@ RawIOBase = _io.RawIOBase -class FileIO(_fileio._FileIO, RawIOBase): +class unused_FileIO(_fileio._FileIO, RawIOBase): """Raw I/O implementation for OS files.""" @@ -634,9 +637,10 @@ @property def mode(self): return self._mode +FileIO = _io.FileIO -class BufferedIOBase(IOBase): +class unused_BufferedIOBase(IOBase): """Base class for buffered IO objects. @@ -706,9 +710,10 @@ underlying raw stream cannot accept more data at the moment. """ self._unsupported("write") +BufferedIOBase = _io.BufferedIOBase -class _BufferedIOMixin(BufferedIOBase): +class unused_BufferedIOMixin(BufferedIOBase): """A mixin implementation of BufferedIOBase with an underlying raw stream. @@ -777,7 +782,7 @@ return self.raw.isatty() -class _BytesIO(BufferedIOBase): +class unused_BytesIO(BufferedIOBase): """Buffered I/O implementation using an in-memory bytes buffer.""" @@ -884,9 +889,10 @@ except ImportError: BytesIO = _BytesIO +BytesIO = _io.BytesIO -class BufferedReader(_BufferedIOMixin): +class unused_BufferedReader(unused_BufferedIOMixin): """BufferedReader(raw[, buffer_size]) @@ -1009,9 +1015,10 @@ pos = self.raw.seek(pos, whence) self._reset_read_buf() return pos +BufferedReader = _io.BufferedReader -class BufferedWriter(_BufferedIOMixin): +class unused_BufferedWriter(unused_BufferedIOMixin): """A buffer for a writeable sequential RawIO object. @@ -1096,6 +1103,7 @@ with self._write_lock: self._flush_unlocked() return self.raw.seek(pos, whence) +BufferedWriter = _io.BufferedWriter class BufferedRWPair(BufferedIOBase): @@ -1163,8 +1171,7 @@ def closed(self): return self.writer.closed() - -class BufferedRandom(BufferedWriter, BufferedReader): +class unused_BufferedRandom(unused_BufferedWriter, unused_BufferedReader): """A buffered interface to random access streams. @@ -1227,6 +1234,7 @@ self.raw.seek(self._read_pos - len(self._read_buf), 1) self._reset_read_buf() return BufferedWriter.write(self, b) +BufferedRandom = _io.BufferedRandom class TextIOBase(IOBase): From buildbot at python.org Tue Nov 4 01:58:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 00:58:22 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081104005822.8D0EF1E4002@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/1239 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: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 4 02:59:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 01:59:57 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081104015957.F0E1C1E4002@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/726 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: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_xmlrpc_net make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 4 05:04:55 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 04:04:55 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081104040456.D74391E4002@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/646 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: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Tue Nov 4 07:22:31 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 4 Nov 2008 01:22:31 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081104062231.GA20803@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex) ! Extra \fi. l.62 \fi\fi ? ! Emergency stop. l.62 \fi\fi No pages of output. Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From buildbot at python.org Tue Nov 4 08:05:03 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 07:05:03 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081104070503.5BFC31E4002@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/543 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: hirokazu.yamamoto 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 Tue Nov 4 15:29:27 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 14:29:27 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux 3.0 Message-ID: <20081104142927.6CDA31E4002@bag.python.org> The Buildbot has detected a new failure of ARM Linux 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%203.0/builds/23 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-arm Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue Nov 4 21:24:54 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 4 Nov 2008 21:24:54 +0100 (CET) Subject: [Python-checkins] r67096 - sandbox/trunk/io-c/io.c Message-ID: <20081104202454.192001E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 4 21:24:41 2008 New Revision: 67096 Log: Two small corrections, and almost all tests pass in test_io. Modified: sandbox/trunk/io-c/io.c Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Tue Nov 4 21:24:41 2008 @@ -313,6 +313,7 @@ break; case 'U': universal = 1; + reading = 1; break; default: goto invalid_mode; @@ -1874,7 +1875,7 @@ Py_DECREF(res); have = Py_SIZE(self->read_buf) - self->read_pos; - if (n < have) + if (n > have) n = have; res = _BufferedReader_read_unlocked(self, n); From python-checkins at python.org Tue Nov 4 21:25:28 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 4 Nov 2008 21:25:28 +0100 (CET) Subject: [Python-checkins] r67097 - sandbox/trunk/io-c/io.c Message-ID: <20081104202528.4195F1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 4 21:25:27 2008 New Revision: 67097 Log: untabify Modified: sandbox/trunk/io-c/io.c Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Tue Nov 4 21:25:27 2008 @@ -2198,13 +2198,13 @@ goto fail; ((PyBlockingIOErrorObject *)value)->written = overage; } - else - { - Py_CLEAR(type); - Py_CLEAR(value); - Py_CLEAR(traceback); - goto end; - } + else + { + Py_CLEAR(type); + Py_CLEAR(value); + Py_CLEAR(traceback); + goto end; + } } PyErr_Restore(type, value, traceback); @@ -2707,10 +2707,10 @@ /* UnsupportedOperation inherits from ValueError and IOError */ PyExc_UnsupportedOperation = PyObject_CallFunction( - (PyObject*)&PyType_Type, "s(OO){}", - "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + (PyObject*)&PyType_Type, "s(OO){}", + "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); if (PyExc_UnsupportedOperation == NULL) - goto fail; + goto fail; PyModule_AddObject(m, "UnsupportedOperation", PyExc_UnsupportedOperation); From python-checkins at python.org Tue Nov 4 21:40:10 2008 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 4 Nov 2008 21:40:10 +0100 (CET) Subject: [Python-checkins] r67098 - in python/trunk: Misc/NEWS Modules/_multiprocessing/multiprocessing.h Modules/readline.c configure configure.in setup.py Message-ID: <20081104204010.4B8F11E401E@bag.python.org> Author: martin.v.loewis Date: Tue Nov 4 21:40:09 2008 New Revision: 67098 Log: Issue #4204: Fixed module build errors on FreeBSD 4. Modified: python/trunk/Misc/NEWS python/trunk/Modules/_multiprocessing/multiprocessing.h python/trunk/Modules/readline.c python/trunk/configure python/trunk/configure.in python/trunk/setup.py Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Nov 4 21:40:09 2008 @@ -63,6 +63,8 @@ - Issue #3758: Add ``patchcheck`` build target to .PHONY. +- Issue #4204: Fixed module build errors on FreeBSD 4. + C-API ----- Modified: python/trunk/Modules/_multiprocessing/multiprocessing.h ============================================================================== --- python/trunk/Modules/_multiprocessing/multiprocessing.h (original) +++ python/trunk/Modules/_multiprocessing/multiprocessing.h Tue Nov 4 21:40:09 2008 @@ -20,7 +20,9 @@ # define SEM_VALUE_MAX LONG_MAX #else # include /* O_CREAT and O_EXCL */ +# include # include +# include # include /* htonl() and ntohl() */ # if HAVE_SEM_OPEN # include Modified: python/trunk/Modules/readline.c ============================================================================== --- python/trunk/Modules/readline.c (original) +++ python/trunk/Modules/readline.c Tue Nov 4 21:40:09 2008 @@ -35,7 +35,11 @@ #define completion_matches(x, y) \ rl_completion_matches((x), ((rl_compentry_func_t *)(y))) #else +#if defined(_RL_FUNCTION_TYPEDEF) extern char **completion_matches(char *, rl_compentry_func_t *); +#else +extern char **completion_matches(char *, CPFunction *); +#endif #endif static void @@ -213,7 +217,11 @@ default completion display. */ rl_completion_display_matches_hook = completion_display_matches_hook ? +#if defined(_RL_FUNCTION_TYPEDEF) (rl_compdisp_func_t *)on_completion_display_matches_hook : 0; +#else + (VFunction *)on_completion_display_matches_hook : 0; +#endif #endif return result; Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Tue Nov 4 21:40:09 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 66295 . +# From configure.in Revision: 66764 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.7. # @@ -2105,11 +2105,18 @@ # but used in struct sockaddr.sa_family. Reported by Tim Rice. SCO_SV/3.2) define_xopen_source=no;; - # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that - # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently, - # this is fixed in 10.3, which identifies itself as Darwin/7.* - # This should hopefully be fixed in FreeBSD 4.9 - FreeBSD/4.8* | Darwin/6* ) + # On FreeBSD 4, the math functions C89 does not cover are never defined + # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. + FreeBSD/4.*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which + # identifies itself as Darwin/7.* + # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # disables platform specific features beyond repair. + # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # has no effect, don't bother defining them + Darwin/[6789].*) define_xopen_source=no;; # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined @@ -2121,13 +2128,6 @@ define_xopen_source=no fi ;; - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - 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) Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Tue Nov 4 21:40:09 2008 @@ -276,11 +276,18 @@ # but used in struct sockaddr.sa_family. Reported by Tim Rice. SCO_SV/3.2) define_xopen_source=no;; - # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that - # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently, - # this is fixed in 10.3, which identifies itself as Darwin/7.* - # This should hopefully be fixed in FreeBSD 4.9 - FreeBSD/4.8* | Darwin/6* ) + # On FreeBSD 4, the math functions C89 does not cover are never defined + # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. + FreeBSD/4.*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which + # identifies itself as Darwin/7.* + # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # disables platform specific features beyond repair. + # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # has no effect, don't bother defining them + Darwin/@<:@6789@:>@.*) define_xopen_source=no;; # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined @@ -292,13 +299,6 @@ define_xopen_source=no fi ;; - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - 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) Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Tue Nov 4 21:40:09 2008 @@ -1261,7 +1261,7 @@ ) libraries = [] - elif platform in ('freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): + elif platform in ('freebsd4', '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 From python-checkins at python.org Tue Nov 4 21:43:32 2008 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 4 Nov 2008 21:43:32 +0100 (CET) Subject: [Python-checkins] r67099 - in python/branches/release26-maint: Misc/NEWS Modules/_multiprocessing/multiprocessing.h Modules/readline.c configure configure.in setup.py Message-ID: <20081104204332.58C561E4002@bag.python.org> Author: martin.v.loewis Date: Tue Nov 4 21:43:31 2008 New Revision: 67099 Log: Issue #4204: Fixed module build errors on FreeBSD 4. Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/_multiprocessing/multiprocessing.h python/branches/release26-maint/Modules/readline.c python/branches/release26-maint/configure python/branches/release26-maint/configure.in python/branches/release26-maint/setup.py Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Tue Nov 4 21:43:31 2008 @@ -61,6 +61,8 @@ - Issue #3758: Add ``patchcheck`` build target to .PHONY. +- Issue #4204: Fixed module build errors on FreeBSD 4. + C-API ----- Modified: python/branches/release26-maint/Modules/_multiprocessing/multiprocessing.h ============================================================================== --- python/branches/release26-maint/Modules/_multiprocessing/multiprocessing.h (original) +++ python/branches/release26-maint/Modules/_multiprocessing/multiprocessing.h Tue Nov 4 21:43:31 2008 @@ -20,7 +20,9 @@ # define SEM_VALUE_MAX LONG_MAX #else # include /* O_CREAT and O_EXCL */ +# include # include +# include # include /* htonl() and ntohl() */ # if HAVE_SEM_OPEN # include Modified: python/branches/release26-maint/Modules/readline.c ============================================================================== --- python/branches/release26-maint/Modules/readline.c (original) +++ python/branches/release26-maint/Modules/readline.c Tue Nov 4 21:43:31 2008 @@ -35,7 +35,11 @@ #define completion_matches(x, y) \ rl_completion_matches((x), ((rl_compentry_func_t *)(y))) #else +#if defined(_RL_FUNCTION_TYPEDEF) extern char **completion_matches(char *, rl_compentry_func_t *); +#else +extern char **completion_matches(char *, CPFunction *); +#endif #endif static void @@ -213,7 +217,11 @@ default completion display. */ rl_completion_display_matches_hook = completion_display_matches_hook ? +#if defined(_RL_FUNCTION_TYPEDEF) (rl_compdisp_func_t *)on_completion_display_matches_hook : 0; +#else + (VFunction *)on_completion_display_matches_hook : 0; +#endif #endif return result; Modified: python/branches/release26-maint/configure ============================================================================== --- python/branches/release26-maint/configure (original) +++ python/branches/release26-maint/configure Tue Nov 4 21:43:31 2008 @@ -2105,11 +2105,18 @@ # but used in struct sockaddr.sa_family. Reported by Tim Rice. SCO_SV/3.2) define_xopen_source=no;; - # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that - # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently, - # this is fixed in 10.3, which identifies itself as Darwin/7.* - # This should hopefully be fixed in FreeBSD 4.9 - FreeBSD/4.8* | Darwin/6* ) + # On FreeBSD 4, the math functions C89 does not cover are never defined + # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. + FreeBSD/4.*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which + # identifies itself as Darwin/7.* + # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # disables platform specific features beyond repair. + # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # has no effect, don't bother defining them + Darwin/[6789].*) define_xopen_source=no;; # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined @@ -2121,13 +2128,6 @@ define_xopen_source=no fi ;; - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - 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) Modified: python/branches/release26-maint/configure.in ============================================================================== --- python/branches/release26-maint/configure.in (original) +++ python/branches/release26-maint/configure.in Tue Nov 4 21:43:31 2008 @@ -276,11 +276,18 @@ # but used in struct sockaddr.sa_family. Reported by Tim Rice. SCO_SV/3.2) define_xopen_source=no;; - # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that - # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently, - # this is fixed in 10.3, which identifies itself as Darwin/7.* - # This should hopefully be fixed in FreeBSD 4.9 - FreeBSD/4.8* | Darwin/6* ) + # On FreeBSD 4, the math functions C89 does not cover are never defined + # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. + FreeBSD/4.*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which + # identifies itself as Darwin/7.* + # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # disables platform specific features beyond repair. + # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # has no effect, don't bother defining them + Darwin/@<:@6789@:>@.*) define_xopen_source=no;; # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined @@ -292,13 +299,6 @@ define_xopen_source=no fi ;; - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - 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) Modified: python/branches/release26-maint/setup.py ============================================================================== --- python/branches/release26-maint/setup.py (original) +++ python/branches/release26-maint/setup.py Tue Nov 4 21:43:31 2008 @@ -1261,7 +1261,7 @@ ) libraries = [] - elif platform in ('freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): + elif platform in ('freebsd4', '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 From python-checkins at python.org Tue Nov 4 21:46:31 2008 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 4 Nov 2008 21:46:31 +0100 (CET) Subject: [Python-checkins] r67099 - svn:log Message-ID: <20081104204631.91C1C1E4002@bag.python.org> Author: martin.v.loewis Revision: 67099 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1 +1,8 @@ -Issue #4204: Fixed module build errors on FreeBSD 4. +Merged revisions 67098 via svnmerge from +svn+ssh://pythondev at svn.python.org/python/trunk + +........ + r67098 | martin.v.loewis | 2008-11-04 21:40:09 +0100 (Di, 04 Nov 2008) | 2 lines + + Issue #4204: Fixed module build errors on FreeBSD 4. +........ From python-checkins at python.org Tue Nov 4 21:49:35 2008 From: python-checkins at python.org (georg.brandl) Date: Tue, 4 Nov 2008 21:49:35 +0100 (CET) Subject: [Python-checkins] r67101 - python/trunk/Doc/library/select.rst Message-ID: <20081104204935.D8C131E4002@bag.python.org> Author: georg.brandl Date: Tue Nov 4 21:49:35 2008 New Revision: 67101 Log: #4167: fix markup glitches. Modified: python/trunk/Doc/library/select.rst Modified: python/trunk/Doc/library/select.rst ============================================================================== --- python/trunk/Doc/library/select.rst (original) +++ python/trunk/Doc/library/select.rst Tue Nov 4 21:49:35 2008 @@ -363,7 +363,7 @@ Filter specific flags - *:const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags* + :const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -372,7 +372,7 @@ +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_VNODE` filter flags* + :const:`KQ_FILTER_VNODE` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -393,7 +393,7 @@ +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_PROC` filter flags* + :const:`KQ_FILTER_PROC` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -416,7 +416,7 @@ | :const:`KQ_NOTE_TRACKERR` | unable to attach to a child | +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_NETDEV` filter flags* [not available on Mac OS X] + :const:`KQ_FILTER_NETDEV` filter flags [not available on Mac OS X] +----------------------------+--------------------------------------------+ | Constant | Meaning | From python-checkins at python.org Tue Nov 4 22:33:06 2008 From: python-checkins at python.org (andrew.kuchling) Date: Tue, 4 Nov 2008 22:33:06 +0100 (CET) Subject: [Python-checkins] r67102 - python/branches/release26-maint/Doc/whatsnew/2.6.rst Message-ID: <20081104213306.DE4271E4002@bag.python.org> Author: andrew.kuchling Date: Tue Nov 4 22:33:06 2008 New Revision: 67102 Log: Backport text fix Modified: python/branches/release26-maint/Doc/whatsnew/2.6.rst Modified: python/branches/release26-maint/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/release26-maint/Doc/whatsnew/2.6.rst (original) +++ python/branches/release26-maint/Doc/whatsnew/2.6.rst Tue Nov 4 22:33:06 2008 @@ -179,7 +179,7 @@ lot of effort into importing existing bugs and patches from SourceForge; his scripts for this import operation are at http://svn.python.org/view/tracker/importer/ and may be useful to -other projects wished to move from SourceForge to Roundup. +other projects wishing to move from SourceForge to Roundup. .. seealso:: @@ -3282,5 +3282,6 @@ The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: Georg Brandl, Steve Brown, Nick Coghlan, Ralph Corderoy, -Jim Jewett, Kent Johnson, Chris Lambacher, Antoine Pitrou, Brian Warner. +Jim Jewett, Kent Johnson, Chris Lambacher, Martin Michlmayr, +Antoine Pitrou, Brian Warner. From buildbot at python.org Tue Nov 4 22:35:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 21:35:51 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081104213552.11DC11E4002@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/308 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 Tue Nov 4 22:37:44 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 4 Nov 2008 22:37:44 +0100 (CET) Subject: [Python-checkins] r67103 - in sandbox/trunk/io-c: io.c io.py Message-ID: <20081104213744.F125E1E4010@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 4 22:37:44 2008 New Revision: 67103 Log: Implement io.BufferedRWPair Modified: sandbox/trunk/io-c/io.c sandbox/trunk/io-c/io.py Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Tue Nov 4 22:37:44 2008 @@ -726,6 +726,7 @@ Py_RETURN_FALSE; } +/* May be called with any object */ static int IOBase_checkReadable(PyObject *self) { @@ -752,6 +753,7 @@ Py_RETURN_FALSE; } +/* May be called with any object */ static int IOBase_checkWritable(PyObject *self) { @@ -1561,7 +1563,7 @@ self->raw = raw; self->buffer_size = buffer_size; - self->read_buf = NULL; + self->read_buf = NULL; if( _BufferedReader_reset_read_buf(self) < 0) return -1; @@ -2379,6 +2381,227 @@ }; + +/* + * BufferedRWPair + */ + +PyDoc_STRVAR(BufferedRWPair_doc, + "A buffered reader and writer object together.\n" + "\n" + "A buffered reader object and buffered writer object put together to\n" + "form a sequential IO object that can read and write. This is typically\n" + "used with a socket or two-way pipe.\n" + "\n" + "reader and writer are RawIOBase objects that are readable and\n" + "writeable respectively. If the buffer_size is omitted it defaults to\n" + "DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer)\n" + "defaults to twice the buffer size.\n" + ); + +/* XXX The usefulness of this (compared to having two separate IO objects) is + * questionable. + */ + +typedef struct { + PyObject_HEAD + BufferedObject *reader; + BufferedObject *writer; +} BufferedRWPairObject; + +static int +BufferedRWPair_init(BufferedRWPairObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *reader, *writer; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + + if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, + &buffer_size, &max_buffer_size)) { + return -1; + } + + if (IOBase_checkReadable(reader) < 0) + return -1; + if (IOBase_checkWritable(writer) < 0) + return -1; + + args = Py_BuildValue("(n)", buffer_size); + if (args == NULL) { + Py_CLEAR(self->reader); + return -1; + } + self->reader = (BufferedObject*)PyType_GenericNew(&BufferedReader_Type, args, NULL); + Py_DECREF(args); + if (self->reader == NULL) + return -1; + + args = Py_BuildValue("(nn)", buffer_size, max_buffer_size); + if (args == NULL) { + Py_CLEAR(self->reader); + return -1; + } + self->writer = (BufferedObject*)PyType_GenericNew(&BufferedWriter_Type, args, NULL); + Py_DECREF(args); + if (self->writer == NULL) { + Py_CLEAR(self->reader); + return -1; + } + return 0; +} + +static void +BufferedRWPair_dealloc(BufferedRWPairObject *self) +{ + Py_CLEAR(self->reader); + Py_CLEAR(self->writer); +} + +static PyObject * +_forward_call(BufferedObject *self, const char* name, PyObject *args) +{ + PyObject *func = PyObject_GetAttrString((PyObject*)self, name); + PyObject *ret; + + if (func == NULL) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + ret = PyObject_CallObject(func, args); + Py_DECREF(func); + return ret; +} + +static PyObject * +BufferedRWPair_read(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "read", args); +} + +static PyObject * +BufferedRWPair_peek(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "peek", args); +} + +static PyObject * +BufferedRWPair_read1(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "read1", args); +} + +static PyObject * +BufferedRWPair_write(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "write", args); +} + +static PyObject * +BufferedRWPair_flush(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "flush", args); +} + +static PyObject * +BufferedRWPair_readable(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "readable", args); +} + +static PyObject * +BufferedRWPair_writable(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "writable", args); +} + +static PyObject * +BufferedRWPair_close(BufferedRWPairObject *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "close", args); + if (ret == NULL) + return NULL; + Py_DECREF(ret); + + return _forward_call(self->reader, "close", args); +} + +static PyObject * +BufferedRWPair_isatty(BufferedRWPairObject *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "isatty", args); + + if (ret != Py_False) { + /* either True or exception */ + return ret; + } + Py_DECREF(ret); + + return _forward_call(self->reader, "isatty", args); +} + + +static PyMethodDef BufferedRWPair_methods[] = { + {"read", (PyCFunction)BufferedRWPair_read, METH_VARARGS}, + {"peek", (PyCFunction)BufferedRWPair_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedRWPair_read1, METH_VARARGS}, + + {"write", (PyCFunction)BufferedRWPair_write, METH_VARARGS}, + {"flush", (PyCFunction)BufferedRWPair_flush, METH_NOARGS}, + + {"readable", (PyCFunction)BufferedRWPair_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedRWPair_writable, METH_NOARGS}, + + {"close", (PyCFunction)BufferedRWPair_close, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedRWPair_isatty, METH_NOARGS}, + + {NULL, NULL} +}; + +PyTypeObject BufferedRWPair_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedRWPair", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedRWPair_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedRWPair_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedRWPair_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + /* * BufferedRandom */ @@ -2769,6 +2992,13 @@ Py_INCREF(&BufferedWriter_Type); PyModule_AddObject(m, "BufferedWriter", (PyObject *) &BufferedWriter_Type); + /* BufferedRWPair */ + BufferedRWPair_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedRWPair_Type) < 0) + goto fail; + Py_INCREF(&BufferedRWPair_Type); + PyModule_AddObject(m, "BufferedRWPair", (PyObject *) &BufferedRWPair_Type); + /* BufferedRandom */ BufferedRandom_Type.tp_base = &_BufferedIOBase_Type; if (PyType_Ready(&BufferedRandom_Type) < 0) Modified: sandbox/trunk/io-c/io.py ============================================================================== --- sandbox/trunk/io-c/io.py (original) +++ sandbox/trunk/io-c/io.py Tue Nov 4 22:37:44 2008 @@ -1106,7 +1106,7 @@ BufferedWriter = _io.BufferedWriter -class BufferedRWPair(BufferedIOBase): +class unused_BufferedRWPair(BufferedIOBase): """A buffered reader and writer object together. @@ -1170,6 +1170,7 @@ @property def closed(self): return self.writer.closed() +BufferedRWPair = _io.BufferedRWPair class unused_BufferedRandom(unused_BufferedWriter, unused_BufferedReader): From buildbot at python.org Tue Nov 4 22:59:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 21:59:12 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux trunk Message-ID: <20081104215913.167351E4002@bag.python.org> The Buildbot has detected a new failure of ARM Linux trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20trunk/builds/25 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-arm Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Aborted sincerely, -The Buildbot From buildbot at python.org Tue Nov 4 23:38:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 04 Nov 2008 22:38:59 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081104223859.7C7F31E4002@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/801 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: 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 python-checkins at python.org Tue Nov 4 23:42:23 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 4 Nov 2008 23:42:23 +0100 (CET) Subject: [Python-checkins] r67104 - sandbox/trunk/io-c/io.c Message-ID: <20081104224223.C8EB61E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 4 23:42:23 2008 New Revision: 67104 Log: Expose methods _checkClosed & co: socket.SocketIO needs them. Modified: sandbox/trunk/io-c/io.c Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Tue Nov 4 23:42:23 2008 @@ -641,14 +641,14 @@ } -static int -IOBase_checkClosed(PyObject *self) +static PyObject * +IOBase_checkClosed(PyObject *self, PyObject *unused) { if (IOBase_closed(self)) { PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); - return -1; + return NULL; } - return 0; + Py_RETURN_NONE; } static PyObject* @@ -700,19 +700,17 @@ Py_RETURN_FALSE; } -static int -IOBase_checkSeekable(PyObject *self) +static PyObject* +IOBase_checkSeekable(PyObject *self, PyObject *unused) { - int ret = 0; PyObject *res = PyObject_CallMethod(self, "seekable", NULL); if (res == NULL) - return -1; + return NULL; if (res != Py_True) { + Py_CLEAR(res); PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); - ret = -1; } - Py_DECREF(res); - return ret; + return res; } PyDoc_STRVAR(IOBase_readable_doc, @@ -727,19 +725,17 @@ } /* May be called with any object */ -static int -IOBase_checkReadable(PyObject *self) +static PyObject* +IOBase_checkReadable(PyObject *self, PyObject *unused) { - int ret = 0; PyObject *res = PyObject_CallMethod(self, "readable", NULL); if (res == NULL) - return -1; + return NULL; if (res != Py_True) { + Py_CLEAR(res); PyErr_SetString(PyExc_IOError, "File or stream is not readable."); - ret = -1; } - Py_DECREF(res); - return ret; + return res; } PyDoc_STRVAR(IOBase_writable_doc, @@ -754,19 +750,17 @@ } /* May be called with any object */ -static int -IOBase_checkWritable(PyObject *self) +static PyObject* +IOBase_checkWritable(PyObject *self, PyObject *unused) { - int ret = 0; PyObject *res = PyObject_CallMethod(self, "writable", NULL); if (res == NULL) - return -1; + return NULL; if (res != Py_True) { + Py_CLEAR(res); PyErr_SetString(PyExc_IOError, "File or stream is not writable."); - ret = -1; } - Py_DECREF(res); - return ret; + return res; } /* Context manager */ @@ -774,7 +768,7 @@ static PyObject * IOBase_enter(PyObject *self, PyObject *args) { - if (IOBase_checkClosed(self) < 0) + if (IOBase_checkClosed(self, NULL) == NULL) return NULL; Py_INCREF(self); @@ -810,7 +804,7 @@ static PyObject * IOBase_isatty(PyObject *self, PyObject *args) { - if (IOBase_checkClosed(self) < 0) + if (IOBase_checkClosed(self, NULL) == NULL) return NULL; Py_RETURN_FALSE; } @@ -840,7 +834,7 @@ return NULL; } - if (IOBase_checkClosed(self) < 0) + if (IOBase_checkClosed(self, NULL) == NULL) return NULL; if (PyObject_HasAttrString(self, "peek")) @@ -924,7 +918,7 @@ static PyObject * IOBase_iter(PyObject *self, PyObject *args) { - if (IOBase_checkClosed(self) < 0) + if (IOBase_checkClosed(self, NULL) == NULL) return NULL; Py_INCREF(self); @@ -1015,7 +1009,7 @@ return NULL; } - if (IOBase_checkClosed(self) < 0) + if (IOBase_checkClosed(self, NULL) == NULL) return NULL; iter = PyObject_GetIter(lines); @@ -1054,6 +1048,12 @@ {"seekable", IOBase_seekable, METH_NOARGS}, {"readable", IOBase_readable, METH_NOARGS}, {"writable", IOBase_writable, METH_NOARGS}, + + {"_checkClosed", IOBase_checkClosed, METH_NOARGS}, + {"_checkSeekable", IOBase_checkSeekable, METH_NOARGS}, + {"_checkReadable", IOBase_checkReadable, METH_NOARGS}, + {"_checkWritable", IOBase_checkWritable, METH_NOARGS}, + {"fileno", IOBase_fileno, METH_NOARGS}, {"isatty", IOBase_isatty, METH_NOARGS}, @@ -1191,9 +1191,10 @@ PyObject *b; Py_ssize_t cursize = 0; - b = PyBytes_FromStringAndSize(NULL, 0); + b = PyBytes_FromStringAndSize(NULL, 1); /* Avoid shared buffer */ if (b == NULL) return NULL; + assert (Py_REFCNT(b) == 1); while (1) { Py_ssize_t length; @@ -1556,7 +1557,7 @@ return -1; } - if (IOBase_checkReadable(raw) < 0) + if (IOBase_checkReadable(raw, NULL) == NULL) return -1; Py_INCREF(raw); @@ -2039,7 +2040,7 @@ return -1; } - if (IOBase_checkWritable(raw) < 0) + if (IOBase_checkWritable(raw, NULL) == NULL) return -1; Py_INCREF(raw); @@ -2422,9 +2423,9 @@ return -1; } - if (IOBase_checkReadable(reader) < 0) + if (IOBase_checkReadable(reader, NULL) == NULL) return -1; - if (IOBase_checkWritable(writer) < 0) + if (IOBase_checkWritable(writer, NULL) == NULL) return -1; args = Py_BuildValue("(n)", buffer_size); @@ -2628,11 +2629,11 @@ return -1; } - if (IOBase_checkSeekable(raw) < 0) + if (IOBase_checkSeekable(raw, NULL) == NULL) return -1; - if (IOBase_checkReadable(raw) < 0) + if (IOBase_checkReadable(raw, NULL) == NULL) return -1; - if (IOBase_checkWritable(raw) < 0) + if (IOBase_checkWritable(raw, NULL) == NULL) return -1; Py_INCREF(raw); From python-checkins at python.org Wed Nov 5 00:38:50 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 5 Nov 2008 00:38:50 +0100 (CET) Subject: [Python-checkins] r67105 - sandbox/trunk/io-c/io.c Message-ID: <20081104233850.825C31E4002@bag.python.org> Author: amaury.forgeotdarc Date: Wed Nov 5 00:38:50 2008 New Revision: 67105 Log: Properly free BufferObject instances, and make sure that readall() return an empty string when there is nothig to read. Modified: sandbox/trunk/io-c/io.c Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Wed Nov 5 00:38:50 2008 @@ -707,7 +707,7 @@ if (res == NULL) return NULL; if (res != Py_True) { - Py_CLEAR(res); + Py_CLEAR(res); PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); } return res; @@ -732,7 +732,7 @@ if (res == NULL) return NULL; if (res != Py_True) { - Py_CLEAR(res); + Py_CLEAR(res); PyErr_SetString(PyExc_IOError, "File or stream is not readable."); } return res; @@ -757,7 +757,7 @@ if (res == NULL) return NULL; if (res != Py_True) { - Py_CLEAR(res); + Py_CLEAR(res); PyErr_SetString(PyExc_IOError, "File or stream is not writable."); } return res; @@ -768,7 +768,7 @@ static PyObject * IOBase_enter(PyObject *self, PyObject *args) { - if (IOBase_checkClosed(self, NULL) == NULL) + if (IOBase_checkClosed(self, NULL) == NULL) return NULL; Py_INCREF(self); @@ -1188,26 +1188,21 @@ static PyObject * RawIOBase_readall(PyObject *self, PyObject *args) { - PyObject *b; + PyObject *b = NULL; Py_ssize_t cursize = 0; - b = PyBytes_FromStringAndSize(NULL, 1); /* Avoid shared buffer */ - if (b == NULL) - return NULL; - assert (Py_REFCNT(b) == 1); - while (1) { Py_ssize_t length; PyObject *data = PyObject_CallMethod(self, "read", "i", DEFAULT_BUFFER_SIZE); if (!data) { - Py_DECREF(b); + Py_XDECREF(b); return NULL; } - if (!PyBytes_Check(b)) { - Py_DECREF(b); + if (!PyBytes_Check(data)) { + Py_XDECREF(b); Py_DECREF(data); PyErr_SetString(PyExc_TypeError, "read() should return bytes"); return NULL; @@ -1215,13 +1210,23 @@ length = Py_SIZE(data); + if (b == NULL) + b = data; + else if (length != 0) { + + _PyBytes_Resize(&b, cursize + length); + if (b == NULL) { + Py_DECREF(data); + return NULL; + } + + memcpy(PyBytes_AS_STRING(b) + cursize, + PyBytes_AS_STRING(data), length); + Py_DECREF(data); + } + if (length == 0) break; - - _PyBytes_Resize(&b, cursize + length); - memcpy(PyBytes_AS_STRING(b) + cursize, - PyBytes_AS_STRING(data), length); - Py_DECREF(data); } return b; @@ -1398,6 +1403,19 @@ PyObject *dict; PyObject *weakreflist; } BufferedObject; + +static void +BufferedObject_dealloc(BufferedObject *self) +{ + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + Py_CLEAR(self->raw); + Py_CLEAR(self->name); + Py_CLEAR(self->mode); + Py_CLEAR(self->read_buf); + Py_CLEAR(self->write_buf); + Py_CLEAR(self->dict); +} /* @@ -1978,7 +1996,7 @@ "BufferedReader", /*tp_name*/ sizeof(BufferedObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -2345,7 +2363,7 @@ "BufferedWriter", /*tp_name*/ sizeof(BufferedObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -2419,35 +2437,35 @@ Py_ssize_t max_buffer_size = -1; if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, - &buffer_size, &max_buffer_size)) { + &buffer_size, &max_buffer_size)) { return -1; } if (IOBase_checkReadable(reader, NULL) == NULL) - return -1; + return -1; if (IOBase_checkWritable(writer, NULL) == NULL) - return -1; + return -1; args = Py_BuildValue("(n)", buffer_size); if (args == NULL) { - Py_CLEAR(self->reader); - return -1; + Py_CLEAR(self->reader); + return -1; } self->reader = (BufferedObject*)PyType_GenericNew(&BufferedReader_Type, args, NULL); Py_DECREF(args); if (self->reader == NULL) - return -1; + return -1; args = Py_BuildValue("(nn)", buffer_size, max_buffer_size); if (args == NULL) { - Py_CLEAR(self->reader); - return -1; + Py_CLEAR(self->reader); + return -1; } self->writer = (BufferedObject*)PyType_GenericNew(&BufferedWriter_Type, args, NULL); Py_DECREF(args); if (self->writer == NULL) { - Py_CLEAR(self->reader); - return -1; + Py_CLEAR(self->reader); + return -1; } return 0; } @@ -2466,8 +2484,8 @@ PyObject *ret; if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; + PyErr_SetString(PyExc_AttributeError, name); + return NULL; } ret = PyObject_CallObject(func, args); @@ -2522,7 +2540,7 @@ { PyObject *ret = _forward_call(self->writer, "close", args); if (ret == NULL) - return NULL; + return NULL; Py_DECREF(ret); return _forward_call(self->reader, "close", args); @@ -2534,8 +2552,8 @@ PyObject *ret = _forward_call(self->writer, "isatty", args); if (ret != Py_False) { - /* either True or exception */ - return ret; + /* either True or exception */ + return ret; } Py_DECREF(ret); @@ -2563,7 +2581,7 @@ PyTypeObject BufferedRWPair_Type = { PyVarObject_HEAD_INIT(NULL, 0) "BufferedRWPair", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ + sizeof(BufferedRWPairObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ @@ -2860,7 +2878,7 @@ "BufferedRandom", /*tp_name*/ sizeof(BufferedObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ From buildbot at python.org Wed Nov 5 05:20:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 04:20:20 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI trunk Message-ID: <20081105042021.141B71E4002@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%20trunk/builds/46 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi 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_float ====================================================================== FAIL: test_from_hex (test.test_float.HexFloatTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/trunk.klose-linux-armeabi/build/Lib/test/test_float.py", line 622, in test_from_hex self.identical(fromHex('0x0.ffffffffffffd6p-1022'), MIN-3*TINY) File "/home/pybot/buildarea-armeabi/trunk.klose-linux-armeabi/build/Lib/test/test_float.py", line 363, in identical self.fail('%r not identical to %r' % (x, y)) AssertionError: 2.2250738585071999e-308 not identical to 2.2250738585071984e-308 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 5 05:27:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 04:27:36 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20081105042736.72DB91E4002@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/44 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: martin.v.loewis BUILD FAILED: failed compile sincerely, -The Buildbot From nnorwitz at gmail.com Wed Nov 5 07:22:50 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 5 Nov 2008 01:22:50 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081105062250.GA15425@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 1 source files that are out of date updating environment: 0 added, 0 changed, 0 removed preparing documents... done writing output... contents whatsnew/2.6 whatsnew/index build succeeded. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex) ! Extra \fi. l.62 \fi\fi ? ! Emergency stop. l.62 \fi\fi No pages of output. Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From buildbot at python.org Wed Nov 5 21:06:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 20:06:12 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081105200612.C4C6E1E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/383 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: christian.heimes BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed Nov 5 21:07:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 20:07:01 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081105200701.3FE261E4002@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/1242 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: christian.heimes BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 5 21:21:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 20:21:42 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081105202142.AEBFC1E4002@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/468 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: christian.heimes BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_calendar test_mailbox test_socket ====================================================================== ERROR: testShutdown (test.test_socket.BasicTCPTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.heller-x86-osx5/build/Lib/test/test_socket.py", line 121, in _tearDown self.fail(msg) AssertionError: [Errno 57] Socket is not connected make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 6 00:26:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 23:26:53 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081105232653.C70E61E4002@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/549 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1082, in http_open return self.do_open(http.client.HTTPConnection, req) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: 1 test failed: test_robotparser make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 6 00:39:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 23:39:20 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081105233920.9C8A91E4002@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/651 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 6 00:40:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 05 Nov 2008 23:40:35 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081105234035.DA0811E4002@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/731 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_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Nov 6 00:50:12 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 6 Nov 2008 00:50:12 +0100 (CET) Subject: [Python-checkins] r67112 - svn:log Message-ID: <20081105235012.4C0FD1E4002@bag.python.org> Author: benjamin.peterson Revision: 67112 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1 +1,2 @@ -fix #4211: the __path__ of a frozen package should be a list \ No newline at end of file +fix #4211: the __path__ of a frozen package should be a list +Reviewed by myself \ No newline at end of file From python-checkins at python.org Thu Nov 6 01:42:43 2008 From: python-checkins at python.org (brett.cannon) Date: Thu, 6 Nov 2008 01:42:43 +0100 (CET) Subject: [Python-checkins] r67112 - svn:log Message-ID: <20081106004243.4A9161E4002@bag.python.org> Author: brett.cannon Revision: 67112 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1,2 +1,3 @@ -fix #4211: the __path__ of a frozen package should be a list -Reviewed by myself \ No newline at end of file +fix #4211: the __path__ of a frozen package should be a list. + +Patch by Brett Cannon, review by Christian Heimes. From python-checkins at python.org Thu Nov 6 04:38:33 2008 From: python-checkins at python.org (barry.warsaw) Date: Thu, 6 Nov 2008 04:38:33 +0100 (CET) Subject: [Python-checkins] r67115 - python/tags/r30rc2 Message-ID: <20081106033833.D13971E4002@bag.python.org> Author: barry.warsaw Date: Thu Nov 6 04:38:33 2008 New Revision: 67115 Log: Tagging release. Added: python/tags/r30rc2/ - copied from r67114, /python/branches/py3k/ From buildbot at python.org Thu Nov 6 04:52:27 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 06 Nov 2008 03:52:27 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081106035228.18B851E4002@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/1247 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: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Thu Nov 6 07:22:29 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 6 Nov 2008 01:22:29 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081106062229.GA12096@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex) ! Extra \fi. l.62 \fi\fi ? ! Emergency stop. l.62 \fi\fi No pages of output. Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Thu Nov 6 10:10:57 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 6 Nov 2008 10:10:57 +0100 (CET) Subject: [Python-checkins] r67116 - in doctools/trunk/sphinx: __init__.py builder.py config.py directives/desc.py directives/other.py htmlwriter.py latexwriter.py texinputs/sphinx.sty textwriter.py util/compat.py util/texescape.py Message-ID: <20081106091057.EBFFC1E4014@bag.python.org> Author: georg.brandl Date: Thu Nov 6 10:10:57 2008 New Revision: 67116 Log: Copy changes from Hg until r720:23cba1770f48. Modified: doctools/trunk/sphinx/__init__.py doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/config.py doctools/trunk/sphinx/directives/desc.py doctools/trunk/sphinx/directives/other.py doctools/trunk/sphinx/htmlwriter.py doctools/trunk/sphinx/latexwriter.py doctools/trunk/sphinx/texinputs/sphinx.sty doctools/trunk/sphinx/textwriter.py doctools/trunk/sphinx/util/compat.py doctools/trunk/sphinx/util/texescape.py Modified: doctools/trunk/sphinx/__init__.py ============================================================================== --- doctools/trunk/sphinx/__init__.py (original) +++ doctools/trunk/sphinx/__init__.py Thu Nov 6 10:10:57 2008 @@ -21,7 +21,7 @@ __revision__ = '$Revision$' __version__ = '0.5' -__released__ = '0.5 (SVN)' +__released__ = '0.5 (hg)' def usage(argv, msg=None): @@ -39,8 +39,10 @@ -c -- path where configuration file (conf.py) is located (default: same as sourcedir) -D -- override a setting in configuration + -A -- pass a value into the templates, for HTML builder -N -- do not do colored output -q -- no output on stdout, just warnings on stderr + -Q -- no output at all, not even warnings -P -- run Pdb on exception Modi: * without -a and without filenames, write new and changed files. @@ -59,7 +61,7 @@ nocolor() try: - opts, args = getopt.getopt(argv[1:], 'ab:d:c:D:NEqP') + opts, args = getopt.getopt(argv[1:], 'ab:d:c:D:A:NEqP') srcdir = confdir = path.abspath(args[0]) if not path.isdir(srcdir): print >>sys.stderr, 'Error: Cannot find source directory.' @@ -70,8 +72,8 @@ return 1 outdir = path.abspath(args[1]) if not path.isdir(outdir): - print >>sys.stderr, 'Error: Cannot find output directory.' - return 1 + print >>sys.stderr, 'Making output directory...' + os.makedirs(outdir) except (IndexError, getopt.error): usage(argv) return 1 @@ -88,7 +90,9 @@ buildername = all_files = None freshenv = use_pdb = False status = sys.stdout + warning = sys.stderr confoverrides = {} + htmlcontext = {} doctreedir = path.join(outdir, '.doctrees') for opt, val in opts: if opt == '-b': @@ -107,24 +111,45 @@ 'Error: Configuration directory doesn\'t contain conf.py file.' return 1 elif opt == '-D': - key, val = val.split('=') + try: + key, val = val.split('=') + except ValueError: + print >>sys.stderr, \ + 'Error: -D option argument must be in the form name=value.' + return 1 try: val = int(val) except ValueError: pass confoverrides[key] = val + elif opt == '-A': + try: + key, val = val.split('=') + except ValueError: + print >>sys.stderr, \ + 'Error: -A option argument must be in the form name=value.' + return 1 + try: + val = int(val) + except ValueError: + pass + htmlcontext[key] = val elif opt == '-N': nocolor() elif opt == '-E': freshenv = True elif opt == '-q': status = StringIO() + elif opt == '-Q': + status = StringIO() + warning = StringIO() elif opt == '-P': use_pdb = True + confoverrides['html_context'] = htmlcontext try: app = Sphinx(srcdir, confdir, outdir, doctreedir, buildername, - confoverrides, status, sys.stderr, freshenv) + confoverrides, status, warning, freshenv) app.build(all_files, filenames) except KeyboardInterrupt: if use_pdb: Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Thu Nov 6 10:10:57 2008 @@ -67,7 +67,7 @@ self.outdir = app.outdir self.doctreedir = app.doctreedir if not path.isdir(self.doctreedir): - os.mkdir(self.doctreedir) + os.makedirs(self.doctreedir) self.app = app self.warn = app.warn @@ -425,7 +425,7 @@ rellinks = [] if self.config.html_use_index: rellinks.append(('genindex', _('General Index'), 'I', _('index'))) - if self.config.html_use_modindex: + if self.config.html_use_modindex and self.env.modules: rellinks.append(('modindex', _('Global Module Index'), 'M', _('modules'))) self.globalcontext = dict( @@ -449,6 +449,7 @@ logo = logo, favicon = favicon, ) + self.globalcontext.update(self.config.html_context) def get_doc_context(self, docname, body, metatags): """Collect items for the template context of a page.""" @@ -558,7 +559,7 @@ # the global module index - if self.config.html_use_modindex: + if self.config.html_use_modindex and self.env.modules: # the sorted list of all modules, for the global module index modules = sorted(((mn, (self.get_relative_uri('modindex', fn) + '#module-' + mn, sy, pl, dep)) Modified: doctools/trunk/sphinx/config.py ============================================================================== --- doctools/trunk/sphinx/config.py (original) +++ doctools/trunk/sphinx/config.py Thu Nov 6 10:10:57 2008 @@ -71,6 +71,7 @@ html_use_opensearch = ('', False), html_file_suffix = (None, False), html_show_sphinx = (True, False), + html_context = ({}, False), # HTML help only options htmlhelp_basename = ('pydoc', False), Modified: doctools/trunk/sphinx/directives/desc.py ============================================================================== --- doctools/trunk/sphinx/directives/desc.py (original) +++ doctools/trunk/sphinx/directives/desc.py Thu Nov 6 10:10:57 2008 @@ -30,6 +30,8 @@ return _('%s (built-in variable)') % name return _('%s (in module %s)') % (name, module) elif desctype == 'class': + if not module: + return _('%s (built-in class)') % name return _('%s (class in %s)') % (name, module) elif desctype == 'exception': return name @@ -145,7 +147,7 @@ dlitem = nodes.list_item() dlpar = nodes.paragraph() dlpar += nodes.emphasis(obj, obj) - dlpar += nodes.Text('', ' -- ') + dlpar += nodes.Text(' -- ', ' -- ') dlpar += children param_nodes[obj] = dlpar dlitem += dlpar Modified: doctools/trunk/sphinx/directives/other.py ============================================================================== --- doctools/trunk/sphinx/directives/other.py (original) +++ doctools/trunk/sphinx/directives/other.py Thu Nov 6 10:10:57 2008 @@ -229,13 +229,18 @@ def seealso_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): - rv = make_admonition( + seealsonode = make_admonition( addnodes.seealso, name, [_('See also')], options, content, lineno, content_offset, block_text, state, state_machine) - return rv + if arguments: + argnodes, msgs = state.inline_text(arguments[0], lineno) + para = nodes.paragraph() + para += argnodes + seealsonode[1:1] = [para] + msgs + return [seealsonode] seealso_directive.content = 1 -seealso_directive.arguments = (0, 0, 0) +seealso_directive.arguments = (0, 1, 1) directives.register_directive('seealso', seealso_directive) Modified: doctools/trunk/sphinx/htmlwriter.py ============================================================================== --- doctools/trunk/sphinx/htmlwriter.py (original) +++ doctools/trunk/sphinx/htmlwriter.py Thu Nov 6 10:10:57 2008 @@ -447,6 +447,13 @@ finally: self.no_smarty -= 1 + def visit_option(self, node): + self.no_smarty += 1 + HTMLTranslator.visit_option(self, node) + def depart_option(self, node): + self.no_smarty -= 1 + HTMLTranslator.depart_option(self, node) + def bulk_text_processor(self, text): if self.no_smarty <= 0: return sphinx_smarty_pants(text) Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Thu Nov 6 10:10:57 2008 @@ -1069,9 +1069,9 @@ pass def visit_option_string(self, node): - pass - def depart_option_string(self, node): - pass + ostring = node.astext() + self.body.append(self.encode(ostring.replace('--', u'-?-'))) + raise nodes.SkipNode def visit_description(self, node): self.body.append( ' ' ) Modified: doctools/trunk/sphinx/texinputs/sphinx.sty ============================================================================== --- doctools/trunk/sphinx/texinputs/sphinx.sty (original) +++ doctools/trunk/sphinx/texinputs/sphinx.sty Thu Nov 6 10:10:57 2008 @@ -55,11 +55,10 @@ \fi\fi % XeLaTeX can do colors, too -\IfFileExists{ifxetex.sty}{\RequirePackage{ifxetex}}{} -\ifx\ifxetex\undefined\else\ifxetex +\ifx\XeTeXrevision\undefined\else \def\py at NormalColor{\color[rgb]{0.0,0.0,0.0}} \def\py at TitleColor{\color{TitleColor}} -\fi\fi +\fi % Increase printable page size (copied from fullpage.sty) \topmargin 0pt Modified: doctools/trunk/sphinx/textwriter.py ============================================================================== --- doctools/trunk/sphinx/textwriter.py (original) +++ doctools/trunk/sphinx/textwriter.py Thu Nov 6 10:10:57 2008 @@ -284,6 +284,46 @@ def visit_label(self, node): raise nodes.SkipNode + # XXX: option list could use some better styling + + def visit_option_list(self, node): + pass + def depart_option_list(self, node): + pass + + def visit_option_list_item(self, node): + self.new_state(0) + def depart_option_list_item(self, node): + self.end_state() + + def visit_option_group(self, node): + self._firstoption = True + def depart_option_group(self, node): + self.add_text(' ') + + def visit_option(self, node): + if self._firstoption: + self._firstoption = False + else: + self.add_text(', ') + def depart_option(self, node): + pass + + def visit_option_string(self, node): + pass + def depart_option_string(self, node): + pass + + def visit_option_argument(self, node): + self.add_text(node['delimiter']) + def depart_option_argument(self, node): + pass + + def visit_description(self, node): + pass + def depart_description(self, node): + pass + def visit_tabular_col_spec(self, node): raise nodes.SkipNode Modified: doctools/trunk/sphinx/util/compat.py ============================================================================== --- doctools/trunk/sphinx/util/compat.py (original) +++ doctools/trunk/sphinx/util/compat.py Thu Nov 6 10:10:57 2008 @@ -33,5 +33,5 @@ classes = ['admonition-' + nodes.make_id(title_text)] admonition_node['classes'] += classes state.nested_parse(content, content_offset, admonition_node) - return [admonition_node] + return admonition_node Modified: doctools/trunk/sphinx/util/texescape.py ============================================================================== --- doctools/trunk/sphinx/util/texescape.py (original) +++ doctools/trunk/sphinx/util/texescape.py Thu Nov 6 10:10:57 2008 @@ -34,6 +34,8 @@ (u'?', ur'\(\pm\)'), (u'?', ur'\(\rightarrow\)'), (u'?', ur'\(\rightarrow\)'), + # used to separate -- in options + (u'?', ur'{}'), # map some special Unicode characters to similar ASCII ones (u'?', ur'-'), (u'?', ur'\_'), From python-checkins at python.org Thu Nov 6 11:17:59 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 6 Nov 2008 11:17:59 +0100 (CET) Subject: [Python-checkins] r67117 - python/trunk/Doc/library/email.parser.rst Message-ID: <20081106101759.4DEC51E4002@bag.python.org> Author: georg.brandl Date: Thu Nov 6 11:17:58 2008 New Revision: 67117 Log: #4268: Use correct module for two toplevel functions. Modified: python/trunk/Doc/library/email.parser.rst Modified: python/trunk/Doc/library/email.parser.rst ============================================================================== --- python/trunk/Doc/library/email.parser.rst (original) +++ python/trunk/Doc/library/email.parser.rst Thu Nov 6 11:17:58 2008 @@ -159,6 +159,7 @@ a common task, two functions are provided as a convenience. They are available in the top-level :mod:`email` package namespace. +.. currentmodule:: email .. function:: message_from_string(s[, _class[, strict]]) From python-checkins at python.org Thu Nov 6 11:19:11 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 6 Nov 2008 11:19:11 +0100 (CET) Subject: [Python-checkins] r67118 - python/trunk/Doc/library/sqlite3.rst Message-ID: <20081106101911.BB7BA1E4002@bag.python.org> Author: georg.brandl Date: Thu Nov 6 11:19:11 2008 New Revision: 67118 Log: #4267: small fixes in sqlite3 docs. Modified: python/trunk/Doc/library/sqlite3.rst Modified: python/trunk/Doc/library/sqlite3.rst ============================================================================== --- python/trunk/Doc/library/sqlite3.rst (original) +++ python/trunk/Doc/library/sqlite3.rst Thu Nov 6 11:19:11 2008 @@ -64,10 +64,10 @@ c.execute('select * from stocks where symbol=?', t) # Larger example - for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00), + for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00), ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00), ('2006-04-06', 'SELL', 'IBM', 500, 53.00), - ): + ]: c.execute('insert into stocks values (?,?,?,?,?)', t) To retrieve data after executing a SELECT statement, you can either treat the @@ -426,10 +426,9 @@ import sqlite3, os con = sqlite3.connect('existing_db.db') - full_dump = os.linesep.join(con.iterdump()) - f = open('dump.sql', 'w') - f.writelines(full_dump) - f.close() + with open('dump.sql', 'w') as f: + for line in con.iterdump(): + f.write('%s\n' % line) .. _sqlite3-cursor-objects: @@ -813,8 +812,8 @@ If you want **autocommit mode**, then set :attr:`isolation_level` to None. Otherwise leave it at its default, which will result in a plain "BEGIN" -statement, or set it to one of SQLite's supported isolation levels: DEFERRED, -IMMEDIATE or EXCLUSIVE. +statement, or set it to one of SQLite's supported isolation levels: "DEFERRED", +"IMMEDIATE" or "EXCLUSIVE". From python-checkins at python.org Thu Nov 6 11:20:49 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 6 Nov 2008 11:20:49 +0100 (CET) Subject: [Python-checkins] r67119 - python/trunk/Doc/library/threading.rst Message-ID: <20081106102049.C2A101E400C@bag.python.org> Author: georg.brandl Date: Thu Nov 6 11:20:49 2008 New Revision: 67119 Log: #4245: move Thread section to the top. 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 Thu Nov 6 11:20:49 2008 @@ -180,6 +180,166 @@ All of the methods described below are executed atomically. +.. _thread-objects: + +Thread Objects +-------------- + +This class represents an activity that is run in a separate thread of control. +There are two ways to specify the activity: by passing a callable object to the +constructor, or by overriding the :meth:`run` method in a subclass. No other +methods (except for the constructor) should be overridden in a subclass. In +other words, *only* override the :meth:`__init__` and :meth:`run` methods of +this class. + +Once a thread object is created, its activity must be started by calling the +thread's :meth:`start` method. This invokes the :meth:`run` method in a +separate thread of control. + +Once the thread's activity is started, the thread is considered 'alive'. It +stops being alive when its :meth:`run` method terminates -- either normally, or +by raising an unhandled exception. The :meth:`is_alive` method tests whether the +thread is alive. + +Other threads can call a thread's :meth:`join` method. This blocks the calling +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, and read or +changed through the :attr:`name` attribute. + +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 +through the :attr:`daemon` attribute. + +There is a "main thread" object; this corresponds to the initial thread of +control in the Python program. It is not a daemon thread. + +There is the possibility that "dummy thread objects" are created. These are +thread objects corresponding to "alien threads", which are threads of control +started outside the threading module, such as directly from C code. Dummy +thread objects have limited functionality; they are always considered alive and +daemonic, and cannot be :meth:`join`\ ed. They are never deleted, since it is +impossible to detect the termination of alien threads. + + +.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}) + + This constructor should always be called with keyword arguments. Arguments are: + + *group* should be ``None``; reserved for future extension when a + :class:`ThreadGroup` class is implemented. + + *target* is the callable object to be invoked by the :meth:`run` method. + Defaults to ``None``, meaning nothing is called. + + *name* is the thread name. By default, a unique name is constructed of the form + "Thread-*N*" where *N* is a small decimal number. + + *args* is the argument tuple for the target invocation. Defaults to ``()``. + + *kwargs* is a dictionary of keyword arguments for the target invocation. + Defaults to ``{}``. + + If the subclass overrides the constructor, it must make sure to invoke the base + class constructor (``Thread.__init__()``) before doing anything else to the + thread. + + +.. method:: Thread.start() + + Start the thread's activity. + + It must be called at most once per thread object. It arranges for the object's + :meth:`run` method to be invoked in a separate thread of control. + + This method will raise a :exc:`RuntimeException` if called more than once on the + same thread object. + + +.. method:: Thread.run() + + Method representing the thread'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:: Thread.join([timeout]) + + Wait until the thread terminates. This blocks the calling thread until the + thread whose :meth:`join` method is called terminates -- either normally or + through an unhandled exception -- or until the optional timeout occurs. + + When the *timeout* argument is present and not ``None``, it should be a floating + point number specifying a timeout for the operation in seconds (or fractions + thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive` + after :meth:`join` to decide whether a timeout happened -- if the thread is + still alive, the :meth:`join` call timed out. + + When the *timeout* argument is not present or ``None``, the operation will block + until the thread terminates. + + A thread can be :meth:`join`\ ed many times. + + :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join + the current thread as that would cause a deadlock. It is also an error to + :meth:`join` a thread before it has been started and attempts to do so + raises the same exception. + + +.. method:: Thread.getName() + Thread.setName() + + Old API for :attr:`~Thread.name`. + + +.. attribute:: Thread.name + + A string used for identification purposes only. It has no semantics. + Multiple threads may be given the same name. The initial name is set by the + constructor. + + +.. attribute:: Thread.ident + + 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()` + function. Thread identifiers may be recycled when a thread exits and another + thread is created. The identifier is available even after the thread has + exited. + + .. versionadded:: 2.6 + + +.. method:: Thread.is_alive() + Thread.isAlive() + + Return whether the thread is alive. + + Roughly, a thread is alive from the moment the :meth:`start` method returns + until its :meth:`run` method terminates. The module function :func:`enumerate` + returns a list of all alive threads. + + +.. method:: Thread.isDaemon() + Thread.setDaemon() + + Old API for :attr:`~Thread.daemon`. + + +.. attribute:: Thread.daemon + + The thread's daemon flag. This must be set before :meth:`start` is called, + otherwise :exc:`RuntimeError` is raised. + + The initial value is inherited from the creating thread. + + The entire Python program exits when no alive non-daemon threads are left. + + .. _lock-objects: Lock Objects @@ -539,166 +699,6 @@ thereof). -.. _thread-objects: - -Thread Objects --------------- - -This class represents an activity that is run in a separate thread of control. -There are two ways to specify the activity: by passing a callable object to the -constructor, or by overriding the :meth:`run` method in a subclass. No other -methods (except for the constructor) should be overridden in a subclass. In -other words, *only* override the :meth:`__init__` and :meth:`run` methods of -this class. - -Once a thread object is created, its activity must be started by calling the -thread's :meth:`start` method. This invokes the :meth:`run` method in a -separate thread of control. - -Once the thread's activity is started, the thread is considered 'alive'. It -stops being alive when its :meth:`run` method terminates -- either normally, or -by raising an unhandled exception. The :meth:`is_alive` method tests whether the -thread is alive. - -Other threads can call a thread's :meth:`join` method. This blocks the calling -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, and read or -changed through the :attr:`name` attribute. - -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 -through the :attr:`daemon` attribute. - -There is a "main thread" object; this corresponds to the initial thread of -control in the Python program. It is not a daemon thread. - -There is the possibility that "dummy thread objects" are created. These are -thread objects corresponding to "alien threads", which are threads of control -started outside the threading module, such as directly from C code. Dummy -thread objects have limited functionality; they are always considered alive and -daemonic, and cannot be :meth:`join`\ ed. They are never deleted, since it is -impossible to detect the termination of alien threads. - - -.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}) - - This constructor should always be called with keyword arguments. Arguments are: - - *group* should be ``None``; reserved for future extension when a - :class:`ThreadGroup` class is implemented. - - *target* is the callable object to be invoked by the :meth:`run` method. - Defaults to ``None``, meaning nothing is called. - - *name* is the thread name. By default, a unique name is constructed of the form - "Thread-*N*" where *N* is a small decimal number. - - *args* is the argument tuple for the target invocation. Defaults to ``()``. - - *kwargs* is a dictionary of keyword arguments for the target invocation. - Defaults to ``{}``. - - If the subclass overrides the constructor, it must make sure to invoke the base - class constructor (``Thread.__init__()``) before doing anything else to the - thread. - - -.. method:: Thread.start() - - Start the thread's activity. - - It must be called at most once per thread object. It arranges for the object's - :meth:`run` method to be invoked in a separate thread of control. - - This method will raise a :exc:`RuntimeException` if called more than once on the - same thread object. - - -.. method:: Thread.run() - - Method representing the thread'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:: Thread.join([timeout]) - - Wait until the thread terminates. This blocks the calling thread until the - thread whose :meth:`join` method is called terminates -- either normally or - through an unhandled exception -- or until the optional timeout occurs. - - When the *timeout* argument is present and not ``None``, it should be a floating - point number specifying a timeout for the operation in seconds (or fractions - thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive` - after :meth:`join` to decide whether a timeout happened -- if the thread is - still alive, the :meth:`join` call timed out. - - When the *timeout* argument is not present or ``None``, the operation will block - until the thread terminates. - - A thread can be :meth:`join`\ ed many times. - - :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join - the current thread as that would cause a deadlock. It is also an error to - :meth:`join` a thread before it has been started and attempts to do so - raises the same exception. - - -.. method:: Thread.getName() - Thread.setName() - - Old API for :attr:`~Thread.name`. - - -.. attribute:: Thread.name - - A string used for identification purposes only. It has no semantics. - Multiple threads may be given the same name. The initial name is set by the - constructor. - - -.. attribute:: Thread.ident - - 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()` - function. Thread identifiers may be recycled when a thread exits and another - thread is created. The identifier is available even after the thread has - exited. - - .. versionadded:: 2.6 - - -.. method:: Thread.is_alive() - Thread.isAlive() - - Return whether the thread is alive. - - Roughly, a thread is alive from the moment the :meth:`start` method returns - until its :meth:`run` method terminates. The module function :func:`enumerate` - returns a list of all alive threads. - - -.. method:: Thread.isDaemon() - Thread.setDaemon() - - Old API for :attr:`~Thread.daemon`. - - -.. attribute:: Thread.daemon - - The thread's daemon flag. This must be set before :meth:`start` is called, - otherwise :exc:`RuntimeError` is raised. - - The initial value is inherited from the creating thread. - - The entire Python program exits when no alive non-daemon threads are left. - - .. _timer-objects: Timer Objects From python-checkins at python.org Thu Nov 6 17:43:00 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 6 Nov 2008 17:43:00 +0100 (CET) Subject: [Python-checkins] r67120 - in python/trunk: Misc/NEWS PCbuild/pyd.vsprops PCbuild/pyd_d.vsprops Message-ID: <20081106164300.9BE9C1E4002@bag.python.org> Author: martin.v.loewis Date: Thu Nov 6 17:43:00 2008 New Revision: 67120 Log: Issue #4120: Exclude manifest from extension modules in VS2008. Modified: python/trunk/Misc/NEWS python/trunk/PCbuild/pyd.vsprops python/trunk/PCbuild/pyd_d.vsprops Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Nov 6 17:43:00 2008 @@ -57,6 +57,8 @@ Build ----- +- Issue #4120: Exclude manifest from extension modules in VS2008. + - Issue #4091: Install pythonxy.dll in system32 again. - Issue #4018: Disable "for me" installations on Vista. Modified: python/trunk/PCbuild/pyd.vsprops ============================================================================== --- python/trunk/PCbuild/pyd.vsprops (original) +++ python/trunk/PCbuild/pyd.vsprops Thu Nov 6 17:43:00 2008 @@ -1,4 +1,4 @@ - + + + Author: martin.v.loewis Date: Thu Nov 6 18:29:54 2008 New Revision: 67121 Log: Merged revisions 67120 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67120 | martin.v.loewis | 2008-11-06 17:43:00 +0100 (Do, 06 Nov 2008) | 2 lines Issue #4120: Exclude manifest from extension modules in VS2008. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/PCbuild/pyd.vsprops python/branches/release26-maint/PCbuild/pyd_d.vsprops Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Thu Nov 6 18:29:54 2008 @@ -55,6 +55,8 @@ Build ----- +- Issue #4120: Exclude manifest from extension modules in VS2008. + - Issue #4091: Install pythonxy.dll in system32 again. - Issue #4018: Disable "for me" installations on Vista. Modified: python/branches/release26-maint/PCbuild/pyd.vsprops ============================================================================== --- python/branches/release26-maint/PCbuild/pyd.vsprops (original) +++ python/branches/release26-maint/PCbuild/pyd.vsprops Thu Nov 6 18:29:54 2008 @@ -1,4 +1,4 @@ - + + + Author: georg.brandl Date: Thu Nov 6 19:49:15 2008 New Revision: 67123 Log: #4247: add "pass" examples to tutorial. Modified: python/trunk/Doc/tutorial/controlflow.rst Modified: python/trunk/Doc/tutorial/controlflow.rst ============================================================================== --- python/trunk/Doc/tutorial/controlflow.rst (original) +++ python/trunk/Doc/tutorial/controlflow.rst Thu Nov 6 19:49:15 2008 @@ -166,6 +166,39 @@ ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ... +This is commonly used for creating minimal classes like with exceptions, or +for skipping unwanted exceptions:: + + >>> class ParserError(Exception): + ... pass + ... + >>> try: + ... import audioop + ... except ImportError: + ... pass + ... + +Another place it can be used is as a place-holder for a function or +conditional body when you are working on new code, allowing you to keep +thinking at a more abstract level. However, as :keyword:`pass` is silently +ignored, a better choice may be to raise a :exc:`NotImplementedError` +exception:: + + >>> def initlog(*args): + ... raise NotImplementedError # Open logfile if not already open + ... if not logfp: + ... raise NotImplementedError # Set up dummy log back-end + ... raise NotImplementedError('Call log initialization handler') + ... + +If :keyword:`pass` were used here and you later ran tests, they may fail +without indicating why. Using :exc:`NotImplementedError` causes this code +to raise an exception, allowing you to tell exactly where code that you +need to complete is. Note the two call styles of the exceptions above. +The comment style is useful in that when you remove the exception you can +easily leave the comment, which ideally would be a good description for +the block of code the exception is a placeholder for. The call-style +will raise a more useful exception however. .. _tut-functions: From python-checkins at python.org Thu Nov 6 20:23:02 2008 From: python-checkins at python.org (andrew.kuchling) Date: Thu, 6 Nov 2008 20:23:02 +0100 (CET) Subject: [Python-checkins] r67124 - python/trunk/Doc/tutorial/controlflow.rst Message-ID: <20081106192302.5B6721E4002@bag.python.org> Author: andrew.kuchling Date: Thu Nov 6 20:23:02 2008 New Revision: 67124 Log: Fix grammar error; reword two paragraphs Modified: python/trunk/Doc/tutorial/controlflow.rst Modified: python/trunk/Doc/tutorial/controlflow.rst ============================================================================== --- python/trunk/Doc/tutorial/controlflow.rst (original) +++ python/trunk/Doc/tutorial/controlflow.rst Thu Nov 6 20:23:02 2008 @@ -166,8 +166,8 @@ ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ... -This is commonly used for creating minimal classes like with exceptions, or -for skipping unwanted exceptions:: +This is commonly used for creating minimal classes such as exceptions, or +for ignoring unwanted exceptions:: >>> class ParserError(Exception): ... pass @@ -178,7 +178,7 @@ ... pass ... -Another place it can be used is as a place-holder for a function or +Another place :keyword:`pass` can be used is as a place-holder for a function or conditional body when you are working on new code, allowing you to keep thinking at a more abstract level. However, as :keyword:`pass` is silently ignored, a better choice may be to raise a :exc:`NotImplementedError` @@ -193,12 +193,14 @@ If :keyword:`pass` were used here and you later ran tests, they may fail without indicating why. Using :exc:`NotImplementedError` causes this code -to raise an exception, allowing you to tell exactly where code that you -need to complete is. Note the two call styles of the exceptions above. -The comment style is useful in that when you remove the exception you can -easily leave the comment, which ideally would be a good description for -the block of code the exception is a placeholder for. The call-style -will raise a more useful exception however. +to raise an exception, telling you exactly where the incomplete code +is. Note the two calling styles of the exceptions above. +The first style, with no message but with an accompanying comment, +lets you easily leave the comment when you remove the exception, +which ideally would be a good description for +the block of code the exception is a placeholder for. However, the +third example, providing a message for the exception, will produce +a more useful traceback. .. _tut-functions: From python-checkins at python.org Thu Nov 6 20:46:04 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 6 Nov 2008 20:46:04 +0100 (CET) Subject: [Python-checkins] r67125 - python/trunk/Tools/msi/msi.py Message-ID: <20081106194604.017411E400C@bag.python.org> Author: martin.v.loewis Date: Thu Nov 6 20:46:03 2008 New Revision: 67125 Log: Stop including fake manifest file in DLLs directory. 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 Nov 6 20:46:03 2008 @@ -940,10 +940,12 @@ root.add_file(manifest[0], **manifest[1]) root.add_file(crtdll[0], **crtdll[1]) # Copy the manifest - manifest_dlls = manifest[0]+".root" - open(manifest_dlls, "w").write(open(manifest[1]['src']).read().replace("msvcr","../msvcr")) - DLLs.start_component("msvcr90_dlls", feature=private_crt) - DLLs.add_file(manifest[0], src=os.path.abspath(manifest_dlls)) + # Actually, don't do that anymore - no DLL in DLLs should have a manifest + # dependency on msvcr90.dll anymore, so this should not be necessary + #manifest_dlls = manifest[0]+".root" + #open(manifest_dlls, "w").write(open(manifest[1]['src']).read().replace("msvcr","../msvcr")) + #DLLs.start_component("msvcr90_dlls", feature=private_crt) + #DLLs.add_file(manifest[0], src=os.path.abspath(manifest_dlls)) # Now start the main component for the DLLs directory; # no regular files have been added to the directory yet. From python-checkins at python.org Thu Nov 6 20:46:46 2008 From: python-checkins at python.org (martin.v.loewis) Date: Thu, 6 Nov 2008 20:46:46 +0100 (CET) Subject: [Python-checkins] r67126 - in python/branches/release26-maint: Tools/msi/msi.py Message-ID: <20081106194646.73C071E4002@bag.python.org> Author: martin.v.loewis Date: Thu Nov 6 20:46:46 2008 New Revision: 67126 Log: Merged revisions 67125 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67125 | martin.v.loewis | 2008-11-06 20:46:03 +0100 (Do, 06 Nov 2008) | 2 lines Stop including fake manifest file in DLLs directory. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Tools/msi/msi.py Modified: python/branches/release26-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release26-maint/Tools/msi/msi.py (original) +++ python/branches/release26-maint/Tools/msi/msi.py Thu Nov 6 20:46:46 2008 @@ -939,10 +939,12 @@ root.add_file(manifest[0], **manifest[1]) root.add_file(crtdll[0], **crtdll[1]) # Copy the manifest - manifest_dlls = manifest[0]+".root" - open(manifest_dlls, "w").write(open(manifest[1]['src']).read().replace("msvcr","../msvcr")) - DLLs.start_component("msvcr90_dlls", feature=private_crt) - DLLs.add_file(manifest[0], src=os.path.abspath(manifest_dlls)) + # Actually, don't do that anymore - no DLL in DLLs should have a manifest + # dependency on msvcr90.dll anymore, so this should not be necessary + #manifest_dlls = manifest[0]+".root" + #open(manifest_dlls, "w").write(open(manifest[1]['src']).read().replace("msvcr","../msvcr")) + #DLLs.start_component("msvcr90_dlls", feature=private_crt) + #DLLs.add_file(manifest[0], src=os.path.abspath(manifest_dlls)) # Now start the main component for the DLLs directory; # no regular files have been added to the directory yet. From nnorwitz at gmail.com Thu Nov 6 23:14:08 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 6 Nov 2008 17:14:08 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081106221408.GA15641@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_cmd_line leaked [-50, 25, 25] references, sum=0 test_file leaked [0, 0, 69] references, sum=69 test_filecmp leaked [0, 0, -69] references, sum=-69 test_smtplib leaked [0, -6, -82] references, sum=-88 test_socketserver leaked [0, 82, -82] references, sum=0 test_sys leaked [0, 42, -21] references, sum=21 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From python-checkins at python.org Thu Nov 6 23:33:03 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 6 Nov 2008 23:33:03 +0100 (CET) Subject: [Python-checkins] r67130 - in sandbox/trunk/io-c: build.py io.c Message-ID: <20081106223303.B04691E4045@bag.python.org> Author: amaury.forgeotdarc Date: Thu Nov 6 23:33:02 2008 New Revision: 67130 Log: Set svn:eol-style = native Modified: sandbox/trunk/io-c/build.py (contents, props changed) sandbox/trunk/io-c/io.c (contents, props changed) Modified: sandbox/trunk/io-c/build.py ============================================================================== --- sandbox/trunk/io-c/build.py (original) +++ sandbox/trunk/io-c/build.py Thu Nov 6 23:33:02 2008 @@ -1,40 +1,40 @@ -import os, sys -from distutils.core import Extension, Distribution -from distutils.command.build_ext import build_ext - -def compile(): - sources = ['io.c', '_fileio.c', '_bytesio.c'] - sources = [os.path.join(os.path.dirname(__file__), s) for s in sources] - io_ext = Extension('_io', sources) - dist = Distribution({'name': '_io', 'ext_modules': [io_ext]}) - cmd = build_ext(dist) - cmd.build_lib = os.path.dirname(__file__) - 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.ensure_finalized() - cmd.run() - -def test(): - import subprocess - env = os.environ.copy() - env['PYTHONPATH'] = os.path.abspath(os.path.dirname(__file__)) - - print("try importing module") - p = subprocess.Popen([sys.executable, "-c", - "import io; print(io)"], - env=env) - p.wait() - - print("run the test suite") - p = subprocess.Popen([sys.executable, "-c", - "from test.test_io import test_main; test_main()"], - env=env) - p.wait() - - -if __name__ == "__main__": - compile() - test() +import os, sys +from distutils.core import Extension, Distribution +from distutils.command.build_ext import build_ext + +def compile(): + sources = ['io.c', '_fileio.c', '_bytesio.c'] + sources = [os.path.join(os.path.dirname(__file__), s) for s in sources] + io_ext = Extension('_io', sources) + dist = Distribution({'name': '_io', 'ext_modules': [io_ext]}) + cmd = build_ext(dist) + cmd.build_lib = os.path.dirname(__file__) + 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.ensure_finalized() + cmd.run() + +def test(): + import subprocess + env = os.environ.copy() + env['PYTHONPATH'] = os.path.abspath(os.path.dirname(__file__)) + + print("try importing module") + p = subprocess.Popen([sys.executable, "-c", + "import io; print(io)"], + env=env) + p.wait() + + print("run the test suite") + p = subprocess.Popen([sys.executable, "-c", + "from test.test_io import test_main; test_main()"], + env=env) + p.wait() + + +if __name__ == "__main__": + compile() + test() Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Thu Nov 6 23:33:02 2008 @@ -1,3033 +1,3033 @@ -#include -#include "structmember.h" -#include "pythread.h" - -extern PyTypeObject PyFileIO_Type; -extern PyTypeObject PyBytesIO_Type; - -static PyObject *io_py_module; - -/* open() uses st_blksize whenever we can */ -#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */ - - -PyDoc_STRVAR(module_doc, -"The io module provides the Python interfaces to stream handling. The\n" -"builtin open function is defined in this module.\n" -"\n" -"At the top of the I/O hierarchy is the abstract base class IOBase. It\n" -"defines the basic interface to a stream. Note, however, that there is no\n" -"seperation between reading and writing to streams; implementations are\n" -"allowed to throw an IOError if they do not support a given operation.\n" -"\n" -"Extending IOBase is RawIOBase which deals simply with the reading and\n" -"writing of raw bytes to a stream. FileIO subc lasses RawIOBase to provide\n" -"an interface to OS files.\n" -"\n" -"BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\n" -"subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\n" -"streams that are readable, writable, and both respectively.\n" -"BufferedRandom provides a buffered interface to random access\n" -"streams. BytesIO is a simple stream of in-memory bytes.\n" -"\n" -"Another IOBase subclass, TextIOBase, deals with the encoding and decoding\n" -"of streams into text. TextIOWrapper, which extends it, is a buffered text\n" -"interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\n" -"is a in-memory stream for text.\n" -"\n" -"Argument names are not part of the specification, and only the arguments\n" -"of open() are intended to be used as keyword arguments.\n" -"\n" -"data:\n" -"\n" -"DEFAULT_BUFFER_SIZE\n" -"\n" -" An int containing the default buffer size used by the module's buffered\n" -" I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n" -" possible.\n" - ); - - -/* - * BlockingIOError extends IOError - */ - -typedef struct { - PyException_HEAD - PyObject *myerrno; - PyObject *strerror; - PyObject *filename; /* Not used, but part of the IOError object */ - Py_ssize_t written; -} PyBlockingIOErrorObject; - - -static int -BlockingIOError_init(PyBlockingIOErrorObject *self, PyObject *args, - PyObject *kwds) -{ - PyObject *myerrno = NULL, *strerror = NULL, *written; - PyObject *baseargs = NULL; - - assert(PyTuple_Check(args)); - - if (PyTuple_GET_SIZE(args) <= 1 || PyTuple_GET_SIZE(args) > 3) - return 0; - - baseargs = PyTuple_GetSlice(args, 0, 2); - if (baseargs == NULL) - return -1; - - if (((PyTypeObject*)PyExc_IOError)->tp_init( - (PyObject*)self, baseargs, kwds) == -1) { - Py_DECREF(baseargs); - return -1; - } - - Py_DECREF(baseargs); - - if (!PyArg_UnpackTuple(args, "BlockingIOError", 2, 3, - &myerrno, &strerror, &written)) { - return -1; - } - - Py_INCREF(myerrno); - self->myerrno = myerrno; - - Py_INCREF(strerror); - self->strerror = strerror; - - self->written = PyNumber_AsSsize_t(written, PyExc_ValueError); - if(self->written == -1 && PyErr_Occurred()) - return -1; - - return 0; -} - -static PyMemberDef BlockingIOError_members[] = { - {"characters_written", T_PYSSIZET, offsetof(PyBlockingIOErrorObject, written), 0}, - {NULL} /* Sentinel */ -}; - - -static PyTypeObject _PyExc_BlockingIOError = { - PyVarObject_HEAD_INIT(NULL, 0) - "BlockingIOError", /*tp_name*/ - sizeof(PyBlockingIOErrorObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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 | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - PyDoc_STR("Exception raised when I/O would block on a non-blocking I/O stream"), /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - BlockingIOError_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BlockingIOError_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; -PyObject *PyExc_BlockingIOError = (PyObject *)&_PyExc_BlockingIOError; - - -/* - * The main open() function - */ -PyDoc_STRVAR(open_doc, -"Open file and return a stream. If the file cannot be opened, an IOError is\n" -"raised.\n" -"\n" -"file is either a string giving the name (and the path if the file\n" -"isn't in the current working directory) of the file to be opened or an\n" -"integer file descriptor of the file to be wrapped. (If a file\n" -"descriptor is given, it is closed when the returned I/O object is\n" -"closed, unless closefd is set to False.)\n" -"\n" -"mode is an optional string that specifies the mode in which the file\n" -"is opened. It defaults to 'r' which means open for reading in text\n" -"mode. Other common values are 'w' for writing (truncating the file if\n" -"it already exists), and 'a' for appending (which on some Unix systems,\n" -"means that all writes append to the end of the file regardless of the\n" -"current seek position). In text mode, if encoding is not specified the\n" -"encoding used is platform dependent. (For reading and writing raw\n" -"bytes use binary mode and leave encoding unspecified.) The available\n" -"modes are:\n" -"\n" -"========= ===============================================================\n" -"Character Meaning\n" -"--------- ---------------------------------------------------------------\n" -"'r' open for reading (default)\n" -"'w' open for writing, truncating the file first\n" -"'a' open for writing, appending to the end of the file if it exists\n" -"'b' binary mode\n" -"'t' text mode (default)\n" -"'+' open a disk file for updating (reading and writing)\n" -"'U' universal newline mode (for backwards compatibility; unneeded\n" -" for new code)\n" -"========= ===============================================================\n" -"\n" -"The default mode is 'rt' (open for reading text). For binary random\n" -"access, the mode 'w+b' opens and truncates the file to 0 bytes, while\n" -"'r+b' opens the file without truncation.\n" -"\n" -"Python distinguishes between files opened in binary and text modes,\n" -"even when the underlying operating system doesn't. Files opened in\n" -"binary mode (appending 'b' to the mode argument) return contents as\n" -"bytes objects without any decoding. In text mode (the default, or when\n" -"'t' is appended to the mode argument), the contents of the file are\n" -"returned as strings, the bytes having been first decoded using a\n" -"platform-dependent encoding or using the specified encoding if given.\n" -"\n" -"buffering is an optional integer used to set the buffering policy. By\n" -"default full buffering is on. Pass 0 to switch buffering off (only\n" -"allowed in binary mode), 1 to set line buffering, and an integer > 1\n" -"for full buffering.\n" -"\n" -"encoding is the name of the encoding used to decode or encode the\n" -"file. This should only be used in text mode. The default encoding is\n" -"platform dependent, but any encoding supported by Python can be\n" -"passed. See the codecs module for the list of supported encodings.\n" -"\n" -"errors is an optional string that specifies how encoding errors are to\n" -"be handled---this argument should not be used in binary mode. Pass\n" -"'strict' to raise a ValueError exception if there is an encoding error\n" -"(the default of None has the same effect), or pass 'ignore' to ignore\n" -"errors. (Note that ignoring encoding errors can lead to data loss.)\n" -"See the documentation for codecs.register for a list of the permitted\n" -"encoding error strings.\n" -"\n" -"newline controls how universal newlines works (it only applies to text\n" -"mode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\n" -"follows:\n" -"\n" -"* On input, if newline is None, universal newlines mode is\n" -" enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n" -" these are translated into '\\n' before being returned to the\n" -" caller. If it is '', universal newline mode is enabled, but line\n" -" endings are returned to the caller untranslated. If it has any of\n" -" the other legal values, input lines are only terminated by the given\n" -" string, and the line ending is returned to the caller untranslated.\n" -"\n" -"* On output, if newline is None, any '\\n' characters written are\n" -" translated to the system default line separator, os.linesep. If\n" -" newline is '', no translation takes place. If newline is any of the\n" -" other legal values, any '\\n' characters written are translated to\n" -" the given string.\n" -"\n" -"If closefd is False, the underlying file descriptor will be kept open\n" -"when the file is closed. This does not work when a file name is given\n" -"and must be True in that case.\n" -"\n" -"open() returns a file object whose type depends on the mode, and\n" -"through which the standard file operations such as reading and writing\n" -"are performed. When open() is used to open a file in a text mode ('w',\n" -"'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\n" -"a file in a binary mode, the returned class varies: in read binary\n" -"mode, it returns a BufferedReader; in write binary and append binary\n" -"modes, it returns a BufferedWriter, and in read/write mode, it returns\n" -"a BufferedRandom.\n" -"\n" -"It is also possible to use a string or bytearray as a file for both\n" -"reading and writing. For strings StringIO can be used like a file\n" -"opened in a text mode, and for bytes a BytesIO can be used like a file\n" -"opened in a binary mode.\n" - ); - -static PyObject * -io_open(PyObject* self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"file", "mode", "buffering", - "encoding", "errors", "newline", - "closefd", NULL}; - PyObject *file; - char *mode = "r"; - int buffering = -1, closefd = 1; - char *encoding = NULL, *errors = NULL, *newline = NULL; - unsigned i; - - int reading = 0, writing = 0, appending = 0, updating = 0; - int text = 0, binary = 0, universal = 0; - - PyObject *FileIO_class; - char rawmode[5], *m; - int line_buffering, isatty; - - PyObject *raw, *modeobj = NULL, *buffer = NULL, *wrapper = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist, - &file, &mode, &buffering, - &encoding, &errors, &newline, - &closefd)) { - return NULL; - } - - if (!PyUnicode_Check(file) && !PyNumber_Check(file)) { - PyErr_Format(PyExc_TypeError, "invalid file: %R", file); - return NULL; - } - - /* Decode mode */ - for (i = 0; i < strlen(mode); i++) { - char c = mode[i]; - - switch (c) { - case 'r': - reading = 1; - break; - case 'w': - writing = 1; - break; - case 'a': - appending = 1; - break; - case '+': - updating = 1; - break; - case 't': - text = 1; - break; - case 'b': - binary = 1; - break; - case 'U': - universal = 1; - reading = 1; - break; - default: - goto invalid_mode; - } - - /* c must not be duplicated */ - if (strchr(mode+i+1, c)) { - invalid_mode: - PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); - return NULL; - } - - } - - m = rawmode; - if (reading) *(m++) = 'r'; - if (writing) *(m++) = 'w'; - if (appending) *(m++) = 'a'; - if (updating) *(m++) = '+'; - *m = '\0'; - - /* Parameters validation */ - if (universal) { - if (writing || appending) { - PyErr_SetString(PyExc_ValueError, - "can't use U and writing mode at once"); - return NULL; - } - reading = 1; - } - - if (text && binary) { - PyErr_SetString(PyExc_ValueError, - "can't have text and binary mode at once"); - return NULL; - } - - if (reading + writing + appending > 1) { - PyErr_SetString(PyExc_ValueError, - "must have exactly one of read/write/append mode"); - return NULL; - } - - if (binary && encoding != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take an encoding argument"); - return NULL; - } - - if (binary && errors != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take an errors argument"); - return NULL; - } - - if (binary && newline != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take a newline argument"); - return NULL; - } - - /* Create the Raw file stream */ - FileIO_class = PyObject_GetAttrString(io_py_module, "FileIO"); - if (!FileIO_class) - return NULL; - - raw = PyObject_CallFunction(FileIO_class, "Osi", file, rawmode, closefd); - Py_DECREF(FileIO_class); - if (raw == NULL) - return NULL; - - modeobj = PyUnicode_FromString(mode); - if (modeobj == NULL) - goto error; - - /* buffering */ - { - PyObject *res = PyObject_CallMethod(raw, "isatty", NULL); - if (res == NULL) - goto error; - isatty = PyLong_AsLong(res); - Py_DECREF(res); - if (isatty == -1 && PyErr_Occurred()) - goto error; - } - - if (buffering == 1 || (buffering < 0 && isatty)) { - buffering = -1; - line_buffering = 1; - } - else - line_buffering = 0; - - if (buffering < 0) { - buffering = DEFAULT_BUFFER_SIZE; -#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - { - struct stat st; - long fileno; - PyObject *res = PyObject_CallMethod(raw, "fileno", NULL); - if (res == NULL) - goto error; - - fileno = PyLong_AsLong(res); - Py_DECREF(res); - if (fileno == -1 && PyErr_Occurred()) - goto error; - - if (stat(fileno, &st) >= 0) - buffering = st->st_blksize; - } -#endif - } - if (buffering < 0) { - PyErr_SetString(PyExc_ValueError, - "invalid buffering size"); - goto error; - } - - /* if not buffering, returns the raw file object */ - if (buffering == 0) { - if (!binary) { - PyErr_SetString(PyExc_ValueError, - "can't have unbuffered text I/O"); - goto error; - } - - if (PyObject_SetAttrString(raw, "_name", file) < 0) - goto error; - if (PyObject_SetAttrString(raw, "_mode", modeobj) < 0) - goto error; - Py_DECREF(modeobj); - return raw; - } - - /* wraps into a buffered file */ - { - char *Buffered_class_name; - PyObject *Buffered_class; - - if (updating) - Buffered_class_name = "BufferedRandom"; - else if (writing || appending) - Buffered_class_name = "BufferedWriter"; - else if (reading) - Buffered_class_name = "BufferedReader"; - else { - PyErr_Format(PyExc_ValueError, - "unknown mode: '%s'", mode); - goto error; - } - - Buffered_class = PyObject_GetAttrString(io_py_module, - Buffered_class_name); - if (Buffered_class == NULL) - goto error; - - buffer = PyObject_CallFunction(Buffered_class, "Oi", raw, buffering); - Py_DECREF(Buffered_class); - } - Py_CLEAR(raw); - if (buffer == NULL) - goto error; - - - /* if binary, returns the buffered file */ - if (binary) { - if (PyObject_SetAttrString(buffer, "_name", file) < 0) - goto error; - if (PyObject_SetAttrString(buffer, "_mode", modeobj) < 0) - goto error; - Py_DECREF(modeobj); - return buffer; - } - - /* wraps into a TextIOWrapper */ - { - PyObject *TextIOWrapper_class; - TextIOWrapper_class = PyObject_GetAttrString(io_py_module, - "TextIOWrapper"); - if (TextIOWrapper_class == NULL) - goto error; - - wrapper = PyObject_CallFunction(TextIOWrapper_class, "Osssi", - buffer, - encoding, errors, newline, - line_buffering); - Py_DECREF(TextIOWrapper_class); - } - Py_CLEAR(buffer); - if (wrapper == NULL) - goto error; - - if (PyObject_SetAttrString(wrapper, "name", file) < 0) - goto error; - if (PyObject_SetAttrString(wrapper, "mode", modeobj) < 0) - goto error; - Py_DECREF(modeobj); - return wrapper; - - error: - Py_XDECREF(raw); - Py_XDECREF(modeobj); - Py_XDECREF(buffer); - Py_XDECREF(wrapper); - return NULL; -} - - -static PyObject* PyExc_UnsupportedOperation; - -/* - * IOBase class, an abstract class - */ - -PyDoc_STRVAR(IOBase_doc, - "The abstract base class for all I/O classes, acting on streams of\n" - "bytes. There is no public constructor.\n" - "\n" - "This class provides dummy implementations for many methods that\n" - "derived classes can override selectively; the default implementations\n" - "represent a file that cannot be read, written or seeked.\n" - "\n" - "Even though IOBase does not declare read, readinto, or write because\n" - "their signatures will vary, implementations and clients should\n" - "consider those methods part of the interface. Also, implementations\n" - "may raise a IOError when operations they do not support are called.\n" - "\n" - "The basic type used for binary data read from or written to a file is\n" - "bytes. bytearrays are accepted too, and in some cases (such as\n" - "readinto) needed. Text I/O classes work with str data.\n" - "\n" - "Note that calling any method (even inquiries) on a closed stream is\n" - "undefined. Implementations may raise IOError in this case.\n" - "\n" - "IOBase (and its subclasses) support the iterator protocol, meaning\n" - "that an IOBase object can be iterated over yielding the lines in a\n" - "stream.\n" - "\n" - "IOBase also supports the :keyword:`with` statement. In this example,\n" - "fp is closed after the suite of the with statment is complete:\n" - "\n" - "with open('spam.txt', 'r') as fp:\n" - " fp.write('Spam and eggs!')\n"); - -/* Internal methods */ -static PyObject * -IOBase_unsupported(const char* message) -{ - PyErr_SetString(PyExc_UnsupportedOperation, message); - return NULL; -} - -/* Positionning */ - -PyDoc_STRVAR(IOBase_seek_doc, - "Change stream position.\n" - "\n" - "Change the stream position to byte offset offset. offset is\n" - "interpreted relative to the position indicated by whence. Values\n" - "for whence are:\n" - "\n" - "* 0 -- start of stream (the default); offset should be zero or positive\n" - "* 1 -- current stream position; offset may be negative\n" - "* 2 -- end of stream; offset is usually negative\n" - "\n" - "Return the new absolute position."); - -static PyObject* -IOBase_seek(PyObject *self, PyObject *args) -{ - return IOBase_unsupported("seek"); -} - -PyDoc_STRVAR(IOBase_tell_doc, - "Return current stream position."); - -static PyObject * -IOBase_tell(PyObject *self, PyObject *args) -{ - return PyObject_CallMethod(self, "tell", "ii", 0, 1); -} - -PyDoc_STRVAR(IOBase_truncate_doc, - "Truncate file to size bytes.\n" - "\n" - "Size defaults to the current IO position as reported by tell(). Return\n" - "the new size."); - -static PyObject* -IOBase_truncate(PyObject *self, PyObject *args) -{ - return IOBase_unsupported("seek"); -} - -/* Flush and close methods */ - -PyDoc_STRVAR(IOBase_flush_doc, - "Flush write buffers, if applicable.\n" - "\n" - "This is not implemented for read-only and non-blocking streams.\n"); - -static PyObject* -IOBase_flush(PyObject *self, PyObject *args) -{ - /* XXX Should this return the number of bytes written??? */ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(IOBase_close_doc, - "Flush and close the IO object.\n" - "\n" - "This method has no effect if the file is already closed.\n"); - -static int -IOBase_closed(PyObject *self) -{ - return PyObject_HasAttrString(self, "__IOBase_closed"); -} - -static PyObject * -IOBase_closed_get(PyObject *self, void *context) -{ - return PyBool_FromLong(IOBase_closed(self)); -} - - -static PyObject * -IOBase_checkClosed(PyObject *self, PyObject *unused) -{ - if (IOBase_closed(self)) { - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject* -IOBase_close(PyObject *self, PyObject *args) -{ - PyObject *res; - - if (IOBase_closed(self)) - Py_RETURN_NONE; - - PyObject_SetAttrString(self, "__IOBase_closed", Py_True); - - res = PyObject_CallMethod(self, "flush", NULL); - if (res == NULL) { - /* If flush() fails, just give up */ - if (PyErr_ExceptionMatches(PyExc_IOError)) - PyErr_Clear(); - else - return NULL; - } - Py_RETURN_NONE; -} - -static void -IOBase_del(PyObject *self) -{ - PyObject *res = PyObject_CallMethod(self, "flush", NULL); - if (res == NULL) { - /* At program exit time, it's possible that globals have already been - * deleted, and then the close() call might fail. Since there's - * nothing we can do about such failures and they annoy the end - * users, we suppress the traceback. - */ - PyErr_Clear(); - } -} - -/* Inquiry methods */ - -PyDoc_STRVAR(IOBase_seekable_doc, - "Return whether object supports random access.\n" - "\n" - "If False, seek(), tell() and truncate() will raise IOError.\n" - "This method may need to do a test seek()."); - -static PyObject* -IOBase_seekable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -static PyObject* -IOBase_checkSeekable(PyObject *self, PyObject *unused) -{ - PyObject *res = PyObject_CallMethod(self, "seekable", NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); - } - return res; -} - -PyDoc_STRVAR(IOBase_readable_doc, - "Return whether object was opened for reading.\n" - "\n" - "If False, read() will raise IOError."); - -static PyObject* -IOBase_readable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -/* May be called with any object */ -static PyObject* -IOBase_checkReadable(PyObject *self, PyObject *unused) -{ - PyObject *res = PyObject_CallMethod(self, "readable", NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not readable."); - } - return res; -} - -PyDoc_STRVAR(IOBase_writable_doc, - "Return whether object was opened for writing.\n" - "\n" - "If False, read() will raise IOError."); - -static PyObject* -IOBase_writable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -/* May be called with any object */ -static PyObject* -IOBase_checkWritable(PyObject *self, PyObject *unused) -{ - PyObject *res = PyObject_CallMethod(self, "writable", NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not writable."); - } - return res; -} - -/* Context manager */ - -static PyObject * -IOBase_enter(PyObject *self, PyObject *args) -{ - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - Py_INCREF(self); - return self; -} - -static PyObject * -IOBase_exit(PyObject *self, PyObject *args) -{ - return PyObject_CallMethod(self, "close", NULL); -} - -/* Lower-level APIs */ - -/* XXX Should these be present even if unimplemented? */ - -PyDoc_STRVAR(IOBase_fileno_doc, - "Returns underlying file descriptor if one exists.\n" - "\n" - "An IOError is raised if the IO object does not use a file descriptor.\n"); - -static PyObject * -IOBase_fileno(PyObject *self, PyObject *args) -{ - return IOBase_unsupported("fileno"); -} - -PyDoc_STRVAR(IOBase_isatty_doc, - "Return whether this is an 'interactive' stream.\n" - "\n" - "Return False if it can't be determined.\n"); - -static PyObject * -IOBase_isatty(PyObject *self, PyObject *args) -{ - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - Py_RETURN_FALSE; -} - -/* Readline(s) and writelines */ - -PyDoc_STRVAR(IOBase_readline_doc, - "Read and return a line from the stream.\n" - "\n" - "If limit is specified, at most limit bytes will be read.\n" - "\n" - "The line terminator is always b'\n' for binary files; for text\n" - "files, the newlines argument to open can be used to select the line\n" - "terminator(s) recognized.\n"); - -static PyObject * -IOBase_readline(PyObject *self, PyObject *args) -{ - /* For backwards compatibility, a (slowish) readline(). */ - - Py_ssize_t limit = -1; - int has_peek = 0; - PyObject *buffer, *result; - Py_ssize_t old_size = -1; - - if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { - return NULL; - } - - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - if (PyObject_HasAttrString(self, "peek")) - has_peek = 1; - - buffer = PyByteArray_FromStringAndSize(NULL, 0); - if (buffer == NULL) - return NULL; - - while (limit < 0 || Py_SIZE(buffer) < limit) { - Py_ssize_t nreadahead = 1; - PyObject *b; - - if (has_peek) { - PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); - - assert (PyBytes_Check(readahead)); - - if (readahead == NULL) - goto fail; - if (PyBytes_GET_SIZE(readahead) > 0) { - Py_ssize_t n = 0; - const char *buf = PyBytes_AS_STRING(readahead); - if (limit >= 0) { - do { - if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) - break; - if (buf[n] == '\n') - { - n++; - break; - } - n++; - } while (1); - } - else { - do { - if (n >= PyBytes_GET_SIZE(readahead)) - break; - if (buf[n] == '\n') - { - n++; - break; - } - n++; - } while (1); - } - nreadahead = n; - } - } - - b = PyObject_CallMethod(self, "read", "n", nreadahead); - - if (b == NULL) - goto fail; - - assert (PyBytes_Check(b)); - - if (Py_SIZE(b) == 0) - break; - - old_size = Py_SIZE(buffer); - PyByteArray_Resize(buffer, old_size + Py_SIZE(b)); - memcpy(PyByteArray_AS_STRING(buffer) + old_size, PyBytes_AS_STRING(b), Py_SIZE(b)); - - Py_DECREF(b); - - if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') - break; - } - - result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), - PyByteArray_GET_SIZE(buffer)); - Py_DECREF(buffer); - return result; - fail: - Py_DECREF(buffer); - return NULL; -} - -static PyObject * -IOBase_iter(PyObject *self, PyObject *args) -{ - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - Py_INCREF(self); - return self; -} - -static PyObject * -IOBase_next(PyObject *self, PyObject *args) -{ - PyObject *line = PyObject_CallMethod(self, "readline", NULL); - - if (line == NULL) - return NULL; - - assert (PyBytes_Check(line)); - - if (PyBytes_GET_SIZE(line) == 0) { - Py_DECREF(line); - return NULL; - } - - return line; -} - -PyDoc_STRVAR(IOBase_readlines_doc, - "Return a list of lines from the stream.\n" - "\n" - "hint can be specified to control the number of lines read: no more\n" - "lines will be read if the total size (in bytes/characters) of all\n" - "lines so far exceeds hint."); - -static PyObject * -IOBase_readlines(PyObject *self, PyObject *args) -{ - Py_ssize_t hint = -1, length = 0; - PyObject *line, *result; - - if (!PyArg_ParseTuple(args, "|n:readlines", &hint)) { - return NULL; - } - - result = PyList_New(0); - if (result == NULL) - return NULL; - - if (hint <= 0) { - PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); - if( ret == NULL) { - Py_DECREF(result); - return NULL; - } - Py_DECREF(ret); - return result; - } - - while (1) { - line = PyObject_CallMethod(self, "__next__", NULL); - if (line == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; - } - else - break; /* SopIteration raised */ - } - assert (PyBytes_Check(line)); - - if (PyList_Append(result, line) < 0) { - Py_DECREF(line); - Py_DECREF(result); - return NULL; - } - length += Py_SIZE(line); - Py_DECREF(line); - - if (length > hint) - break; - } - return result; -} - -static PyObject * -IOBase_writelines(PyObject *self, PyObject *args) -{ - PyObject *lines, *iter, *res; - - if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { - return NULL; - } - - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - iter = PyObject_GetIter(lines); - if (iter == NULL) - return NULL; - - while (1) { - PyObject *line = PyIter_Next(iter); - if(line == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(iter); - return NULL; - } - else - break; /* Stop Iteration */ - } - - res = PyObject_CallMethod(self, "write", "O", line); - Py_DECREF(line); - if (res == NULL) { - Py_DECREF(iter); - return NULL; - } - Py_DECREF(res); - } - Py_RETURN_NONE; -} - -static PyMethodDef IOBase_methods[] = { - {"seek", IOBase_seek, METH_VARARGS}, - {"tell", IOBase_tell, METH_NOARGS}, - {"truncate", IOBase_truncate, METH_VARARGS}, - {"flush", IOBase_flush, METH_NOARGS}, - {"close", IOBase_close, METH_NOARGS}, - - {"seekable", IOBase_seekable, METH_NOARGS}, - {"readable", IOBase_readable, METH_NOARGS}, - {"writable", IOBase_writable, METH_NOARGS}, - - {"_checkClosed", IOBase_checkClosed, METH_NOARGS}, - {"_checkSeekable", IOBase_checkSeekable, METH_NOARGS}, - {"_checkReadable", IOBase_checkReadable, METH_NOARGS}, - {"_checkWritable", IOBase_checkWritable, METH_NOARGS}, - - {"fileno", IOBase_fileno, METH_NOARGS}, - {"isatty", IOBase_isatty, METH_NOARGS}, - - {"__enter__", IOBase_enter, METH_NOARGS}, - {"__exit__", IOBase_exit, METH_VARARGS}, - - {"__iter__", IOBase_iter, METH_NOARGS}, - {"__next__", IOBase_next, METH_NOARGS}, - - {"readline", IOBase_readline, METH_VARARGS}, - {"readlines", IOBase_readlines, METH_VARARGS}, - {"writelines", IOBase_readlines, METH_VARARGS}, - - {NULL, NULL} -}; - -static PyGetSetDef IOBase_getset[] = { - {"closed", (getter)IOBase_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject _IOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "IOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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*/ - IOBase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - IOBase_methods, /* tp_methods */ - 0, /* tp_members */ - IOBase_getset, /* 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 */ - PyType_GenericNew, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - IOBase_del, /* tp_del */ -}; -PyObject *PyIOBase = (PyObject*)&_IOBase_Type; - - - -/* - * RawIOBase class, Inherits from IOBase. - */ -PyDoc_STRVAR(RawIOBase_doc, - "Base class for raw binary I/O."); - -/* - * The read() method is implemented by calling readinto(); derived classes - * that want to support read() only need to implement readinto() as a - * primitive operation. In general, readinto() can be more efficient than - * read(). - * - * (It would be tempting to also provide an implementation of readinto() in - * terms of read(), in case the latter is a more suitable primitive operation, - * but that would lead to nasty recursion in case a subclass doesn't implement - * either.) -*/ - -static PyObject * -RawIOBase_read(PyObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *b, *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - if (n < 0) - return PyObject_CallMethod(self, "readall", NULL); - - b = PyByteArray_FromStringAndSize(NULL, n); - if (b == NULL) - return NULL; - - res = PyObject_CallMethod(self, "readinto", "O", b); - if (res == NULL) { - Py_DECREF(b); - return NULL; - } - - n = PyNumber_AsSsize_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n == -1 && PyErr_Occurred()) { - Py_DECREF(b); - return NULL; - } - - res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); - Py_DECREF(b); - return res; -} - - -PyDoc_STRVAR(RawIOBase_readall_doc, - "Read until EOF, using multiple read() call."); - -static PyObject * -RawIOBase_readall(PyObject *self, PyObject *args) -{ - PyObject *b = NULL; - Py_ssize_t cursize = 0; - - while (1) { - Py_ssize_t length; - PyObject *data = PyObject_CallMethod(self, "read", - "i", DEFAULT_BUFFER_SIZE); - - if (!data) { - Py_XDECREF(b); - return NULL; - } - - if (!PyBytes_Check(data)) { - Py_XDECREF(b); - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - length = Py_SIZE(data); - - if (b == NULL) - b = data; - else if (length != 0) { - - _PyBytes_Resize(&b, cursize + length); - if (b == NULL) { - Py_DECREF(data); - return NULL; - } - - memcpy(PyBytes_AS_STRING(b) + cursize, - PyBytes_AS_STRING(data), length); - Py_DECREF(data); - } - - if (length == 0) - break; - } - - return b; - -} - -static PyMethodDef RawIOBase_methods[] = { - {"read", RawIOBase_read, METH_VARARGS}, - {"readall", RawIOBase_readall, METH_NOARGS, RawIOBase_readall_doc}, - {NULL, NULL} -}; - -PyTypeObject _RawIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "RawIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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*/ - RawIOBase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - RawIOBase_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &_IOBase_Type, /* 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 */ -}; -PyObject *PyRawIOBase = (PyObject*)&_RawIOBase_Type; - - -/* - * BufferedIOBase class, inherits from IOBase. - */ -PyDoc_STRVAR(BufferedIOBase_doc, - "Base class for buffered IO objects.\n" - "\n" - "The main difference with RawIOBase is that the read() method\n" - "supports omitting the size argument, and does not have a default\n" - "implementation that defers to readinto().\n" - "\n" - "In addition, read(), readinto() and write() may raise\n" - "BlockingIOError if the underlying raw stream is in non-blocking\n" - "mode and not ready; unlike their raw counterparts, they will never\n" - "return None.\n" - "\n" - "A typical implementation should not inherit from a RawIOBase\n" - "implementation, but wrap one.\n" - ); - -static PyObject * -BufferedIOBase_readinto(PyObject *self, PyObject *args) -{ - Py_buffer buf; - Py_ssize_t len; - PyObject *data; - - if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { - return NULL; - } - - data = PyObject_CallMethod(self, "read", "n", buf.len); - if (data == NULL) - goto error; - - if (!PyBytes_Check(data)) { - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - goto error; - } - - len = Py_SIZE(data); - memcpy(buf.buf, PyBytes_AS_STRING(data), len); - - PyBuffer_Release(&buf); - Py_DECREF(data); - - return PyLong_FromSsize_t(len); - - error: - PyBuffer_Release(&buf); - return NULL; -} - -static PyMethodDef BufferedIOBase_methods[] = { - {"readinto", BufferedIOBase_readinto, METH_VARARGS}, - {NULL, NULL} -}; - -PyTypeObject _BufferedIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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*/ - BufferedIOBase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedIOBase_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &_IOBase_Type, /* 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 */ -}; - - -typedef struct { - PyObject_HEAD - - PyObject *raw; - - PyObject *name; - PyObject *mode; - - PyObject *read_buf; - Py_ssize_t read_pos; - PyThread_type_lock read_lock; - - PyObject *write_buf; - PyThread_type_lock write_lock; - - Py_ssize_t buffer_size; - Py_ssize_t max_buffer_size; - - PyObject *dict; - PyObject *weakreflist; -} BufferedObject; - -static void -BufferedObject_dealloc(BufferedObject *self) -{ - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)self); - Py_CLEAR(self->raw); - Py_CLEAR(self->name); - Py_CLEAR(self->mode); - Py_CLEAR(self->read_buf); - Py_CLEAR(self->write_buf); - Py_CLEAR(self->dict); -} - - -/* - * _BufferedIOMixin methods - * This is not a class, just a collection of methods that will be reused - * by BufferedReader and BufferedWriter - */ - -/* Positioning */ - -static PyObject* -BufferedIOMixin_truncate(BufferedObject *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - /* Flush the stream. We're mixing buffered I/O with lower-level I/O, - * and a flush may be necessary to synch both views of the current - * file state. - */ - res = PyObject_CallMethod(self->raw, "flush", NULL); - if (res == NULL) - return NULL; - Py_DECREF(res); - - if (pos == Py_None) - pos = PyObject_CallMethod(self->raw, "tell", NULL); - else - Py_INCREF(pos); - - /* XXX: Should seek() be used, instead of passing the position - * XXX directly to truncate? - */ - res = PyObject_CallMethod(self->raw, "truncate", "O", pos); - Py_DECREF(pos); - - return res; -} - -/* Flush and close */ - -static PyObject* -BufferedIOMixin_flush(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "flush", NULL); -} - -static int -BufferedIOMixin_closed(BufferedObject *self) -{ - int closed; - PyObject *res = PyObject_GetAttrString(self->raw, "closed"); - if (res == NULL) - return 0; - closed = PyObject_IsTrue(res); - Py_DECREF(res); - return closed; -} - -static PyObject * -BufferedIOMixin_closed_get(BufferedObject *self, void *context) -{ - return PyObject_GetAttrString(self->raw, "closed"); -} - - -static PyObject* -BufferedIOMixin_close(BufferedObject *self, PyObject *args) -{ - PyObject *res; - - if (BufferedIOMixin_closed(self)) - Py_RETURN_NONE; - - res = PyObject_CallMethod((PyObject *)self, "flush", NULL); - if (res == NULL) { - /* If flush() fails, just give up */ - if (PyErr_ExceptionMatches(PyExc_IOError)) - PyErr_Clear(); - else - return NULL; - } - - return PyObject_CallMethod(self->raw, "close", NULL); -} - -/* Inquiries */ - -static PyObject* -BufferedIOMixin_seekable(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "seekable", NULL); -} - -static PyObject* -BufferedIOMixin_readable(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "readable", NULL); -} - -static PyObject* -BufferedIOMixin_writable(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "writable", NULL); -} - -/* Lower-level APIs */ - -static PyObject* -BufferedIOMixin_fileno(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "fileno", NULL); -} - -static PyObject* -BufferedIOMixin_isatty(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "isatty", NULL); -} - - -/* - * class BufferedReader - */ - -PyDoc_STRVAR(BufferedReader_doc, - "Create a new buffered reader using the given readable raw IO object."); - -static int _BufferedReader_reset_read_buf(BufferedObject *self) -{ - PyObject *oldbuf = self->read_buf; - - self->read_buf = PyBytes_FromStringAndSize(NULL, 0); - self->read_pos = 0; - - Py_XDECREF(oldbuf); - - if (self->read_buf == NULL) - return -1; - - return 0; -} - -static int -BufferedReader_init(BufferedObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - PyObject *raw; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, - &raw, &buffer_size)) { - return -1; - } - - if (IOBase_checkReadable(raw, NULL) == NULL) - return -1; - - Py_INCREF(raw); - self->raw = raw; - - self->buffer_size = buffer_size; - self->read_buf = NULL; - - if( _BufferedReader_reset_read_buf(self) < 0) - return -1; - - self->read_lock = PyThread_allocate_lock(); - if (self->read_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); - return -1; - } - - return 0; -} - -static PyObject * -_BufferedReader_read_unlocked(BufferedObject *self, Py_ssize_t n) -{ - PyObject *nodata_val = NULL; - PyObject *empty_values = NULL; - - PyObject *buf = self->read_buf; - Py_ssize_t pos = self->read_pos; - PyObject *data, *chunks, *sep, *res; - Py_ssize_t current_size; - - /* Special case for when the number of bytes to read is unspecified. */ - if (n == -1) { - chunks = PyList_New(0); - if (chunks == NULL) - return NULL; - - Py_INCREF(buf); - if (_BufferedReader_reset_read_buf(self) < 0) - return NULL; - - /* Strip the consumed bytes */ - current_size = Py_SIZE(buf) - pos; - data = NULL; - if (current_size) { - data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); - if (data == NULL) { - Py_DECREF(buf); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(buf); - } - - while (1) { - if (data) { - if (PyList_Append(chunks, data) < 0) { - Py_DECREF(data); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(data); - } - - /* Read until EOF or until read() would block. */ - data = PyObject_CallMethod(self->raw, "read", NULL); - - if (data == NULL) { - Py_DECREF(chunks); - return NULL; - } - - if (data != Py_None && !PyBytes_Check(data)) { - Py_DECREF(data); - Py_DECREF(chunks); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - if (data == Py_None || Py_SIZE(data) == 0) { - if (current_size == 0) { - Py_DECREF(chunks); - return data; - } - else { - Py_DECREF(data); - sep = PyBytes_FromStringAndSize(NULL, 0); - - if (sep == NULL) { - Py_DECREF(chunks); - return NULL; - } - res =_PyBytes_Join(sep, chunks); - Py_DECREF(sep); - Py_DECREF(chunks); - - return res; - } - } - - current_size += Py_SIZE(data); - } - } - - /* The number of bytes to read is specified, return at most n bytes. */ - - current_size = Py_SIZE(buf) - pos; /* Length of the available buffered data. */ - if (n <= current_size) { - /* Fast path: the data to read is fully buffered. */ - self->read_pos += n; - return PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, n); - } - - /* Slow path: read from the stream until enough bytes are read, - * or until an EOF occurs or until read() would block. - */ - chunks = PyList_New(0); - if (chunks == NULL) - return NULL; - - data = NULL; - - if (current_size) - data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); - - while (1) { - Py_ssize_t wanted; - - if (data) { - if (PyList_Append(chunks, data) < 0) { - Py_DECREF(data); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(data); - } - - if (current_size >= n) - break; - - wanted = n; - if (wanted < self->buffer_size) - wanted = self->buffer_size; - - data = PyObject_CallMethod(self->raw, "read", "n", wanted); - - if (data != Py_None && !PyBytes_Check(data)) { - Py_DECREF(data); - Py_DECREF(chunks); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - if (data == Py_None || Py_SIZE(data) == 0) { - /* EOF occurred or read() would block. */ - - if (current_size == 0) { - Py_DECREF(chunks); - - if( _BufferedReader_reset_read_buf(self) < 0) { - Py_DECREF(data); - return NULL; - } - - return data; - } - else { - Py_DECREF(data); - break; - } - } - - current_size += Py_SIZE(data); - } - - sep = PyBytes_FromStringAndSize(NULL, 0); - - if (sep == NULL) { - Py_DECREF(chunks); - return NULL; - } - - res =_PyBytes_Join(sep, chunks); - Py_DECREF(sep); - Py_DECREF(chunks); - - if (Py_SIZE(res) > n) { - /* Save the extra data in the buffer. */ - self->read_pos = 0; - buf = self->read_buf; - self->read_buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res) + n, Py_SIZE(res) - n); - Py_DECREF(buf); - if (self->read_buf == NULL) { - Py_DECREF(res); - return NULL; - } - - /* Truncate the result to the desired length */ - buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res), n); - if (buf == NULL) { - Py_DECREF(res); - return NULL; - } - - Py_DECREF(res); - res = buf; - } - - return res; -} - -static PyObject * -BufferedReader_read(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedReader_read_unlocked(self, n); - - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject * -_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t n) -{ - Py_ssize_t have; - - if (n > self->buffer_size) - n = self->buffer_size; - - have = Py_SIZE(self->read_buf) - self->read_pos; - - if (have < n) { - Py_ssize_t to_read = self->buffer_size - have; - PyObject *current = PyObject_CallMethod(self->raw, "read", "n", to_read); - - if (current == NULL) - return NULL; - - if (!PyBytes_Check(current)) { - Py_DECREF(current); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - if (Py_SIZE(current) > 0) { - PyObject *oldbuf = self->read_buf; - self->read_buf = PyBytes_FromStringAndSize(NULL, have + Py_SIZE(current)); - memcpy(PyBytes_AS_STRING(self->read_buf), PyBytes_AS_STRING(oldbuf) + self->read_pos, have); - memcpy(PyBytes_AS_STRING(self->read_buf) + have, PyBytes_AS_STRING(current), Py_SIZE(current)); - self->read_pos = 0; - } - Py_DECREF(current); - } - - if (self->read_pos == 0) { - Py_INCREF(self->read_buf); - return self->read_buf; - } - else { - return PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self->read_buf) + self->read_pos, - Py_SIZE(self->read_buf) - self->read_pos); - } -} - -static PyObject * -BufferedReader_peek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|n:peek", &n)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedReader_peek_unlocked(self, n); - - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject * -BufferedReader_read1(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n, have; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n:read1", &n)) { - return NULL; - } - - if (n <= 0) - return PyBytes_FromStringAndSize(NULL, 0); - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedReader_peek_unlocked(self, 1); - if(res == NULL) - goto end; - Py_DECREF(res); - - have = Py_SIZE(self->read_buf) - self->read_pos; - if (n > have) - n = have; - - res = _BufferedReader_read_unlocked(self, n); - - end: - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject* -BufferedReader_seek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t pos; - int whence = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - if (whence == 1) { - pos -= Py_SIZE(self->read_buf) - self->read_pos; - } - - res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); - if (res == NULL) - return NULL; - - if (_BufferedReader_reset_read_buf(self) < 0) - Py_CLEAR(res); - - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject* -BufferedReader_tell(BufferedObject *self, PyObject *args) -{ - PyObject *op1, *op2, *res; - - op1 = PyObject_CallMethod(self->raw, "tell", NULL); - - if (op1 == NULL) - return NULL; - - op2 = PyLong_FromSsize_t(Py_SIZE(self->read_buf) - self->read_pos); - if (op2 == NULL) { - Py_DECREF(op1); - return NULL; - } - - res = PyNumber_Subtract(op1, op2); - Py_DECREF(op1); - Py_DECREF(op2); - return res; -} - -static PyMethodDef BufferedReader_methods[] = { - /* BufferedIOMixin methods */ - {"truncate", (PyCFunction)BufferedIOMixin_truncate, METH_VARARGS}, - {"flush", (PyCFunction)BufferedIOMixin_flush, METH_NOARGS}, - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"read", (PyCFunction)BufferedReader_read, METH_VARARGS}, - {"peek", (PyCFunction)BufferedReader_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedReader_read1, METH_VARARGS}, - {"seek", (PyCFunction)BufferedReader_seek, METH_VARARGS}, - {"tell", (PyCFunction)BufferedReader_tell, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef BufferedReader_members[] = { - {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, - {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, - {NULL} -}; - -static PyGetSetDef BufferedReader_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject BufferedReader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedReader", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedReader_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedReader_methods, /* tp_methods */ - BufferedReader_members, /* tp_members */ - BufferedReader_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedReader_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - -/* - * class BufferedWriter - */ -PyDoc_STRVAR(BufferedWriter_doc, - "A buffer for a writeable sequential RawIO object.\n" - "\n" - "The constructor creates a BufferedWriter for the given writeable raw\n" - "stream. If the buffer_size is not given, it defaults to\n" - "DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to\n" - "twice the buffer size.\n" - ); - -static int -BufferedWriter_init(BufferedObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -1; - PyObject *raw; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, - &raw, &buffer_size, &max_buffer_size)) { - return -1; - } - - if (IOBase_checkWritable(raw, NULL) == NULL) - return -1; - - Py_INCREF(raw); - self->raw = raw; - - if (max_buffer_size < 0) - max_buffer_size = buffer_size * 2; - self->buffer_size = buffer_size; - self->max_buffer_size = max_buffer_size; - - self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); - if (self->write_buf == NULL) - return -1; - - self->write_lock = PyThread_allocate_lock(); - if (self->write_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); - return -1; - } - - return 0; -} - -static PyObject * -_BufferedWriter_flush_unlocked(BufferedObject *self) -{ - Py_ssize_t written = 0; - - if (BufferedIOMixin_closed(self)) { - PyErr_SetString(PyExc_ValueError, "flush of closed file"); - return NULL; - } - - while (Py_SIZE(self->write_buf) > 0) { - PyObject *slice, *res; - Py_ssize_t w; - PyObject *n = PyObject_CallMethod(self->raw, "write", "O", self->write_buf); - - if (n == NULL) { - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - if (value == NULL || - !PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { - PyErr_Restore(type, value, traceback); - return NULL; - } - - w = ((PyBlockingIOErrorObject *)value)->written; - - /* del self->write_buf[:w] */ - slice = _PySlice_FromIndices(0, w); - if (slice == NULL) - return NULL; - res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); - Py_DECREF(slice); - if (res == NULL) - return NULL; - Py_DECREF(res); - - written += w; - ((PyBlockingIOErrorObject *)value)->written = written; - - PyErr_Restore(type, value, traceback); - return NULL; - } - - /* del self->write_buf[:w] */ - w = PyNumber_AsSsize_t(n, PyExc_ValueError); - Py_DECREF(n); - if (w == -1 && PyErr_Occurred()) - return NULL; - - slice = _PySlice_FromIndices(0, w); - if (slice == NULL) - return NULL; - res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); - Py_DECREF(slice); - if (res == NULL) - return NULL; - Py_DECREF(res); - - written += w; - } - - Py_RETURN_NONE; -} - -static PyObject * -BufferedWriter_write(BufferedObject *self, PyObject *args) -{ - PyObject *res; - Py_buffer buf; - Py_ssize_t before, written; - - if (!PyArg_ParseTuple(args, "y*:write", &buf)) { - return NULL; - } - - if (BufferedIOMixin_closed(self)) { - PyErr_SetString(PyExc_ValueError, "write to closed file"); - PyBuffer_Release(&buf); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - /* XXX we can implement some more tricks to try and avoid - * partial writes - */ - - if (Py_SIZE(self->write_buf) > self->buffer_size) { - /* We're full, so let's pre-flush the buffer*/ - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) { - /* We can't accept anything else. */ - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - if (value != NULL && - PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { - ((PyBlockingIOErrorObject *)value)->written = 0; - } - - PyErr_Restore(type, value, traceback); - goto fail; - } - } - - written = buf.len; - - before = Py_SIZE(self->write_buf); - if (PyByteArray_Resize(self->write_buf, before + written) < 0) { - res = NULL; - goto fail; - } - memcpy(PyByteArray_AS_STRING(self->write_buf) + before, buf.buf, written); - - if (Py_SIZE(self->write_buf) > self->buffer_size) { - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) { - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - if (value != NULL && - PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { - - Py_ssize_t overage = - Py_SIZE(self->write_buf) - self->max_buffer_size; - - if (overage > 0) { - /* We've hit max_buffer_size. We have to accept a - * partial write and cut back our buffer. - */ - if (PyByteArray_Resize(self->write_buf, self->max_buffer_size) < 0) - goto fail; - ((PyBlockingIOErrorObject *)value)->written = overage; - } - else - { - Py_CLEAR(type); - Py_CLEAR(value); - Py_CLEAR(traceback); - goto end; - } - } - - PyErr_Restore(type, value, traceback); - goto fail; - } - } - - end: - res = PyLong_FromSsize_t(written); - - fail: - PyThread_release_lock(self->write_lock); - PyBuffer_Release(&buf); - return res; -} - -static PyObject * -BufferedWriter_truncate(BufferedObject *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) - goto end; - Py_DECREF(res); - - res = BufferedIOMixin_truncate(self, args); - - end: - PyThread_release_lock(self->write_lock); - return res; -} - -static PyObject * -BufferedWriter_flush(BufferedObject *self, PyObject *args) -{ - PyObject *res; - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedWriter_flush_unlocked(self); - - PyThread_release_lock(self->write_lock); - - return res; -} - -static PyObject * -BufferedWriter_tell(BufferedObject *self, PyObject *args) -{ - PyObject *op1, *op2, *res; - - op1 = PyObject_CallMethod(self->raw, "tell", NULL); - - op2 = PyLong_FromSsize_t(Py_SIZE(self->write_buf)); - if (op2 == NULL) { - Py_DECREF(op1); - return NULL; - } - - res = PyNumber_Add(op1, op2); - Py_DECREF(op1); - Py_DECREF(op2); - return res; -} - -static PyObject * -BufferedWriter_seek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t pos; - int whence = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) - goto end; - - res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); - - end: - PyThread_release_lock(self->write_lock); - return res; -} - -static PyMethodDef BufferedWriter_methods[] = { - /* BufferedIOMixin methods */ - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, - {"truncate", (PyCFunction)BufferedWriter_truncate, METH_VARARGS}, - {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, - {"seek", (PyCFunction)BufferedWriter_seek, METH_VARARGS}, - {"tell", (PyCFunction)BufferedWriter_tell, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef BufferedWriter_members[] = { - {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, - {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, - {NULL} -}; - -static PyGetSetDef BufferedWriter_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject BufferedWriter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedWriter", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedWriter_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedWriter_methods, /* tp_methods */ - BufferedWriter_members, /* tp_members */ - BufferedWriter_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedWriter_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -/* - * BufferedRWPair - */ - -PyDoc_STRVAR(BufferedRWPair_doc, - "A buffered reader and writer object together.\n" - "\n" - "A buffered reader object and buffered writer object put together to\n" - "form a sequential IO object that can read and write. This is typically\n" - "used with a socket or two-way pipe.\n" - "\n" - "reader and writer are RawIOBase objects that are readable and\n" - "writeable respectively. If the buffer_size is omitted it defaults to\n" - "DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer)\n" - "defaults to twice the buffer size.\n" - ); - -/* XXX The usefulness of this (compared to having two separate IO objects) is - * questionable. - */ - -typedef struct { - PyObject_HEAD - BufferedObject *reader; - BufferedObject *writer; -} BufferedRWPairObject; - -static int -BufferedRWPair_init(BufferedRWPairObject *self, PyObject *args, - PyObject *kwds) -{ - PyObject *reader, *writer; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -1; - - if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, - &buffer_size, &max_buffer_size)) { - return -1; - } - - if (IOBase_checkReadable(reader, NULL) == NULL) - return -1; - if (IOBase_checkWritable(writer, NULL) == NULL) - return -1; - - args = Py_BuildValue("(n)", buffer_size); - if (args == NULL) { - Py_CLEAR(self->reader); - return -1; - } - self->reader = (BufferedObject*)PyType_GenericNew(&BufferedReader_Type, args, NULL); - Py_DECREF(args); - if (self->reader == NULL) - return -1; - - args = Py_BuildValue("(nn)", buffer_size, max_buffer_size); - if (args == NULL) { - Py_CLEAR(self->reader); - return -1; - } - self->writer = (BufferedObject*)PyType_GenericNew(&BufferedWriter_Type, args, NULL); - Py_DECREF(args); - if (self->writer == NULL) { - Py_CLEAR(self->reader); - return -1; - } - return 0; -} - -static void -BufferedRWPair_dealloc(BufferedRWPairObject *self) -{ - Py_CLEAR(self->reader); - Py_CLEAR(self->writer); -} - -static PyObject * -_forward_call(BufferedObject *self, const char* name, PyObject *args) -{ - PyObject *func = PyObject_GetAttrString((PyObject*)self, name); - PyObject *ret; - - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; - } - - ret = PyObject_CallObject(func, args); - Py_DECREF(func); - return ret; -} - -static PyObject * -BufferedRWPair_read(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "read", args); -} - -static PyObject * -BufferedRWPair_peek(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "peek", args); -} - -static PyObject * -BufferedRWPair_read1(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "read1", args); -} - -static PyObject * -BufferedRWPair_write(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->writer, "write", args); -} - -static PyObject * -BufferedRWPair_flush(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->writer, "flush", args); -} - -static PyObject * -BufferedRWPair_readable(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "readable", args); -} - -static PyObject * -BufferedRWPair_writable(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->writer, "writable", args); -} - -static PyObject * -BufferedRWPair_close(BufferedRWPairObject *self, PyObject *args) -{ - PyObject *ret = _forward_call(self->writer, "close", args); - if (ret == NULL) - return NULL; - Py_DECREF(ret); - - return _forward_call(self->reader, "close", args); -} - -static PyObject * -BufferedRWPair_isatty(BufferedRWPairObject *self, PyObject *args) -{ - PyObject *ret = _forward_call(self->writer, "isatty", args); - - if (ret != Py_False) { - /* either True or exception */ - return ret; - } - Py_DECREF(ret); - - return _forward_call(self->reader, "isatty", args); -} - - -static PyMethodDef BufferedRWPair_methods[] = { - {"read", (PyCFunction)BufferedRWPair_read, METH_VARARGS}, - {"peek", (PyCFunction)BufferedRWPair_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedRWPair_read1, METH_VARARGS}, - - {"write", (PyCFunction)BufferedRWPair_write, METH_VARARGS}, - {"flush", (PyCFunction)BufferedRWPair_flush, METH_NOARGS}, - - {"readable", (PyCFunction)BufferedRWPair_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedRWPair_writable, METH_NOARGS}, - - {"close", (PyCFunction)BufferedRWPair_close, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedRWPair_isatty, METH_NOARGS}, - - {NULL, NULL} -}; - -PyTypeObject BufferedRWPair_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedRWPair", /*tp_name*/ - sizeof(BufferedRWPairObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedRWPair_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedRWPair_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedRWPair_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -/* - * BufferedRandom - */ - -PyDoc_STRVAR(BufferedRandom_doc, - "A buffered interface to random access streams.\n" - "\n" - "The constructor creates a reader and writer for a seekable stream,\n" - "raw, given in the first argument. If the buffer_size is omitted it\n" - "defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered\n" - "writer) defaults to twice the buffer size.\n" - ); - -static int -BufferedRandom_init(BufferedObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -1; - PyObject *raw; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, - &raw, &buffer_size, &max_buffer_size)) { - return -1; - } - - if (IOBase_checkSeekable(raw, NULL) == NULL) - return -1; - if (IOBase_checkReadable(raw, NULL) == NULL) - return -1; - if (IOBase_checkWritable(raw, NULL) == NULL) - return -1; - - Py_INCREF(raw); - self->raw = raw; - - if (max_buffer_size < 0) - max_buffer_size = buffer_size * 2; - self->buffer_size = buffer_size; - self->max_buffer_size = max_buffer_size; - - if( _BufferedReader_reset_read_buf(self) < 0) - return -1; - - self->read_lock = PyThread_allocate_lock(); - if (self->read_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); - return -1; - } - - self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); - if (self->write_buf == NULL) - return -1; - - self->write_lock = PyThread_allocate_lock(); - if (self->write_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); - return -1; - } - - return 0; -} - -static PyObject * -BufferedRandom_tell(BufferedObject *self, PyObject *args) -{ - if (Py_SIZE(self->write_buf)) - return BufferedWriter_tell(self, args); - else - return BufferedReader_tell(self, args); -} - -static PyObject * -BufferedRandom_seek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t pos; - int whence = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { - return NULL; - } - - res = PyObject_CallMethod((PyObject*)self, "flush", NULL); - if (res == NULL) - return NULL; - - /* First do the raw seek, then empty the read buffer, so that - * if the raw seek fails, we don't lose buffered data forever. - */ - - res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); - if (res == NULL) - return NULL; - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - if( _BufferedReader_reset_read_buf(self) < 0) - Py_CLEAR(res); - - PyThread_release_lock(self->read_lock); - return res; -} - -static PyObject * -BufferedRandom_truncate(BufferedObject *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - if (pos == Py_None) - pos = PyObject_CallMethod(self->raw, "tell", NULL); - else - Py_INCREF(pos); - - /* Use seek to flush the read buffer. */ - res = PyObject_CallMethod((PyObject *)self, "seek", "O", pos); - Py_DECREF(pos); - if (res == NULL) - return NULL; - Py_DECREF(res); - - args = PyTuple_New(0); - if (args == NULL) - return NULL; - res = BufferedWriter_truncate(self, args); - Py_DECREF(args); - - return res; -} - -static PyObject * -BufferedRandom_read(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - - return BufferedReader_read(self, args); -} - -static PyObject * -BufferedRandom_readinto(BufferedObject *self, PyObject *args) -{ - PyObject *res; - - res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return BufferedIOBase_readinto((PyObject *)self, args); -} - -static PyObject * -BufferedRandom_peek(BufferedObject *self, PyObject *args) -{ - PyObject *res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return BufferedReader_peek(self, args); -} - -static PyObject * -BufferedRandom_read1(BufferedObject *self, PyObject *args) -{ - PyObject *res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return BufferedReader_read1(self, args); -} - -static PyObject * -BufferedRandom_write(BufferedObject *self, PyObject *args) -{ - if (Py_SIZE(self->read_buf) > 0) { - PyObject *res; - /* Undo readahead */ - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = PyObject_CallMethod(self->raw, "seek", "ni", - self->read_pos - Py_SIZE(self->read_buf), 1); - Py_XDECREF(res); - if (res != NULL) { - if( _BufferedReader_reset_read_buf(self) < 0) - res = NULL; - } - - PyThread_release_lock(self->read_lock); - - if (res == NULL) - return NULL; - } - - return BufferedWriter_write(self, args); -} - - -static PyMethodDef BufferedRandom_methods[] = { - /* BufferedIOMixin methods */ - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, - - {"seek", (PyCFunction)BufferedRandom_seek, METH_VARARGS}, - {"tell", (PyCFunction)BufferedRandom_tell, METH_NOARGS}, - {"truncate", (PyCFunction)BufferedRandom_truncate, METH_VARARGS}, - {"read", (PyCFunction)BufferedRandom_read, METH_VARARGS}, - {"readinto", (PyCFunction)BufferedRandom_readinto, METH_VARARGS}, - {"peek", (PyCFunction)BufferedRandom_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedRandom_read1, METH_VARARGS}, - {"write", (PyCFunction)BufferedRandom_write, METH_VARARGS}, - {NULL, NULL} -}; - -static PyMemberDef BufferedRandom_members[] = { - {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, - {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, - {NULL} -}; - -static PyGetSetDef BufferedRandom_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject BufferedRandom_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedRandom", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedRandom_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedRandom_methods, /* tp_methods */ - BufferedRandom_members, /* tp_members */ - BufferedRandom_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /*tp_dict*/ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /*tp_dictoffset*/ - (initproc)BufferedRandom_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - -/* - * Module definition - */ - -static PyMethodDef module_methods[] = { - {"open", (PyCFunction)io_open, METH_VARARGS|METH_KEYWORDS, open_doc}, - {NULL, NULL} -}; - -static struct PyModuleDef iomodule = { - PyModuleDef_HEAD_INIT, - "io", - module_doc, - -1, - module_methods, - NULL, - NULL, - NULL, - NULL -}; - -PyMODINIT_FUNC -PyInit__io() -{ - PyObject *m = PyModule_Create(&iomodule); - PyTypeObject *base; - if (m == NULL) - goto fail; - - io_py_module = PyImport_ImportModule("io"); - if (io_py_module == NULL) - goto fail; - - /* UnsupportedOperation inherits from ValueError and IOError */ - PyExc_UnsupportedOperation = PyObject_CallFunction( - (PyObject*)&PyType_Type, "s(OO){}", - "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); - if (PyExc_UnsupportedOperation == NULL) - goto fail; - PyModule_AddObject(m, "UnsupportedOperation", - PyExc_UnsupportedOperation); - - /* BlockingIOError */ - base = (PyTypeObject*)PyExc_IOError; - _PyExc_BlockingIOError.tp_base = base; - if (PyType_Ready(&_PyExc_BlockingIOError) < 0) - goto fail; - Py_INCREF(&_PyExc_BlockingIOError); - PyModule_AddObject(m, "BlockingIOError", - (PyObject *)&_PyExc_BlockingIOError); - - if (PyType_Ready(&_IOBase_Type) < 0) - goto fail; - Py_INCREF(&_IOBase_Type); - PyModule_AddObject(m, "IOBase", - (PyObject *)&_IOBase_Type); - - if (PyType_Ready(&_RawIOBase_Type) < 0) - goto fail; - Py_INCREF(&_RawIOBase_Type); - PyModule_AddObject(m, "RawIOBase", - (PyObject *)&_RawIOBase_Type); - - /* FileIO */ - PyFileIO_Type.tp_base = &_RawIOBase_Type; - if (PyType_Ready(&PyFileIO_Type) < 0) - goto fail; - Py_INCREF(&PyFileIO_Type); - PyModule_AddObject(m, "FileIO", (PyObject *) &PyFileIO_Type); - - /* BufferedIOBase */ - if (PyType_Ready(&_BufferedIOBase_Type) < 0) - goto fail; - Py_INCREF(&_BufferedIOBase_Type); - PyModule_AddObject(m, "BufferedIOBase", (PyObject *) &_BufferedIOBase_Type); - - /* BytesIO */ - PyBytesIO_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&PyBytesIO_Type) < 0) - goto fail; - Py_INCREF(&PyBytesIO_Type); - PyModule_AddObject(m, "BytesIO", (PyObject *) &PyBytesIO_Type); - - /* BufferedReader */ - BufferedReader_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedReader_Type) < 0) - goto fail; - Py_INCREF(&BufferedReader_Type); - PyModule_AddObject(m, "BufferedReader", (PyObject *) &BufferedReader_Type); - - /* BufferedWriter */ - BufferedWriter_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedWriter_Type) < 0) - goto fail; - Py_INCREF(&BufferedWriter_Type); - PyModule_AddObject(m, "BufferedWriter", (PyObject *) &BufferedWriter_Type); - - /* BufferedRWPair */ - BufferedRWPair_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedRWPair_Type) < 0) - goto fail; - Py_INCREF(&BufferedRWPair_Type); - PyModule_AddObject(m, "BufferedRWPair", (PyObject *) &BufferedRWPair_Type); - - /* BufferedRandom */ - BufferedRandom_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedRandom_Type) < 0) - goto fail; - Py_INCREF(&BufferedRandom_Type); - PyModule_AddObject(m, "BufferedRandom", (PyObject *) &BufferedRandom_Type); - - return m; - - fail: - Py_XDECREF(m); - return NULL; -} +#include +#include "structmember.h" +#include "pythread.h" + +extern PyTypeObject PyFileIO_Type; +extern PyTypeObject PyBytesIO_Type; + +static PyObject *io_py_module; + +/* open() uses st_blksize whenever we can */ +#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */ + + +PyDoc_STRVAR(module_doc, +"The io module provides the Python interfaces to stream handling. The\n" +"builtin open function is defined in this module.\n" +"\n" +"At the top of the I/O hierarchy is the abstract base class IOBase. It\n" +"defines the basic interface to a stream. Note, however, that there is no\n" +"seperation between reading and writing to streams; implementations are\n" +"allowed to throw an IOError if they do not support a given operation.\n" +"\n" +"Extending IOBase is RawIOBase which deals simply with the reading and\n" +"writing of raw bytes to a stream. FileIO subc lasses RawIOBase to provide\n" +"an interface to OS files.\n" +"\n" +"BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\n" +"subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\n" +"streams that are readable, writable, and both respectively.\n" +"BufferedRandom provides a buffered interface to random access\n" +"streams. BytesIO is a simple stream of in-memory bytes.\n" +"\n" +"Another IOBase subclass, TextIOBase, deals with the encoding and decoding\n" +"of streams into text. TextIOWrapper, which extends it, is a buffered text\n" +"interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\n" +"is a in-memory stream for text.\n" +"\n" +"Argument names are not part of the specification, and only the arguments\n" +"of open() are intended to be used as keyword arguments.\n" +"\n" +"data:\n" +"\n" +"DEFAULT_BUFFER_SIZE\n" +"\n" +" An int containing the default buffer size used by the module's buffered\n" +" I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n" +" possible.\n" + ); + + +/* + * BlockingIOError extends IOError + */ + +typedef struct { + PyException_HEAD + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; /* Not used, but part of the IOError object */ + Py_ssize_t written; +} PyBlockingIOErrorObject; + + +static int +BlockingIOError_init(PyBlockingIOErrorObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *myerrno = NULL, *strerror = NULL, *written; + PyObject *baseargs = NULL; + + assert(PyTuple_Check(args)); + + if (PyTuple_GET_SIZE(args) <= 1 || PyTuple_GET_SIZE(args) > 3) + return 0; + + baseargs = PyTuple_GetSlice(args, 0, 2); + if (baseargs == NULL) + return -1; + + if (((PyTypeObject*)PyExc_IOError)->tp_init( + (PyObject*)self, baseargs, kwds) == -1) { + Py_DECREF(baseargs); + return -1; + } + + Py_DECREF(baseargs); + + if (!PyArg_UnpackTuple(args, "BlockingIOError", 2, 3, + &myerrno, &strerror, &written)) { + return -1; + } + + Py_INCREF(myerrno); + self->myerrno = myerrno; + + Py_INCREF(strerror); + self->strerror = strerror; + + self->written = PyNumber_AsSsize_t(written, PyExc_ValueError); + if(self->written == -1 && PyErr_Occurred()) + return -1; + + return 0; +} + +static PyMemberDef BlockingIOError_members[] = { + {"characters_written", T_PYSSIZET, offsetof(PyBlockingIOErrorObject, written), 0}, + {NULL} /* Sentinel */ +}; + + +static PyTypeObject _PyExc_BlockingIOError = { + PyVarObject_HEAD_INIT(NULL, 0) + "BlockingIOError", /*tp_name*/ + sizeof(PyBlockingIOErrorObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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 | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + PyDoc_STR("Exception raised when I/O would block on a non-blocking I/O stream"), /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + BlockingIOError_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BlockingIOError_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; +PyObject *PyExc_BlockingIOError = (PyObject *)&_PyExc_BlockingIOError; + + +/* + * The main open() function + */ +PyDoc_STRVAR(open_doc, +"Open file and return a stream. If the file cannot be opened, an IOError is\n" +"raised.\n" +"\n" +"file is either a string giving the name (and the path if the file\n" +"isn't in the current working directory) of the file to be opened or an\n" +"integer file descriptor of the file to be wrapped. (If a file\n" +"descriptor is given, it is closed when the returned I/O object is\n" +"closed, unless closefd is set to False.)\n" +"\n" +"mode is an optional string that specifies the mode in which the file\n" +"is opened. It defaults to 'r' which means open for reading in text\n" +"mode. Other common values are 'w' for writing (truncating the file if\n" +"it already exists), and 'a' for appending (which on some Unix systems,\n" +"means that all writes append to the end of the file regardless of the\n" +"current seek position). In text mode, if encoding is not specified the\n" +"encoding used is platform dependent. (For reading and writing raw\n" +"bytes use binary mode and leave encoding unspecified.) The available\n" +"modes are:\n" +"\n" +"========= ===============================================================\n" +"Character Meaning\n" +"--------- ---------------------------------------------------------------\n" +"'r' open for reading (default)\n" +"'w' open for writing, truncating the file first\n" +"'a' open for writing, appending to the end of the file if it exists\n" +"'b' binary mode\n" +"'t' text mode (default)\n" +"'+' open a disk file for updating (reading and writing)\n" +"'U' universal newline mode (for backwards compatibility; unneeded\n" +" for new code)\n" +"========= ===============================================================\n" +"\n" +"The default mode is 'rt' (open for reading text). For binary random\n" +"access, the mode 'w+b' opens and truncates the file to 0 bytes, while\n" +"'r+b' opens the file without truncation.\n" +"\n" +"Python distinguishes between files opened in binary and text modes,\n" +"even when the underlying operating system doesn't. Files opened in\n" +"binary mode (appending 'b' to the mode argument) return contents as\n" +"bytes objects without any decoding. In text mode (the default, or when\n" +"'t' is appended to the mode argument), the contents of the file are\n" +"returned as strings, the bytes having been first decoded using a\n" +"platform-dependent encoding or using the specified encoding if given.\n" +"\n" +"buffering is an optional integer used to set the buffering policy. By\n" +"default full buffering is on. Pass 0 to switch buffering off (only\n" +"allowed in binary mode), 1 to set line buffering, and an integer > 1\n" +"for full buffering.\n" +"\n" +"encoding is the name of the encoding used to decode or encode the\n" +"file. This should only be used in text mode. The default encoding is\n" +"platform dependent, but any encoding supported by Python can be\n" +"passed. See the codecs module for the list of supported encodings.\n" +"\n" +"errors is an optional string that specifies how encoding errors are to\n" +"be handled---this argument should not be used in binary mode. Pass\n" +"'strict' to raise a ValueError exception if there is an encoding error\n" +"(the default of None has the same effect), or pass 'ignore' to ignore\n" +"errors. (Note that ignoring encoding errors can lead to data loss.)\n" +"See the documentation for codecs.register for a list of the permitted\n" +"encoding error strings.\n" +"\n" +"newline controls how universal newlines works (it only applies to text\n" +"mode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\n" +"follows:\n" +"\n" +"* On input, if newline is None, universal newlines mode is\n" +" enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n" +" these are translated into '\\n' before being returned to the\n" +" caller. If it is '', universal newline mode is enabled, but line\n" +" endings are returned to the caller untranslated. If it has any of\n" +" the other legal values, input lines are only terminated by the given\n" +" string, and the line ending is returned to the caller untranslated.\n" +"\n" +"* On output, if newline is None, any '\\n' characters written are\n" +" translated to the system default line separator, os.linesep. If\n" +" newline is '', no translation takes place. If newline is any of the\n" +" other legal values, any '\\n' characters written are translated to\n" +" the given string.\n" +"\n" +"If closefd is False, the underlying file descriptor will be kept open\n" +"when the file is closed. This does not work when a file name is given\n" +"and must be True in that case.\n" +"\n" +"open() returns a file object whose type depends on the mode, and\n" +"through which the standard file operations such as reading and writing\n" +"are performed. When open() is used to open a file in a text mode ('w',\n" +"'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\n" +"a file in a binary mode, the returned class varies: in read binary\n" +"mode, it returns a BufferedReader; in write binary and append binary\n" +"modes, it returns a BufferedWriter, and in read/write mode, it returns\n" +"a BufferedRandom.\n" +"\n" +"It is also possible to use a string or bytearray as a file for both\n" +"reading and writing. For strings StringIO can be used like a file\n" +"opened in a text mode, and for bytes a BytesIO can be used like a file\n" +"opened in a binary mode.\n" + ); + +static PyObject * +io_open(PyObject* self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"file", "mode", "buffering", + "encoding", "errors", "newline", + "closefd", NULL}; + PyObject *file; + char *mode = "r"; + int buffering = -1, closefd = 1; + char *encoding = NULL, *errors = NULL, *newline = NULL; + unsigned i; + + int reading = 0, writing = 0, appending = 0, updating = 0; + int text = 0, binary = 0, universal = 0; + + PyObject *FileIO_class; + char rawmode[5], *m; + int line_buffering, isatty; + + PyObject *raw, *modeobj = NULL, *buffer = NULL, *wrapper = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist, + &file, &mode, &buffering, + &encoding, &errors, &newline, + &closefd)) { + return NULL; + } + + if (!PyUnicode_Check(file) && !PyNumber_Check(file)) { + PyErr_Format(PyExc_TypeError, "invalid file: %R", file); + return NULL; + } + + /* Decode mode */ + for (i = 0; i < strlen(mode); i++) { + char c = mode[i]; + + switch (c) { + case 'r': + reading = 1; + break; + case 'w': + writing = 1; + break; + case 'a': + appending = 1; + break; + case '+': + updating = 1; + break; + case 't': + text = 1; + break; + case 'b': + binary = 1; + break; + case 'U': + universal = 1; + reading = 1; + break; + default: + goto invalid_mode; + } + + /* c must not be duplicated */ + if (strchr(mode+i+1, c)) { + invalid_mode: + PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); + return NULL; + } + + } + + m = rawmode; + if (reading) *(m++) = 'r'; + if (writing) *(m++) = 'w'; + if (appending) *(m++) = 'a'; + if (updating) *(m++) = '+'; + *m = '\0'; + + /* Parameters validation */ + if (universal) { + if (writing || appending) { + PyErr_SetString(PyExc_ValueError, + "can't use U and writing mode at once"); + return NULL; + } + reading = 1; + } + + if (text && binary) { + PyErr_SetString(PyExc_ValueError, + "can't have text and binary mode at once"); + return NULL; + } + + if (reading + writing + appending > 1) { + PyErr_SetString(PyExc_ValueError, + "must have exactly one of read/write/append mode"); + return NULL; + } + + if (binary && encoding != NULL) { + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take an encoding argument"); + return NULL; + } + + if (binary && errors != NULL) { + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take an errors argument"); + return NULL; + } + + if (binary && newline != NULL) { + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take a newline argument"); + return NULL; + } + + /* Create the Raw file stream */ + FileIO_class = PyObject_GetAttrString(io_py_module, "FileIO"); + if (!FileIO_class) + return NULL; + + raw = PyObject_CallFunction(FileIO_class, "Osi", file, rawmode, closefd); + Py_DECREF(FileIO_class); + if (raw == NULL) + return NULL; + + modeobj = PyUnicode_FromString(mode); + if (modeobj == NULL) + goto error; + + /* buffering */ + { + PyObject *res = PyObject_CallMethod(raw, "isatty", NULL); + if (res == NULL) + goto error; + isatty = PyLong_AsLong(res); + Py_DECREF(res); + if (isatty == -1 && PyErr_Occurred()) + goto error; + } + + if (buffering == 1 || (buffering < 0 && isatty)) { + buffering = -1; + line_buffering = 1; + } + else + line_buffering = 0; + + if (buffering < 0) { + buffering = DEFAULT_BUFFER_SIZE; +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + { + struct stat st; + long fileno; + PyObject *res = PyObject_CallMethod(raw, "fileno", NULL); + if (res == NULL) + goto error; + + fileno = PyLong_AsLong(res); + Py_DECREF(res); + if (fileno == -1 && PyErr_Occurred()) + goto error; + + if (stat(fileno, &st) >= 0) + buffering = st->st_blksize; + } +#endif + } + if (buffering < 0) { + PyErr_SetString(PyExc_ValueError, + "invalid buffering size"); + goto error; + } + + /* if not buffering, returns the raw file object */ + if (buffering == 0) { + if (!binary) { + PyErr_SetString(PyExc_ValueError, + "can't have unbuffered text I/O"); + goto error; + } + + if (PyObject_SetAttrString(raw, "_name", file) < 0) + goto error; + if (PyObject_SetAttrString(raw, "_mode", modeobj) < 0) + goto error; + Py_DECREF(modeobj); + return raw; + } + + /* wraps into a buffered file */ + { + char *Buffered_class_name; + PyObject *Buffered_class; + + if (updating) + Buffered_class_name = "BufferedRandom"; + else if (writing || appending) + Buffered_class_name = "BufferedWriter"; + else if (reading) + Buffered_class_name = "BufferedReader"; + else { + PyErr_Format(PyExc_ValueError, + "unknown mode: '%s'", mode); + goto error; + } + + Buffered_class = PyObject_GetAttrString(io_py_module, + Buffered_class_name); + if (Buffered_class == NULL) + goto error; + + buffer = PyObject_CallFunction(Buffered_class, "Oi", raw, buffering); + Py_DECREF(Buffered_class); + } + Py_CLEAR(raw); + if (buffer == NULL) + goto error; + + + /* if binary, returns the buffered file */ + if (binary) { + if (PyObject_SetAttrString(buffer, "_name", file) < 0) + goto error; + if (PyObject_SetAttrString(buffer, "_mode", modeobj) < 0) + goto error; + Py_DECREF(modeobj); + return buffer; + } + + /* wraps into a TextIOWrapper */ + { + PyObject *TextIOWrapper_class; + TextIOWrapper_class = PyObject_GetAttrString(io_py_module, + "TextIOWrapper"); + if (TextIOWrapper_class == NULL) + goto error; + + wrapper = PyObject_CallFunction(TextIOWrapper_class, "Osssi", + buffer, + encoding, errors, newline, + line_buffering); + Py_DECREF(TextIOWrapper_class); + } + Py_CLEAR(buffer); + if (wrapper == NULL) + goto error; + + if (PyObject_SetAttrString(wrapper, "name", file) < 0) + goto error; + if (PyObject_SetAttrString(wrapper, "mode", modeobj) < 0) + goto error; + Py_DECREF(modeobj); + return wrapper; + + error: + Py_XDECREF(raw); + Py_XDECREF(modeobj); + Py_XDECREF(buffer); + Py_XDECREF(wrapper); + return NULL; +} + + +static PyObject* PyExc_UnsupportedOperation; + +/* + * IOBase class, an abstract class + */ + +PyDoc_STRVAR(IOBase_doc, + "The abstract base class for all I/O classes, acting on streams of\n" + "bytes. There is no public constructor.\n" + "\n" + "This class provides dummy implementations for many methods that\n" + "derived classes can override selectively; the default implementations\n" + "represent a file that cannot be read, written or seeked.\n" + "\n" + "Even though IOBase does not declare read, readinto, or write because\n" + "their signatures will vary, implementations and clients should\n" + "consider those methods part of the interface. Also, implementations\n" + "may raise a IOError when operations they do not support are called.\n" + "\n" + "The basic type used for binary data read from or written to a file is\n" + "bytes. bytearrays are accepted too, and in some cases (such as\n" + "readinto) needed. Text I/O classes work with str data.\n" + "\n" + "Note that calling any method (even inquiries) on a closed stream is\n" + "undefined. Implementations may raise IOError in this case.\n" + "\n" + "IOBase (and its subclasses) support the iterator protocol, meaning\n" + "that an IOBase object can be iterated over yielding the lines in a\n" + "stream.\n" + "\n" + "IOBase also supports the :keyword:`with` statement. In this example,\n" + "fp is closed after the suite of the with statment is complete:\n" + "\n" + "with open('spam.txt', 'r') as fp:\n" + " fp.write('Spam and eggs!')\n"); + +/* Internal methods */ +static PyObject * +IOBase_unsupported(const char* message) +{ + PyErr_SetString(PyExc_UnsupportedOperation, message); + return NULL; +} + +/* Positionning */ + +PyDoc_STRVAR(IOBase_seek_doc, + "Change stream position.\n" + "\n" + "Change the stream position to byte offset offset. offset is\n" + "interpreted relative to the position indicated by whence. Values\n" + "for whence are:\n" + "\n" + "* 0 -- start of stream (the default); offset should be zero or positive\n" + "* 1 -- current stream position; offset may be negative\n" + "* 2 -- end of stream; offset is usually negative\n" + "\n" + "Return the new absolute position."); + +static PyObject* +IOBase_seek(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("seek"); +} + +PyDoc_STRVAR(IOBase_tell_doc, + "Return current stream position."); + +static PyObject * +IOBase_tell(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "tell", "ii", 0, 1); +} + +PyDoc_STRVAR(IOBase_truncate_doc, + "Truncate file to size bytes.\n" + "\n" + "Size defaults to the current IO position as reported by tell(). Return\n" + "the new size."); + +static PyObject* +IOBase_truncate(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("seek"); +} + +/* Flush and close methods */ + +PyDoc_STRVAR(IOBase_flush_doc, + "Flush write buffers, if applicable.\n" + "\n" + "This is not implemented for read-only and non-blocking streams.\n"); + +static PyObject* +IOBase_flush(PyObject *self, PyObject *args) +{ + /* XXX Should this return the number of bytes written??? */ + Py_RETURN_NONE; +} + +PyDoc_STRVAR(IOBase_close_doc, + "Flush and close the IO object.\n" + "\n" + "This method has no effect if the file is already closed.\n"); + +static int +IOBase_closed(PyObject *self) +{ + return PyObject_HasAttrString(self, "__IOBase_closed"); +} + +static PyObject * +IOBase_closed_get(PyObject *self, void *context) +{ + return PyBool_FromLong(IOBase_closed(self)); +} + + +static PyObject * +IOBase_checkClosed(PyObject *self, PyObject *unused) +{ + if (IOBase_closed(self)) { + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); + return NULL; + } + Py_RETURN_NONE; +} + +static PyObject* +IOBase_close(PyObject *self, PyObject *args) +{ + PyObject *res; + + if (IOBase_closed(self)) + Py_RETURN_NONE; + + PyObject_SetAttrString(self, "__IOBase_closed", Py_True); + + res = PyObject_CallMethod(self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + +static void +IOBase_del(PyObject *self) +{ + PyObject *res = PyObject_CallMethod(self, "flush", NULL); + if (res == NULL) { + /* At program exit time, it's possible that globals have already been + * deleted, and then the close() call might fail. Since there's + * nothing we can do about such failures and they annoy the end + * users, we suppress the traceback. + */ + PyErr_Clear(); + } +} + +/* Inquiry methods */ + +PyDoc_STRVAR(IOBase_seekable_doc, + "Return whether object supports random access.\n" + "\n" + "If False, seek(), tell() and truncate() will raise IOError.\n" + "This method may need to do a test seek()."); + +static PyObject* +IOBase_seekable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +static PyObject* +IOBase_checkSeekable(PyObject *self, PyObject *unused) +{ + PyObject *res = PyObject_CallMethod(self, "seekable", NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); + } + return res; +} + +PyDoc_STRVAR(IOBase_readable_doc, + "Return whether object was opened for reading.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject* +IOBase_readable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +/* May be called with any object */ +static PyObject* +IOBase_checkReadable(PyObject *self, PyObject *unused) +{ + PyObject *res = PyObject_CallMethod(self, "readable", NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not readable."); + } + return res; +} + +PyDoc_STRVAR(IOBase_writable_doc, + "Return whether object was opened for writing.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject* +IOBase_writable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +/* May be called with any object */ +static PyObject* +IOBase_checkWritable(PyObject *self, PyObject *unused) +{ + PyObject *res = PyObject_CallMethod(self, "writable", NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not writable."); + } + return res; +} + +/* Context manager */ + +static PyObject * +IOBase_enter(PyObject *self, PyObject *args) +{ + if (IOBase_checkClosed(self, NULL) == NULL) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +IOBase_exit(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "close", NULL); +} + +/* Lower-level APIs */ + +/* XXX Should these be present even if unimplemented? */ + +PyDoc_STRVAR(IOBase_fileno_doc, + "Returns underlying file descriptor if one exists.\n" + "\n" + "An IOError is raised if the IO object does not use a file descriptor.\n"); + +static PyObject * +IOBase_fileno(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("fileno"); +} + +PyDoc_STRVAR(IOBase_isatty_doc, + "Return whether this is an 'interactive' stream.\n" + "\n" + "Return False if it can't be determined.\n"); + +static PyObject * +IOBase_isatty(PyObject *self, PyObject *args) +{ + if (IOBase_checkClosed(self, NULL) == NULL) + return NULL; + Py_RETURN_FALSE; +} + +/* Readline(s) and writelines */ + +PyDoc_STRVAR(IOBase_readline_doc, + "Read and return a line from the stream.\n" + "\n" + "If limit is specified, at most limit bytes will be read.\n" + "\n" + "The line terminator is always b'\n' for binary files; for text\n" + "files, the newlines argument to open can be used to select the line\n" + "terminator(s) recognized.\n"); + +static PyObject * +IOBase_readline(PyObject *self, PyObject *args) +{ + /* For backwards compatibility, a (slowish) readline(). */ + + Py_ssize_t limit = -1; + int has_peek = 0; + PyObject *buffer, *result; + Py_ssize_t old_size = -1; + + if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { + return NULL; + } + + if (IOBase_checkClosed(self, NULL) == NULL) + return NULL; + + if (PyObject_HasAttrString(self, "peek")) + has_peek = 1; + + buffer = PyByteArray_FromStringAndSize(NULL, 0); + if (buffer == NULL) + return NULL; + + while (limit < 0 || Py_SIZE(buffer) < limit) { + Py_ssize_t nreadahead = 1; + PyObject *b; + + if (has_peek) { + PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); + + assert (PyBytes_Check(readahead)); + + if (readahead == NULL) + goto fail; + if (PyBytes_GET_SIZE(readahead) > 0) { + Py_ssize_t n = 0; + const char *buf = PyBytes_AS_STRING(readahead); + if (limit >= 0) { + do { + if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) + break; + if (buf[n] == '\n') + { + n++; + break; + } + n++; + } while (1); + } + else { + do { + if (n >= PyBytes_GET_SIZE(readahead)) + break; + if (buf[n] == '\n') + { + n++; + break; + } + n++; + } while (1); + } + nreadahead = n; + } + } + + b = PyObject_CallMethod(self, "read", "n", nreadahead); + + if (b == NULL) + goto fail; + + assert (PyBytes_Check(b)); + + if (Py_SIZE(b) == 0) + break; + + old_size = Py_SIZE(buffer); + PyByteArray_Resize(buffer, old_size + Py_SIZE(b)); + memcpy(PyByteArray_AS_STRING(buffer) + old_size, PyBytes_AS_STRING(b), Py_SIZE(b)); + + Py_DECREF(b); + + if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') + break; + } + + result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), + PyByteArray_GET_SIZE(buffer)); + Py_DECREF(buffer); + return result; + fail: + Py_DECREF(buffer); + return NULL; +} + +static PyObject * +IOBase_iter(PyObject *self, PyObject *args) +{ + if (IOBase_checkClosed(self, NULL) == NULL) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +IOBase_next(PyObject *self, PyObject *args) +{ + PyObject *line = PyObject_CallMethod(self, "readline", NULL); + + if (line == NULL) + return NULL; + + assert (PyBytes_Check(line)); + + if (PyBytes_GET_SIZE(line) == 0) { + Py_DECREF(line); + return NULL; + } + + return line; +} + +PyDoc_STRVAR(IOBase_readlines_doc, + "Return a list of lines from the stream.\n" + "\n" + "hint can be specified to control the number of lines read: no more\n" + "lines will be read if the total size (in bytes/characters) of all\n" + "lines so far exceeds hint."); + +static PyObject * +IOBase_readlines(PyObject *self, PyObject *args) +{ + Py_ssize_t hint = -1, length = 0; + PyObject *line, *result; + + if (!PyArg_ParseTuple(args, "|n:readlines", &hint)) { + return NULL; + } + + result = PyList_New(0); + if (result == NULL) + return NULL; + + if (hint <= 0) { + PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); + if( ret == NULL) { + Py_DECREF(result); + return NULL; + } + Py_DECREF(ret); + return result; + } + + while (1) { + line = PyObject_CallMethod(self, "__next__", NULL); + if (line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } + else + break; /* SopIteration raised */ + } + assert (PyBytes_Check(line)); + + if (PyList_Append(result, line) < 0) { + Py_DECREF(line); + Py_DECREF(result); + return NULL; + } + length += Py_SIZE(line); + Py_DECREF(line); + + if (length > hint) + break; + } + return result; +} + +static PyObject * +IOBase_writelines(PyObject *self, PyObject *args) +{ + PyObject *lines, *iter, *res; + + if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { + return NULL; + } + + if (IOBase_checkClosed(self, NULL) == NULL) + return NULL; + + iter = PyObject_GetIter(lines); + if (iter == NULL) + return NULL; + + while (1) { + PyObject *line = PyIter_Next(iter); + if(line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(iter); + return NULL; + } + else + break; /* Stop Iteration */ + } + + res = PyObject_CallMethod(self, "write", "O", line); + Py_DECREF(line); + if (res == NULL) { + Py_DECREF(iter); + return NULL; + } + Py_DECREF(res); + } + Py_RETURN_NONE; +} + +static PyMethodDef IOBase_methods[] = { + {"seek", IOBase_seek, METH_VARARGS}, + {"tell", IOBase_tell, METH_NOARGS}, + {"truncate", IOBase_truncate, METH_VARARGS}, + {"flush", IOBase_flush, METH_NOARGS}, + {"close", IOBase_close, METH_NOARGS}, + + {"seekable", IOBase_seekable, METH_NOARGS}, + {"readable", IOBase_readable, METH_NOARGS}, + {"writable", IOBase_writable, METH_NOARGS}, + + {"_checkClosed", IOBase_checkClosed, METH_NOARGS}, + {"_checkSeekable", IOBase_checkSeekable, METH_NOARGS}, + {"_checkReadable", IOBase_checkReadable, METH_NOARGS}, + {"_checkWritable", IOBase_checkWritable, METH_NOARGS}, + + {"fileno", IOBase_fileno, METH_NOARGS}, + {"isatty", IOBase_isatty, METH_NOARGS}, + + {"__enter__", IOBase_enter, METH_NOARGS}, + {"__exit__", IOBase_exit, METH_VARARGS}, + + {"__iter__", IOBase_iter, METH_NOARGS}, + {"__next__", IOBase_next, METH_NOARGS}, + + {"readline", IOBase_readline, METH_VARARGS}, + {"readlines", IOBase_readlines, METH_VARARGS}, + {"writelines", IOBase_readlines, METH_VARARGS}, + + {NULL, NULL} +}; + +static PyGetSetDef IOBase_getset[] = { + {"closed", (getter)IOBase_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject _IOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "IOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + IOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + IOBase_methods, /* tp_methods */ + 0, /* tp_members */ + IOBase_getset, /* 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 */ + PyType_GenericNew, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + IOBase_del, /* tp_del */ +}; +PyObject *PyIOBase = (PyObject*)&_IOBase_Type; + + + +/* + * RawIOBase class, Inherits from IOBase. + */ +PyDoc_STRVAR(RawIOBase_doc, + "Base class for raw binary I/O."); + +/* + * The read() method is implemented by calling readinto(); derived classes + * that want to support read() only need to implement readinto() as a + * primitive operation. In general, readinto() can be more efficient than + * read(). + * + * (It would be tempting to also provide an implementation of readinto() in + * terms of read(), in case the latter is a more suitable primitive operation, + * but that would lead to nasty recursion in case a subclass doesn't implement + * either.) +*/ + +static PyObject * +RawIOBase_read(PyObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *b, *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + if (n < 0) + return PyObject_CallMethod(self, "readall", NULL); + + b = PyByteArray_FromStringAndSize(NULL, n); + if (b == NULL) + return NULL; + + res = PyObject_CallMethod(self, "readinto", "O", b); + if (res == NULL) { + Py_DECREF(b); + return NULL; + } + + n = PyNumber_AsSsize_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n == -1 && PyErr_Occurred()) { + Py_DECREF(b); + return NULL; + } + + res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); + Py_DECREF(b); + return res; +} + + +PyDoc_STRVAR(RawIOBase_readall_doc, + "Read until EOF, using multiple read() call."); + +static PyObject * +RawIOBase_readall(PyObject *self, PyObject *args) +{ + PyObject *b = NULL; + Py_ssize_t cursize = 0; + + while (1) { + Py_ssize_t length; + PyObject *data = PyObject_CallMethod(self, "read", + "i", DEFAULT_BUFFER_SIZE); + + if (!data) { + Py_XDECREF(b); + return NULL; + } + + if (!PyBytes_Check(data)) { + Py_XDECREF(b); + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + length = Py_SIZE(data); + + if (b == NULL) + b = data; + else if (length != 0) { + + _PyBytes_Resize(&b, cursize + length); + if (b == NULL) { + Py_DECREF(data); + return NULL; + } + + memcpy(PyBytes_AS_STRING(b) + cursize, + PyBytes_AS_STRING(data), length); + Py_DECREF(data); + } + + if (length == 0) + break; + } + + return b; + +} + +static PyMethodDef RawIOBase_methods[] = { + {"read", RawIOBase_read, METH_VARARGS}, + {"readall", RawIOBase_readall, METH_NOARGS, RawIOBase_readall_doc}, + {NULL, NULL} +}; + +PyTypeObject _RawIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "RawIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + RawIOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + RawIOBase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &_IOBase_Type, /* 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 */ +}; +PyObject *PyRawIOBase = (PyObject*)&_RawIOBase_Type; + + +/* + * BufferedIOBase class, inherits from IOBase. + */ +PyDoc_STRVAR(BufferedIOBase_doc, + "Base class for buffered IO objects.\n" + "\n" + "The main difference with RawIOBase is that the read() method\n" + "supports omitting the size argument, and does not have a default\n" + "implementation that defers to readinto().\n" + "\n" + "In addition, read(), readinto() and write() may raise\n" + "BlockingIOError if the underlying raw stream is in non-blocking\n" + "mode and not ready; unlike their raw counterparts, they will never\n" + "return None.\n" + "\n" + "A typical implementation should not inherit from a RawIOBase\n" + "implementation, but wrap one.\n" + ); + +static PyObject * +BufferedIOBase_readinto(PyObject *self, PyObject *args) +{ + Py_buffer buf; + Py_ssize_t len; + PyObject *data; + + if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { + return NULL; + } + + data = PyObject_CallMethod(self, "read", "n", buf.len); + if (data == NULL) + goto error; + + if (!PyBytes_Check(data)) { + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + goto error; + } + + len = Py_SIZE(data); + memcpy(buf.buf, PyBytes_AS_STRING(data), len); + + PyBuffer_Release(&buf); + Py_DECREF(data); + + return PyLong_FromSsize_t(len); + + error: + PyBuffer_Release(&buf); + return NULL; +} + +static PyMethodDef BufferedIOBase_methods[] = { + {"readinto", BufferedIOBase_readinto, METH_VARARGS}, + {NULL, NULL} +}; + +PyTypeObject _BufferedIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + BufferedIOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedIOBase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &_IOBase_Type, /* 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 */ +}; + + +typedef struct { + PyObject_HEAD + + PyObject *raw; + + PyObject *name; + PyObject *mode; + + PyObject *read_buf; + Py_ssize_t read_pos; + PyThread_type_lock read_lock; + + PyObject *write_buf; + PyThread_type_lock write_lock; + + Py_ssize_t buffer_size; + Py_ssize_t max_buffer_size; + + PyObject *dict; + PyObject *weakreflist; +} BufferedObject; + +static void +BufferedObject_dealloc(BufferedObject *self) +{ + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + Py_CLEAR(self->raw); + Py_CLEAR(self->name); + Py_CLEAR(self->mode); + Py_CLEAR(self->read_buf); + Py_CLEAR(self->write_buf); + Py_CLEAR(self->dict); +} + + +/* + * _BufferedIOMixin methods + * This is not a class, just a collection of methods that will be reused + * by BufferedReader and BufferedWriter + */ + +/* Positioning */ + +static PyObject* +BufferedIOMixin_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + /* Flush the stream. We're mixing buffered I/O with lower-level I/O, + * and a flush may be necessary to synch both views of the current + * file state. + */ + res = PyObject_CallMethod(self->raw, "flush", NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + + if (pos == Py_None) + pos = PyObject_CallMethod(self->raw, "tell", NULL); + else + Py_INCREF(pos); + + /* XXX: Should seek() be used, instead of passing the position + * XXX directly to truncate? + */ + res = PyObject_CallMethod(self->raw, "truncate", "O", pos); + Py_DECREF(pos); + + return res; +} + +/* Flush and close */ + +static PyObject* +BufferedIOMixin_flush(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "flush", NULL); +} + +static int +BufferedIOMixin_closed(BufferedObject *self) +{ + int closed; + PyObject *res = PyObject_GetAttrString(self->raw, "closed"); + if (res == NULL) + return 0; + closed = PyObject_IsTrue(res); + Py_DECREF(res); + return closed; +} + +static PyObject * +BufferedIOMixin_closed_get(BufferedObject *self, void *context) +{ + return PyObject_GetAttrString(self->raw, "closed"); +} + + +static PyObject* +BufferedIOMixin_close(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + if (BufferedIOMixin_closed(self)) + Py_RETURN_NONE; + + res = PyObject_CallMethod((PyObject *)self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + + return PyObject_CallMethod(self->raw, "close", NULL); +} + +/* Inquiries */ + +static PyObject* +BufferedIOMixin_seekable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "seekable", NULL); +} + +static PyObject* +BufferedIOMixin_readable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "readable", NULL); +} + +static PyObject* +BufferedIOMixin_writable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "writable", NULL); +} + +/* Lower-level APIs */ + +static PyObject* +BufferedIOMixin_fileno(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "fileno", NULL); +} + +static PyObject* +BufferedIOMixin_isatty(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "isatty", NULL); +} + + +/* + * class BufferedReader + */ + +PyDoc_STRVAR(BufferedReader_doc, + "Create a new buffered reader using the given readable raw IO object."); + +static int _BufferedReader_reset_read_buf(BufferedObject *self) +{ + PyObject *oldbuf = self->read_buf; + + self->read_buf = PyBytes_FromStringAndSize(NULL, 0); + self->read_pos = 0; + + Py_XDECREF(oldbuf); + + if (self->read_buf == NULL) + return -1; + + return 0; +} + +static int +BufferedReader_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, + &raw, &buffer_size)) { + return -1; + } + + if (IOBase_checkReadable(raw, NULL) == NULL) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + self->buffer_size = buffer_size; + self->read_buf = NULL; + + if( _BufferedReader_reset_read_buf(self) < 0) + return -1; + + self->read_lock = PyThread_allocate_lock(); + if (self->read_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } + + return 0; +} + +static PyObject * +_BufferedReader_read_unlocked(BufferedObject *self, Py_ssize_t n) +{ + PyObject *nodata_val = NULL; + PyObject *empty_values = NULL; + + PyObject *buf = self->read_buf; + Py_ssize_t pos = self->read_pos; + PyObject *data, *chunks, *sep, *res; + Py_ssize_t current_size; + + /* Special case for when the number of bytes to read is unspecified. */ + if (n == -1) { + chunks = PyList_New(0); + if (chunks == NULL) + return NULL; + + Py_INCREF(buf); + if (_BufferedReader_reset_read_buf(self) < 0) + return NULL; + + /* Strip the consumed bytes */ + current_size = Py_SIZE(buf) - pos; + data = NULL; + if (current_size) { + data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); + if (data == NULL) { + Py_DECREF(buf); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(buf); + } + + while (1) { + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + /* Read until EOF or until read() would block. */ + data = PyObject_CallMethod(self->raw, "read", NULL); + + if (data == NULL) { + Py_DECREF(chunks); + return NULL; + } + + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (data == Py_None || Py_SIZE(data) == 0) { + if (current_size == 0) { + Py_DECREF(chunks); + return data; + } + else { + Py_DECREF(data); + sep = PyBytes_FromStringAndSize(NULL, 0); + + if (sep == NULL) { + Py_DECREF(chunks); + return NULL; + } + res =_PyBytes_Join(sep, chunks); + Py_DECREF(sep); + Py_DECREF(chunks); + + return res; + } + } + + current_size += Py_SIZE(data); + } + } + + /* The number of bytes to read is specified, return at most n bytes. */ + + current_size = Py_SIZE(buf) - pos; /* Length of the available buffered data. */ + if (n <= current_size) { + /* Fast path: the data to read is fully buffered. */ + self->read_pos += n; + return PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, n); + } + + /* Slow path: read from the stream until enough bytes are read, + * or until an EOF occurs or until read() would block. + */ + chunks = PyList_New(0); + if (chunks == NULL) + return NULL; + + data = NULL; + + if (current_size) + data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); + + while (1) { + Py_ssize_t wanted; + + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + if (current_size >= n) + break; + + wanted = n; + if (wanted < self->buffer_size) + wanted = self->buffer_size; + + data = PyObject_CallMethod(self->raw, "read", "n", wanted); + + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (data == Py_None || Py_SIZE(data) == 0) { + /* EOF occurred or read() would block. */ + + if (current_size == 0) { + Py_DECREF(chunks); + + if( _BufferedReader_reset_read_buf(self) < 0) { + Py_DECREF(data); + return NULL; + } + + return data; + } + else { + Py_DECREF(data); + break; + } + } + + current_size += Py_SIZE(data); + } + + sep = PyBytes_FromStringAndSize(NULL, 0); + + if (sep == NULL) { + Py_DECREF(chunks); + return NULL; + } + + res =_PyBytes_Join(sep, chunks); + Py_DECREF(sep); + Py_DECREF(chunks); + + if (Py_SIZE(res) > n) { + /* Save the extra data in the buffer. */ + self->read_pos = 0; + buf = self->read_buf; + self->read_buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res) + n, Py_SIZE(res) - n); + Py_DECREF(buf); + if (self->read_buf == NULL) { + Py_DECREF(res); + return NULL; + } + + /* Truncate the result to the desired length */ + buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res), n); + if (buf == NULL) { + Py_DECREF(res); + return NULL; + } + + Py_DECREF(res); + res = buf; + } + + return res; +} + +static PyObject * +BufferedReader_read(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_read_unlocked(self, n); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject * +_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t n) +{ + Py_ssize_t have; + + if (n > self->buffer_size) + n = self->buffer_size; + + have = Py_SIZE(self->read_buf) - self->read_pos; + + if (have < n) { + Py_ssize_t to_read = self->buffer_size - have; + PyObject *current = PyObject_CallMethod(self->raw, "read", "n", to_read); + + if (current == NULL) + return NULL; + + if (!PyBytes_Check(current)) { + Py_DECREF(current); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (Py_SIZE(current) > 0) { + PyObject *oldbuf = self->read_buf; + self->read_buf = PyBytes_FromStringAndSize(NULL, have + Py_SIZE(current)); + memcpy(PyBytes_AS_STRING(self->read_buf), PyBytes_AS_STRING(oldbuf) + self->read_pos, have); + memcpy(PyBytes_AS_STRING(self->read_buf) + have, PyBytes_AS_STRING(current), Py_SIZE(current)); + self->read_pos = 0; + } + Py_DECREF(current); + } + + if (self->read_pos == 0) { + Py_INCREF(self->read_buf); + return self->read_buf; + } + else { + return PyBytes_FromStringAndSize( + PyBytes_AS_STRING(self->read_buf) + self->read_pos, + Py_SIZE(self->read_buf) - self->read_pos); + } +} + +static PyObject * +BufferedReader_peek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:peek", &n)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_peek_unlocked(self, n); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject * +BufferedReader_read1(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n, have; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n:read1", &n)) { + return NULL; + } + + if (n <= 0) + return PyBytes_FromStringAndSize(NULL, 0); + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_peek_unlocked(self, 1); + if(res == NULL) + goto end; + Py_DECREF(res); + + have = Py_SIZE(self->read_buf) - self->read_pos; + if (n > have) + n = have; + + res = _BufferedReader_read_unlocked(self, n); + + end: + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject* +BufferedReader_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + if (whence == 1) { + pos -= Py_SIZE(self->read_buf) - self->read_pos; + } + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + if (res == NULL) + return NULL; + + if (_BufferedReader_reset_read_buf(self) < 0) + Py_CLEAR(res); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject* +BufferedReader_tell(BufferedObject *self, PyObject *args) +{ + PyObject *op1, *op2, *res; + + op1 = PyObject_CallMethod(self->raw, "tell", NULL); + + if (op1 == NULL) + return NULL; + + op2 = PyLong_FromSsize_t(Py_SIZE(self->read_buf) - self->read_pos); + if (op2 == NULL) { + Py_DECREF(op1); + return NULL; + } + + res = PyNumber_Subtract(op1, op2); + Py_DECREF(op1); + Py_DECREF(op2); + return res; +} + +static PyMethodDef BufferedReader_methods[] = { + /* BufferedIOMixin methods */ + {"truncate", (PyCFunction)BufferedIOMixin_truncate, METH_VARARGS}, + {"flush", (PyCFunction)BufferedIOMixin_flush, METH_NOARGS}, + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"read", (PyCFunction)BufferedReader_read, METH_VARARGS}, + {"peek", (PyCFunction)BufferedReader_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedReader_read1, METH_VARARGS}, + {"seek", (PyCFunction)BufferedReader_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedReader_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedReader_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedReader_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject BufferedReader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedReader", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedReader_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedReader_methods, /* tp_methods */ + BufferedReader_members, /* tp_members */ + BufferedReader_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedReader_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + +/* + * class BufferedWriter + */ +PyDoc_STRVAR(BufferedWriter_doc, + "A buffer for a writeable sequential RawIO object.\n" + "\n" + "The constructor creates a BufferedWriter for the given writeable raw\n" + "stream. If the buffer_size is not given, it defaults to\n" + "DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to\n" + "twice the buffer size.\n" + ); + +static int +BufferedWriter_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (IOBase_checkWritable(raw, NULL) == NULL) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + if (max_buffer_size < 0) + max_buffer_size = buffer_size * 2; + self->buffer_size = buffer_size; + self->max_buffer_size = max_buffer_size; + + self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); + if (self->write_buf == NULL) + return -1; + + self->write_lock = PyThread_allocate_lock(); + if (self->write_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); + return -1; + } + + return 0; +} + +static PyObject * +_BufferedWriter_flush_unlocked(BufferedObject *self) +{ + Py_ssize_t written = 0; + + if (BufferedIOMixin_closed(self)) { + PyErr_SetString(PyExc_ValueError, "flush of closed file"); + return NULL; + } + + while (Py_SIZE(self->write_buf) > 0) { + PyObject *slice, *res; + Py_ssize_t w; + PyObject *n = PyObject_CallMethod(self->raw, "write", "O", self->write_buf); + + if (n == NULL) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value == NULL || + !PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + PyErr_Restore(type, value, traceback); + return NULL; + } + + w = ((PyBlockingIOErrorObject *)value)->written; + + /* del self->write_buf[:w] */ + slice = _PySlice_FromIndices(0, w); + if (slice == NULL) + return NULL; + res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); + Py_DECREF(slice); + if (res == NULL) + return NULL; + Py_DECREF(res); + + written += w; + ((PyBlockingIOErrorObject *)value)->written = written; + + PyErr_Restore(type, value, traceback); + return NULL; + } + + /* del self->write_buf[:w] */ + w = PyNumber_AsSsize_t(n, PyExc_ValueError); + Py_DECREF(n); + if (w == -1 && PyErr_Occurred()) + return NULL; + + slice = _PySlice_FromIndices(0, w); + if (slice == NULL) + return NULL; + res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); + Py_DECREF(slice); + if (res == NULL) + return NULL; + Py_DECREF(res); + + written += w; + } + + Py_RETURN_NONE; +} + +static PyObject * +BufferedWriter_write(BufferedObject *self, PyObject *args) +{ + PyObject *res; + Py_buffer buf; + Py_ssize_t before, written; + + if (!PyArg_ParseTuple(args, "y*:write", &buf)) { + return NULL; + } + + if (BufferedIOMixin_closed(self)) { + PyErr_SetString(PyExc_ValueError, "write to closed file"); + PyBuffer_Release(&buf); + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + /* XXX we can implement some more tricks to try and avoid + * partial writes + */ + + if (Py_SIZE(self->write_buf) > self->buffer_size) { + /* We're full, so let's pre-flush the buffer*/ + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) { + /* We can't accept anything else. */ + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value != NULL && + PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + ((PyBlockingIOErrorObject *)value)->written = 0; + } + + PyErr_Restore(type, value, traceback); + goto fail; + } + } + + written = buf.len; + + before = Py_SIZE(self->write_buf); + if (PyByteArray_Resize(self->write_buf, before + written) < 0) { + res = NULL; + goto fail; + } + memcpy(PyByteArray_AS_STRING(self->write_buf) + before, buf.buf, written); + + if (Py_SIZE(self->write_buf) > self->buffer_size) { + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value != NULL && + PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + + Py_ssize_t overage = + Py_SIZE(self->write_buf) - self->max_buffer_size; + + if (overage > 0) { + /* We've hit max_buffer_size. We have to accept a + * partial write and cut back our buffer. + */ + if (PyByteArray_Resize(self->write_buf, self->max_buffer_size) < 0) + goto fail; + ((PyBlockingIOErrorObject *)value)->written = overage; + } + else + { + Py_CLEAR(type); + Py_CLEAR(value); + Py_CLEAR(traceback); + goto end; + } + } + + PyErr_Restore(type, value, traceback); + goto fail; + } + } + + end: + res = PyLong_FromSsize_t(written); + + fail: + PyThread_release_lock(self->write_lock); + PyBuffer_Release(&buf); + return res; +} + +static PyObject * +BufferedWriter_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) + goto end; + Py_DECREF(res); + + res = BufferedIOMixin_truncate(self, args); + + end: + PyThread_release_lock(self->write_lock); + return res; +} + +static PyObject * +BufferedWriter_flush(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + + PyThread_release_lock(self->write_lock); + + return res; +} + +static PyObject * +BufferedWriter_tell(BufferedObject *self, PyObject *args) +{ + PyObject *op1, *op2, *res; + + op1 = PyObject_CallMethod(self->raw, "tell", NULL); + + op2 = PyLong_FromSsize_t(Py_SIZE(self->write_buf)); + if (op2 == NULL) { + Py_DECREF(op1); + return NULL; + } + + res = PyNumber_Add(op1, op2); + Py_DECREF(op1); + Py_DECREF(op2); + return res; +} + +static PyObject * +BufferedWriter_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) + goto end; + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + + end: + PyThread_release_lock(self->write_lock); + return res; +} + +static PyMethodDef BufferedWriter_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, + {"truncate", (PyCFunction)BufferedWriter_truncate, METH_VARARGS}, + {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, + {"seek", (PyCFunction)BufferedWriter_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedWriter_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedWriter_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedWriter_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject BufferedWriter_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedWriter", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedWriter_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedWriter_methods, /* tp_methods */ + BufferedWriter_members, /* tp_members */ + BufferedWriter_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedWriter_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +/* + * BufferedRWPair + */ + +PyDoc_STRVAR(BufferedRWPair_doc, + "A buffered reader and writer object together.\n" + "\n" + "A buffered reader object and buffered writer object put together to\n" + "form a sequential IO object that can read and write. This is typically\n" + "used with a socket or two-way pipe.\n" + "\n" + "reader and writer are RawIOBase objects that are readable and\n" + "writeable respectively. If the buffer_size is omitted it defaults to\n" + "DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer)\n" + "defaults to twice the buffer size.\n" + ); + +/* XXX The usefulness of this (compared to having two separate IO objects) is + * questionable. + */ + +typedef struct { + PyObject_HEAD + BufferedObject *reader; + BufferedObject *writer; +} BufferedRWPairObject; + +static int +BufferedRWPair_init(BufferedRWPairObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *reader, *writer; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + + if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, + &buffer_size, &max_buffer_size)) { + return -1; + } + + if (IOBase_checkReadable(reader, NULL) == NULL) + return -1; + if (IOBase_checkWritable(writer, NULL) == NULL) + return -1; + + args = Py_BuildValue("(n)", buffer_size); + if (args == NULL) { + Py_CLEAR(self->reader); + return -1; + } + self->reader = (BufferedObject*)PyType_GenericNew(&BufferedReader_Type, args, NULL); + Py_DECREF(args); + if (self->reader == NULL) + return -1; + + args = Py_BuildValue("(nn)", buffer_size, max_buffer_size); + if (args == NULL) { + Py_CLEAR(self->reader); + return -1; + } + self->writer = (BufferedObject*)PyType_GenericNew(&BufferedWriter_Type, args, NULL); + Py_DECREF(args); + if (self->writer == NULL) { + Py_CLEAR(self->reader); + return -1; + } + return 0; +} + +static void +BufferedRWPair_dealloc(BufferedRWPairObject *self) +{ + Py_CLEAR(self->reader); + Py_CLEAR(self->writer); +} + +static PyObject * +_forward_call(BufferedObject *self, const char* name, PyObject *args) +{ + PyObject *func = PyObject_GetAttrString((PyObject*)self, name); + PyObject *ret; + + if (func == NULL) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + ret = PyObject_CallObject(func, args); + Py_DECREF(func); + return ret; +} + +static PyObject * +BufferedRWPair_read(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "read", args); +} + +static PyObject * +BufferedRWPair_peek(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "peek", args); +} + +static PyObject * +BufferedRWPair_read1(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "read1", args); +} + +static PyObject * +BufferedRWPair_write(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "write", args); +} + +static PyObject * +BufferedRWPair_flush(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "flush", args); +} + +static PyObject * +BufferedRWPair_readable(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "readable", args); +} + +static PyObject * +BufferedRWPair_writable(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "writable", args); +} + +static PyObject * +BufferedRWPair_close(BufferedRWPairObject *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "close", args); + if (ret == NULL) + return NULL; + Py_DECREF(ret); + + return _forward_call(self->reader, "close", args); +} + +static PyObject * +BufferedRWPair_isatty(BufferedRWPairObject *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "isatty", args); + + if (ret != Py_False) { + /* either True or exception */ + return ret; + } + Py_DECREF(ret); + + return _forward_call(self->reader, "isatty", args); +} + + +static PyMethodDef BufferedRWPair_methods[] = { + {"read", (PyCFunction)BufferedRWPair_read, METH_VARARGS}, + {"peek", (PyCFunction)BufferedRWPair_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedRWPair_read1, METH_VARARGS}, + + {"write", (PyCFunction)BufferedRWPair_write, METH_VARARGS}, + {"flush", (PyCFunction)BufferedRWPair_flush, METH_NOARGS}, + + {"readable", (PyCFunction)BufferedRWPair_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedRWPair_writable, METH_NOARGS}, + + {"close", (PyCFunction)BufferedRWPair_close, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedRWPair_isatty, METH_NOARGS}, + + {NULL, NULL} +}; + +PyTypeObject BufferedRWPair_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedRWPair", /*tp_name*/ + sizeof(BufferedRWPairObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedRWPair_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedRWPair_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedRWPair_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +/* + * BufferedRandom + */ + +PyDoc_STRVAR(BufferedRandom_doc, + "A buffered interface to random access streams.\n" + "\n" + "The constructor creates a reader and writer for a seekable stream,\n" + "raw, given in the first argument. If the buffer_size is omitted it\n" + "defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered\n" + "writer) defaults to twice the buffer size.\n" + ); + +static int +BufferedRandom_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (IOBase_checkSeekable(raw, NULL) == NULL) + return -1; + if (IOBase_checkReadable(raw, NULL) == NULL) + return -1; + if (IOBase_checkWritable(raw, NULL) == NULL) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + if (max_buffer_size < 0) + max_buffer_size = buffer_size * 2; + self->buffer_size = buffer_size; + self->max_buffer_size = max_buffer_size; + + if( _BufferedReader_reset_read_buf(self) < 0) + return -1; + + self->read_lock = PyThread_allocate_lock(); + if (self->read_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } + + self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); + if (self->write_buf == NULL) + return -1; + + self->write_lock = PyThread_allocate_lock(); + if (self->write_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); + return -1; + } + + return 0; +} + +static PyObject * +BufferedRandom_tell(BufferedObject *self, PyObject *args) +{ + if (Py_SIZE(self->write_buf)) + return BufferedWriter_tell(self, args); + else + return BufferedReader_tell(self, args); +} + +static PyObject * +BufferedRandom_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + res = PyObject_CallMethod((PyObject*)self, "flush", NULL); + if (res == NULL) + return NULL; + + /* First do the raw seek, then empty the read buffer, so that + * if the raw seek fails, we don't lose buffered data forever. + */ + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + if (res == NULL) + return NULL; + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + if( _BufferedReader_reset_read_buf(self) < 0) + Py_CLEAR(res); + + PyThread_release_lock(self->read_lock); + return res; +} + +static PyObject * +BufferedRandom_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + if (pos == Py_None) + pos = PyObject_CallMethod(self->raw, "tell", NULL); + else + Py_INCREF(pos); + + /* Use seek to flush the read buffer. */ + res = PyObject_CallMethod((PyObject *)self, "seek", "O", pos); + Py_DECREF(pos); + if (res == NULL) + return NULL; + Py_DECREF(res); + + args = PyTuple_New(0); + if (args == NULL) + return NULL; + res = BufferedWriter_truncate(self, args); + Py_DECREF(args); + + return res; +} + +static PyObject * +BufferedRandom_read(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + + return BufferedReader_read(self, args); +} + +static PyObject * +BufferedRandom_readinto(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedIOBase_readinto((PyObject *)self, args); +} + +static PyObject * +BufferedRandom_peek(BufferedObject *self, PyObject *args) +{ + PyObject *res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedReader_peek(self, args); +} + +static PyObject * +BufferedRandom_read1(BufferedObject *self, PyObject *args) +{ + PyObject *res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedReader_read1(self, args); +} + +static PyObject * +BufferedRandom_write(BufferedObject *self, PyObject *args) +{ + if (Py_SIZE(self->read_buf) > 0) { + PyObject *res; + /* Undo readahead */ + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = PyObject_CallMethod(self->raw, "seek", "ni", + self->read_pos - Py_SIZE(self->read_buf), 1); + Py_XDECREF(res); + if (res != NULL) { + if( _BufferedReader_reset_read_buf(self) < 0) + res = NULL; + } + + PyThread_release_lock(self->read_lock); + + if (res == NULL) + return NULL; + } + + return BufferedWriter_write(self, args); +} + + +static PyMethodDef BufferedRandom_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, + + {"seek", (PyCFunction)BufferedRandom_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedRandom_tell, METH_NOARGS}, + {"truncate", (PyCFunction)BufferedRandom_truncate, METH_VARARGS}, + {"read", (PyCFunction)BufferedRandom_read, METH_VARARGS}, + {"readinto", (PyCFunction)BufferedRandom_readinto, METH_VARARGS}, + {"peek", (PyCFunction)BufferedRandom_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedRandom_read1, METH_VARARGS}, + {"write", (PyCFunction)BufferedRandom_write, METH_VARARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedRandom_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedRandom_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject BufferedRandom_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedRandom", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedRandom_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedRandom_methods, /* tp_methods */ + BufferedRandom_members, /* tp_members */ + BufferedRandom_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /*tp_dict*/ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /*tp_dictoffset*/ + (initproc)BufferedRandom_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + +/* + * Module definition + */ + +static PyMethodDef module_methods[] = { + {"open", (PyCFunction)io_open, METH_VARARGS|METH_KEYWORDS, open_doc}, + {NULL, NULL} +}; + +static struct PyModuleDef iomodule = { + PyModuleDef_HEAD_INIT, + "io", + module_doc, + -1, + module_methods, + NULL, + NULL, + NULL, + NULL +}; + +PyMODINIT_FUNC +PyInit__io() +{ + PyObject *m = PyModule_Create(&iomodule); + PyTypeObject *base; + if (m == NULL) + goto fail; + + io_py_module = PyImport_ImportModule("io"); + if (io_py_module == NULL) + goto fail; + + /* UnsupportedOperation inherits from ValueError and IOError */ + PyExc_UnsupportedOperation = PyObject_CallFunction( + (PyObject*)&PyType_Type, "s(OO){}", + "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + if (PyExc_UnsupportedOperation == NULL) + goto fail; + PyModule_AddObject(m, "UnsupportedOperation", + PyExc_UnsupportedOperation); + + /* BlockingIOError */ + base = (PyTypeObject*)PyExc_IOError; + _PyExc_BlockingIOError.tp_base = base; + if (PyType_Ready(&_PyExc_BlockingIOError) < 0) + goto fail; + Py_INCREF(&_PyExc_BlockingIOError); + PyModule_AddObject(m, "BlockingIOError", + (PyObject *)&_PyExc_BlockingIOError); + + if (PyType_Ready(&_IOBase_Type) < 0) + goto fail; + Py_INCREF(&_IOBase_Type); + PyModule_AddObject(m, "IOBase", + (PyObject *)&_IOBase_Type); + + if (PyType_Ready(&_RawIOBase_Type) < 0) + goto fail; + Py_INCREF(&_RawIOBase_Type); + PyModule_AddObject(m, "RawIOBase", + (PyObject *)&_RawIOBase_Type); + + /* FileIO */ + PyFileIO_Type.tp_base = &_RawIOBase_Type; + if (PyType_Ready(&PyFileIO_Type) < 0) + goto fail; + Py_INCREF(&PyFileIO_Type); + PyModule_AddObject(m, "FileIO", (PyObject *) &PyFileIO_Type); + + /* BufferedIOBase */ + if (PyType_Ready(&_BufferedIOBase_Type) < 0) + goto fail; + Py_INCREF(&_BufferedIOBase_Type); + PyModule_AddObject(m, "BufferedIOBase", (PyObject *) &_BufferedIOBase_Type); + + /* BytesIO */ + PyBytesIO_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&PyBytesIO_Type) < 0) + goto fail; + Py_INCREF(&PyBytesIO_Type); + PyModule_AddObject(m, "BytesIO", (PyObject *) &PyBytesIO_Type); + + /* BufferedReader */ + BufferedReader_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedReader_Type) < 0) + goto fail; + Py_INCREF(&BufferedReader_Type); + PyModule_AddObject(m, "BufferedReader", (PyObject *) &BufferedReader_Type); + + /* BufferedWriter */ + BufferedWriter_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedWriter_Type) < 0) + goto fail; + Py_INCREF(&BufferedWriter_Type); + PyModule_AddObject(m, "BufferedWriter", (PyObject *) &BufferedWriter_Type); + + /* BufferedRWPair */ + BufferedRWPair_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedRWPair_Type) < 0) + goto fail; + Py_INCREF(&BufferedRWPair_Type); + PyModule_AddObject(m, "BufferedRWPair", (PyObject *) &BufferedRWPair_Type); + + /* BufferedRandom */ + BufferedRandom_Type.tp_base = &_BufferedIOBase_Type; + if (PyType_Ready(&BufferedRandom_Type) < 0) + goto fail; + Py_INCREF(&BufferedRandom_Type); + PyModule_AddObject(m, "BufferedRandom", (PyObject *) &BufferedRandom_Type); + + return m; + + fail: + Py_XDECREF(m); + return NULL; +} From buildbot at python.org Fri Nov 7 00:08:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 06 Nov 2008 23:08:49 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081106230849.E56B81E4002@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/654 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_subprocess ====================================================================== ERROR: test_no_leaking (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_subprocess.py", line 423, in test_no_leaking data = p.communicate(b"lime")[0] File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 671, in communicate return self._communicate(input) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 1171, in _communicate bytes_written = os.write(self.stdin.fileno(), chunk) OSError: [Errno 32] Broken pipe make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Nov 7 01:26:37 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 7 Nov 2008 01:26:37 +0100 (CET) Subject: [Python-checkins] r67131 - in sandbox/trunk/io-c: _bufferedio.c _fileio.c _iobase.c _iomodule.h build.py io.c Message-ID: <20081107002637.52DDC1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Fri Nov 7 01:26:36 2008 New Revision: 67131 Log: Split the module into more manageable pieces. Added: sandbox/trunk/io-c/_bufferedio.c (contents, props changed) sandbox/trunk/io-c/_iobase.c (contents, props changed) sandbox/trunk/io-c/_iomodule.h (contents, props changed) Modified: sandbox/trunk/io-c/_fileio.c sandbox/trunk/io-c/build.py sandbox/trunk/io-c/io.c Added: sandbox/trunk/io-c/_bufferedio.c ============================================================================== --- (empty file) +++ sandbox/trunk/io-c/_bufferedio.c Fri Nov 7 01:26:36 2008 @@ -0,0 +1,1637 @@ +#include "Python.h" +#include "structmember.h" +#include "pythread.h" +#include "_iomodule.h" + +/* + * BufferedIOBase class, inherits from IOBase. + */ +PyDoc_STRVAR(BufferedIOBase_doc, + "Base class for buffered IO objects.\n" + "\n" + "The main difference with RawIOBase is that the read() method\n" + "supports omitting the size argument, and does not have a default\n" + "implementation that defers to readinto().\n" + "\n" + "In addition, read(), readinto() and write() may raise\n" + "BlockingIOError if the underlying raw stream is in non-blocking\n" + "mode and not ready; unlike their raw counterparts, they will never\n" + "return None.\n" + "\n" + "A typical implementation should not inherit from a RawIOBase\n" + "implementation, but wrap one.\n" + ); + +static PyObject * +BufferedIOBase_readinto(PyObject *self, PyObject *args) +{ + Py_buffer buf; + Py_ssize_t len; + PyObject *data; + + if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { + return NULL; + } + + data = PyObject_CallMethod(self, "read", "n", buf.len); + if (data == NULL) + goto error; + + if (!PyBytes_Check(data)) { + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + goto error; + } + + len = Py_SIZE(data); + memcpy(buf.buf, PyBytes_AS_STRING(data), len); + + PyBuffer_Release(&buf); + Py_DECREF(data); + + return PyLong_FromSsize_t(len); + + error: + PyBuffer_Release(&buf); + return NULL; +} + +static PyMethodDef BufferedIOBase_methods[] = { + {"readinto", BufferedIOBase_readinto, METH_VARARGS}, + {NULL, NULL} +}; + +PyTypeObject PyBufferedIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + BufferedIOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedIOBase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyIOBase_Type, /* 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 */ +}; + + +typedef struct { + PyObject_HEAD + + PyObject *raw; + + PyObject *name; + PyObject *mode; + + PyObject *read_buf; + Py_ssize_t read_pos; + PyThread_type_lock read_lock; + + PyObject *write_buf; + PyThread_type_lock write_lock; + + Py_ssize_t buffer_size; + Py_ssize_t max_buffer_size; + + PyObject *dict; + PyObject *weakreflist; +} BufferedObject; + +static void +BufferedObject_dealloc(BufferedObject *self) +{ + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + Py_CLEAR(self->raw); + Py_CLEAR(self->name); + Py_CLEAR(self->mode); + Py_CLEAR(self->read_buf); + Py_CLEAR(self->write_buf); + Py_CLEAR(self->dict); +} + + +/* + * _BufferedIOMixin methods + * This is not a class, just a collection of methods that will be reused + * by BufferedReader and BufferedWriter + */ + +/* Positioning */ + +static PyObject* +BufferedIOMixin_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + /* Flush the stream. We're mixing buffered I/O with lower-level I/O, + * and a flush may be necessary to synch both views of the current + * file state. + */ + res = PyObject_CallMethod(self->raw, "flush", NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + + if (pos == Py_None) + pos = PyObject_CallMethod(self->raw, "tell", NULL); + else + Py_INCREF(pos); + + /* XXX: Should seek() be used, instead of passing the position + * XXX directly to truncate? + */ + res = PyObject_CallMethod(self->raw, "truncate", "O", pos); + Py_DECREF(pos); + + return res; +} + +/* Flush and close */ + +static PyObject* +BufferedIOMixin_flush(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "flush", NULL); +} + +static int +BufferedIOMixin_closed(BufferedObject *self) +{ + int closed; + PyObject *res = PyObject_GetAttrString(self->raw, "closed"); + if (res == NULL) + return 0; + closed = PyObject_IsTrue(res); + Py_DECREF(res); + return closed; +} + +static PyObject * +BufferedIOMixin_closed_get(BufferedObject *self, void *context) +{ + return PyObject_GetAttrString(self->raw, "closed"); +} + + +static PyObject* +BufferedIOMixin_close(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + if (BufferedIOMixin_closed(self)) + Py_RETURN_NONE; + + res = PyObject_CallMethod((PyObject *)self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + + return PyObject_CallMethod(self->raw, "close", NULL); +} + +/* Inquiries */ + +static PyObject* +BufferedIOMixin_seekable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "seekable", NULL); +} + +static PyObject* +BufferedIOMixin_readable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "readable", NULL); +} + +static PyObject* +BufferedIOMixin_writable(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "writable", NULL); +} + +/* Lower-level APIs */ + +static PyObject* +BufferedIOMixin_fileno(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "fileno", NULL); +} + +static PyObject* +BufferedIOMixin_isatty(BufferedObject *self, PyObject *args) +{ + return PyObject_CallMethod(self->raw, "isatty", NULL); +} + + +/* + * class BufferedReader + */ + +PyDoc_STRVAR(BufferedReader_doc, + "Create a new buffered reader using the given readable raw IO object."); + +static int _BufferedReader_reset_read_buf(BufferedObject *self) +{ + PyObject *oldbuf = self->read_buf; + + self->read_buf = PyBytes_FromStringAndSize(NULL, 0); + self->read_pos = 0; + + Py_XDECREF(oldbuf); + + if (self->read_buf == NULL) + return -1; + + return 0; +} + +static int +BufferedReader_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, + &raw, &buffer_size)) { + return -1; + } + + if (_PyIOBase_checkReadable(raw, NULL) == NULL) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + self->buffer_size = buffer_size; + self->read_buf = NULL; + + if( _BufferedReader_reset_read_buf(self) < 0) + return -1; + + self->read_lock = PyThread_allocate_lock(); + if (self->read_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } + + return 0; +} + +static PyObject * +_BufferedReader_read_unlocked(BufferedObject *self, Py_ssize_t n) +{ + PyObject *nodata_val = NULL; + PyObject *empty_values = NULL; + + PyObject *buf = self->read_buf; + Py_ssize_t pos = self->read_pos; + PyObject *data, *chunks, *sep, *res; + Py_ssize_t current_size; + + /* Special case for when the number of bytes to read is unspecified. */ + if (n == -1) { + chunks = PyList_New(0); + if (chunks == NULL) + return NULL; + + Py_INCREF(buf); + if (_BufferedReader_reset_read_buf(self) < 0) + return NULL; + + /* Strip the consumed bytes */ + current_size = Py_SIZE(buf) - pos; + data = NULL; + if (current_size) { + data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); + if (data == NULL) { + Py_DECREF(buf); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(buf); + } + + while (1) { + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + /* Read until EOF or until read() would block. */ + data = PyObject_CallMethod(self->raw, "read", NULL); + + if (data == NULL) { + Py_DECREF(chunks); + return NULL; + } + + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (data == Py_None || Py_SIZE(data) == 0) { + if (current_size == 0) { + Py_DECREF(chunks); + return data; + } + else { + Py_DECREF(data); + sep = PyBytes_FromStringAndSize(NULL, 0); + + if (sep == NULL) { + Py_DECREF(chunks); + return NULL; + } + res =_PyBytes_Join(sep, chunks); + Py_DECREF(sep); + Py_DECREF(chunks); + + return res; + } + } + + current_size += Py_SIZE(data); + } + } + + /* The number of bytes to read is specified, return at most n bytes. */ + + current_size = Py_SIZE(buf) - pos; /* Length of the available buffered data. */ + if (n <= current_size) { + /* Fast path: the data to read is fully buffered. */ + self->read_pos += n; + return PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, n); + } + + /* Slow path: read from the stream until enough bytes are read, + * or until an EOF occurs or until read() would block. + */ + chunks = PyList_New(0); + if (chunks == NULL) + return NULL; + + data = NULL; + + if (current_size) + data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); + + while (1) { + Py_ssize_t wanted; + + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + if (current_size >= n) + break; + + wanted = n; + if (wanted < self->buffer_size) + wanted = self->buffer_size; + + data = PyObject_CallMethod(self->raw, "read", "n", wanted); + + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (data == Py_None || Py_SIZE(data) == 0) { + /* EOF occurred or read() would block. */ + + if (current_size == 0) { + Py_DECREF(chunks); + + if( _BufferedReader_reset_read_buf(self) < 0) { + Py_DECREF(data); + return NULL; + } + + return data; + } + else { + Py_DECREF(data); + break; + } + } + + current_size += Py_SIZE(data); + } + + sep = PyBytes_FromStringAndSize(NULL, 0); + + if (sep == NULL) { + Py_DECREF(chunks); + return NULL; + } + + res =_PyBytes_Join(sep, chunks); + Py_DECREF(sep); + Py_DECREF(chunks); + + if (Py_SIZE(res) > n) { + /* Save the extra data in the buffer. */ + self->read_pos = 0; + buf = self->read_buf; + self->read_buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res) + n, Py_SIZE(res) - n); + Py_DECREF(buf); + if (self->read_buf == NULL) { + Py_DECREF(res); + return NULL; + } + + /* Truncate the result to the desired length */ + buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res), n); + if (buf == NULL) { + Py_DECREF(res); + return NULL; + } + + Py_DECREF(res); + res = buf; + } + + return res; +} + +static PyObject * +BufferedReader_read(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_read_unlocked(self, n); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject * +_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t n) +{ + Py_ssize_t have; + + if (n > self->buffer_size) + n = self->buffer_size; + + have = Py_SIZE(self->read_buf) - self->read_pos; + + if (have < n) { + Py_ssize_t to_read = self->buffer_size - have; + PyObject *current = PyObject_CallMethod(self->raw, "read", "n", to_read); + + if (current == NULL) + return NULL; + + if (!PyBytes_Check(current)) { + Py_DECREF(current); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + if (Py_SIZE(current) > 0) { + PyObject *oldbuf = self->read_buf; + self->read_buf = PyBytes_FromStringAndSize(NULL, have + Py_SIZE(current)); + memcpy(PyBytes_AS_STRING(self->read_buf), PyBytes_AS_STRING(oldbuf) + self->read_pos, have); + memcpy(PyBytes_AS_STRING(self->read_buf) + have, PyBytes_AS_STRING(current), Py_SIZE(current)); + self->read_pos = 0; + } + Py_DECREF(current); + } + + if (self->read_pos == 0) { + Py_INCREF(self->read_buf); + return self->read_buf; + } + else { + return PyBytes_FromStringAndSize( + PyBytes_AS_STRING(self->read_buf) + self->read_pos, + Py_SIZE(self->read_buf) - self->read_pos); + } +} + +static PyObject * +BufferedReader_peek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:peek", &n)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_peek_unlocked(self, n); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject * +BufferedReader_read1(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n, have; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n:read1", &n)) { + return NULL; + } + + if (n <= 0) + return PyBytes_FromStringAndSize(NULL, 0); + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedReader_peek_unlocked(self, 1); + if(res == NULL) + goto end; + Py_DECREF(res); + + have = Py_SIZE(self->read_buf) - self->read_pos; + if (n > have) + n = have; + + res = _BufferedReader_read_unlocked(self, n); + + end: + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject* +BufferedReader_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + if (whence == 1) { + pos -= Py_SIZE(self->read_buf) - self->read_pos; + } + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + if (res == NULL) + return NULL; + + if (_BufferedReader_reset_read_buf(self) < 0) + Py_CLEAR(res); + + PyThread_release_lock(self->read_lock); + + return res; +} + +static PyObject* +BufferedReader_tell(BufferedObject *self, PyObject *args) +{ + PyObject *op1, *op2, *res; + + op1 = PyObject_CallMethod(self->raw, "tell", NULL); + + if (op1 == NULL) + return NULL; + + op2 = PyLong_FromSsize_t(Py_SIZE(self->read_buf) - self->read_pos); + if (op2 == NULL) { + Py_DECREF(op1); + return NULL; + } + + res = PyNumber_Subtract(op1, op2); + Py_DECREF(op1); + Py_DECREF(op2); + return res; +} + +static PyMethodDef BufferedReader_methods[] = { + /* BufferedIOMixin methods */ + {"truncate", (PyCFunction)BufferedIOMixin_truncate, METH_VARARGS}, + {"flush", (PyCFunction)BufferedIOMixin_flush, METH_NOARGS}, + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"read", (PyCFunction)BufferedReader_read, METH_VARARGS}, + {"peek", (PyCFunction)BufferedReader_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedReader_read1, METH_VARARGS}, + {"seek", (PyCFunction)BufferedReader_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedReader_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedReader_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedReader_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject PyBufferedReader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedReader", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedReader_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedReader_methods, /* tp_methods */ + BufferedReader_members, /* tp_members */ + BufferedReader_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedReader_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + +/* + * class BufferedWriter + */ +PyDoc_STRVAR(BufferedWriter_doc, + "A buffer for a writeable sequential RawIO object.\n" + "\n" + "The constructor creates a BufferedWriter for the given writeable raw\n" + "stream. If the buffer_size is not given, it defaults to\n" + "DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to\n" + "twice the buffer size.\n" + ); + +static int +BufferedWriter_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (_PyIOBase_checkWritable(raw, NULL) == NULL) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + if (max_buffer_size < 0) + max_buffer_size = buffer_size * 2; + self->buffer_size = buffer_size; + self->max_buffer_size = max_buffer_size; + + self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); + if (self->write_buf == NULL) + return -1; + + self->write_lock = PyThread_allocate_lock(); + if (self->write_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); + return -1; + } + + return 0; +} + +static PyObject * +_BufferedWriter_flush_unlocked(BufferedObject *self) +{ + Py_ssize_t written = 0; + + if (BufferedIOMixin_closed(self)) { + PyErr_SetString(PyExc_ValueError, "flush of closed file"); + return NULL; + } + + while (Py_SIZE(self->write_buf) > 0) { + PyObject *slice, *res; + Py_ssize_t w; + PyObject *n = PyObject_CallMethod(self->raw, "write", "O", self->write_buf); + + if (n == NULL) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value == NULL || + !PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + PyErr_Restore(type, value, traceback); + return NULL; + } + + w = ((PyBlockingIOErrorObject *)value)->written; + + /* del self->write_buf[:w] */ + slice = _PySlice_FromIndices(0, w); + if (slice == NULL) + return NULL; + res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); + Py_DECREF(slice); + if (res == NULL) + return NULL; + Py_DECREF(res); + + written += w; + ((PyBlockingIOErrorObject *)value)->written = written; + + PyErr_Restore(type, value, traceback); + return NULL; + } + + /* del self->write_buf[:w] */ + w = PyNumber_AsSsize_t(n, PyExc_ValueError); + Py_DECREF(n); + if (w == -1 && PyErr_Occurred()) + return NULL; + + slice = _PySlice_FromIndices(0, w); + if (slice == NULL) + return NULL; + res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); + Py_DECREF(slice); + if (res == NULL) + return NULL; + Py_DECREF(res); + + written += w; + } + + Py_RETURN_NONE; +} + +static PyObject * +BufferedWriter_write(BufferedObject *self, PyObject *args) +{ + PyObject *res; + Py_buffer buf; + Py_ssize_t before, written; + + if (!PyArg_ParseTuple(args, "y*:write", &buf)) { + return NULL; + } + + if (BufferedIOMixin_closed(self)) { + PyErr_SetString(PyExc_ValueError, "write to closed file"); + PyBuffer_Release(&buf); + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + /* XXX we can implement some more tricks to try and avoid + * partial writes + */ + + if (Py_SIZE(self->write_buf) > self->buffer_size) { + /* We're full, so let's pre-flush the buffer*/ + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) { + /* We can't accept anything else. */ + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value != NULL && + PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + ((PyBlockingIOErrorObject *)value)->written = 0; + } + + PyErr_Restore(type, value, traceback); + goto fail; + } + } + + written = buf.len; + + before = Py_SIZE(self->write_buf); + if (PyByteArray_Resize(self->write_buf, before + written) < 0) { + res = NULL; + goto fail; + } + memcpy(PyByteArray_AS_STRING(self->write_buf) + before, buf.buf, written); + + if (Py_SIZE(self->write_buf) > self->buffer_size) { + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + if (value != NULL && + PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { + + Py_ssize_t overage = + Py_SIZE(self->write_buf) - self->max_buffer_size; + + if (overage > 0) { + /* We've hit max_buffer_size. We have to accept a + * partial write and cut back our buffer. + */ + if (PyByteArray_Resize(self->write_buf, self->max_buffer_size) < 0) + goto fail; + ((PyBlockingIOErrorObject *)value)->written = overage; + } + else + { + Py_CLEAR(type); + Py_CLEAR(value); + Py_CLEAR(traceback); + goto end; + } + } + + PyErr_Restore(type, value, traceback); + goto fail; + } + } + + end: + res = PyLong_FromSsize_t(written); + + fail: + PyThread_release_lock(self->write_lock); + PyBuffer_Release(&buf); + return res; +} + +static PyObject * +BufferedWriter_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) + goto end; + Py_DECREF(res); + + res = BufferedIOMixin_truncate(self, args); + + end: + PyThread_release_lock(self->write_lock); + return res; +} + +static PyObject * +BufferedWriter_flush(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + + PyThread_release_lock(self->write_lock); + + return res; +} + +static PyObject * +BufferedWriter_tell(BufferedObject *self, PyObject *args) +{ + PyObject *op1, *op2, *res; + + op1 = PyObject_CallMethod(self->raw, "tell", NULL); + + op2 = PyLong_FromSsize_t(Py_SIZE(self->write_buf)); + if (op2 == NULL) { + Py_DECREF(op1); + return NULL; + } + + res = PyNumber_Add(op1, op2); + Py_DECREF(op1); + Py_DECREF(op2); + return res; +} + +static PyObject * +BufferedWriter_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->write_lock, 1); + Py_END_ALLOW_THREADS + + res = _BufferedWriter_flush_unlocked(self); + if (res == NULL) + goto end; + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + + end: + PyThread_release_lock(self->write_lock); + return res; +} + +static PyMethodDef BufferedWriter_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, + {"truncate", (PyCFunction)BufferedWriter_truncate, METH_VARARGS}, + {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, + {"seek", (PyCFunction)BufferedWriter_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedWriter_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedWriter_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedWriter_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject PyBufferedWriter_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedWriter", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedWriter_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedWriter_methods, /* tp_methods */ + BufferedWriter_members, /* tp_members */ + BufferedWriter_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedWriter_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +/* + * BufferedRWPair + */ + +PyDoc_STRVAR(BufferedRWPair_doc, + "A buffered reader and writer object together.\n" + "\n" + "A buffered reader object and buffered writer object put together to\n" + "form a sequential IO object that can read and write. This is typically\n" + "used with a socket or two-way pipe.\n" + "\n" + "reader and writer are RawIOBase objects that are readable and\n" + "writeable respectively. If the buffer_size is omitted it defaults to\n" + "DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer)\n" + "defaults to twice the buffer size.\n" + ); + +/* XXX The usefulness of this (compared to having two separate IO objects) is + * questionable. + */ + +typedef struct { + PyObject_HEAD + BufferedObject *reader; + BufferedObject *writer; +} BufferedRWPairObject; + +static int +BufferedRWPair_init(BufferedRWPairObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *reader, *writer; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + + if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, + &buffer_size, &max_buffer_size)) { + return -1; + } + + if (_PyIOBase_checkReadable(reader, NULL) == NULL) + return -1; + if (_PyIOBase_checkWritable(writer, NULL) == NULL) + return -1; + + args = Py_BuildValue("(n)", buffer_size); + if (args == NULL) { + Py_CLEAR(self->reader); + return -1; + } + self->reader = (BufferedObject*)PyType_GenericNew(&PyBufferedReader_Type, args, NULL); + Py_DECREF(args); + if (self->reader == NULL) + return -1; + + args = Py_BuildValue("(nn)", buffer_size, max_buffer_size); + if (args == NULL) { + Py_CLEAR(self->reader); + return -1; + } + self->writer = (BufferedObject*)PyType_GenericNew(&PyBufferedWriter_Type, args, NULL); + Py_DECREF(args); + if (self->writer == NULL) { + Py_CLEAR(self->reader); + return -1; + } + return 0; +} + +static void +BufferedRWPair_dealloc(BufferedRWPairObject *self) +{ + Py_CLEAR(self->reader); + Py_CLEAR(self->writer); +} + +static PyObject * +_forward_call(BufferedObject *self, const char* name, PyObject *args) +{ + PyObject *func = PyObject_GetAttrString((PyObject*)self, name); + PyObject *ret; + + if (func == NULL) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + ret = PyObject_CallObject(func, args); + Py_DECREF(func); + return ret; +} + +static PyObject * +BufferedRWPair_read(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "read", args); +} + +static PyObject * +BufferedRWPair_peek(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "peek", args); +} + +static PyObject * +BufferedRWPair_read1(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "read1", args); +} + +static PyObject * +BufferedRWPair_write(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "write", args); +} + +static PyObject * +BufferedRWPair_flush(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "flush", args); +} + +static PyObject * +BufferedRWPair_readable(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->reader, "readable", args); +} + +static PyObject * +BufferedRWPair_writable(BufferedRWPairObject *self, PyObject *args) +{ + return _forward_call(self->writer, "writable", args); +} + +static PyObject * +BufferedRWPair_close(BufferedRWPairObject *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "close", args); + if (ret == NULL) + return NULL; + Py_DECREF(ret); + + return _forward_call(self->reader, "close", args); +} + +static PyObject * +BufferedRWPair_isatty(BufferedRWPairObject *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "isatty", args); + + if (ret != Py_False) { + /* either True or exception */ + return ret; + } + Py_DECREF(ret); + + return _forward_call(self->reader, "isatty", args); +} + + +static PyMethodDef BufferedRWPair_methods[] = { + {"read", (PyCFunction)BufferedRWPair_read, METH_VARARGS}, + {"peek", (PyCFunction)BufferedRWPair_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedRWPair_read1, METH_VARARGS}, + + {"write", (PyCFunction)BufferedRWPair_write, METH_VARARGS}, + {"flush", (PyCFunction)BufferedRWPair_flush, METH_NOARGS}, + + {"readable", (PyCFunction)BufferedRWPair_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedRWPair_writable, METH_NOARGS}, + + {"close", (PyCFunction)BufferedRWPair_close, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedRWPair_isatty, METH_NOARGS}, + + {NULL, NULL} +}; + +PyTypeObject PyBufferedRWPair_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedRWPair", /*tp_name*/ + sizeof(BufferedRWPairObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedRWPair_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedRWPair_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /* tp_dictoffset */ + (initproc)BufferedRWPair_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +/* + * BufferedRandom + */ + +PyDoc_STRVAR(BufferedRandom_doc, + "A buffered interface to random access streams.\n" + "\n" + "The constructor creates a reader and writer for a seekable stream,\n" + "raw, given in the first argument. If the buffer_size is omitted it\n" + "defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered\n" + "writer) defaults to twice the buffer size.\n" + ); + +static int +BufferedRandom_init(BufferedObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -1; + PyObject *raw; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (_PyIOBase_checkSeekable(raw, NULL) == NULL) + return -1; + if (_PyIOBase_checkReadable(raw, NULL) == NULL) + return -1; + if (_PyIOBase_checkWritable(raw, NULL) == NULL) + return -1; + + Py_INCREF(raw); + self->raw = raw; + + if (max_buffer_size < 0) + max_buffer_size = buffer_size * 2; + self->buffer_size = buffer_size; + self->max_buffer_size = max_buffer_size; + + if( _BufferedReader_reset_read_buf(self) < 0) + return -1; + + self->read_lock = PyThread_allocate_lock(); + if (self->read_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } + + self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); + if (self->write_buf == NULL) + return -1; + + self->write_lock = PyThread_allocate_lock(); + if (self->write_lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); + return -1; + } + + return 0; +} + +static PyObject * +BufferedRandom_tell(BufferedObject *self, PyObject *args) +{ + if (Py_SIZE(self->write_buf)) + return BufferedWriter_tell(self, args); + else + return BufferedReader_tell(self, args); +} + +static PyObject * +BufferedRandom_seek(BufferedObject *self, PyObject *args) +{ + Py_ssize_t pos; + int whence = 0; + PyObject *res; + + if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { + return NULL; + } + + res = PyObject_CallMethod((PyObject*)self, "flush", NULL); + if (res == NULL) + return NULL; + + /* First do the raw seek, then empty the read buffer, so that + * if the raw seek fails, we don't lose buffered data forever. + */ + + res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); + if (res == NULL) + return NULL; + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + if( _BufferedReader_reset_read_buf(self) < 0) + Py_CLEAR(res); + + PyThread_release_lock(self->read_lock); + return res; +} + +static PyObject * +BufferedRandom_truncate(BufferedObject *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + if (pos == Py_None) + pos = PyObject_CallMethod(self->raw, "tell", NULL); + else + Py_INCREF(pos); + + /* Use seek to flush the read buffer. */ + res = PyObject_CallMethod((PyObject *)self, "seek", "O", pos); + Py_DECREF(pos); + if (res == NULL) + return NULL; + Py_DECREF(res); + + args = PyTuple_New(0); + if (args == NULL) + return NULL; + res = BufferedWriter_truncate(self, args); + Py_DECREF(args); + + return res; +} + +static PyObject * +BufferedRandom_read(BufferedObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + + return BufferedReader_read(self, args); +} + +static PyObject * +BufferedRandom_readinto(BufferedObject *self, PyObject *args) +{ + PyObject *res; + + res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedIOBase_readinto((PyObject *)self, args); +} + +static PyObject * +BufferedRandom_peek(BufferedObject *self, PyObject *args) +{ + PyObject *res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedReader_peek(self, args); +} + +static PyObject * +BufferedRandom_read1(BufferedObject *self, PyObject *args) +{ + PyObject *res = BufferedWriter_flush(self, Py_None); + if (res == NULL) + return NULL; + Py_DECREF(res); + + return BufferedReader_read1(self, args); +} + +static PyObject * +BufferedRandom_write(BufferedObject *self, PyObject *args) +{ + if (Py_SIZE(self->read_buf) > 0) { + PyObject *res; + /* Undo readahead */ + + Py_BEGIN_ALLOW_THREADS + PyThread_acquire_lock(self->read_lock, 1); + Py_END_ALLOW_THREADS + + res = PyObject_CallMethod(self->raw, "seek", "ni", + self->read_pos - Py_SIZE(self->read_buf), 1); + Py_XDECREF(res); + if (res != NULL) { + if( _BufferedReader_reset_read_buf(self) < 0) + res = NULL; + } + + PyThread_release_lock(self->read_lock); + + if (res == NULL) + return NULL; + } + + return BufferedWriter_write(self, args); +} + + +static PyMethodDef BufferedRandom_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, + {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, + {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, + {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, + {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, + + {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, + + {"seek", (PyCFunction)BufferedRandom_seek, METH_VARARGS}, + {"tell", (PyCFunction)BufferedRandom_tell, METH_NOARGS}, + {"truncate", (PyCFunction)BufferedRandom_truncate, METH_VARARGS}, + {"read", (PyCFunction)BufferedRandom_read, METH_VARARGS}, + {"readinto", (PyCFunction)BufferedRandom_readinto, METH_VARARGS}, + {"peek", (PyCFunction)BufferedRandom_peek, METH_VARARGS}, + {"read1", (PyCFunction)BufferedRandom_read1, METH_VARARGS}, + {"write", (PyCFunction)BufferedRandom_write, METH_VARARGS}, + {NULL, NULL} +}; + +static PyMemberDef BufferedRandom_members[] = { + {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, + {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, + {NULL} +}; + +static PyGetSetDef BufferedRandom_getset[] = { + {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject PyBufferedRandom_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "BufferedRandom", /*tp_name*/ + sizeof(BufferedObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + BufferedRandom_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BufferedRandom_methods, /* tp_methods */ + BufferedRandom_members, /* tp_members */ + BufferedRandom_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /*tp_dict*/ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(BufferedObject, dict), /*tp_dictoffset*/ + (initproc)BufferedRandom_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + Modified: sandbox/trunk/io-c/_fileio.c ============================================================================== --- sandbox/trunk/io-c/_fileio.c (original) +++ sandbox/trunk/io-c/_fileio.c Fri Nov 7 01:26:36 2008 @@ -6,8 +6,7 @@ #include #include #include /* For offsetof */ - -extern PyObject *PyRawIOBase; +#include "_iomodule.h" /* * Known likely problems: @@ -76,7 +75,7 @@ return NULL; } - return PyObject_CallMethod(PyRawIOBase, "close", "O", self); + return PyObject_CallMethod(&PyRawIOBase_Type, "close", "O", self); } static PyObject * Added: sandbox/trunk/io-c/_iobase.c ============================================================================== --- (empty file) +++ sandbox/trunk/io-c/_iobase.c Fri Nov 7 01:26:36 2008 @@ -0,0 +1,757 @@ +#include "Python.h" +#include "structmember.h" +#include "_iomodule.h" + +/* + * IOBase class, an abstract class + */ + +PyDoc_STRVAR(IOBase_doc, + "The abstract base class for all I/O classes, acting on streams of\n" + "bytes. There is no public constructor.\n" + "\n" + "This class provides dummy implementations for many methods that\n" + "derived classes can override selectively; the default implementations\n" + "represent a file that cannot be read, written or seeked.\n" + "\n" + "Even though IOBase does not declare read, readinto, or write because\n" + "their signatures will vary, implementations and clients should\n" + "consider those methods part of the interface. Also, implementations\n" + "may raise a IOError when operations they do not support are called.\n" + "\n" + "The basic type used for binary data read from or written to a file is\n" + "bytes. bytearrays are accepted too, and in some cases (such as\n" + "readinto) needed. Text I/O classes work with str data.\n" + "\n" + "Note that calling any method (even inquiries) on a closed stream is\n" + "undefined. Implementations may raise IOError in this case.\n" + "\n" + "IOBase (and its subclasses) support the iterator protocol, meaning\n" + "that an IOBase object can be iterated over yielding the lines in a\n" + "stream.\n" + "\n" + "IOBase also supports the :keyword:`with` statement. In this example,\n" + "fp is closed after the suite of the with statment is complete:\n" + "\n" + "with open('spam.txt', 'r') as fp:\n" + " fp.write('Spam and eggs!')\n"); + +/* Internal methods */ +static PyObject * +IOBase_unsupported(const char* message) +{ + PyErr_SetString(PyIOExc_UnsupportedOperation, message); + return NULL; +} + +/* Positionning */ + +PyDoc_STRVAR(IOBase_seek_doc, + "Change stream position.\n" + "\n" + "Change the stream position to byte offset offset. offset is\n" + "interpreted relative to the position indicated by whence. Values\n" + "for whence are:\n" + "\n" + "* 0 -- start of stream (the default); offset should be zero or positive\n" + "* 1 -- current stream position; offset may be negative\n" + "* 2 -- end of stream; offset is usually negative\n" + "\n" + "Return the new absolute position."); + +static PyObject* +IOBase_seek(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("seek"); +} + +PyDoc_STRVAR(IOBase_tell_doc, + "Return current stream position."); + +static PyObject * +IOBase_tell(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "tell", "ii", 0, 1); +} + +PyDoc_STRVAR(IOBase_truncate_doc, + "Truncate file to size bytes.\n" + "\n" + "Size defaults to the current IO position as reported by tell(). Return\n" + "the new size."); + +static PyObject* +IOBase_truncate(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("seek"); +} + +/* Flush and close methods */ + +PyDoc_STRVAR(IOBase_flush_doc, + "Flush write buffers, if applicable.\n" + "\n" + "This is not implemented for read-only and non-blocking streams.\n"); + +static PyObject* +IOBase_flush(PyObject *self, PyObject *args) +{ + /* XXX Should this return the number of bytes written??? */ + Py_RETURN_NONE; +} + +PyDoc_STRVAR(IOBase_close_doc, + "Flush and close the IO object.\n" + "\n" + "This method has no effect if the file is already closed.\n"); + +static int +IOBase_closed(PyObject *self) +{ + return PyObject_HasAttrString(self, "__IOBase_closed"); +} + +static PyObject * +IOBase_closed_get(PyObject *self, void *context) +{ + return PyBool_FromLong(IOBase_closed(self)); +} + + +PyObject * +_PyIOBase_checkClosed(PyObject *self, PyObject *unused) +{ + if (IOBase_closed(self)) { + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); + return NULL; + } + Py_RETURN_NONE; +} + +static PyObject* +IOBase_close(PyObject *self, PyObject *args) +{ + PyObject *res; + + if (IOBase_closed(self)) + Py_RETURN_NONE; + + PyObject_SetAttrString(self, "__IOBase_closed", Py_True); + + res = PyObject_CallMethod(self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + Py_RETURN_NONE; +} + +static void +IOBase_del(PyObject *self) +{ + PyObject *res = PyObject_CallMethod(self, "flush", NULL); + if (res == NULL) { + /* At program exit time, it's possible that globals have already been + * deleted, and then the close() call might fail. Since there's + * nothing we can do about such failures and they annoy the end + * users, we suppress the traceback. + */ + PyErr_Clear(); + } +} + +/* Inquiry methods */ + +PyDoc_STRVAR(IOBase_seekable_doc, + "Return whether object supports random access.\n" + "\n" + "If False, seek(), tell() and truncate() will raise IOError.\n" + "This method may need to do a test seek()."); + +static PyObject* +IOBase_seekable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +PyObject* +_PyIOBase_checkSeekable(PyObject *self, PyObject *unused) +{ + PyObject *res = PyObject_CallMethod(self, "seekable", NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); + } + return res; +} + +PyDoc_STRVAR(IOBase_readable_doc, + "Return whether object was opened for reading.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject* +IOBase_readable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +/* May be called with any object */ +PyObject* +_PyIOBase_checkReadable(PyObject *self, PyObject *unused) +{ + PyObject *res = PyObject_CallMethod(self, "readable", NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not readable."); + } + return res; +} + +PyDoc_STRVAR(IOBase_writable_doc, + "Return whether object was opened for writing.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject* +IOBase_writable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +/* May be called with any object */ +PyObject* +_PyIOBase_checkWritable(PyObject *self, PyObject *unused) +{ + PyObject *res = PyObject_CallMethod(self, "writable", NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not writable."); + } + return res; +} + +/* Context manager */ + +static PyObject * +IOBase_enter(PyObject *self, PyObject *args) +{ + if (_PyIOBase_checkClosed(self, NULL) == NULL) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +IOBase_exit(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "close", NULL); +} + +/* Lower-level APIs */ + +/* XXX Should these be present even if unimplemented? */ + +PyDoc_STRVAR(IOBase_fileno_doc, + "Returns underlying file descriptor if one exists.\n" + "\n" + "An IOError is raised if the IO object does not use a file descriptor.\n"); + +static PyObject * +IOBase_fileno(PyObject *self, PyObject *args) +{ + return IOBase_unsupported("fileno"); +} + +PyDoc_STRVAR(IOBase_isatty_doc, + "Return whether this is an 'interactive' stream.\n" + "\n" + "Return False if it can't be determined.\n"); + +static PyObject * +IOBase_isatty(PyObject *self, PyObject *args) +{ + if (_PyIOBase_checkClosed(self, NULL) == NULL) + return NULL; + Py_RETURN_FALSE; +} + +/* Readline(s) and writelines */ + +PyDoc_STRVAR(IOBase_readline_doc, + "Read and return a line from the stream.\n" + "\n" + "If limit is specified, at most limit bytes will be read.\n" + "\n" + "The line terminator is always b'\n' for binary files; for text\n" + "files, the newlines argument to open can be used to select the line\n" + "terminator(s) recognized.\n"); + +static PyObject * +IOBase_readline(PyObject *self, PyObject *args) +{ + /* For backwards compatibility, a (slowish) readline(). */ + + Py_ssize_t limit = -1; + int has_peek = 0; + PyObject *buffer, *result; + Py_ssize_t old_size = -1; + + if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { + return NULL; + } + + if (_PyIOBase_checkClosed(self, NULL) == NULL) + return NULL; + + if (PyObject_HasAttrString(self, "peek")) + has_peek = 1; + + buffer = PyByteArray_FromStringAndSize(NULL, 0); + if (buffer == NULL) + return NULL; + + while (limit < 0 || Py_SIZE(buffer) < limit) { + Py_ssize_t nreadahead = 1; + PyObject *b; + + if (has_peek) { + PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); + + assert (PyBytes_Check(readahead)); + + if (readahead == NULL) + goto fail; + if (PyBytes_GET_SIZE(readahead) > 0) { + Py_ssize_t n = 0; + const char *buf = PyBytes_AS_STRING(readahead); + if (limit >= 0) { + do { + if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) + break; + if (buf[n] == '\n') + { + n++; + break; + } + n++; + } while (1); + } + else { + do { + if (n >= PyBytes_GET_SIZE(readahead)) + break; + if (buf[n] == '\n') + { + n++; + break; + } + n++; + } while (1); + } + nreadahead = n; + } + } + + b = PyObject_CallMethod(self, "read", "n", nreadahead); + + if (b == NULL) + goto fail; + + assert (PyBytes_Check(b)); + + if (Py_SIZE(b) == 0) + break; + + old_size = Py_SIZE(buffer); + PyByteArray_Resize(buffer, old_size + Py_SIZE(b)); + memcpy(PyByteArray_AS_STRING(buffer) + old_size, PyBytes_AS_STRING(b), Py_SIZE(b)); + + Py_DECREF(b); + + if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') + break; + } + + result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), + PyByteArray_GET_SIZE(buffer)); + Py_DECREF(buffer); + return result; + fail: + Py_DECREF(buffer); + return NULL; +} + +static PyObject * +IOBase_iter(PyObject *self, PyObject *args) +{ + if (_PyIOBase_checkClosed(self, NULL) == NULL) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +IOBase_next(PyObject *self, PyObject *args) +{ + PyObject *line = PyObject_CallMethod(self, "readline", NULL); + + if (line == NULL) + return NULL; + + assert (PyBytes_Check(line)); + + if (PyBytes_GET_SIZE(line) == 0) { + Py_DECREF(line); + return NULL; + } + + return line; +} + +PyDoc_STRVAR(IOBase_readlines_doc, + "Return a list of lines from the stream.\n" + "\n" + "hint can be specified to control the number of lines read: no more\n" + "lines will be read if the total size (in bytes/characters) of all\n" + "lines so far exceeds hint."); + +static PyObject * +IOBase_readlines(PyObject *self, PyObject *args) +{ + Py_ssize_t hint = -1, length = 0; + PyObject *line, *result; + + if (!PyArg_ParseTuple(args, "|n:readlines", &hint)) { + return NULL; + } + + result = PyList_New(0); + if (result == NULL) + return NULL; + + if (hint <= 0) { + PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); + if( ret == NULL) { + Py_DECREF(result); + return NULL; + } + Py_DECREF(ret); + return result; + } + + while (1) { + line = PyObject_CallMethod(self, "__next__", NULL); + if (line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } + else + break; /* SopIteration raised */ + } + assert (PyBytes_Check(line)); + + if (PyList_Append(result, line) < 0) { + Py_DECREF(line); + Py_DECREF(result); + return NULL; + } + length += Py_SIZE(line); + Py_DECREF(line); + + if (length > hint) + break; + } + return result; +} + +static PyObject * +IOBase_writelines(PyObject *self, PyObject *args) +{ + PyObject *lines, *iter, *res; + + if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { + return NULL; + } + + if (_PyIOBase_checkClosed(self, NULL) == NULL) + return NULL; + + iter = PyObject_GetIter(lines); + if (iter == NULL) + return NULL; + + while (1) { + PyObject *line = PyIter_Next(iter); + if(line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(iter); + return NULL; + } + else + break; /* Stop Iteration */ + } + + res = PyObject_CallMethod(self, "write", "O", line); + Py_DECREF(line); + if (res == NULL) { + Py_DECREF(iter); + return NULL; + } + Py_DECREF(res); + } + Py_RETURN_NONE; +} + +static PyMethodDef IOBase_methods[] = { + {"seek", IOBase_seek, METH_VARARGS}, + {"tell", IOBase_tell, METH_NOARGS}, + {"truncate", IOBase_truncate, METH_VARARGS}, + {"flush", IOBase_flush, METH_NOARGS}, + {"close", IOBase_close, METH_NOARGS}, + + {"seekable", IOBase_seekable, METH_NOARGS}, + {"readable", IOBase_readable, METH_NOARGS}, + {"writable", IOBase_writable, METH_NOARGS}, + + {"_checkClosed", _PyIOBase_checkClosed, METH_NOARGS}, + {"_checkSeekable", _PyIOBase_checkSeekable, METH_NOARGS}, + {"_checkReadable", _PyIOBase_checkReadable, METH_NOARGS}, + {"_checkWritable", _PyIOBase_checkWritable, METH_NOARGS}, + + {"fileno", IOBase_fileno, METH_NOARGS}, + {"isatty", IOBase_isatty, METH_NOARGS}, + + {"__enter__", IOBase_enter, METH_NOARGS}, + {"__exit__", IOBase_exit, METH_VARARGS}, + + {"__iter__", IOBase_iter, METH_NOARGS}, + {"__next__", IOBase_next, METH_NOARGS}, + + {"readline", IOBase_readline, METH_VARARGS}, + {"readlines", IOBase_readlines, METH_VARARGS}, + {"writelines", IOBase_readlines, METH_VARARGS}, + + {NULL, NULL} +}; + +static PyGetSetDef IOBase_getset[] = { + {"closed", (getter)IOBase_closed_get, NULL, NULL}, + {0} +}; + + +PyTypeObject PyIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "IOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + IOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + IOBase_methods, /* tp_methods */ + 0, /* tp_members */ + IOBase_getset, /* 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 */ + PyType_GenericNew, /* tp_new */ + 0, /* tp_free */ + 0, /* tp_is_gc */ + 0, /* tp_bases */ + 0, /* tp_mro */ + 0, /* tp_cache */ + 0, /* tp_subclasses */ + 0, /* tp_weaklist */ + IOBase_del, /* tp_del */ +}; + + + +/* + * RawIOBase class, Inherits from IOBase. + */ +PyDoc_STRVAR(RawIOBase_doc, + "Base class for raw binary I/O."); + +/* + * The read() method is implemented by calling readinto(); derived classes + * that want to support read() only need to implement readinto() as a + * primitive operation. In general, readinto() can be more efficient than + * read(). + * + * (It would be tempting to also provide an implementation of readinto() in + * terms of read(), in case the latter is a more suitable primitive operation, + * but that would lead to nasty recursion in case a subclass doesn't implement + * either.) +*/ + +static PyObject * +RawIOBase_read(PyObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *b, *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + if (n < 0) + return PyObject_CallMethod(self, "readall", NULL); + + b = PyByteArray_FromStringAndSize(NULL, n); + if (b == NULL) + return NULL; + + res = PyObject_CallMethod(self, "readinto", "O", b); + if (res == NULL) { + Py_DECREF(b); + return NULL; + } + + n = PyNumber_AsSsize_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n == -1 && PyErr_Occurred()) { + Py_DECREF(b); + return NULL; + } + + res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); + Py_DECREF(b); + return res; +} + + +PyDoc_STRVAR(RawIOBase_readall_doc, + "Read until EOF, using multiple read() call."); + +static PyObject * +RawIOBase_readall(PyObject *self, PyObject *args) +{ + PyObject *b = NULL; + Py_ssize_t cursize = 0; + + while (1) { + Py_ssize_t length; + PyObject *data = PyObject_CallMethod(self, "read", + "i", DEFAULT_BUFFER_SIZE); + + if (!data) { + Py_XDECREF(b); + return NULL; + } + + if (!PyBytes_Check(data)) { + Py_XDECREF(b); + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + + length = Py_SIZE(data); + + if (b == NULL) + b = data; + else if (length != 0) { + + _PyBytes_Resize(&b, cursize + length); + if (b == NULL) { + Py_DECREF(data); + return NULL; + } + + memcpy(PyBytes_AS_STRING(b) + cursize, + PyBytes_AS_STRING(data), length); + Py_DECREF(data); + } + + if (length == 0) + break; + } + + return b; + +} + +static PyMethodDef RawIOBase_methods[] = { + {"read", RawIOBase_read, METH_VARARGS}, + {"readall", RawIOBase_readall, METH_NOARGS, RawIOBase_readall_doc}, + {NULL, NULL} +}; + +PyTypeObject PyRawIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "RawIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 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*/ + RawIOBase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + RawIOBase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyIOBase_Type, /* 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 */ +}; Added: sandbox/trunk/io-c/_iomodule.h ============================================================================== --- (empty file) +++ sandbox/trunk/io-c/_iomodule.h Fri Nov 7 01:26:36 2008 @@ -0,0 +1,31 @@ +/* + * Declarations shared between the different parts of the io module + */ + +extern PyTypeObject PyFileIO_Type; +extern PyTypeObject PyBytesIO_Type; +extern PyTypeObject PyIOBase_Type; +extern PyTypeObject PyRawIOBase_Type; +extern PyTypeObject PyBufferedIOBase_Type; +extern PyTypeObject PyBufferedReader_Type; +extern PyTypeObject PyBufferedWriter_Type; +extern PyTypeObject PyBufferedRWPair_Type; +extern PyTypeObject PyBufferedRandom_Type; + +extern PyObject* _PyIOBase_checkReadable(PyObject *self, PyObject *unused); +extern PyObject* _PyIOBase_checkWritable(PyObject *self, PyObject *unused); +extern PyObject* _PyIOBase_checkSeekable(PyObject *self, PyObject *unused); + +extern PyObject* PyIOExc_UnsupportedOperation; + +#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */ + +typedef struct { + PyException_HEAD + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; /* Not used, but part of the IOError object */ + Py_ssize_t written; +} PyBlockingIOErrorObject; +PyObject *PyExc_BlockingIOError; + Modified: sandbox/trunk/io-c/build.py ============================================================================== --- sandbox/trunk/io-c/build.py (original) +++ sandbox/trunk/io-c/build.py Fri Nov 7 01:26:36 2008 @@ -3,7 +3,8 @@ from distutils.command.build_ext import build_ext def compile(): - sources = ['io.c', '_fileio.c', '_bytesio.c'] + sources = ['io.c', '_iobase.c', '_bufferedio.c', + '_fileio.c', '_bytesio.c'] sources = [os.path.join(os.path.dirname(__file__), s) for s in sources] io_ext = Extension('_io', sources) dist = Distribution({'name': '_io', 'ext_modules': [io_ext]}) Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Fri Nov 7 01:26:36 2008 @@ -1,15 +1,12 @@ #include #include "structmember.h" -#include "pythread.h" +#include "_iomodule.h" -extern PyTypeObject PyFileIO_Type; -extern PyTypeObject PyBytesIO_Type; +PyObject *PyIOExc_UnsupportedOperation; + static PyObject *io_py_module; -/* open() uses st_blksize whenever we can */ -#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */ - PyDoc_STRVAR(module_doc, "The io module provides the Python interfaces to stream handling. The\n" @@ -52,15 +49,6 @@ * BlockingIOError extends IOError */ -typedef struct { - PyException_HEAD - PyObject *myerrno; - PyObject *strerror; - PyObject *filename; /* Not used, but part of the IOError object */ - Py_ssize_t written; -} PyBlockingIOErrorObject; - - static int BlockingIOError_init(PyBlockingIOErrorObject *self, PyObject *args, PyObject *kwds) @@ -523,2397 +511,6 @@ } -static PyObject* PyExc_UnsupportedOperation; - -/* - * IOBase class, an abstract class - */ - -PyDoc_STRVAR(IOBase_doc, - "The abstract base class for all I/O classes, acting on streams of\n" - "bytes. There is no public constructor.\n" - "\n" - "This class provides dummy implementations for many methods that\n" - "derived classes can override selectively; the default implementations\n" - "represent a file that cannot be read, written or seeked.\n" - "\n" - "Even though IOBase does not declare read, readinto, or write because\n" - "their signatures will vary, implementations and clients should\n" - "consider those methods part of the interface. Also, implementations\n" - "may raise a IOError when operations they do not support are called.\n" - "\n" - "The basic type used for binary data read from or written to a file is\n" - "bytes. bytearrays are accepted too, and in some cases (such as\n" - "readinto) needed. Text I/O classes work with str data.\n" - "\n" - "Note that calling any method (even inquiries) on a closed stream is\n" - "undefined. Implementations may raise IOError in this case.\n" - "\n" - "IOBase (and its subclasses) support the iterator protocol, meaning\n" - "that an IOBase object can be iterated over yielding the lines in a\n" - "stream.\n" - "\n" - "IOBase also supports the :keyword:`with` statement. In this example,\n" - "fp is closed after the suite of the with statment is complete:\n" - "\n" - "with open('spam.txt', 'r') as fp:\n" - " fp.write('Spam and eggs!')\n"); - -/* Internal methods */ -static PyObject * -IOBase_unsupported(const char* message) -{ - PyErr_SetString(PyExc_UnsupportedOperation, message); - return NULL; -} - -/* Positionning */ - -PyDoc_STRVAR(IOBase_seek_doc, - "Change stream position.\n" - "\n" - "Change the stream position to byte offset offset. offset is\n" - "interpreted relative to the position indicated by whence. Values\n" - "for whence are:\n" - "\n" - "* 0 -- start of stream (the default); offset should be zero or positive\n" - "* 1 -- current stream position; offset may be negative\n" - "* 2 -- end of stream; offset is usually negative\n" - "\n" - "Return the new absolute position."); - -static PyObject* -IOBase_seek(PyObject *self, PyObject *args) -{ - return IOBase_unsupported("seek"); -} - -PyDoc_STRVAR(IOBase_tell_doc, - "Return current stream position."); - -static PyObject * -IOBase_tell(PyObject *self, PyObject *args) -{ - return PyObject_CallMethod(self, "tell", "ii", 0, 1); -} - -PyDoc_STRVAR(IOBase_truncate_doc, - "Truncate file to size bytes.\n" - "\n" - "Size defaults to the current IO position as reported by tell(). Return\n" - "the new size."); - -static PyObject* -IOBase_truncate(PyObject *self, PyObject *args) -{ - return IOBase_unsupported("seek"); -} - -/* Flush and close methods */ - -PyDoc_STRVAR(IOBase_flush_doc, - "Flush write buffers, if applicable.\n" - "\n" - "This is not implemented for read-only and non-blocking streams.\n"); - -static PyObject* -IOBase_flush(PyObject *self, PyObject *args) -{ - /* XXX Should this return the number of bytes written??? */ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(IOBase_close_doc, - "Flush and close the IO object.\n" - "\n" - "This method has no effect if the file is already closed.\n"); - -static int -IOBase_closed(PyObject *self) -{ - return PyObject_HasAttrString(self, "__IOBase_closed"); -} - -static PyObject * -IOBase_closed_get(PyObject *self, void *context) -{ - return PyBool_FromLong(IOBase_closed(self)); -} - - -static PyObject * -IOBase_checkClosed(PyObject *self, PyObject *unused) -{ - if (IOBase_closed(self)) { - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject* -IOBase_close(PyObject *self, PyObject *args) -{ - PyObject *res; - - if (IOBase_closed(self)) - Py_RETURN_NONE; - - PyObject_SetAttrString(self, "__IOBase_closed", Py_True); - - res = PyObject_CallMethod(self, "flush", NULL); - if (res == NULL) { - /* If flush() fails, just give up */ - if (PyErr_ExceptionMatches(PyExc_IOError)) - PyErr_Clear(); - else - return NULL; - } - Py_RETURN_NONE; -} - -static void -IOBase_del(PyObject *self) -{ - PyObject *res = PyObject_CallMethod(self, "flush", NULL); - if (res == NULL) { - /* At program exit time, it's possible that globals have already been - * deleted, and then the close() call might fail. Since there's - * nothing we can do about such failures and they annoy the end - * users, we suppress the traceback. - */ - PyErr_Clear(); - } -} - -/* Inquiry methods */ - -PyDoc_STRVAR(IOBase_seekable_doc, - "Return whether object supports random access.\n" - "\n" - "If False, seek(), tell() and truncate() will raise IOError.\n" - "This method may need to do a test seek()."); - -static PyObject* -IOBase_seekable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -static PyObject* -IOBase_checkSeekable(PyObject *self, PyObject *unused) -{ - PyObject *res = PyObject_CallMethod(self, "seekable", NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); - } - return res; -} - -PyDoc_STRVAR(IOBase_readable_doc, - "Return whether object was opened for reading.\n" - "\n" - "If False, read() will raise IOError."); - -static PyObject* -IOBase_readable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -/* May be called with any object */ -static PyObject* -IOBase_checkReadable(PyObject *self, PyObject *unused) -{ - PyObject *res = PyObject_CallMethod(self, "readable", NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not readable."); - } - return res; -} - -PyDoc_STRVAR(IOBase_writable_doc, - "Return whether object was opened for writing.\n" - "\n" - "If False, read() will raise IOError."); - -static PyObject* -IOBase_writable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -/* May be called with any object */ -static PyObject* -IOBase_checkWritable(PyObject *self, PyObject *unused) -{ - PyObject *res = PyObject_CallMethod(self, "writable", NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not writable."); - } - return res; -} - -/* Context manager */ - -static PyObject * -IOBase_enter(PyObject *self, PyObject *args) -{ - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - Py_INCREF(self); - return self; -} - -static PyObject * -IOBase_exit(PyObject *self, PyObject *args) -{ - return PyObject_CallMethod(self, "close", NULL); -} - -/* Lower-level APIs */ - -/* XXX Should these be present even if unimplemented? */ - -PyDoc_STRVAR(IOBase_fileno_doc, - "Returns underlying file descriptor if one exists.\n" - "\n" - "An IOError is raised if the IO object does not use a file descriptor.\n"); - -static PyObject * -IOBase_fileno(PyObject *self, PyObject *args) -{ - return IOBase_unsupported("fileno"); -} - -PyDoc_STRVAR(IOBase_isatty_doc, - "Return whether this is an 'interactive' stream.\n" - "\n" - "Return False if it can't be determined.\n"); - -static PyObject * -IOBase_isatty(PyObject *self, PyObject *args) -{ - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - Py_RETURN_FALSE; -} - -/* Readline(s) and writelines */ - -PyDoc_STRVAR(IOBase_readline_doc, - "Read and return a line from the stream.\n" - "\n" - "If limit is specified, at most limit bytes will be read.\n" - "\n" - "The line terminator is always b'\n' for binary files; for text\n" - "files, the newlines argument to open can be used to select the line\n" - "terminator(s) recognized.\n"); - -static PyObject * -IOBase_readline(PyObject *self, PyObject *args) -{ - /* For backwards compatibility, a (slowish) readline(). */ - - Py_ssize_t limit = -1; - int has_peek = 0; - PyObject *buffer, *result; - Py_ssize_t old_size = -1; - - if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { - return NULL; - } - - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - if (PyObject_HasAttrString(self, "peek")) - has_peek = 1; - - buffer = PyByteArray_FromStringAndSize(NULL, 0); - if (buffer == NULL) - return NULL; - - while (limit < 0 || Py_SIZE(buffer) < limit) { - Py_ssize_t nreadahead = 1; - PyObject *b; - - if (has_peek) { - PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); - - assert (PyBytes_Check(readahead)); - - if (readahead == NULL) - goto fail; - if (PyBytes_GET_SIZE(readahead) > 0) { - Py_ssize_t n = 0; - const char *buf = PyBytes_AS_STRING(readahead); - if (limit >= 0) { - do { - if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) - break; - if (buf[n] == '\n') - { - n++; - break; - } - n++; - } while (1); - } - else { - do { - if (n >= PyBytes_GET_SIZE(readahead)) - break; - if (buf[n] == '\n') - { - n++; - break; - } - n++; - } while (1); - } - nreadahead = n; - } - } - - b = PyObject_CallMethod(self, "read", "n", nreadahead); - - if (b == NULL) - goto fail; - - assert (PyBytes_Check(b)); - - if (Py_SIZE(b) == 0) - break; - - old_size = Py_SIZE(buffer); - PyByteArray_Resize(buffer, old_size + Py_SIZE(b)); - memcpy(PyByteArray_AS_STRING(buffer) + old_size, PyBytes_AS_STRING(b), Py_SIZE(b)); - - Py_DECREF(b); - - if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') - break; - } - - result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), - PyByteArray_GET_SIZE(buffer)); - Py_DECREF(buffer); - return result; - fail: - Py_DECREF(buffer); - return NULL; -} - -static PyObject * -IOBase_iter(PyObject *self, PyObject *args) -{ - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - Py_INCREF(self); - return self; -} - -static PyObject * -IOBase_next(PyObject *self, PyObject *args) -{ - PyObject *line = PyObject_CallMethod(self, "readline", NULL); - - if (line == NULL) - return NULL; - - assert (PyBytes_Check(line)); - - if (PyBytes_GET_SIZE(line) == 0) { - Py_DECREF(line); - return NULL; - } - - return line; -} - -PyDoc_STRVAR(IOBase_readlines_doc, - "Return a list of lines from the stream.\n" - "\n" - "hint can be specified to control the number of lines read: no more\n" - "lines will be read if the total size (in bytes/characters) of all\n" - "lines so far exceeds hint."); - -static PyObject * -IOBase_readlines(PyObject *self, PyObject *args) -{ - Py_ssize_t hint = -1, length = 0; - PyObject *line, *result; - - if (!PyArg_ParseTuple(args, "|n:readlines", &hint)) { - return NULL; - } - - result = PyList_New(0); - if (result == NULL) - return NULL; - - if (hint <= 0) { - PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); - if( ret == NULL) { - Py_DECREF(result); - return NULL; - } - Py_DECREF(ret); - return result; - } - - while (1) { - line = PyObject_CallMethod(self, "__next__", NULL); - if (line == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; - } - else - break; /* SopIteration raised */ - } - assert (PyBytes_Check(line)); - - if (PyList_Append(result, line) < 0) { - Py_DECREF(line); - Py_DECREF(result); - return NULL; - } - length += Py_SIZE(line); - Py_DECREF(line); - - if (length > hint) - break; - } - return result; -} - -static PyObject * -IOBase_writelines(PyObject *self, PyObject *args) -{ - PyObject *lines, *iter, *res; - - if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { - return NULL; - } - - if (IOBase_checkClosed(self, NULL) == NULL) - return NULL; - - iter = PyObject_GetIter(lines); - if (iter == NULL) - return NULL; - - while (1) { - PyObject *line = PyIter_Next(iter); - if(line == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(iter); - return NULL; - } - else - break; /* Stop Iteration */ - } - - res = PyObject_CallMethod(self, "write", "O", line); - Py_DECREF(line); - if (res == NULL) { - Py_DECREF(iter); - return NULL; - } - Py_DECREF(res); - } - Py_RETURN_NONE; -} - -static PyMethodDef IOBase_methods[] = { - {"seek", IOBase_seek, METH_VARARGS}, - {"tell", IOBase_tell, METH_NOARGS}, - {"truncate", IOBase_truncate, METH_VARARGS}, - {"flush", IOBase_flush, METH_NOARGS}, - {"close", IOBase_close, METH_NOARGS}, - - {"seekable", IOBase_seekable, METH_NOARGS}, - {"readable", IOBase_readable, METH_NOARGS}, - {"writable", IOBase_writable, METH_NOARGS}, - - {"_checkClosed", IOBase_checkClosed, METH_NOARGS}, - {"_checkSeekable", IOBase_checkSeekable, METH_NOARGS}, - {"_checkReadable", IOBase_checkReadable, METH_NOARGS}, - {"_checkWritable", IOBase_checkWritable, METH_NOARGS}, - - {"fileno", IOBase_fileno, METH_NOARGS}, - {"isatty", IOBase_isatty, METH_NOARGS}, - - {"__enter__", IOBase_enter, METH_NOARGS}, - {"__exit__", IOBase_exit, METH_VARARGS}, - - {"__iter__", IOBase_iter, METH_NOARGS}, - {"__next__", IOBase_next, METH_NOARGS}, - - {"readline", IOBase_readline, METH_VARARGS}, - {"readlines", IOBase_readlines, METH_VARARGS}, - {"writelines", IOBase_readlines, METH_VARARGS}, - - {NULL, NULL} -}; - -static PyGetSetDef IOBase_getset[] = { - {"closed", (getter)IOBase_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject _IOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "IOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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*/ - IOBase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - IOBase_methods, /* tp_methods */ - 0, /* tp_members */ - IOBase_getset, /* 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 */ - PyType_GenericNew, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - IOBase_del, /* tp_del */ -}; -PyObject *PyIOBase = (PyObject*)&_IOBase_Type; - - - -/* - * RawIOBase class, Inherits from IOBase. - */ -PyDoc_STRVAR(RawIOBase_doc, - "Base class for raw binary I/O."); - -/* - * The read() method is implemented by calling readinto(); derived classes - * that want to support read() only need to implement readinto() as a - * primitive operation. In general, readinto() can be more efficient than - * read(). - * - * (It would be tempting to also provide an implementation of readinto() in - * terms of read(), in case the latter is a more suitable primitive operation, - * but that would lead to nasty recursion in case a subclass doesn't implement - * either.) -*/ - -static PyObject * -RawIOBase_read(PyObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *b, *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - if (n < 0) - return PyObject_CallMethod(self, "readall", NULL); - - b = PyByteArray_FromStringAndSize(NULL, n); - if (b == NULL) - return NULL; - - res = PyObject_CallMethod(self, "readinto", "O", b); - if (res == NULL) { - Py_DECREF(b); - return NULL; - } - - n = PyNumber_AsSsize_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n == -1 && PyErr_Occurred()) { - Py_DECREF(b); - return NULL; - } - - res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); - Py_DECREF(b); - return res; -} - - -PyDoc_STRVAR(RawIOBase_readall_doc, - "Read until EOF, using multiple read() call."); - -static PyObject * -RawIOBase_readall(PyObject *self, PyObject *args) -{ - PyObject *b = NULL; - Py_ssize_t cursize = 0; - - while (1) { - Py_ssize_t length; - PyObject *data = PyObject_CallMethod(self, "read", - "i", DEFAULT_BUFFER_SIZE); - - if (!data) { - Py_XDECREF(b); - return NULL; - } - - if (!PyBytes_Check(data)) { - Py_XDECREF(b); - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - length = Py_SIZE(data); - - if (b == NULL) - b = data; - else if (length != 0) { - - _PyBytes_Resize(&b, cursize + length); - if (b == NULL) { - Py_DECREF(data); - return NULL; - } - - memcpy(PyBytes_AS_STRING(b) + cursize, - PyBytes_AS_STRING(data), length); - Py_DECREF(data); - } - - if (length == 0) - break; - } - - return b; - -} - -static PyMethodDef RawIOBase_methods[] = { - {"read", RawIOBase_read, METH_VARARGS}, - {"readall", RawIOBase_readall, METH_NOARGS, RawIOBase_readall_doc}, - {NULL, NULL} -}; - -PyTypeObject _RawIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "RawIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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*/ - RawIOBase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - RawIOBase_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &_IOBase_Type, /* 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 */ -}; -PyObject *PyRawIOBase = (PyObject*)&_RawIOBase_Type; - - -/* - * BufferedIOBase class, inherits from IOBase. - */ -PyDoc_STRVAR(BufferedIOBase_doc, - "Base class for buffered IO objects.\n" - "\n" - "The main difference with RawIOBase is that the read() method\n" - "supports omitting the size argument, and does not have a default\n" - "implementation that defers to readinto().\n" - "\n" - "In addition, read(), readinto() and write() may raise\n" - "BlockingIOError if the underlying raw stream is in non-blocking\n" - "mode and not ready; unlike their raw counterparts, they will never\n" - "return None.\n" - "\n" - "A typical implementation should not inherit from a RawIOBase\n" - "implementation, but wrap one.\n" - ); - -static PyObject * -BufferedIOBase_readinto(PyObject *self, PyObject *args) -{ - Py_buffer buf; - Py_ssize_t len; - PyObject *data; - - if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { - return NULL; - } - - data = PyObject_CallMethod(self, "read", "n", buf.len); - if (data == NULL) - goto error; - - if (!PyBytes_Check(data)) { - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - goto error; - } - - len = Py_SIZE(data); - memcpy(buf.buf, PyBytes_AS_STRING(data), len); - - PyBuffer_Release(&buf); - Py_DECREF(data); - - return PyLong_FromSsize_t(len); - - error: - PyBuffer_Release(&buf); - return NULL; -} - -static PyMethodDef BufferedIOBase_methods[] = { - {"readinto", BufferedIOBase_readinto, METH_VARARGS}, - {NULL, NULL} -}; - -PyTypeObject _BufferedIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 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*/ - BufferedIOBase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedIOBase_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &_IOBase_Type, /* 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 */ -}; - - -typedef struct { - PyObject_HEAD - - PyObject *raw; - - PyObject *name; - PyObject *mode; - - PyObject *read_buf; - Py_ssize_t read_pos; - PyThread_type_lock read_lock; - - PyObject *write_buf; - PyThread_type_lock write_lock; - - Py_ssize_t buffer_size; - Py_ssize_t max_buffer_size; - - PyObject *dict; - PyObject *weakreflist; -} BufferedObject; - -static void -BufferedObject_dealloc(BufferedObject *self) -{ - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)self); - Py_CLEAR(self->raw); - Py_CLEAR(self->name); - Py_CLEAR(self->mode); - Py_CLEAR(self->read_buf); - Py_CLEAR(self->write_buf); - Py_CLEAR(self->dict); -} - - -/* - * _BufferedIOMixin methods - * This is not a class, just a collection of methods that will be reused - * by BufferedReader and BufferedWriter - */ - -/* Positioning */ - -static PyObject* -BufferedIOMixin_truncate(BufferedObject *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - /* Flush the stream. We're mixing buffered I/O with lower-level I/O, - * and a flush may be necessary to synch both views of the current - * file state. - */ - res = PyObject_CallMethod(self->raw, "flush", NULL); - if (res == NULL) - return NULL; - Py_DECREF(res); - - if (pos == Py_None) - pos = PyObject_CallMethod(self->raw, "tell", NULL); - else - Py_INCREF(pos); - - /* XXX: Should seek() be used, instead of passing the position - * XXX directly to truncate? - */ - res = PyObject_CallMethod(self->raw, "truncate", "O", pos); - Py_DECREF(pos); - - return res; -} - -/* Flush and close */ - -static PyObject* -BufferedIOMixin_flush(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "flush", NULL); -} - -static int -BufferedIOMixin_closed(BufferedObject *self) -{ - int closed; - PyObject *res = PyObject_GetAttrString(self->raw, "closed"); - if (res == NULL) - return 0; - closed = PyObject_IsTrue(res); - Py_DECREF(res); - return closed; -} - -static PyObject * -BufferedIOMixin_closed_get(BufferedObject *self, void *context) -{ - return PyObject_GetAttrString(self->raw, "closed"); -} - - -static PyObject* -BufferedIOMixin_close(BufferedObject *self, PyObject *args) -{ - PyObject *res; - - if (BufferedIOMixin_closed(self)) - Py_RETURN_NONE; - - res = PyObject_CallMethod((PyObject *)self, "flush", NULL); - if (res == NULL) { - /* If flush() fails, just give up */ - if (PyErr_ExceptionMatches(PyExc_IOError)) - PyErr_Clear(); - else - return NULL; - } - - return PyObject_CallMethod(self->raw, "close", NULL); -} - -/* Inquiries */ - -static PyObject* -BufferedIOMixin_seekable(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "seekable", NULL); -} - -static PyObject* -BufferedIOMixin_readable(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "readable", NULL); -} - -static PyObject* -BufferedIOMixin_writable(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "writable", NULL); -} - -/* Lower-level APIs */ - -static PyObject* -BufferedIOMixin_fileno(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "fileno", NULL); -} - -static PyObject* -BufferedIOMixin_isatty(BufferedObject *self, PyObject *args) -{ - return PyObject_CallMethod(self->raw, "isatty", NULL); -} - - -/* - * class BufferedReader - */ - -PyDoc_STRVAR(BufferedReader_doc, - "Create a new buffered reader using the given readable raw IO object."); - -static int _BufferedReader_reset_read_buf(BufferedObject *self) -{ - PyObject *oldbuf = self->read_buf; - - self->read_buf = PyBytes_FromStringAndSize(NULL, 0); - self->read_pos = 0; - - Py_XDECREF(oldbuf); - - if (self->read_buf == NULL) - return -1; - - return 0; -} - -static int -BufferedReader_init(BufferedObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - PyObject *raw; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, - &raw, &buffer_size)) { - return -1; - } - - if (IOBase_checkReadable(raw, NULL) == NULL) - return -1; - - Py_INCREF(raw); - self->raw = raw; - - self->buffer_size = buffer_size; - self->read_buf = NULL; - - if( _BufferedReader_reset_read_buf(self) < 0) - return -1; - - self->read_lock = PyThread_allocate_lock(); - if (self->read_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); - return -1; - } - - return 0; -} - -static PyObject * -_BufferedReader_read_unlocked(BufferedObject *self, Py_ssize_t n) -{ - PyObject *nodata_val = NULL; - PyObject *empty_values = NULL; - - PyObject *buf = self->read_buf; - Py_ssize_t pos = self->read_pos; - PyObject *data, *chunks, *sep, *res; - Py_ssize_t current_size; - - /* Special case for when the number of bytes to read is unspecified. */ - if (n == -1) { - chunks = PyList_New(0); - if (chunks == NULL) - return NULL; - - Py_INCREF(buf); - if (_BufferedReader_reset_read_buf(self) < 0) - return NULL; - - /* Strip the consumed bytes */ - current_size = Py_SIZE(buf) - pos; - data = NULL; - if (current_size) { - data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); - if (data == NULL) { - Py_DECREF(buf); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(buf); - } - - while (1) { - if (data) { - if (PyList_Append(chunks, data) < 0) { - Py_DECREF(data); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(data); - } - - /* Read until EOF or until read() would block. */ - data = PyObject_CallMethod(self->raw, "read", NULL); - - if (data == NULL) { - Py_DECREF(chunks); - return NULL; - } - - if (data != Py_None && !PyBytes_Check(data)) { - Py_DECREF(data); - Py_DECREF(chunks); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - if (data == Py_None || Py_SIZE(data) == 0) { - if (current_size == 0) { - Py_DECREF(chunks); - return data; - } - else { - Py_DECREF(data); - sep = PyBytes_FromStringAndSize(NULL, 0); - - if (sep == NULL) { - Py_DECREF(chunks); - return NULL; - } - res =_PyBytes_Join(sep, chunks); - Py_DECREF(sep); - Py_DECREF(chunks); - - return res; - } - } - - current_size += Py_SIZE(data); - } - } - - /* The number of bytes to read is specified, return at most n bytes. */ - - current_size = Py_SIZE(buf) - pos; /* Length of the available buffered data. */ - if (n <= current_size) { - /* Fast path: the data to read is fully buffered. */ - self->read_pos += n; - return PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, n); - } - - /* Slow path: read from the stream until enough bytes are read, - * or until an EOF occurs or until read() would block. - */ - chunks = PyList_New(0); - if (chunks == NULL) - return NULL; - - data = NULL; - - if (current_size) - data = PyBytes_FromStringAndSize(PyBytes_AS_STRING(buf) + pos, current_size); - - while (1) { - Py_ssize_t wanted; - - if (data) { - if (PyList_Append(chunks, data) < 0) { - Py_DECREF(data); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(data); - } - - if (current_size >= n) - break; - - wanted = n; - if (wanted < self->buffer_size) - wanted = self->buffer_size; - - data = PyObject_CallMethod(self->raw, "read", "n", wanted); - - if (data != Py_None && !PyBytes_Check(data)) { - Py_DECREF(data); - Py_DECREF(chunks); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - if (data == Py_None || Py_SIZE(data) == 0) { - /* EOF occurred or read() would block. */ - - if (current_size == 0) { - Py_DECREF(chunks); - - if( _BufferedReader_reset_read_buf(self) < 0) { - Py_DECREF(data); - return NULL; - } - - return data; - } - else { - Py_DECREF(data); - break; - } - } - - current_size += Py_SIZE(data); - } - - sep = PyBytes_FromStringAndSize(NULL, 0); - - if (sep == NULL) { - Py_DECREF(chunks); - return NULL; - } - - res =_PyBytes_Join(sep, chunks); - Py_DECREF(sep); - Py_DECREF(chunks); - - if (Py_SIZE(res) > n) { - /* Save the extra data in the buffer. */ - self->read_pos = 0; - buf = self->read_buf; - self->read_buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res) + n, Py_SIZE(res) - n); - Py_DECREF(buf); - if (self->read_buf == NULL) { - Py_DECREF(res); - return NULL; - } - - /* Truncate the result to the desired length */ - buf = PyBytes_FromStringAndSize(PyBytes_AS_STRING(res), n); - if (buf == NULL) { - Py_DECREF(res); - return NULL; - } - - Py_DECREF(res); - res = buf; - } - - return res; -} - -static PyObject * -BufferedReader_read(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedReader_read_unlocked(self, n); - - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject * -_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t n) -{ - Py_ssize_t have; - - if (n > self->buffer_size) - n = self->buffer_size; - - have = Py_SIZE(self->read_buf) - self->read_pos; - - if (have < n) { - Py_ssize_t to_read = self->buffer_size - have; - PyObject *current = PyObject_CallMethod(self->raw, "read", "n", to_read); - - if (current == NULL) - return NULL; - - if (!PyBytes_Check(current)) { - Py_DECREF(current); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - - if (Py_SIZE(current) > 0) { - PyObject *oldbuf = self->read_buf; - self->read_buf = PyBytes_FromStringAndSize(NULL, have + Py_SIZE(current)); - memcpy(PyBytes_AS_STRING(self->read_buf), PyBytes_AS_STRING(oldbuf) + self->read_pos, have); - memcpy(PyBytes_AS_STRING(self->read_buf) + have, PyBytes_AS_STRING(current), Py_SIZE(current)); - self->read_pos = 0; - } - Py_DECREF(current); - } - - if (self->read_pos == 0) { - Py_INCREF(self->read_buf); - return self->read_buf; - } - else { - return PyBytes_FromStringAndSize( - PyBytes_AS_STRING(self->read_buf) + self->read_pos, - Py_SIZE(self->read_buf) - self->read_pos); - } -} - -static PyObject * -BufferedReader_peek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|n:peek", &n)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedReader_peek_unlocked(self, n); - - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject * -BufferedReader_read1(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n, have; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n:read1", &n)) { - return NULL; - } - - if (n <= 0) - return PyBytes_FromStringAndSize(NULL, 0); - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedReader_peek_unlocked(self, 1); - if(res == NULL) - goto end; - Py_DECREF(res); - - have = Py_SIZE(self->read_buf) - self->read_pos; - if (n > have) - n = have; - - res = _BufferedReader_read_unlocked(self, n); - - end: - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject* -BufferedReader_seek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t pos; - int whence = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - if (whence == 1) { - pos -= Py_SIZE(self->read_buf) - self->read_pos; - } - - res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); - if (res == NULL) - return NULL; - - if (_BufferedReader_reset_read_buf(self) < 0) - Py_CLEAR(res); - - PyThread_release_lock(self->read_lock); - - return res; -} - -static PyObject* -BufferedReader_tell(BufferedObject *self, PyObject *args) -{ - PyObject *op1, *op2, *res; - - op1 = PyObject_CallMethod(self->raw, "tell", NULL); - - if (op1 == NULL) - return NULL; - - op2 = PyLong_FromSsize_t(Py_SIZE(self->read_buf) - self->read_pos); - if (op2 == NULL) { - Py_DECREF(op1); - return NULL; - } - - res = PyNumber_Subtract(op1, op2); - Py_DECREF(op1); - Py_DECREF(op2); - return res; -} - -static PyMethodDef BufferedReader_methods[] = { - /* BufferedIOMixin methods */ - {"truncate", (PyCFunction)BufferedIOMixin_truncate, METH_VARARGS}, - {"flush", (PyCFunction)BufferedIOMixin_flush, METH_NOARGS}, - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"read", (PyCFunction)BufferedReader_read, METH_VARARGS}, - {"peek", (PyCFunction)BufferedReader_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedReader_read1, METH_VARARGS}, - {"seek", (PyCFunction)BufferedReader_seek, METH_VARARGS}, - {"tell", (PyCFunction)BufferedReader_tell, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef BufferedReader_members[] = { - {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, - {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, - {NULL} -}; - -static PyGetSetDef BufferedReader_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject BufferedReader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedReader", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedReader_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedReader_methods, /* tp_methods */ - BufferedReader_members, /* tp_members */ - BufferedReader_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedReader_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - -/* - * class BufferedWriter - */ -PyDoc_STRVAR(BufferedWriter_doc, - "A buffer for a writeable sequential RawIO object.\n" - "\n" - "The constructor creates a BufferedWriter for the given writeable raw\n" - "stream. If the buffer_size is not given, it defaults to\n" - "DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to\n" - "twice the buffer size.\n" - ); - -static int -BufferedWriter_init(BufferedObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -1; - PyObject *raw; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, - &raw, &buffer_size, &max_buffer_size)) { - return -1; - } - - if (IOBase_checkWritable(raw, NULL) == NULL) - return -1; - - Py_INCREF(raw); - self->raw = raw; - - if (max_buffer_size < 0) - max_buffer_size = buffer_size * 2; - self->buffer_size = buffer_size; - self->max_buffer_size = max_buffer_size; - - self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); - if (self->write_buf == NULL) - return -1; - - self->write_lock = PyThread_allocate_lock(); - if (self->write_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); - return -1; - } - - return 0; -} - -static PyObject * -_BufferedWriter_flush_unlocked(BufferedObject *self) -{ - Py_ssize_t written = 0; - - if (BufferedIOMixin_closed(self)) { - PyErr_SetString(PyExc_ValueError, "flush of closed file"); - return NULL; - } - - while (Py_SIZE(self->write_buf) > 0) { - PyObject *slice, *res; - Py_ssize_t w; - PyObject *n = PyObject_CallMethod(self->raw, "write", "O", self->write_buf); - - if (n == NULL) { - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - if (value == NULL || - !PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { - PyErr_Restore(type, value, traceback); - return NULL; - } - - w = ((PyBlockingIOErrorObject *)value)->written; - - /* del self->write_buf[:w] */ - slice = _PySlice_FromIndices(0, w); - if (slice == NULL) - return NULL; - res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); - Py_DECREF(slice); - if (res == NULL) - return NULL; - Py_DECREF(res); - - written += w; - ((PyBlockingIOErrorObject *)value)->written = written; - - PyErr_Restore(type, value, traceback); - return NULL; - } - - /* del self->write_buf[:w] */ - w = PyNumber_AsSsize_t(n, PyExc_ValueError); - Py_DECREF(n); - if (w == -1 && PyErr_Occurred()) - return NULL; - - slice = _PySlice_FromIndices(0, w); - if (slice == NULL) - return NULL; - res = PyObject_CallMethod(self->write_buf, "__delitem__", "O", slice); - Py_DECREF(slice); - if (res == NULL) - return NULL; - Py_DECREF(res); - - written += w; - } - - Py_RETURN_NONE; -} - -static PyObject * -BufferedWriter_write(BufferedObject *self, PyObject *args) -{ - PyObject *res; - Py_buffer buf; - Py_ssize_t before, written; - - if (!PyArg_ParseTuple(args, "y*:write", &buf)) { - return NULL; - } - - if (BufferedIOMixin_closed(self)) { - PyErr_SetString(PyExc_ValueError, "write to closed file"); - PyBuffer_Release(&buf); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - /* XXX we can implement some more tricks to try and avoid - * partial writes - */ - - if (Py_SIZE(self->write_buf) > self->buffer_size) { - /* We're full, so let's pre-flush the buffer*/ - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) { - /* We can't accept anything else. */ - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - if (value != NULL && - PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { - ((PyBlockingIOErrorObject *)value)->written = 0; - } - - PyErr_Restore(type, value, traceback); - goto fail; - } - } - - written = buf.len; - - before = Py_SIZE(self->write_buf); - if (PyByteArray_Resize(self->write_buf, before + written) < 0) { - res = NULL; - goto fail; - } - memcpy(PyByteArray_AS_STRING(self->write_buf) + before, buf.buf, written); - - if (Py_SIZE(self->write_buf) > self->buffer_size) { - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) { - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - if (value != NULL && - PyErr_GivenExceptionMatches(value, PyExc_BlockingIOError)) { - - Py_ssize_t overage = - Py_SIZE(self->write_buf) - self->max_buffer_size; - - if (overage > 0) { - /* We've hit max_buffer_size. We have to accept a - * partial write and cut back our buffer. - */ - if (PyByteArray_Resize(self->write_buf, self->max_buffer_size) < 0) - goto fail; - ((PyBlockingIOErrorObject *)value)->written = overage; - } - else - { - Py_CLEAR(type); - Py_CLEAR(value); - Py_CLEAR(traceback); - goto end; - } - } - - PyErr_Restore(type, value, traceback); - goto fail; - } - } - - end: - res = PyLong_FromSsize_t(written); - - fail: - PyThread_release_lock(self->write_lock); - PyBuffer_Release(&buf); - return res; -} - -static PyObject * -BufferedWriter_truncate(BufferedObject *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) - goto end; - Py_DECREF(res); - - res = BufferedIOMixin_truncate(self, args); - - end: - PyThread_release_lock(self->write_lock); - return res; -} - -static PyObject * -BufferedWriter_flush(BufferedObject *self, PyObject *args) -{ - PyObject *res; - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedWriter_flush_unlocked(self); - - PyThread_release_lock(self->write_lock); - - return res; -} - -static PyObject * -BufferedWriter_tell(BufferedObject *self, PyObject *args) -{ - PyObject *op1, *op2, *res; - - op1 = PyObject_CallMethod(self->raw, "tell", NULL); - - op2 = PyLong_FromSsize_t(Py_SIZE(self->write_buf)); - if (op2 == NULL) { - Py_DECREF(op1); - return NULL; - } - - res = PyNumber_Add(op1, op2); - Py_DECREF(op1); - Py_DECREF(op2); - return res; -} - -static PyObject * -BufferedWriter_seek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t pos; - int whence = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->write_lock, 1); - Py_END_ALLOW_THREADS - - res = _BufferedWriter_flush_unlocked(self); - if (res == NULL) - goto end; - - res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); - - end: - PyThread_release_lock(self->write_lock); - return res; -} - -static PyMethodDef BufferedWriter_methods[] = { - /* BufferedIOMixin methods */ - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, - {"truncate", (PyCFunction)BufferedWriter_truncate, METH_VARARGS}, - {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, - {"seek", (PyCFunction)BufferedWriter_seek, METH_VARARGS}, - {"tell", (PyCFunction)BufferedWriter_tell, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef BufferedWriter_members[] = { - {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, - {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, - {NULL} -}; - -static PyGetSetDef BufferedWriter_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject BufferedWriter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedWriter", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedWriter_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedWriter_methods, /* tp_methods */ - BufferedWriter_members, /* tp_members */ - BufferedWriter_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedWriter_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -/* - * BufferedRWPair - */ - -PyDoc_STRVAR(BufferedRWPair_doc, - "A buffered reader and writer object together.\n" - "\n" - "A buffered reader object and buffered writer object put together to\n" - "form a sequential IO object that can read and write. This is typically\n" - "used with a socket or two-way pipe.\n" - "\n" - "reader and writer are RawIOBase objects that are readable and\n" - "writeable respectively. If the buffer_size is omitted it defaults to\n" - "DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer)\n" - "defaults to twice the buffer size.\n" - ); - -/* XXX The usefulness of this (compared to having two separate IO objects) is - * questionable. - */ - -typedef struct { - PyObject_HEAD - BufferedObject *reader; - BufferedObject *writer; -} BufferedRWPairObject; - -static int -BufferedRWPair_init(BufferedRWPairObject *self, PyObject *args, - PyObject *kwds) -{ - PyObject *reader, *writer; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -1; - - if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, - &buffer_size, &max_buffer_size)) { - return -1; - } - - if (IOBase_checkReadable(reader, NULL) == NULL) - return -1; - if (IOBase_checkWritable(writer, NULL) == NULL) - return -1; - - args = Py_BuildValue("(n)", buffer_size); - if (args == NULL) { - Py_CLEAR(self->reader); - return -1; - } - self->reader = (BufferedObject*)PyType_GenericNew(&BufferedReader_Type, args, NULL); - Py_DECREF(args); - if (self->reader == NULL) - return -1; - - args = Py_BuildValue("(nn)", buffer_size, max_buffer_size); - if (args == NULL) { - Py_CLEAR(self->reader); - return -1; - } - self->writer = (BufferedObject*)PyType_GenericNew(&BufferedWriter_Type, args, NULL); - Py_DECREF(args); - if (self->writer == NULL) { - Py_CLEAR(self->reader); - return -1; - } - return 0; -} - -static void -BufferedRWPair_dealloc(BufferedRWPairObject *self) -{ - Py_CLEAR(self->reader); - Py_CLEAR(self->writer); -} - -static PyObject * -_forward_call(BufferedObject *self, const char* name, PyObject *args) -{ - PyObject *func = PyObject_GetAttrString((PyObject*)self, name); - PyObject *ret; - - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; - } - - ret = PyObject_CallObject(func, args); - Py_DECREF(func); - return ret; -} - -static PyObject * -BufferedRWPair_read(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "read", args); -} - -static PyObject * -BufferedRWPair_peek(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "peek", args); -} - -static PyObject * -BufferedRWPair_read1(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "read1", args); -} - -static PyObject * -BufferedRWPair_write(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->writer, "write", args); -} - -static PyObject * -BufferedRWPair_flush(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->writer, "flush", args); -} - -static PyObject * -BufferedRWPair_readable(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->reader, "readable", args); -} - -static PyObject * -BufferedRWPair_writable(BufferedRWPairObject *self, PyObject *args) -{ - return _forward_call(self->writer, "writable", args); -} - -static PyObject * -BufferedRWPair_close(BufferedRWPairObject *self, PyObject *args) -{ - PyObject *ret = _forward_call(self->writer, "close", args); - if (ret == NULL) - return NULL; - Py_DECREF(ret); - - return _forward_call(self->reader, "close", args); -} - -static PyObject * -BufferedRWPair_isatty(BufferedRWPairObject *self, PyObject *args) -{ - PyObject *ret = _forward_call(self->writer, "isatty", args); - - if (ret != Py_False) { - /* either True or exception */ - return ret; - } - Py_DECREF(ret); - - return _forward_call(self->reader, "isatty", args); -} - - -static PyMethodDef BufferedRWPair_methods[] = { - {"read", (PyCFunction)BufferedRWPair_read, METH_VARARGS}, - {"peek", (PyCFunction)BufferedRWPair_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedRWPair_read1, METH_VARARGS}, - - {"write", (PyCFunction)BufferedRWPair_write, METH_VARARGS}, - {"flush", (PyCFunction)BufferedRWPair_flush, METH_NOARGS}, - - {"readable", (PyCFunction)BufferedRWPair_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedRWPair_writable, METH_NOARGS}, - - {"close", (PyCFunction)BufferedRWPair_close, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedRWPair_isatty, METH_NOARGS}, - - {NULL, NULL} -}; - -PyTypeObject BufferedRWPair_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedRWPair", /*tp_name*/ - sizeof(BufferedRWPairObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedRWPair_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedRWPair_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedRWPair_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -/* - * BufferedRandom - */ - -PyDoc_STRVAR(BufferedRandom_doc, - "A buffered interface to random access streams.\n" - "\n" - "The constructor creates a reader and writer for a seekable stream,\n" - "raw, given in the first argument. If the buffer_size is omitted it\n" - "defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered\n" - "writer) defaults to twice the buffer size.\n" - ); - -static int -BufferedRandom_init(BufferedObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -1; - PyObject *raw; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, - &raw, &buffer_size, &max_buffer_size)) { - return -1; - } - - if (IOBase_checkSeekable(raw, NULL) == NULL) - return -1; - if (IOBase_checkReadable(raw, NULL) == NULL) - return -1; - if (IOBase_checkWritable(raw, NULL) == NULL) - return -1; - - Py_INCREF(raw); - self->raw = raw; - - if (max_buffer_size < 0) - max_buffer_size = buffer_size * 2; - self->buffer_size = buffer_size; - self->max_buffer_size = max_buffer_size; - - if( _BufferedReader_reset_read_buf(self) < 0) - return -1; - - self->read_lock = PyThread_allocate_lock(); - if (self->read_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); - return -1; - } - - self->write_buf = PyByteArray_FromStringAndSize(NULL, 0); - if (self->write_buf == NULL) - return -1; - - self->write_lock = PyThread_allocate_lock(); - if (self->write_lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate write lock"); - return -1; - } - - return 0; -} - -static PyObject * -BufferedRandom_tell(BufferedObject *self, PyObject *args) -{ - if (Py_SIZE(self->write_buf)) - return BufferedWriter_tell(self, args); - else - return BufferedReader_tell(self, args); -} - -static PyObject * -BufferedRandom_seek(BufferedObject *self, PyObject *args) -{ - Py_ssize_t pos; - int whence = 0; - PyObject *res; - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &whence)) { - return NULL; - } - - res = PyObject_CallMethod((PyObject*)self, "flush", NULL); - if (res == NULL) - return NULL; - - /* First do the raw seek, then empty the read buffer, so that - * if the raw seek fails, we don't lose buffered data forever. - */ - - res = PyObject_CallMethod(self->raw, "seek", "ni", pos, whence); - if (res == NULL) - return NULL; - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - if( _BufferedReader_reset_read_buf(self) < 0) - Py_CLEAR(res); - - PyThread_release_lock(self->read_lock); - return res; -} - -static PyObject * -BufferedRandom_truncate(BufferedObject *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - if (pos == Py_None) - pos = PyObject_CallMethod(self->raw, "tell", NULL); - else - Py_INCREF(pos); - - /* Use seek to flush the read buffer. */ - res = PyObject_CallMethod((PyObject *)self, "seek", "O", pos); - Py_DECREF(pos); - if (res == NULL) - return NULL; - Py_DECREF(res); - - args = PyTuple_New(0); - if (args == NULL) - return NULL; - res = BufferedWriter_truncate(self, args); - Py_DECREF(args); - - return res; -} - -static PyObject * -BufferedRandom_read(BufferedObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - - return BufferedReader_read(self, args); -} - -static PyObject * -BufferedRandom_readinto(BufferedObject *self, PyObject *args) -{ - PyObject *res; - - res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return BufferedIOBase_readinto((PyObject *)self, args); -} - -static PyObject * -BufferedRandom_peek(BufferedObject *self, PyObject *args) -{ - PyObject *res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return BufferedReader_peek(self, args); -} - -static PyObject * -BufferedRandom_read1(BufferedObject *self, PyObject *args) -{ - PyObject *res = BufferedWriter_flush(self, Py_None); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return BufferedReader_read1(self, args); -} - -static PyObject * -BufferedRandom_write(BufferedObject *self, PyObject *args) -{ - if (Py_SIZE(self->read_buf) > 0) { - PyObject *res; - /* Undo readahead */ - - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->read_lock, 1); - Py_END_ALLOW_THREADS - - res = PyObject_CallMethod(self->raw, "seek", "ni", - self->read_pos - Py_SIZE(self->read_buf), 1); - Py_XDECREF(res); - if (res != NULL) { - if( _BufferedReader_reset_read_buf(self) < 0) - res = NULL; - } - - PyThread_release_lock(self->read_lock); - - if (res == NULL) - return NULL; - } - - return BufferedWriter_write(self, args); -} - - -static PyMethodDef BufferedRandom_methods[] = { - /* BufferedIOMixin methods */ - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS}, - - {"seek", (PyCFunction)BufferedRandom_seek, METH_VARARGS}, - {"tell", (PyCFunction)BufferedRandom_tell, METH_NOARGS}, - {"truncate", (PyCFunction)BufferedRandom_truncate, METH_VARARGS}, - {"read", (PyCFunction)BufferedRandom_read, METH_VARARGS}, - {"readinto", (PyCFunction)BufferedRandom_readinto, METH_VARARGS}, - {"peek", (PyCFunction)BufferedRandom_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedRandom_read1, METH_VARARGS}, - {"write", (PyCFunction)BufferedRandom_write, METH_VARARGS}, - {NULL, NULL} -}; - -static PyMemberDef BufferedRandom_members[] = { - {"_name", T_OBJECT, offsetof(BufferedObject, name), 0}, - {"_mode", T_OBJECT, offsetof(BufferedObject, mode), 0}, - {NULL} -}; - -static PyGetSetDef BufferedRandom_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {0} -}; - - -PyTypeObject BufferedRandom_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BufferedRandom", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedRandom_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BufferedRandom_methods, /* tp_methods */ - BufferedRandom_members, /* tp_members */ - BufferedRandom_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /*tp_dict*/ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /*tp_dictoffset*/ - (initproc)BufferedRandom_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - /* * Module definition */ @@ -2948,13 +545,13 @@ goto fail; /* UnsupportedOperation inherits from ValueError and IOError */ - PyExc_UnsupportedOperation = PyObject_CallFunction( + PyIOExc_UnsupportedOperation = PyObject_CallFunction( (PyObject*)&PyType_Type, "s(OO){}", "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); - if (PyExc_UnsupportedOperation == NULL) + if (PyIOExc_UnsupportedOperation == NULL) goto fail; PyModule_AddObject(m, "UnsupportedOperation", - PyExc_UnsupportedOperation); + PyIOExc_UnsupportedOperation); /* BlockingIOError */ base = (PyTypeObject*)PyExc_IOError; @@ -2965,65 +562,65 @@ PyModule_AddObject(m, "BlockingIOError", (PyObject *)&_PyExc_BlockingIOError); - if (PyType_Ready(&_IOBase_Type) < 0) + if (PyType_Ready(&PyIOBase_Type) < 0) goto fail; - Py_INCREF(&_IOBase_Type); + Py_INCREF(&PyIOBase_Type); PyModule_AddObject(m, "IOBase", - (PyObject *)&_IOBase_Type); + (PyObject *)&PyIOBase_Type); - if (PyType_Ready(&_RawIOBase_Type) < 0) + if (PyType_Ready(&PyRawIOBase_Type) < 0) goto fail; - Py_INCREF(&_RawIOBase_Type); + Py_INCREF(&PyRawIOBase_Type); PyModule_AddObject(m, "RawIOBase", - (PyObject *)&_RawIOBase_Type); + (PyObject *)&PyRawIOBase_Type); /* FileIO */ - PyFileIO_Type.tp_base = &_RawIOBase_Type; + PyFileIO_Type.tp_base = &PyRawIOBase_Type; if (PyType_Ready(&PyFileIO_Type) < 0) goto fail; Py_INCREF(&PyFileIO_Type); PyModule_AddObject(m, "FileIO", (PyObject *) &PyFileIO_Type); /* BufferedIOBase */ - if (PyType_Ready(&_BufferedIOBase_Type) < 0) + if (PyType_Ready(&PyBufferedIOBase_Type) < 0) goto fail; - Py_INCREF(&_BufferedIOBase_Type); - PyModule_AddObject(m, "BufferedIOBase", (PyObject *) &_BufferedIOBase_Type); + Py_INCREF(&PyBufferedIOBase_Type); + PyModule_AddObject(m, "BufferedIOBase", (PyObject *) &PyBufferedIOBase_Type); /* BytesIO */ - PyBytesIO_Type.tp_base = &_BufferedIOBase_Type; + PyBytesIO_Type.tp_base = &PyBufferedIOBase_Type; if (PyType_Ready(&PyBytesIO_Type) < 0) goto fail; Py_INCREF(&PyBytesIO_Type); PyModule_AddObject(m, "BytesIO", (PyObject *) &PyBytesIO_Type); /* BufferedReader */ - BufferedReader_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedReader_Type) < 0) + PyBufferedReader_Type.tp_base = &PyBufferedIOBase_Type; + if (PyType_Ready(&PyBufferedReader_Type) < 0) goto fail; - Py_INCREF(&BufferedReader_Type); - PyModule_AddObject(m, "BufferedReader", (PyObject *) &BufferedReader_Type); + Py_INCREF(&PyBufferedReader_Type); + PyModule_AddObject(m, "BufferedReader", (PyObject *) &PyBufferedReader_Type); /* BufferedWriter */ - BufferedWriter_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedWriter_Type) < 0) + PyBufferedWriter_Type.tp_base = &PyBufferedIOBase_Type; + if (PyType_Ready(&PyBufferedWriter_Type) < 0) goto fail; - Py_INCREF(&BufferedWriter_Type); - PyModule_AddObject(m, "BufferedWriter", (PyObject *) &BufferedWriter_Type); + Py_INCREF(&PyBufferedWriter_Type); + PyModule_AddObject(m, "BufferedWriter", (PyObject *) &PyBufferedWriter_Type); /* BufferedRWPair */ - BufferedRWPair_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedRWPair_Type) < 0) + PyBufferedRWPair_Type.tp_base = &PyBufferedIOBase_Type; + if (PyType_Ready(&PyBufferedRWPair_Type) < 0) goto fail; - Py_INCREF(&BufferedRWPair_Type); - PyModule_AddObject(m, "BufferedRWPair", (PyObject *) &BufferedRWPair_Type); + Py_INCREF(&PyBufferedRWPair_Type); + PyModule_AddObject(m, "BufferedRWPair", (PyObject *) &PyBufferedRWPair_Type); /* BufferedRandom */ - BufferedRandom_Type.tp_base = &_BufferedIOBase_Type; - if (PyType_Ready(&BufferedRandom_Type) < 0) + PyBufferedRandom_Type.tp_base = &PyBufferedIOBase_Type; + if (PyType_Ready(&PyBufferedRandom_Type) < 0) goto fail; - Py_INCREF(&BufferedRandom_Type); - PyModule_AddObject(m, "BufferedRandom", (PyObject *) &BufferedRandom_Type); + Py_INCREF(&PyBufferedRandom_Type); + PyModule_AddObject(m, "BufferedRandom", (PyObject *) &PyBufferedRandom_Type); return m; From python-checkins at python.org Fri Nov 7 02:39:28 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 7 Nov 2008 02:39:28 +0100 (CET) Subject: [Python-checkins] r67133 - python/tags/r30rc2 Message-ID: <20081107013928.1303B1E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 7 02:39:27 2008 New Revision: 67133 Log: Removing old tag. Removed: python/tags/r30rc2/ From python-checkins at python.org Fri Nov 7 02:40:26 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 7 Nov 2008 02:40:26 +0100 (CET) Subject: [Python-checkins] r67134 - python/tags/r30rc2 Message-ID: <20081107014026.11D661E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 7 02:40:25 2008 New Revision: 67134 Log: Tagging Added: python/tags/r30rc2/ - copied from r67133, /python/branches/py3k/ From python-checkins at python.org Fri Nov 7 03:16:54 2008 From: python-checkins at python.org (alexandre.vassalotti) Date: Fri, 7 Nov 2008 03:16:54 +0100 (CET) Subject: [Python-checkins] r67135 - in sandbox/trunk/io-c: _bytesio.c _iobase.c io.c Message-ID: <20081107021654.581821E4002@bag.python.org> Author: alexandre.vassalotti Date: Fri Nov 7 03:16:54 2008 New Revision: 67135 Log: Fix compiler errors and warnings. Modified: sandbox/trunk/io-c/_bytesio.c sandbox/trunk/io-c/_iobase.c sandbox/trunk/io-c/io.c Modified: sandbox/trunk/io-c/_bytesio.c ============================================================================== --- sandbox/trunk/io-c/_bytesio.c (original) +++ sandbox/trunk/io-c/_bytesio.c Fri Nov 7 03:16:54 2008 @@ -1,4 +1,5 @@ #include "Python.h" +#include "structmember.h" /* for offsetof() */ typedef struct { PyObject_HEAD Modified: sandbox/trunk/io-c/_iobase.c ============================================================================== --- sandbox/trunk/io-c/_iobase.c (original) +++ sandbox/trunk/io-c/_iobase.c Fri Nov 7 03:16:54 2008 @@ -516,23 +516,23 @@ } static PyMethodDef IOBase_methods[] = { - {"seek", IOBase_seek, METH_VARARGS}, - {"tell", IOBase_tell, METH_NOARGS}, - {"truncate", IOBase_truncate, METH_VARARGS}, - {"flush", IOBase_flush, METH_NOARGS}, - {"close", IOBase_close, METH_NOARGS}, - - {"seekable", IOBase_seekable, METH_NOARGS}, - {"readable", IOBase_readable, METH_NOARGS}, - {"writable", IOBase_writable, METH_NOARGS}, + {"seek", IOBase_seek, METH_VARARGS, IOBase_seek_doc}, + {"tell", IOBase_tell, METH_NOARGS, IOBase_tell_doc}, + {"truncate", IOBase_truncate, METH_VARARGS, IOBase_truncate_doc}, + {"flush", IOBase_flush, METH_NOARGS, IOBase_flush_doc}, + {"close", IOBase_close, METH_NOARGS, IOBase_close_doc}, + + {"seekable", IOBase_seekable, METH_NOARGS, IOBase_seekable_doc}, + {"readable", IOBase_readable, METH_NOARGS, IOBase_readable_doc}, + {"writable", IOBase_writable, METH_NOARGS, IOBase_writable_doc}, {"_checkClosed", _PyIOBase_checkClosed, METH_NOARGS}, {"_checkSeekable", _PyIOBase_checkSeekable, METH_NOARGS}, {"_checkReadable", _PyIOBase_checkReadable, METH_NOARGS}, {"_checkWritable", _PyIOBase_checkWritable, METH_NOARGS}, - {"fileno", IOBase_fileno, METH_NOARGS}, - {"isatty", IOBase_isatty, METH_NOARGS}, + {"fileno", IOBase_fileno, METH_NOARGS, IOBase_fileno_doc}, + {"isatty", IOBase_isatty, METH_NOARGS, IOBase_isatty_doc}, {"__enter__", IOBase_enter, METH_NOARGS}, {"__exit__", IOBase_exit, METH_VARARGS}, @@ -540,9 +540,9 @@ {"__iter__", IOBase_iter, METH_NOARGS}, {"__next__", IOBase_next, METH_NOARGS}, - {"readline", IOBase_readline, METH_VARARGS}, - {"readlines", IOBase_readlines, METH_VARARGS}, - {"writelines", IOBase_readlines, METH_VARARGS}, + {"readline", IOBase_readline, METH_VARARGS, IOBase_readline_doc}, + {"readlines", IOBase_readlines, METH_VARARGS, IOBase_readlines_doc}, + {"writelines", IOBase_writelines, METH_VARARGS}, {NULL, NULL} }; Modified: sandbox/trunk/io-c/io.c ============================================================================== --- sandbox/trunk/io-c/io.c (original) +++ sandbox/trunk/io-c/io.c Fri Nov 7 03:16:54 2008 @@ -1,4 +1,4 @@ -#include +#include "Python.h" #include "structmember.h" #include "_iomodule.h" @@ -410,8 +410,8 @@ if (fileno == -1 && PyErr_Occurred()) goto error; - if (stat(fileno, &st) >= 0) - buffering = st->st_blksize; + if (fstat(fileno, &st) >= 0) + buffering = st.st_blksize; } #endif } From python-checkins at python.org Fri Nov 7 04:08:42 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 7 Nov 2008 04:08:42 +0100 (CET) Subject: [Python-checkins] r67137 - python/tags/r30rc2 Message-ID: <20081107030842.93A521E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 7 04:08:42 2008 New Revision: 67137 Log: De-tagging Removed: python/tags/r30rc2/ From python-checkins at python.org Fri Nov 7 04:09:16 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 7 Nov 2008 04:09:16 +0100 (CET) Subject: [Python-checkins] r67138 - python/tags/r30rc2 Message-ID: <20081107030916.F25821E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 7 04:09:16 2008 New Revision: 67138 Log: Retagging. Added: python/tags/r30rc2/ - copied from r67137, /python/branches/py3k/ From python-checkins at python.org Fri Nov 7 04:47:15 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 7 Nov 2008 04:47:15 +0100 (CET) Subject: [Python-checkins] r67140 - in peps/trunk: pep-0101.txt pep-0361.txt Message-ID: <20081107034715.A88CD1E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 7 04:47:15 2008 New Revision: 67140 Log: 3.0rc2 released Modified: peps/trunk/pep-0101.txt peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0101.txt ============================================================================== --- peps/trunk/pep-0101.txt (original) +++ peps/trunk/pep-0101.txt Fri Nov 7 04:47:15 2008 @@ -125,7 +125,7 @@ ___ Regenerate Lib/pydoc-topics.py cd to the Doc directory and type ``make pydoc-topics``. Then copy - ``build/pydoc-topics/pydoc-topics.py`` to ``Lib/pydoc-topics.py``. + ``build/pydoc-topics/pydoc-topics.py`` to ``../Lib/pydoc-topics.py``. ___ Bump version numbers via the release script. Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Fri Nov 7 04:47:15 2008 @@ -61,9 +61,8 @@ Sep 12 2008: Python 2.6rc1 is released Sep 17 2008: Python 2.6rc2 and 3.0rc1 released Oct 01 2008: Python 2.6 final released - Oct 15 2008: Python 3.0rc2 planned - Nov 05 2008: Python 3.0rc3 planned (if needed) - Nov 19 2008: Python 3.0rc4 planned (if needed) + Nov 06 2008: Python 3.0rc2 released + Nov 19 2008: Python 3.0rc3 planned (if needed) Dec 03 2008: Python 3.0 final planned See the public `Google calendar`_ From buildbot at python.org Fri Nov 7 06:12:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 07 Nov 2008 05:12:51 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081107051251.F2B981E4002@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/656 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: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Fri Nov 7 07:22:30 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 7 Nov 2008 01:22:30 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081107062230.GA9531@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Fri Nov 7 09:12:30 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 7 Nov 2008 09:12:30 +0100 (CET) Subject: [Python-checkins] r67142 - in doctools/trunk/sphinx: directives/other.py environment.py latexwriter.py static/default.css util/compat.py Message-ID: <20081107081230.348011E400C@bag.python.org> Author: georg.brandl Date: Fri Nov 7 09:12:29 2008 New Revision: 67142 Log: Copy fixes from Hg until 724:bebba06f30d2. Modified: doctools/trunk/sphinx/directives/other.py doctools/trunk/sphinx/environment.py doctools/trunk/sphinx/latexwriter.py doctools/trunk/sphinx/static/default.css doctools/trunk/sphinx/util/compat.py Modified: doctools/trunk/sphinx/directives/other.py ============================================================================== --- doctools/trunk/sphinx/directives/other.py (original) +++ doctools/trunk/sphinx/directives/other.py Fri Nov 7 09:12:29 2008 @@ -229,15 +229,16 @@ def seealso_directive(name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): - seealsonode = make_admonition( + ret = make_admonition( addnodes.seealso, name, [_('See also')], options, content, lineno, content_offset, block_text, state, state_machine) if arguments: argnodes, msgs = state.inline_text(arguments[0], lineno) para = nodes.paragraph() para += argnodes - seealsonode[1:1] = [para] + msgs - return [seealsonode] + para += msgs + ret[0].insert(1, para) + return ret seealso_directive.content = 1 seealso_directive.arguments = (0, 1, 1) Modified: doctools/trunk/sphinx/environment.py ============================================================================== --- doctools/trunk/sphinx/environment.py (original) +++ doctools/trunk/sphinx/environment.py Fri Nov 7 09:12:29 2008 @@ -32,7 +32,7 @@ from docutils import nodes from docutils.io import FileInput, NullOutput from docutils.core import Publisher -from docutils.utils import Reporter +from docutils.utils import Reporter, relative_path from docutils.readers import standalone from docutils.parsers.rst import roles from docutils.parsers.rst.languages import en as english @@ -619,19 +619,22 @@ node['uri'] = imgpath if imgpath.endswith(os.extsep + '*'): for filename in glob(path.join(self.srcdir, imgpath)): - dir, base = path.split(filename) - if base.lower().endswith('.pdf'): - candidates['application/pdf'] = path.join(docdir, base) - elif base.lower().endswith('.svg'): - candidates['image/svg+xml'] = path.join(docdir, base) + relname = relative_path(self.srcdir, filename) + if filename.lower().endswith('.pdf'): + candidates['application/pdf'] = path.join(docdir, relname) + elif filename.lower().endswith('.svg'): + candidates['image/svg+xml'] = path.join(docdir, relname) else: - f = open(filename, 'rb') try: - imgtype = imghdr.what(f) - finally: - f.close() + f = open(filename, 'rb') + try: + imgtype = imghdr.what(f) + finally: + f.close() + except (OSError, IOError): + self.warn(docname, 'Image file %s not readable' % filename) if imgtype: - candidates['image/' + imgtype] = path.join(docdir, base) + candidates['image/' + imgtype] = path.join(docdir, relname) else: candidates['*'] = imgpath for imgpath in candidates.itervalues(): Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Fri Nov 7 09:12:29 2008 @@ -877,6 +877,7 @@ raise nodes.SkipNode def visit_reference(self, node): + print node uri = node.get('refuri', '') if self.in_title or not uri: self.context.append('') Modified: doctools/trunk/sphinx/static/default.css ============================================================================== --- doctools/trunk/sphinx/static/default.css (original) +++ doctools/trunk/sphinx/static/default.css Fri Nov 7 09:12:29 2008 @@ -618,7 +618,7 @@ margin-bottom: 0; } -div.admonition p { +div.admonition p.admonition-title + p { display: inline; } Modified: doctools/trunk/sphinx/util/compat.py ============================================================================== --- doctools/trunk/sphinx/util/compat.py (original) +++ doctools/trunk/sphinx/util/compat.py Fri Nov 7 09:12:29 2008 @@ -15,11 +15,11 @@ # function missing in 0.5 SVN def make_admonition(node_class, name, arguments, options, content, lineno, content_offset, block_text, state, state_machine): - if not content: - error = state_machine.reporter.error( - 'The "%s" admonition is empty; content required.' % (name), - nodes.literal_block(block_text, block_text), line=lineno) - return [error] + #if not content: + # error = state_machine.reporter.error( + # 'The "%s" admonition is empty; content required.' % (name), + # nodes.literal_block(block_text, block_text), line=lineno) + # return [error] text = '\n'.join(content) admonition_node = node_class(text) if arguments: @@ -33,5 +33,5 @@ classes = ['admonition-' + nodes.make_id(title_text)] admonition_node['classes'] += classes state.nested_parse(content, content_offset, admonition_node) - return admonition_node + return [admonition_node] From python-checkins at python.org Fri Nov 7 09:27:39 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 7 Nov 2008 09:27:39 +0100 (CET) Subject: [Python-checkins] r67143 - python/trunk/Doc/using/cmdline.rst Message-ID: <20081107082739.911251E4002@bag.python.org> Author: georg.brandl Date: Fri Nov 7 09:27:39 2008 New Revision: 67143 Log: Fix syntax. 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 Fri Nov 7 09:27:39 2008 @@ -143,8 +143,7 @@ an empty string (``""``) and the current directory will be added to the start of :data:`sys.path`. - .. seealso:: - :ref:`tut-invoking` +.. seealso:: :ref:`tut-invoking` Generic options From python-checkins at python.org Fri Nov 7 09:28:20 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 7 Nov 2008 09:28:20 +0100 (CET) Subject: [Python-checkins] r67144 - in python/branches/release26-maint: Doc/using/cmdline.rst Message-ID: <20081107082820.DB1751E4011@bag.python.org> Author: georg.brandl Date: Fri Nov 7 09:28:20 2008 New Revision: 67144 Log: Merged revisions 67143 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67143 | georg.brandl | 2008-11-07 09:27:39 +0100 (Fri, 07 Nov 2008) | 2 lines Fix syntax. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/using/cmdline.rst Modified: python/branches/release26-maint/Doc/using/cmdline.rst ============================================================================== --- python/branches/release26-maint/Doc/using/cmdline.rst (original) +++ python/branches/release26-maint/Doc/using/cmdline.rst Fri Nov 7 09:28:20 2008 @@ -143,8 +143,7 @@ an empty string (``""``) and the current directory will be added to the start of :data:`sys.path`. - .. seealso:: - :ref:`tut-invoking` +.. seealso:: :ref:`tut-invoking` Generic options From python-checkins at python.org Fri Nov 7 09:29:03 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 7 Nov 2008 09:29:03 +0100 (CET) Subject: [Python-checkins] r67145 - in python/branches/release26-maint: Doc/whatsnew/2.3.rst Doc/whatsnew/2.4.rst Doc/whatsnew/2.5.rst Doc/whatsnew/2.6.rst Message-ID: <20081107082903.01C571E4002@bag.python.org> Author: georg.brandl Date: Fri Nov 7 09:29:02 2008 New Revision: 67145 Log: Merged revisions 66861 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r66861 | benjamin.peterson | 2008-10-08 23:11:33 +0200 (Wed, 08 Oct 2008) | 1 line quiet sphinx warnings ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/whatsnew/2.3.rst python/branches/release26-maint/Doc/whatsnew/2.4.rst python/branches/release26-maint/Doc/whatsnew/2.5.rst python/branches/release26-maint/Doc/whatsnew/2.6.rst Modified: python/branches/release26-maint/Doc/whatsnew/2.3.rst ============================================================================== --- python/branches/release26-maint/Doc/whatsnew/2.3.rst (original) +++ python/branches/release26-maint/Doc/whatsnew/2.3.rst Fri Nov 7 09:29:02 2008 @@ -2062,7 +2062,7 @@ .. ====================================================================== -.. _acks: +.. _23acks: Acknowledgements ================ Modified: python/branches/release26-maint/Doc/whatsnew/2.4.rst ============================================================================== --- python/branches/release26-maint/Doc/whatsnew/2.4.rst (original) +++ python/branches/release26-maint/Doc/whatsnew/2.4.rst Fri Nov 7 09:29:02 2008 @@ -1551,7 +1551,7 @@ .. ====================================================================== -.. _acks: +.. _24acks: Acknowledgements ================ Modified: python/branches/release26-maint/Doc/whatsnew/2.5.rst ============================================================================== --- python/branches/release26-maint/Doc/whatsnew/2.5.rst (original) +++ python/branches/release26-maint/Doc/whatsnew/2.5.rst Fri Nov 7 09:29:02 2008 @@ -1109,7 +1109,7 @@ .. ====================================================================== -.. _interactive: +.. _25interactive: Interactive Interpreter Changes ------------------------------- @@ -1211,7 +1211,7 @@ .. ====================================================================== -.. _modules: +.. _25modules: New, Improved, and Removed Modules ================================== Modified: python/branches/release26-maint/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/release26-maint/Doc/whatsnew/2.6.rst (original) +++ python/branches/release26-maint/Doc/whatsnew/2.6.rst Fri Nov 7 09:29:02 2008 @@ -3274,7 +3274,7 @@ .. ====================================================================== -.. _acks: +.. _26acks: Acknowledgements ================ From python-checkins at python.org Fri Nov 7 09:56:29 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 7 Nov 2008 09:56:29 +0100 (CET) Subject: [Python-checkins] r67146 - in python/branches/release26-maint: Doc/ACKS.txt Doc/c-api/init.rst Doc/library/2to3.rst Doc/library/codecs.rst Doc/library/collections.rst Doc/library/dis.rst Doc/library/email.parser.rst Doc/library/ftplib.rst Doc/library/functions.rst Doc/library/heapq.rst Doc/library/select.rst Doc/library/socket.rst Doc/library/sqlite3.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/tempfile.rst Doc/library/thread.rst Doc/library/threading.rst Doc/reference/datamodel.rst Doc/reference/simple_stmts.rst Doc/tutorial/controlflow.rst Doc/whatsnew/2.6.rst Lib/json/tests/test_scanstring.py Lib/lib2to3 Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_set_literal.py Lib/lib2to3/main.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/data/README Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_pytree.py Lib/lib2to3/tests/test_refactor.py Lib/optparse.py Lib/test/test_bisect.py Lib/test/test_bytes.py Lib/test/test_descr.py Lib/test/test_fileio.py Lib/test/test_io.py Lib/test/test_urllib.py Lib/test/test_xrange.py Misc/NEWS Modules/_bisectmodule.c Modules/_fileio.c Modules/_json.c Objects/dictobject.c Parser/asdl_c.py Python/Python-ast.c Tools/scripts/findnocoding.py Tools/scripts/reindent.py Message-ID: <20081107085629.904A21E4002@bag.python.org> Author: georg.brandl Date: Fri Nov 7 09:56:27 2008 New Revision: 67146 Log: Merged revisions 66801,66803-66804,66813,66854-66856,66866,66870-66872,66874,66887,66903,66905,66911,66913,66927,66932,66938,66942,66962,66964,66973-66974,66977,66992,66998-66999,67002,67005,67007,67028,67040-67041,67044,67070,67089,67091,67101,67117-67119,67123-67124 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r66801 | andrew.kuchling | 2008-10-04 23:51:59 +0200 (Sat, 04 Oct 2008) | 1 line Punctuation fix; expand dict.update docstring to be clearer ................ r66803 | benjamin.peterson | 2008-10-05 00:15:31 +0200 (Sun, 05 Oct 2008) | 1 line fix typo ................ r66804 | andrew.kuchling | 2008-10-05 02:11:56 +0200 (Sun, 05 Oct 2008) | 1 line #1415508 from Rocky Bernstein: add docstrings for enable_interspersed_args(), disable_interspersed_args() ................ r66813 | andrew.kuchling | 2008-10-06 14:07:04 +0200 (Mon, 06 Oct 2008) | 3 lines Per Greg Ward, optparse is no longer being externally maintained. I'll look at the bugs in the Optik bug tracker and copy them to the Python bug tracker if they're still relevant. ................ r66854 | georg.brandl | 2008-10-08 19:20:20 +0200 (Wed, 08 Oct 2008) | 2 lines #4059: patch up some sqlite docs. ................ r66855 | georg.brandl | 2008-10-08 19:30:55 +0200 (Wed, 08 Oct 2008) | 2 lines #4058: fix some whatsnew markup. ................ r66856 | georg.brandl | 2008-10-08 20:47:17 +0200 (Wed, 08 Oct 2008) | 3 lines #3935: properly support list subclasses in the C impl. of bisect. Patch reviewed by Raymond. ................ r66866 | benjamin.peterson | 2008-10-09 22:54:43 +0200 (Thu, 09 Oct 2008) | 1 line update paragraph about __future__ for 2.6 ................ r66870 | armin.rigo | 2008-10-10 10:40:44 +0200 (Fri, 10 Oct 2008) | 2 lines Typo: "ThreadError" is the name in the C source. ................ r66871 | benjamin.peterson | 2008-10-10 22:38:49 +0200 (Fri, 10 Oct 2008) | 1 line fix a small typo ................ r66872 | benjamin.peterson | 2008-10-10 22:51:37 +0200 (Fri, 10 Oct 2008) | 1 line talk about how you can unzip with zip ................ r66874 | benjamin.peterson | 2008-10-11 00:23:41 +0200 (Sat, 11 Oct 2008) | 1 line PyGILState_Acquire -> PyGILState_Ensure ................ r66887 | benjamin.peterson | 2008-10-13 23:51:40 +0200 (Mon, 13 Oct 2008) | 1 line document how to disable fixers ................ r66903 | benjamin.peterson | 2008-10-15 22:34:09 +0200 (Wed, 15 Oct 2008) | 1 line don't recurse into directories that start with '.' ................ r66905 | benjamin.peterson | 2008-10-15 23:05:55 +0200 (Wed, 15 Oct 2008) | 1 line support the optional line argument for idle ................ r66911 | benjamin.peterson | 2008-10-16 01:10:28 +0200 (Thu, 16 Oct 2008) | 41 lines Merged revisions 66805,66841,66860,66884-66886,66893,66907,66910 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r66805 | benjamin.peterson | 2008-10-04 20:11:02 -0500 (Sat, 04 Oct 2008) | 1 line mention what the fixes directory is for ........ r66841 | benjamin.peterson | 2008-10-07 17:48:12 -0500 (Tue, 07 Oct 2008) | 1 line use assertFalse and assertTrue ........ r66860 | benjamin.peterson | 2008-10-08 16:05:07 -0500 (Wed, 08 Oct 2008) | 1 line instead of abusing the pattern matcher, use start_tree to find a next binding ........ r66884 | benjamin.peterson | 2008-10-13 15:50:30 -0500 (Mon, 13 Oct 2008) | 1 line don't print tokens to stdout when -v is given ........ r66885 | benjamin.peterson | 2008-10-13 16:28:57 -0500 (Mon, 13 Oct 2008) | 1 line add the -x option to disable fixers ........ r66886 | benjamin.peterson | 2008-10-13 16:33:53 -0500 (Mon, 13 Oct 2008) | 1 line cut down on some crud ........ r66893 | benjamin.peterson | 2008-10-14 17:16:54 -0500 (Tue, 14 Oct 2008) | 1 line add an optional set literal fixer ........ r66907 | benjamin.peterson | 2008-10-15 16:59:41 -0500 (Wed, 15 Oct 2008) | 1 line don't write backup files by default ........ r66910 | benjamin.peterson | 2008-10-15 17:43:10 -0500 (Wed, 15 Oct 2008) | 1 line add the -n option; it stops backupfiles from being written ........ ................ r66913 | benjamin.peterson | 2008-10-16 20:52:14 +0200 (Thu, 16 Oct 2008) | 1 line document that deque indexing is O(n) #4123 ................ r66927 | andrew.kuchling | 2008-10-16 22:15:47 +0200 (Thu, 16 Oct 2008) | 1 line Fix wording (2.6.1 backport candidate) ................ r66932 | benjamin.peterson | 2008-10-16 23:09:28 +0200 (Thu, 16 Oct 2008) | 1 line check for error conditions in _json #3623 ................ r66938 | benjamin.peterson | 2008-10-16 23:27:54 +0200 (Thu, 16 Oct 2008) | 1 line fix possible ref leak ................ r66942 | benjamin.peterson | 2008-10-16 23:48:06 +0200 (Thu, 16 Oct 2008) | 1 line fix more possible ref leaks in _json and use Py_CLEAR ................ r66962 | benjamin.peterson | 2008-10-17 22:01:01 +0200 (Fri, 17 Oct 2008) | 1 line clarify CALL_FUNCTION #4141 ................ r66964 | georg.brandl | 2008-10-17 23:41:49 +0200 (Fri, 17 Oct 2008) | 2 lines Fix duplicate word. ................ r66973 | armin.ronacher | 2008-10-19 10:27:43 +0200 (Sun, 19 Oct 2008) | 3 lines Fixed #4067 by implementing _attributes and _fields for the AST root node. ................ r66974 | benjamin.peterson | 2008-10-19 15:59:01 +0200 (Sun, 19 Oct 2008) | 1 line fix compiler warning ................ r66977 | benjamin.peterson | 2008-10-19 21:39:16 +0200 (Sun, 19 Oct 2008) | 1 line mention -n ................ r66992 | benjamin.peterson | 2008-10-21 22:51:13 +0200 (Tue, 21 Oct 2008) | 1 line make sure to call iteritems() ................ r66998 | benjamin.peterson | 2008-10-22 22:57:43 +0200 (Wed, 22 Oct 2008) | 1 line fix a few typos ................ r66999 | benjamin.peterson | 2008-10-22 23:05:30 +0200 (Wed, 22 Oct 2008) | 1 line and another typo... ................ r67002 | hirokazu.yamamoto | 2008-10-23 02:37:33 +0200 (Thu, 23 Oct 2008) | 1 line Issue #4183: Some tests didn't run with pickle.HIGHEST_PROTOCOL. ................ r67005 | walter.doerwald | 2008-10-23 15:11:39 +0200 (Thu, 23 Oct 2008) | 2 lines Use the correct names of the stateless codec functions (Fixes issue 4178). ................ r67007 | benjamin.peterson | 2008-10-23 23:43:48 +0200 (Thu, 23 Oct 2008) | 1 line only nonempty __slots__ don't work ................ r67028 | benjamin.peterson | 2008-10-26 01:27:07 +0200 (Sun, 26 Oct 2008) | 1 line don't use a catch-all ................ r67040 | armin.rigo | 2008-10-28 18:01:21 +0100 (Tue, 28 Oct 2008) | 5 lines Fix one of the tests: it relied on being present in an "output test" in order to actually test what it was supposed to test, i.e. that the code in the __del__ method did not crash. Use instead the new helper test_support.captured_output(). ................ r67041 | benjamin.peterson | 2008-10-29 21:33:00 +0100 (Wed, 29 Oct 2008) | 1 line mention the version gettempdir() was added ................ r67044 | amaury.forgeotdarc | 2008-10-30 00:15:57 +0100 (Thu, 30 Oct 2008) | 3 lines Correct error message in io.open(): closefd=True is the only accepted value with a file name. ................ r67070 | benjamin.peterson | 2008-10-31 21:41:44 +0100 (Fri, 31 Oct 2008) | 1 line rephrase has_key doc ................ r67089 | benjamin.peterson | 2008-11-03 21:43:20 +0100 (Mon, 03 Nov 2008) | 1 line clarify by splitting into multiple paragraphs ................ r67091 | benjamin.peterson | 2008-11-03 23:34:57 +0100 (Mon, 03 Nov 2008) | 1 line move a FileIO test to test_fileio ................ r67101 | georg.brandl | 2008-11-04 21:49:35 +0100 (Tue, 04 Nov 2008) | 2 lines #4167: fix markup glitches. ................ r67117 | georg.brandl | 2008-11-06 11:17:58 +0100 (Thu, 06 Nov 2008) | 2 lines #4268: Use correct module for two toplevel functions. ................ r67118 | georg.brandl | 2008-11-06 11:19:11 +0100 (Thu, 06 Nov 2008) | 2 lines #4267: small fixes in sqlite3 docs. ................ r67119 | georg.brandl | 2008-11-06 11:20:49 +0100 (Thu, 06 Nov 2008) | 2 lines #4245: move Thread section to the top. ................ r67123 | georg.brandl | 2008-11-06 19:49:15 +0100 (Thu, 06 Nov 2008) | 2 lines #4247: add "pass" examples to tutorial. ................ r67124 | andrew.kuchling | 2008-11-06 20:23:02 +0100 (Thu, 06 Nov 2008) | 1 line Fix grammar error; reword two paragraphs ................ Added: python/branches/release26-maint/Lib/lib2to3/fixes/fix_set_literal.py - copied unchanged from r66911, /python/trunk/Lib/lib2to3/fixes/fix_set_literal.py Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/ACKS.txt python/branches/release26-maint/Doc/c-api/init.rst python/branches/release26-maint/Doc/library/2to3.rst python/branches/release26-maint/Doc/library/codecs.rst python/branches/release26-maint/Doc/library/collections.rst python/branches/release26-maint/Doc/library/dis.rst python/branches/release26-maint/Doc/library/email.parser.rst python/branches/release26-maint/Doc/library/ftplib.rst python/branches/release26-maint/Doc/library/functions.rst python/branches/release26-maint/Doc/library/heapq.rst python/branches/release26-maint/Doc/library/select.rst python/branches/release26-maint/Doc/library/socket.rst python/branches/release26-maint/Doc/library/sqlite3.rst python/branches/release26-maint/Doc/library/stdtypes.rst python/branches/release26-maint/Doc/library/subprocess.rst python/branches/release26-maint/Doc/library/tempfile.rst python/branches/release26-maint/Doc/library/thread.rst python/branches/release26-maint/Doc/library/threading.rst python/branches/release26-maint/Doc/reference/datamodel.rst python/branches/release26-maint/Doc/reference/simple_stmts.rst python/branches/release26-maint/Doc/tutorial/controlflow.rst python/branches/release26-maint/Doc/whatsnew/2.6.rst python/branches/release26-maint/Lib/json/tests/test_scanstring.py python/branches/release26-maint/Lib/lib2to3/ (props changed) python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py python/branches/release26-maint/Lib/lib2to3/main.py python/branches/release26-maint/Lib/lib2to3/refactor.py python/branches/release26-maint/Lib/lib2to3/tests/data/README python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py python/branches/release26-maint/Lib/lib2to3/tests/test_pytree.py python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py python/branches/release26-maint/Lib/optparse.py python/branches/release26-maint/Lib/test/test_bisect.py python/branches/release26-maint/Lib/test/test_bytes.py python/branches/release26-maint/Lib/test/test_descr.py python/branches/release26-maint/Lib/test/test_fileio.py python/branches/release26-maint/Lib/test/test_io.py python/branches/release26-maint/Lib/test/test_urllib.py python/branches/release26-maint/Lib/test/test_xrange.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/_bisectmodule.c python/branches/release26-maint/Modules/_fileio.c python/branches/release26-maint/Modules/_json.c python/branches/release26-maint/Objects/dictobject.c python/branches/release26-maint/Parser/asdl_c.py python/branches/release26-maint/Python/Python-ast.c python/branches/release26-maint/Tools/scripts/findnocoding.py python/branches/release26-maint/Tools/scripts/reindent.py Modified: python/branches/release26-maint/Doc/ACKS.txt ============================================================================== --- python/branches/release26-maint/Doc/ACKS.txt (original) +++ python/branches/release26-maint/Doc/ACKS.txt Fri Nov 7 09:56:27 2008 @@ -16,6 +16,7 @@ * A. Amoroso * Pehr Anderson * Oliver Andrich + * Heidi Annexstad * Jes?s Cea Avi?n * Daniel Barclay * Chris Barker @@ -189,6 +190,7 @@ * Reuben Sumner * Kalle Svensson * Jim Tittsler + * David Turner * Ville Vainio * Martijn Vries * Charles G. Waldman Modified: python/branches/release26-maint/Doc/c-api/init.rst ============================================================================== --- python/branches/release26-maint/Doc/c-api/init.rst (original) +++ python/branches/release26-maint/Doc/c-api/init.rst Fri Nov 7 09:56:27 2008 @@ -755,11 +755,11 @@ :cmacro:`Py_END_ALLOW_THREADS` macros is acceptable. The return value is an opaque "handle" to the thread state when - :cfunc:`PyGILState_Acquire` was called, and must be passed to + :cfunc:`PyGILState_Ensure` was called, and must be passed to :cfunc:`PyGILState_Release` to ensure Python is left in the same state. Even though recursive calls are allowed, these handles *cannot* be shared - each - unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call to - :cfunc:`PyGILState_Release`. + unique call to :cfunc:`PyGILState_Ensure` must save the handle for its call + to :cfunc:`PyGILState_Release`. When the function returns, the current thread will hold the GIL. Failure is a fatal error. Modified: python/branches/release26-maint/Doc/library/2to3.rst ============================================================================== --- python/branches/release26-maint/Doc/library/2to3.rst (original) +++ python/branches/release26-maint/Doc/library/2to3.rst Fri Nov 7 09:56:27 2008 @@ -37,8 +37,8 @@ A diff against the original source file is printed. 2to3 can also write the needed modifications right back to the source file. (Of course, a backup of the -original is also be made.) Writing the changes back is enabled with the -:option:`-w` flag:: +original is also be made unless :option:`-n` is also given.) Writing the +changes back is enabled with the :option:`-w` flag:: $ 2to3 -w example.py @@ -50,16 +50,19 @@ name = input() greet(name) -Comments and and exact indentation are preserved throughout the translation -process. +Comments and exact indentation are preserved throughout the translation process. By default, 2to3 runs a set of predefined fixers. The :option:`-l` flag lists -all available fixers. An explicit set of fixers to run can be given by use of -the :option:`-f` flag. The following example runs only the ``imports`` and -``has_key`` fixers:: +all available fixers. An explicit set of fixers to run can be given with +:option:`-f`. Likewise the :option:`-x` explicitly disables a fixer. The +following example runs only the ``imports`` and ``has_key`` fixers:: $ 2to3 -f imports -f has_key example.py +This command runs every fixer except the ``apply`` fixer:: + + $ 2to3 -x apply example.py + Some fixers are *explicit*, meaning they aren't run by default and must be listed on the command line to be run. Here, in addition to the default fixers, the ``idioms`` fixer is run:: @@ -68,25 +71,25 @@ Notice how passing ``all`` enables all default fixers. -Sometimes 2to3 will find a place in your source code that needs to be -changed, but 2to3 cannot fix automatically. In this case, 2to3 will print a -warning beneath the diff for a file. You should address the warning in order to -have compliant 3.x code. +Sometimes 2to3 will find a place in your source code that needs to be changed, +but 2to3 cannot fix automatically. In this case, 2to3 will print a warning +beneath the diff for a file. You should address the warning in order to have +compliant 3.x code. 2to3 can also refactor doctests. To enable this mode, use the :option:`-d` flag. Note that *only* doctests will be refactored. This also doesn't require the module to be valid Python. For example, doctest like examples in a reST document could also be refactored with this option. -The :option:`-v` option enables the output of more information on the -translation process. +The :option:`-v` option enables output of more information on the translation +process. -When the :option:`-p` is passed, 2to3 treats ``print`` as a function instead -of a statement. This is useful when ``from __future__ import print_function`` -is being used. If this option is not given, the print fixer will surround -print calls in an extra set of parentheses because it cannot differentiate -between the print statement with parentheses (such as ``print ("a" + "b" + -"c")``) and a true function call. +When the :option:`-p` is passed, 2to3 treats ``print`` as a function instead of +a statement. This is useful when ``from __future__ import print_function`` is +being used. If this option is not given, the print fixer will surround print +calls in an extra set of parentheses because it cannot differentiate between the +print statement with parentheses (such as ``print ("a" + "b" + "c")``) and a +true function call. :mod:`lib2to3` - 2to3's library Modified: python/branches/release26-maint/Doc/library/codecs.rst ============================================================================== --- python/branches/release26-maint/Doc/library/codecs.rst (original) +++ python/branches/release26-maint/Doc/library/codecs.rst Fri Nov 7 09:56:27 2008 @@ -32,9 +32,9 @@ * ``name`` The name of the encoding; - * ``encoder`` The stateless encoding function; + * ``encode`` The stateless encoding function; - * ``decoder`` The stateless decoding function; + * ``decode`` The stateless decoding function; * ``incrementalencoder`` An incremental encoder class or factory function; @@ -46,7 +46,7 @@ The various functions or classes take the following arguments: - *encoder* and *decoder*: These must be functions or methods which have the same + *encode* and *decode*: These must be functions or methods which have the same interface as the :meth:`encode`/:meth:`decode` methods of Codec instances (see Codec Interface). The functions/methods are expected to work in a stateless mode. Modified: python/branches/release26-maint/Doc/library/collections.rst ============================================================================== --- python/branches/release26-maint/Doc/library/collections.rst (original) +++ python/branches/release26-maint/Doc/library/collections.rst Fri Nov 7 09:56:27 2008 @@ -247,7 +247,9 @@ In addition to the above, deques support iteration, pickling, ``len(d)``, ``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with -the :keyword:`in` operator, and subscript references such as ``d[-1]``. +the :keyword:`in` operator, and subscript references such as ``d[-1]``. Indexed +access is O(1) at both ends but slows to O(n) in the middle. For fast random +access, use lists instead. Example: Modified: python/branches/release26-maint/Doc/library/dis.rst ============================================================================== --- python/branches/release26-maint/Doc/library/dis.rst (original) +++ python/branches/release26-maint/Doc/library/dis.rst Fri Nov 7 09:56:27 2008 @@ -755,7 +755,8 @@ opcode finds the keyword parameters first. For each keyword argument, the value is on top of the key. Below the keyword parameters, the positional parameters are on the stack, with the right-most parameter on top. Below the parameters, - the function object to call is on the stack. + the function object to call is on the stack. Pops all function arguments, and + the function itself off the stack, and pushes the return value. .. opcode:: MAKE_FUNCTION (argc) Modified: python/branches/release26-maint/Doc/library/email.parser.rst ============================================================================== --- python/branches/release26-maint/Doc/library/email.parser.rst (original) +++ python/branches/release26-maint/Doc/library/email.parser.rst Fri Nov 7 09:56:27 2008 @@ -159,6 +159,7 @@ a common task, two functions are provided as a convenience. They are available in the top-level :mod:`email` package namespace. +.. currentmodule:: email .. function:: message_from_string(s[, _class[, strict]]) Modified: python/branches/release26-maint/Doc/library/ftplib.rst ============================================================================== --- python/branches/release26-maint/Doc/library/ftplib.rst (original) +++ python/branches/release26-maint/Doc/library/ftplib.rst Fri Nov 7 09:56:27 2008 @@ -315,7 +315,7 @@ .. method:: FTP.quit() Send a ``QUIT`` command to the server and close the connection. This is the - "polite" way to close a connection, but it may raise an exception of the server + "polite" way to close a connection, but it may raise an exception if the server responds with an error to the ``QUIT`` command. This implies a call to the :meth:`close` method which renders the :class:`FTP` instance useless for subsequent calls (see below). Modified: python/branches/release26-maint/Doc/library/functions.rst ============================================================================== --- python/branches/release26-maint/Doc/library/functions.rst (original) +++ python/branches/release26-maint/Doc/library/functions.rst Fri Nov 7 09:56:27 2008 @@ -1397,6 +1397,18 @@ makes possible an idiom for clustering a data series into n-length groups using ``zip(*[iter(s)]*n)``. + :func:`zip` in conjunction with the ``*`` operator can be used to unzip a + list:: + + >>> x = [1, 2, 3] + >>> y = [4, 5, 6] + >>> zipped = zip(x, y) + >>> zipped + [(1, 4), (2, 5), (3, 6)] + >>> x2, y2 = zip(*zipped) + >>> x == x2, y == y2 + True + .. versionadded:: 2.0 .. versionchanged:: 2.4 Modified: python/branches/release26-maint/Doc/library/heapq.rst ============================================================================== --- python/branches/release26-maint/Doc/library/heapq.rst (original) +++ python/branches/release26-maint/Doc/library/heapq.rst Fri Nov 7 09:56:27 2008 @@ -95,7 +95,7 @@ Merge multiple sorted inputs into a single sorted output (for example, merge timestamped entries from multiple log files). Returns an :term:`iterator` - over over the sorted values. + over the sorted values. Similar to ``sorted(itertools.chain(*iterables))`` but returns an iterable, does not pull the data into memory all at once, and assumes that each of the input Modified: python/branches/release26-maint/Doc/library/select.rst ============================================================================== --- python/branches/release26-maint/Doc/library/select.rst (original) +++ python/branches/release26-maint/Doc/library/select.rst Fri Nov 7 09:56:27 2008 @@ -363,7 +363,7 @@ Filter specific flags - *:const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags* + :const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -372,7 +372,7 @@ +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_VNODE` filter flags* + :const:`KQ_FILTER_VNODE` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -393,7 +393,7 @@ +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_PROC` filter flags* + :const:`KQ_FILTER_PROC` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -416,7 +416,7 @@ | :const:`KQ_NOTE_TRACKERR` | unable to attach to a child | +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_NETDEV` filter flags* [not available on Mac OS X] + :const:`KQ_FILTER_NETDEV` filter flags [not available on Mac OS X] +----------------------------+--------------------------------------------+ | Constant | Meaning | Modified: python/branches/release26-maint/Doc/library/socket.rst ============================================================================== --- python/branches/release26-maint/Doc/library/socket.rst (original) +++ python/branches/release26-maint/Doc/library/socket.rst Fri Nov 7 09:56:27 2008 @@ -276,11 +276,15 @@ .. function:: gethostname() Return a string containing the hostname of the machine where the Python - interpreter is currently executing. If you want to know the current machine's IP - address, you may want to use ``gethostbyname(gethostname())``. This operation - assumes that there is a valid address-to-host mapping for the host, and the - assumption does not always hold. Note: :func:`gethostname` doesn't always return - the fully qualified domain name; use ``getfqdn()`` (see above). + interpreter is currently executing. + + If you want to know the current machine's IP address, you may want to use + ``gethostbyname(gethostname())``. This operation assumes that there is a + valid address-to-host mapping for the host, and the assumption does not + always hold. + + Note: :func:`gethostname` doesn't always return the fully qualified domain + name; use ``getfqdn()`` (see above). .. function:: gethostbyaddr(ip_address) Modified: python/branches/release26-maint/Doc/library/sqlite3.rst ============================================================================== --- python/branches/release26-maint/Doc/library/sqlite3.rst (original) +++ python/branches/release26-maint/Doc/library/sqlite3.rst Fri Nov 7 09:56:27 2008 @@ -27,7 +27,7 @@ You can also supply the special name ``:memory:`` to create a database in RAM. Once you have a :class:`Connection`, you can create a :class:`Cursor` object -and call its :meth:`execute` method to perform SQL commands:: +and call its :meth:`~Cursor.execute` method to perform SQL commands:: c = conn.cursor() @@ -52,7 +52,7 @@ Instead, use the DB-API's parameter substitution. Put ``?`` as a placeholder wherever you want to use a value, and then provide a tuple of values as the -second argument to the cursor's :meth:`execute` method. (Other database modules +second argument to the cursor's :meth:`~Cursor.execute` method. (Other database modules may use a different placeholder, such as ``%s`` or ``:1``.) For example:: # Never do this -- insecure! @@ -64,15 +64,15 @@ c.execute('select * from stocks where symbol=?', t) # Larger example - for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00), + for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00), ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00), ('2006-04-06', 'SELL', 'IBM', 500, 53.00), - ): + ]: c.execute('insert into stocks values (?,?,?,?,?)', t) To retrieve data after executing a SELECT statement, you can either treat the -cursor as an :term:`iterator`, call the cursor's :meth:`fetchone` method to -retrieve a single matching row, or call :meth:`fetchall` to get a list of the +cursor as an :term:`iterator`, call the cursor's :meth:`~Cursor.fetchone` method to +retrieve a single matching row, or call :meth:`~Cursor.fetchall` to get a list of the matching rows. This example uses the iterator form:: @@ -130,7 +130,7 @@ returns. It will look for a string formed [mytype] in there, and then decide that 'mytype' is the type of the column. It will try to find an entry of 'mytype' in the converters dictionary and then use the converter function found - there to return the value. The column name found in :attr:`cursor.description` + there to return the value. The column name found in :attr:`Cursor.description` is only the first word of the column name, i. e. if you use something like ``'as "x [datetime]"'`` in your SQL, then we will parse out everything until the first blank for the column name: the column name would simply be "x". @@ -217,11 +217,13 @@ Connection Objects ------------------ -A :class:`Connection` instance has the following attributes and methods: +.. class:: Connection + + A SQLite database connection has the following attributes and methods: .. attribute:: Connection.isolation_level - Get or set the current isolation level. None for autocommit mode or one of + Get or set the current isolation level. :const:`None` for autocommit mode or one of "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section :ref:`sqlite3-controlling-transactions` for a more detailed explanation. @@ -236,7 +238,7 @@ .. method:: Connection.commit() This method commits the current transaction. If you don't call this method, - anything you did since the last call to commit() is not visible from from + anything you did since the last call to ``commit()`` is not visible from from other database connections. If you wonder why you don't see the data you've written to the database, please check you didn't forget to call this method. @@ -386,9 +388,9 @@ .. attribute:: Connection.text_factory - Using this attribute you can control what objects are returned for the TEXT data - type. By default, this attribute is set to :class:`unicode` and the - :mod:`sqlite3` module will return Unicode objects for TEXT. If you want to + Using this attribute you can control what objects are returned for the ``TEXT`` + data type. By default, this attribute is set to :class:`unicode` and the + :mod:`sqlite3` module will return Unicode objects for ``TEXT``. If you want to return bytestrings instead, you can set it to :class:`str`. For efficiency reasons, there's also a way to return Unicode objects only for @@ -424,10 +426,9 @@ import sqlite3, os con = sqlite3.connect('existing_db.db') - full_dump = os.linesep.join(con.iterdump()) - f = open('dump.sql', 'w') - f.writelines(full_dump) - f.close() + with open('dump.sql', 'w') as f: + for line in con.iterdump(): + f.write('%s\n' % line) .. _sqlite3-cursor-objects: @@ -435,8 +436,9 @@ Cursor Objects -------------- -A :class:`Cursor` instance has the following attributes and methods: +.. class:: Cursor + A SQLite database cursor has the following attributes and methods: .. method:: Cursor.execute(sql, [parameters]) @@ -475,7 +477,7 @@ .. method:: Cursor.executescript(sql_script) This is a nonstandard convenience method for executing multiple SQL statements - at once. It issues a COMMIT statement first, then executes the SQL script it + at once. It issues a ``COMMIT`` statement first, then executes the SQL script it gets as a parameter. *sql_script* can be a bytestring or a Unicode string. @@ -488,7 +490,7 @@ .. method:: Cursor.fetchone() Fetches the next row of a query result set, returning a single sequence, - or ``None`` when no more data is available. + or :const:`None` when no more data is available. .. method:: Cursor.fetchmany([size=cursor.arraysize]) @@ -527,8 +529,8 @@ into :attr:`rowcount`. As required by the Python DB API Spec, the :attr:`rowcount` attribute "is -1 in - case no executeXX() has been performed on the cursor or the rowcount of the last - operation is not determinable by the interface". + case no ``executeXX()`` has been performed on the cursor or the rowcount of the + last operation is not determinable by the interface". This includes ``SELECT`` statements because we cannot determine the number of rows a query produced until all rows were fetched. @@ -540,6 +542,81 @@ method. For operations other than ``INSERT`` or when :meth:`executemany` is called, :attr:`lastrowid` is set to :const:`None`. +.. attribute:: Cursor.description + + This read-only attribute provides the column names of the last query. To + remain compatible with the Python DB API, it returns a 7-tuple for each + column where the last six items of each tuple are :const:`None`. + + It is set for ``SELECT`` statements without any matching rows as well. + +.. _sqlite3-row-objects: + +Row Objects +----------- + +.. class:: Row + + A :class:`Row` instance serves as a highly optimized + :attr:`~Connection.row_factory` for :class:`Connection` objects. + It tries to mimic a tuple in most of its features. + + It supports mapping access by column name and index, iteration, + representation, equality testing and :func:`len`. + + If two :class:`Row` objects have exactly the same columns and their + members are equal, they compare equal. + + .. versionchanged:: 2.6 + Added iteration and equality (hashability). + + .. method:: keys + + This method returns a tuple of column names. Immediately after a query, + it is the first member of each tuple in :attr:`Cursor.description`. + + .. versionadded:: 2.6 + +Let's assume we initialize a table as in the example given above:: + + conn = sqlite3.connect(":memory:") + c = conn.cursor() + c.execute('''create table stocks + (date text, trans text, symbol text, + qty real, price real)''') + c.execute("""insert into stocks + values ('2006-01-05','BUY','RHAT',100,35.14)""") + conn.commit() + c.close() + +Now we plug :class:`Row` in:: + + >>> conn.row_factory = sqlite3.Row + >>> c = conn.cursor() + >>> c.execute('select * from stocks') + + >>> r = c.fetchone() + >>> type(r) + + >>> r + (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.140000000000001) + >>> len(r) + 5 + >>> r[2] + u'RHAT' + >>> r.keys() + ['date', 'trans', 'symbol', 'qty', 'price'] + >>> r['qty'] + 100.0 + >>> for member in r: print member + ... + 2006-01-05 + BUY + RHAT + 100.0 + 35.14 + + .. _sqlite3-types: SQLite and Python types @@ -549,43 +626,46 @@ Introduction ^^^^^^^^^^^^ -SQLite natively supports the following types: NULL, INTEGER, REAL, TEXT, BLOB. +SQLite natively supports the following types: ``NULL``, ``INTEGER``, +``REAL``, ``TEXT``, ``BLOB``. The following Python types can thus be sent to SQLite without any problem: -+------------------------+-------------+ -| Python type | SQLite type | -+========================+=============+ -| ``None`` | NULL | -+------------------------+-------------+ -| ``int`` | INTEGER | -+------------------------+-------------+ -| ``long`` | INTEGER | -+------------------------+-------------+ -| ``float`` | REAL | -+------------------------+-------------+ -| ``str (UTF8-encoded)`` | TEXT | -+------------------------+-------------+ -| ``unicode`` | TEXT | -+------------------------+-------------+ -| ``buffer`` | BLOB | -+------------------------+-------------+ ++-----------------------------+-------------+ +| Python type | SQLite type | ++=============================+=============+ +| :const:`None` | ``NULL`` | ++-----------------------------+-------------+ +| :class:`int` | ``INTEGER`` | ++-----------------------------+-------------+ +| :class:`long` | ``INTEGER`` | ++-----------------------------+-------------+ +| :class:`float` | ``REAL`` | ++-----------------------------+-------------+ +| :class:`str` (UTF8-encoded) | ``TEXT`` | ++-----------------------------+-------------+ +| :class:`unicode` | ``TEXT`` | ++-----------------------------+-------------+ +| :class:`buffer` | ``BLOB`` | ++-----------------------------+-------------+ This is how SQLite types are converted to Python types by default: -+-------------+---------------------------------------------+ -| SQLite type | Python type | -+=============+=============================================+ -| ``NULL`` | None | -+-------------+---------------------------------------------+ -| ``INTEGER`` | int or long, depending on size | -+-------------+---------------------------------------------+ -| ``REAL`` | float | -+-------------+---------------------------------------------+ -| ``TEXT`` | depends on text_factory, unicode by default | -+-------------+---------------------------------------------+ -| ``BLOB`` | buffer | -+-------------+---------------------------------------------+ ++-------------+----------------------------------------------+ +| SQLite type | Python type | ++=============+==============================================+ +| ``NULL`` | :const:`None` | ++-------------+----------------------------------------------+ +| ``INTEGER`` | :class:`int` or :class:`long`, | +| | depending on size | ++-------------+----------------------------------------------+ +| ``REAL`` | :class:`float` | ++-------------+----------------------------------------------+ +| ``TEXT`` | depends on :attr:`~Connection.text_factory`, | +| | :class:`unicode` by default | ++-------------+----------------------------------------------+ +| ``BLOB`` | :class:`buffer` | ++-------------+----------------------------------------------+ The type system of the :mod:`sqlite3` module is extensible in two ways: you can store additional Python types in a SQLite database via object adaptation, and @@ -713,9 +793,10 @@ ------------------------ By default, the :mod:`sqlite3` module opens transactions implicitly before a -Data Modification Language (DML) statement (i.e. INSERT/UPDATE/DELETE/REPLACE), -and commits transactions implicitly before a non-DML, non-query statement (i. e. -anything other than SELECT/INSERT/UPDATE/DELETE/REPLACE). +Data Modification Language (DML) statement (i.e. +``INSERT``/``UPDATE``/``DELETE``/``REPLACE``), and commits transactions +implicitly before a non-DML, non-query statement (i. e. +anything other than ``SELECT`` or the aforementioned). So if you are within a transaction and issue a command like ``CREATE TABLE ...``, ``VACUUM``, ``PRAGMA``, the :mod:`sqlite3` module will commit implicitly @@ -724,15 +805,15 @@ is that pysqlite needs to keep track of the transaction state (if a transaction is active or not). -You can control which kind of "BEGIN" statements pysqlite implicitly executes +You can control which kind of ``BEGIN`` statements pysqlite implicitly executes (or none at all) via the *isolation_level* parameter to the :func:`connect` call, or via the :attr:`isolation_level` property of connections. If you want **autocommit mode**, then set :attr:`isolation_level` to None. Otherwise leave it at its default, which will result in a plain "BEGIN" -statement, or set it to one of SQLite's supported isolation levels: DEFERRED, -IMMEDIATE or EXCLUSIVE. +statement, or set it to one of SQLite's supported isolation levels: "DEFERRED", +"IMMEDIATE" or "EXCLUSIVE". @@ -748,7 +829,7 @@ be written more concisely because you don't have to create the (often superfluous) :class:`Cursor` objects explicitly. Instead, the :class:`Cursor` objects are created implicitly and these shortcut methods return the cursor -objects. This way, you can execute a SELECT statement and iterate over it +objects. This way, you can execute a ``SELECT`` statement and iterate over it directly using only a single call on the :class:`Connection` object. .. literalinclude:: ../includes/sqlite3/shortcut_methods.py Modified: python/branches/release26-maint/Doc/library/stdtypes.rst ============================================================================== --- python/branches/release26-maint/Doc/library/stdtypes.rst (original) +++ python/branches/release26-maint/Doc/library/stdtypes.rst Fri Nov 7 09:56:27 2008 @@ -1924,7 +1924,8 @@ .. method:: has_key(key) - ``dict.has_key(key)`` is equivalent to ``key in d``, but deprecated. + Test for the presence of *key* in the dictionary. :meth:`has_key` is + deprecated in favor of ``key in d``. .. method:: items() Modified: python/branches/release26-maint/Doc/library/subprocess.rst ============================================================================== --- python/branches/release26-maint/Doc/library/subprocess.rst (original) +++ python/branches/release26-maint/Doc/library/subprocess.rst Fri Nov 7 09:56:27 2008 @@ -318,8 +318,8 @@ output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0] -Replacing shell pipe line -^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing shell pipeline +^^^^^^^^^^^^^^^^^^^^^^^^ :: Modified: python/branches/release26-maint/Doc/library/tempfile.rst ============================================================================== --- python/branches/release26-maint/Doc/library/tempfile.rst (original) +++ python/branches/release26-maint/Doc/library/tempfile.rst Fri Nov 7 09:56:27 2008 @@ -224,6 +224,8 @@ :data:`tempdir` is not ``None``, this simply returns its contents; otherwise, the search described above is performed, and the result returned. + .. versionadded:: 2.3 + .. data:: template Modified: python/branches/release26-maint/Doc/library/thread.rst ============================================================================== --- python/branches/release26-maint/Doc/library/thread.rst (original) +++ python/branches/release26-maint/Doc/library/thread.rst Fri Nov 7 09:56:27 2008 @@ -99,7 +99,7 @@ *size* argument specifies the stack size to be used for subsequently created threads, and must be 0 (use platform or configured default) or a positive integer value of at least 32,768 (32kB). If changing the thread stack size is - unsupported, a :exc:`ThreadError` is raised. If the specified stack size is + unsupported, the :exc:`error` exception is raised. If the specified stack size is invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32kB is currently the minimum supported stack size value to guarantee sufficient stack space for the interpreter itself. Note that some platforms may have Modified: python/branches/release26-maint/Doc/library/threading.rst ============================================================================== --- python/branches/release26-maint/Doc/library/threading.rst (original) +++ python/branches/release26-maint/Doc/library/threading.rst Fri Nov 7 09:56:27 2008 @@ -180,6 +180,166 @@ All of the methods described below are executed atomically. +.. _thread-objects: + +Thread Objects +-------------- + +This class represents an activity that is run in a separate thread of control. +There are two ways to specify the activity: by passing a callable object to the +constructor, or by overriding the :meth:`run` method in a subclass. No other +methods (except for the constructor) should be overridden in a subclass. In +other words, *only* override the :meth:`__init__` and :meth:`run` methods of +this class. + +Once a thread object is created, its activity must be started by calling the +thread's :meth:`start` method. This invokes the :meth:`run` method in a +separate thread of control. + +Once the thread's activity is started, the thread is considered 'alive'. It +stops being alive when its :meth:`run` method terminates -- either normally, or +by raising an unhandled exception. The :meth:`is_alive` method tests whether the +thread is alive. + +Other threads can call a thread's :meth:`join` method. This blocks the calling +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, and read or +changed through the :attr:`name` attribute. + +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 +through the :attr:`daemon` attribute. + +There is a "main thread" object; this corresponds to the initial thread of +control in the Python program. It is not a daemon thread. + +There is the possibility that "dummy thread objects" are created. These are +thread objects corresponding to "alien threads", which are threads of control +started outside the threading module, such as directly from C code. Dummy +thread objects have limited functionality; they are always considered alive and +daemonic, and cannot be :meth:`join`\ ed. They are never deleted, since it is +impossible to detect the termination of alien threads. + + +.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}) + + This constructor should always be called with keyword arguments. Arguments are: + + *group* should be ``None``; reserved for future extension when a + :class:`ThreadGroup` class is implemented. + + *target* is the callable object to be invoked by the :meth:`run` method. + Defaults to ``None``, meaning nothing is called. + + *name* is the thread name. By default, a unique name is constructed of the form + "Thread-*N*" where *N* is a small decimal number. + + *args* is the argument tuple for the target invocation. Defaults to ``()``. + + *kwargs* is a dictionary of keyword arguments for the target invocation. + Defaults to ``{}``. + + If the subclass overrides the constructor, it must make sure to invoke the base + class constructor (``Thread.__init__()``) before doing anything else to the + thread. + + +.. method:: Thread.start() + + Start the thread's activity. + + It must be called at most once per thread object. It arranges for the object's + :meth:`run` method to be invoked in a separate thread of control. + + This method will raise a :exc:`RuntimeException` if called more than once on the + same thread object. + + +.. method:: Thread.run() + + Method representing the thread'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:: Thread.join([timeout]) + + Wait until the thread terminates. This blocks the calling thread until the + thread whose :meth:`join` method is called terminates -- either normally or + through an unhandled exception -- or until the optional timeout occurs. + + When the *timeout* argument is present and not ``None``, it should be a floating + point number specifying a timeout for the operation in seconds (or fractions + thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive` + after :meth:`join` to decide whether a timeout happened -- if the thread is + still alive, the :meth:`join` call timed out. + + When the *timeout* argument is not present or ``None``, the operation will block + until the thread terminates. + + A thread can be :meth:`join`\ ed many times. + + :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join + the current thread as that would cause a deadlock. It is also an error to + :meth:`join` a thread before it has been started and attempts to do so + raises the same exception. + + +.. method:: Thread.getName() + Thread.setName() + + Old API for :attr:`~Thread.name`. + + +.. attribute:: Thread.name + + A string used for identification purposes only. It has no semantics. + Multiple threads may be given the same name. The initial name is set by the + constructor. + + +.. attribute:: Thread.ident + + 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()` + function. Thread identifiers may be recycled when a thread exits and another + thread is created. The identifier is available even after the thread has + exited. + + .. versionadded:: 2.6 + + +.. method:: Thread.is_alive() + Thread.isAlive() + + Return whether the thread is alive. + + Roughly, a thread is alive from the moment the :meth:`start` method returns + until its :meth:`run` method terminates. The module function :func:`enumerate` + returns a list of all alive threads. + + +.. method:: Thread.isDaemon() + Thread.setDaemon() + + Old API for :attr:`~Thread.daemon`. + + +.. attribute:: Thread.daemon + + The thread's daemon flag. This must be set before :meth:`start` is called, + otherwise :exc:`RuntimeError` is raised. + + The initial value is inherited from the creating thread. + + The entire Python program exits when no alive non-daemon threads are left. + + .. _lock-objects: Lock Objects @@ -539,166 +699,6 @@ thereof). -.. _thread-objects: - -Thread Objects --------------- - -This class represents an activity that is run in a separate thread of control. -There are two ways to specify the activity: by passing a callable object to the -constructor, or by overriding the :meth:`run` method in a subclass. No other -methods (except for the constructor) should be overridden in a subclass. In -other words, *only* override the :meth:`__init__` and :meth:`run` methods of -this class. - -Once a thread object is created, its activity must be started by calling the -thread's :meth:`start` method. This invokes the :meth:`run` method in a -separate thread of control. - -Once the thread's activity is started, the thread is considered 'alive'. It -stops being alive when its :meth:`run` method terminates -- either normally, or -by raising an unhandled exception. The :meth:`is_alive` method tests whether the -thread is alive. - -Other threads can call a thread's :meth:`join` method. This blocks the calling -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, and read or -changed through the :attr:`name` attribute. - -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 -through the :attr:`daemon` attribute. - -There is a "main thread" object; this corresponds to the initial thread of -control in the Python program. It is not a daemon thread. - -There is the possibility that "dummy thread objects" are created. These are -thread objects corresponding to "alien threads", which are threads of control -started outside the threading module, such as directly from C code. Dummy -thread objects have limited functionality; they are always considered alive and -daemonic, and cannot be :meth:`join`\ ed. They are never deleted, since it is -impossible to detect the termination of alien threads. - - -.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}) - - This constructor should always be called with keyword arguments. Arguments are: - - *group* should be ``None``; reserved for future extension when a - :class:`ThreadGroup` class is implemented. - - *target* is the callable object to be invoked by the :meth:`run` method. - Defaults to ``None``, meaning nothing is called. - - *name* is the thread name. By default, a unique name is constructed of the form - "Thread-*N*" where *N* is a small decimal number. - - *args* is the argument tuple for the target invocation. Defaults to ``()``. - - *kwargs* is a dictionary of keyword arguments for the target invocation. - Defaults to ``{}``. - - If the subclass overrides the constructor, it must make sure to invoke the base - class constructor (``Thread.__init__()``) before doing anything else to the - thread. - - -.. method:: Thread.start() - - Start the thread's activity. - - It must be called at most once per thread object. It arranges for the object's - :meth:`run` method to be invoked in a separate thread of control. - - This method will raise a :exc:`RuntimeException` if called more than once on the - same thread object. - - -.. method:: Thread.run() - - Method representing the thread'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:: Thread.join([timeout]) - - Wait until the thread terminates. This blocks the calling thread until the - thread whose :meth:`join` method is called terminates -- either normally or - through an unhandled exception -- or until the optional timeout occurs. - - When the *timeout* argument is present and not ``None``, it should be a floating - point number specifying a timeout for the operation in seconds (or fractions - thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive` - after :meth:`join` to decide whether a timeout happened -- if the thread is - still alive, the :meth:`join` call timed out. - - When the *timeout* argument is not present or ``None``, the operation will block - until the thread terminates. - - A thread can be :meth:`join`\ ed many times. - - :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join - the current thread as that would cause a deadlock. It is also an error to - :meth:`join` a thread before it has been started and attempts to do so - raises the same exception. - - -.. method:: Thread.getName() - Thread.setName() - - Old API for :attr:`~Thread.name`. - - -.. attribute:: Thread.name - - A string used for identification purposes only. It has no semantics. - Multiple threads may be given the same name. The initial name is set by the - constructor. - - -.. attribute:: Thread.ident - - 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()` - function. Thread identifiers may be recycled when a thread exits and another - thread is created. The identifier is available even after the thread has - exited. - - .. versionadded:: 2.6 - - -.. method:: Thread.is_alive() - Thread.isAlive() - - Return whether the thread is alive. - - Roughly, a thread is alive from the moment the :meth:`start` method returns - until its :meth:`run` method terminates. The module function :func:`enumerate` - returns a list of all alive threads. - - -.. method:: Thread.isDaemon() - Thread.setDaemon() - - Old API for :attr:`~Thread.daemon`. - - -.. attribute:: Thread.daemon - - The thread's daemon flag. This must be set before :meth:`start` is called, - otherwise :exc:`RuntimeError` is raised. - - The initial value is inherited from the creating thread. - - The entire Python program exits when no alive non-daemon threads are left. - - .. _timer-objects: Timer Objects Modified: python/branches/release26-maint/Doc/reference/datamodel.rst ============================================================================== --- python/branches/release26-maint/Doc/reference/datamodel.rst (original) +++ python/branches/release26-maint/Doc/reference/datamodel.rst Fri Nov 7 09:56:27 2008 @@ -1663,8 +1663,8 @@ defined. As a result, subclasses will have a *__dict__* unless they also define *__slots__*. -* *__slots__* do not work for classes derived from "variable-length" built-in - types such as :class:`long`, :class:`str` and :class:`tuple`. +* Nonempty *__slots__* does not work for classes derived from "variable-length" + built-in types such as :class:`long`, :class:`str` and :class:`tuple`. * Any non-string iterable may be assigned to *__slots__*. Mappings may also be used; however, in the future, special meaning may be assigned to the values Modified: python/branches/release26-maint/Doc/reference/simple_stmts.rst ============================================================================== --- python/branches/release26-maint/Doc/reference/simple_stmts.rst (original) +++ python/branches/release26-maint/Doc/reference/simple_stmts.rst Fri Nov 7 09:56:27 2008 @@ -788,10 +788,11 @@ * blank lines, and * other future statements. -The features recognized by Python 2.5 are ``absolute_import``, ``division``, -``generators``, ``nested_scopes`` and ``with_statement``. ``generators`` and -``nested_scopes`` are redundant in Python version 2.3 and above because they -are always enabled. +The features recognized by Python 2.6 are ``unicode_literals``, +``print_function``, ``absolute_import``, ``division``, ``generators``, +``nested_scopes`` and ``with_statement``. ``generators``, ``with_statement``, +``nested_scopes`` are redundant in Python version 2.6 and above because they are +always enabled. A future statement is recognized and treated specially at compile time: Changes to the semantics of core constructs are often implemented by generating Modified: python/branches/release26-maint/Doc/tutorial/controlflow.rst ============================================================================== --- python/branches/release26-maint/Doc/tutorial/controlflow.rst (original) +++ python/branches/release26-maint/Doc/tutorial/controlflow.rst Fri Nov 7 09:56:27 2008 @@ -166,6 +166,41 @@ ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ... +This is commonly used for creating minimal classes such as exceptions, or +for ignoring unwanted exceptions:: + + >>> class ParserError(Exception): + ... pass + ... + >>> try: + ... import audioop + ... except ImportError: + ... pass + ... + +Another place :keyword:`pass` can be used is as a place-holder for a function or +conditional body when you are working on new code, allowing you to keep +thinking at a more abstract level. However, as :keyword:`pass` is silently +ignored, a better choice may be to raise a :exc:`NotImplementedError` +exception:: + + >>> def initlog(*args): + ... raise NotImplementedError # Open logfile if not already open + ... if not logfp: + ... raise NotImplementedError # Set up dummy log back-end + ... raise NotImplementedError('Call log initialization handler') + ... + +If :keyword:`pass` were used here and you later ran tests, they may fail +without indicating why. Using :exc:`NotImplementedError` causes this code +to raise an exception, telling you exactly where the incomplete code +is. Note the two calling styles of the exceptions above. +The first style, with no message but with an accompanying comment, +lets you easily leave the comment when you remove the exception, +which ideally would be a good description for +the block of code the exception is a placeholder for. However, the +third example, providing a message for the exception, will produce +a more useful traceback. .. _tut-functions: Modified: python/branches/release26-maint/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/release26-maint/Doc/whatsnew/2.6.rst (original) +++ python/branches/release26-maint/Doc/whatsnew/2.6.rst Fri Nov 7 09:56:27 2008 @@ -662,33 +662,33 @@ from multiprocessing import Pool, Manager def factorial(N, dictionary): - "Compute a factorial." - # Calculate the result - fact = 1L - for i in range(1, N+1): - fact = fact * i + "Compute a factorial." + # Calculate the result + fact = 1L + for i in range(1, N+1): + fact = fact * i # Store result in dictionary - dictionary[N] = fact + dictionary[N] = fact if __name__ == '__main__': - p = Pool(5) - mgr = Manager() - d = mgr.dict() # Create shared dictionary - - # Run tasks using the pool - for N in range(1, 1000, 10): - p.apply_async(factorial, (N, d)) - - # Mark pool as closed -- no more tasks can be added. - p.close() - - # Wait for tasks to exit - p.join() - - # Output results - for k, v in sorted(d.items()): - print k, v + p = Pool(5) + mgr = Manager() + d = mgr.dict() # Create shared dictionary + + # Run tasks using the pool + for N in range(1, 1000, 10): + p.apply_async(factorial, (N, d)) + + # Mark pool as closed -- no more tasks can be added. + p.close() + + # Wait for tasks to exit + p.join() + + # Output results + for k, v in sorted(d.items()): + print k, v This will produce the output:: @@ -723,32 +723,33 @@ treats the string as a template and takes the arguments to be formatted. The formatting template uses curly brackets (`{`, `}`) as special characters:: - # Substitute positional argument 0 into the string. - "User ID: {0}".format("root") -> "User ID: root" - - # Use the named keyword arguments - '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' + >>> # Substitute positional argument 0 into the string. + >>> "User ID: {0}".format("root") + 'User ID: root' + >>> # Use the named keyword arguments + >>> "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' Curly brackets can be escaped by doubling them:: - format("Empty dict: {{}}") -> "Empty dict: {}" + >>> 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 supply compound field names that read attributes or access dictionary keys:: - import sys - 'Platform: {0.platform}\nPython version: {0.version}'.format(sys) -> - 'Platform: darwin\n - Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41) \n - [GCC 4.0.1 (Apple Computer, Inc. build 5367)]' - - import mimetypes - 'Content-type: {0[.mp4]}'.format(mimetypes.types_map) -> - 'Content-type: video/mp4' + >>> import sys + >>> print 'Platform: {0.platform}\nPython version: {0.version}'.format(sys) + Platform: darwin + Python version: 2.6a1+ (trunk:61261M, Mar 5 2008, 20:29:41) + [GCC 4.0.1 (Apple Computer, Inc. build 5367)]' + + >>> import mimetypes + >>> 'Content-type: {0[.mp4]}'.format(mimetypes.types_map) + 'Content-type: video/mp4' Note that when using dictionary-style notation such as ``[.mp4]``, you don't need to put any quotation marks around the string; it will look @@ -760,30 +761,25 @@ resulting string. The precise formatting used is also controllable by adding a colon followed by a format specifier. For example:: - # Field 0: left justify, pad to 15 characters - # Field 1: right justify, pad to 6 characters - fmt = '{0:15} ${1:>6}' - - fmt.format('Registration', 35) -> - 'Registration $ 35' - - fmt.format('Tutorial', 50) -> - 'Tutorial $ 50' - - fmt.format('Banquet', 125) -> - 'Banquet $ 125' + >>> # Field 0: left justify, pad to 15 characters + >>> # Field 1: right justify, pad to 6 characters + >>> fmt = '{0:15} ${1:>6}' + >>> fmt.format('Registration', 35) + 'Registration $ 35' + >>> fmt.format('Tutorial', 50) + 'Tutorial $ 50' + >>> fmt.format('Banquet', 125) + 'Banquet $ 125' Format specifiers can reference other fields through nesting:: - fmt = '{0:{1}}' - - width = 15 - fmt.format('Invoice #1234', width) -> - 'Invoice #1234 ' - - width = 35 - fmt.format('Invoice #1234', width) -> - 'Invoice #1234 ' + >>> fmt = '{0:{1}}' + >>> width = 15 + >>> fmt.format('Invoice #1234', width) + 'Invoice #1234 ' + >>> width = 35 + >>> fmt.format('Invoice #1234', width) + 'Invoice #1234 ' The alignment of a field within the desired width can be specified: @@ -798,7 +794,7 @@ 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: +can be formatted as a general number or in exponential notation:: >>> '{0:g}'.format(3.75) '3.75' @@ -806,25 +802,27 @@ '3.750000e+00' A variety of presentation types are available. Consult the 2.6 -documentation for a :ref:`complete list `; here's a sample:: +documentation for a :ref:`complete list `; here's a sample: - 'b' - Binary. Outputs the number in base 2. - 'c' - Character. Converts the integer to the corresponding - Unicode character before printing. - 'd' - Decimal Integer. Outputs the number in base 10. - 'o' - Octal format. Outputs the number in base 8. - 'x' - Hex format. Outputs the number in base 16, using lower- - case letters for the digits above 9. - 'e' - Exponent notation. Prints the number in scientific - notation using the letter 'e' to indicate the exponent. - 'g' - General format. This prints the number as a fixed-point - number, unless the number is too large, in which case - it switches to 'e' exponent notation. - 'n' - Number. This is the same as 'g' (for floats) or 'd' (for - integers), except that it uses the current locale setting to - insert the appropriate number separator characters. - '%' - Percentage. Multiplies the number by 100 and displays - in fixed ('f') format, followed by a percent sign. +===== ======================================================================== +``b`` Binary. Outputs the number in base 2. +``c`` Character. Converts the integer to the corresponding Unicode character + before printing. +``d`` Decimal Integer. Outputs the number in base 10. +``o`` Octal format. Outputs the number in base 8. +``x`` Hex format. Outputs the number in base 16, using lower-case letters for + the digits above 9. +``e`` Exponent notation. Prints the number in scientific notation using the + letter 'e' to indicate the exponent. +``g`` General format. This prints the number as a fixed-point number, unless + the number is too large, in which case it switches to 'e' exponent + notation. +``n`` Number. This is the same as 'g' (for floats) or 'd' (for integers), + except that it uses the current locale setting to insert the appropriate + number separator characters. +``%`` Percentage. Multiplies the number by 100 and displays in fixed ('f') + format, followed by a percent sign. +===== ======================================================================== Classes and types can define a :meth:`__format__` method to control how they're formatted. It receives a single argument, the format specifier:: @@ -865,13 +863,14 @@ 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 - print('# of entries', len(dictionary), file=sys.stderr) + >>> from __future__ import print_function + >>> print('# of entries', len(dictionary), file=sys.stderr) The signature of the new function is:: def print(*args, sep=' ', end='\n', file=None) + The parameters are: * *args*: positional arguments whose values will be printed out. @@ -1002,6 +1001,8 @@ and some of the methods of lists, such as :meth:`append`, :meth:`pop`, and :meth:`reverse`. +:: + >>> b = bytearray('ABC') >>> b.append('d') >>> b.append(ord('e')) @@ -1224,8 +1225,8 @@ now write:: def func(d): - if not isinstance(d, collections.MutableMapping): - raise ValueError("Mapping object expected, not %r" % d) + if not isinstance(d, collections.MutableMapping): + 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 @@ -1237,22 +1238,22 @@ You can write your own ABCs by using ``abc.ABCMeta`` as the metaclass in a class definition:: - from abc import ABCMeta, abstractmethod + from abc import ABCMeta, abstractmethod - class Drawable(): - __metaclass__ = ABCMeta + class Drawable(): + __metaclass__ = ABCMeta - @abstractmethod - def draw(self, x, y, scale=1.0): - pass + @abstractmethod + def draw(self, x, y, scale=1.0): + pass - def draw_doubled(self, x, y): - self.draw(x, y, scale=2.0) + def draw_doubled(self, x, y): + self.draw(x, y, scale=2.0) - class Square(Drawable): - def draw(self, x, y, scale): - ... + class Square(Drawable): + def draw(self, x, y, scale): + ... In the :class:`Drawable` ABC above, the :meth:`draw_doubled` method @@ -1272,7 +1273,7 @@ >>> class Circle(Drawable): ... pass ... - >>> c=Circle() + >>> c = Circle() Traceback (most recent call last): File "", line 1, in TypeError: Can't instantiate abstract class Circle with abstract methods draw @@ -1331,7 +1332,7 @@ The :func:`int` and :func:`long` built-ins will now accept the "0o" and "0b" prefixes when base-8 or base-2 are requested, or when the *base* argument is zero (signalling that the base used should be -determined from the string): +determined from the string):: >>> int ('0o52', 0) 42 @@ -1504,7 +1505,7 @@ (Contributed by Alexander Belopolsky; :issue:`1686487`.) It's also become legal to provide keyword arguments after a ``*args`` argument - to a function call. + to a function call. :: >>> def f(*args, **kw): ... print args, kw @@ -1545,17 +1546,17 @@ 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 @@ -1878,8 +1879,8 @@ >>> var_type = collections.namedtuple('variable', ... 'id name type size') - # Names are separated by spaces or commas. - # 'id, name, type, size' would also work. + >>> # Names are separated by spaces or commas. + >>> # 'id, name, type, size' would also work. >>> var_type._fields ('id', 'name', 'type', 'size') @@ -1929,11 +1930,13 @@ * A new window method in the :mod:`curses` module, :meth:`chgat`, changes the display attributes for a certain number of - characters on a single line. (Contributed by Fabian Kreutz.) :: + characters on a single line. (Contributed by Fabian Kreutz.) + + :: # 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. @@ -1999,8 +2002,8 @@ order, and returns a new generator that returns the contents of all the iterators, also in sorted order. For example:: - heapq.merge([1, 3, 5, 9], [2, 8, 16]) -> - [1, 2, 3, 5, 8, 9, 16] + >>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16])) + [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. @@ -2034,57 +2037,55 @@ each of the elements; if some of the iterables are shorter than others, the missing values are set to *fillvalue*. For example:: - itertools.izip_longest([1,2,3], [1,2,3,4,5]) -> - (1, 1), (2, 2), (3, 3), (None, 4), (None, 5) + >>> tuple(itertools.izip_longest([1,2,3], [1,2,3,4,5])) + ((1, 1), (2, 2), (3, 3), (None, 4), (None, 5)) ``product(iter1, iter2, ..., [repeat=N])`` returns the Cartesian product of the supplied iterables, a set of tuples containing 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), - (3, 4), (3, 5), (3, 6) + >>> list(itertools.product([1,2,3], [4,5,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, 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), - (2, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2) + >>> list(itertools.product([1,2], repeat=3)) + [(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), - (2, 4, 1, 3), (2, 4, 1, 4), (2, 4, 2, 3), (2, 4, 2, 4) + >>> list(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), + (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 the elements of *iterable*. :: - itertools.combinations('123', 2) -> - ('1', '2'), ('1', '3'), ('2', '3') - - itertools.combinations('123', 3) -> - ('1', '2', '3') - - itertools.combinations('1234', 3) -> - ('1', '2', '3'), ('1', '2', '4'), ('1', '3', '4'), - ('2', '3', '4') + >>> list(itertools.combinations('123', 2)) + [('1', '2'), ('1', '3'), ('2', '3')] + >>> list(itertools.combinations('123', 3)) + [('1', '2', '3')] + >>> list(itertools.combinations('1234', 3)) + [('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 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), - (4, 1), (4, 2), (4, 3) + >>> list(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), + (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. @@ -2093,8 +2094,8 @@ 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 + >>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]])) + [1, 2, 3, 4, 5, 6] (All contributed by Raymond Hettinger.) @@ -2265,16 +2266,15 @@ with an installed Python package. For example:: >>> import pkgutil - >>> pkgutil.get_data('test', 'exception_hierarchy.txt') - 'BaseException + >>> print pkgutil.get_data('test', 'exception_hierarchy.txt') + BaseException +-- SystemExit +-- KeyboardInterrupt +-- GeneratorExit +-- Exception +-- StopIteration +-- StandardError - ...' - >>> + ... (Contributed by Paul Moore; :issue:`2439`.) @@ -2548,9 +2548,9 @@ with test_support.check_warnings() as wrec: warnings.simplefilter("always") - ... code that triggers a warning ... + # ... code that triggers a warning ... assert str(wrec.message) == "function is outdated" - assert len(wrec.warnings) == 1, "Multiple warnings raised" + assert len(wrec.warnings) == 1, "Multiple warnings raised" (Contributed by Brett Cannon.) @@ -2724,7 +2724,7 @@ t = ast.parse(""" d = {} for i in 'abcdefghijklm': - d[i + i] = ord(i) - ord('a') + 1 + d[i + i] = ord(i) - ord('a') + 1 print d """) print ast.dump(t) @@ -2733,32 +2733,32 @@ Module(body=[ Assign(targets=[ - Name(id='d', ctx=Store()) + Name(id='d', ctx=Store()) ], value=Dict(keys=[], values=[])) For(target=Name(id='i', ctx=Store()), - iter=Str(s='abcdefghijklm'), body=[ - Assign(targets=[ - Subscript(value= - Name(id='d', ctx=Load()), - slice= - Index(value= - BinOp(left=Name(id='i', ctx=Load()), op=Add(), - right=Name(id='i', ctx=Load()))), ctx=Store()) - ], value= - BinOp(left= - BinOp(left= - Call(func= - Name(id='ord', ctx=Load()), args=[ - Name(id='i', ctx=Load()) - ], keywords=[], starargs=None, kwargs=None), - op=Sub(), right=Call(func= - Name(id='ord', ctx=Load()), args=[ - Str(s='a') - ], keywords=[], starargs=None, kwargs=None)), - op=Add(), right=Num(n=1))) - ], orelse=[]) - Print(dest=None, values=[ - Name(id='d', ctx=Load()) + iter=Str(s='abcdefghijklm'), body=[ + Assign(targets=[ + Subscript(value= + Name(id='d', ctx=Load()), + slice= + Index(value= + BinOp(left=Name(id='i', ctx=Load()), op=Add(), + right=Name(id='i', ctx=Load()))), ctx=Store()) + ], value= + BinOp(left= + BinOp(left= + Call(func= + Name(id='ord', ctx=Load()), args=[ + Name(id='i', ctx=Load()) + ], keywords=[], starargs=None, kwargs=None), + op=Sub(), right=Call(func= + Name(id='ord', ctx=Load()), args=[ + Str(s='a') + ], keywords=[], starargs=None, kwargs=None)), + op=Add(), right=Num(n=1))) + ], orelse=[]) + Print(dest=None, values=[ + Name(id='d', ctx=Load()) ], nl=True) ]) @@ -2862,8 +2862,8 @@ # Create data structure data_struct = dict(lastAccessed=datetime.datetime.now(), - version=1, - categories=('Personal','Shared','Private')) + version=1, + categories=('Personal','Shared','Private')) # Create string containing XML. plist_str = plistlib.writePlistToString(data_struct) Modified: python/branches/release26-maint/Lib/json/tests/test_scanstring.py ============================================================================== --- python/branches/release26-maint/Lib/json/tests/test_scanstring.py (original) +++ python/branches/release26-maint/Lib/json/tests/test_scanstring.py Fri Nov 7 09:56:27 2008 @@ -2,6 +2,7 @@ import decimal from unittest import TestCase +import json import json.decoder class TestScanString(TestCase): @@ -100,3 +101,9 @@ self.assertEquals( scanstring('["Bad value", truth]', 2, None, True), (u'Bad value', 12)) + + def test_issue3623(self): + self.assertRaises(ValueError, json.decoder.scanstring, b"xxx", 1, + "xxx") + self.assertRaises(UnicodeDecodeError, + json.encoder.encode_basestring_ascii, b"xx\xff") Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py Fri Nov 7 09:56:27 2008 @@ -28,15 +28,19 @@ any* > > | global=global_stmt< 'global' any* 'next' any* > - | - mod=file_input< any+ > """ order = "pre" # Pre-order tree traversal def start_tree(self, tree, filename): super(FixNext, self).start_tree(tree, filename) - self.shadowed_next = False + + n = find_binding('next', tree) + if n: + self.warning(n, bind_warning) + self.shadowed_next = True + else: + self.shadowed_next = False def transform(self, node, results): assert results @@ -69,11 +73,6 @@ elif "global" in results: self.warning(node, bind_warning) self.shadowed_next = True - elif mod: - n = find_binding('next', mod) - if n: - self.warning(n, bind_warning) - self.shadowed_next = True ### The following functions help test if node is part of an assignment Modified: python/branches/release26-maint/Lib/lib2to3/main.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/main.py (original) +++ python/branches/release26-maint/Lib/lib2to3/main.py Fri Nov 7 09:56:27 2008 @@ -15,10 +15,31 @@ Prints output to stdout. """ + def __init__(self, fixers, options, explicit, nobackups): + self.nobackups = nobackups + super(StdoutRefactoringTool, self).__init__(fixers, options, explicit) + def log_error(self, msg, *args, **kwargs): self.errors.append((msg, args, kwargs)) self.logger.error(msg, *args, **kwargs) + def write_file(self, new_text, filename, old_text): + if not self.nobackups: + # Make backup + backup = filename + ".bak" + if os.path.lexists(backup): + try: + os.remove(backup) + except os.error, err: + self.log_message("Can't remove backup %s", backup) + try: + os.rename(filename, backup) + except os.error, err: + self.log_message("Can't rename %s to %s", filename, backup) + # Actually write the new file + super(StdoutRefactoringTool, self).write_file(new_text, + filename, old_text) + def print_output(self, lines): for line in lines: print line @@ -39,7 +60,9 @@ parser.add_option("-d", "--doctests_only", action="store_true", help="Fix up doctests only") parser.add_option("-f", "--fix", action="append", default=[], - help="Each FIX specifies a transformation; default all") + help="Each FIX specifies a transformation; default: all") + parser.add_option("-x", "--nofix", action="append", default=[], + help="Prevent a fixer from being run.") parser.add_option("-l", "--list-fixes", action="store_true", help="List available transformations (fixes/fix_*.py)") parser.add_option("-p", "--print-function", action="store_true", @@ -48,10 +71,14 @@ help="More verbose logging") parser.add_option("-w", "--write", action="store_true", help="Write back modified files") + parser.add_option("-n", "--nobackups", action="store_true", default=False, + help="Don't write backups for modified files.") # Parse command line arguments refactor_stdin = False options, args = parser.parse_args(args) + if not options.write and options.nobackups: + parser.error("Can't use -n without -w") if options.list_fixes: print "Available transformations for the -f/--fix option:" for fixname in refactor.get_all_fix_names(fixer_pkg): @@ -74,15 +101,22 @@ # Initialize the refactoring tool rt_opts = {"print_function" : options.print_function} - avail_names = refactor.get_fixers_from_package(fixer_pkg) - explicit = [] + avail_fixes = set(refactor.get_fixers_from_package(fixer_pkg)) + unwanted_fixes = set(fixer_pkg + ".fix_" + fix for fix in options.nofix) + explicit = set() if options.fix: - explicit = [fixer_pkg + ".fix_" + fix - for fix in options.fix if fix != "all"] - fixer_names = avail_names if "all" in options.fix else explicit + all_present = False + for fix in options.fix: + if fix == "all": + all_present = True + else: + explicit.add(fixer_pkg + ".fix_" + fix) + requested = avail_fixes.union(explicit) if all_present else explicit else: - fixer_names = avail_names - rt = StdoutRefactoringTool(fixer_names, rt_opts, explicit=explicit) + requested = avail_fixes.union(explicit) + fixer_names = requested.difference(unwanted_fixes) + rt = StdoutRefactoringTool(sorted(fixer_names), rt_opts, sorted(explicit), + options.nobackups) # Refactor all files and directories passed as arguments if not rt.errors: Modified: python/branches/release26-maint/Lib/lib2to3/refactor.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/refactor.py (original) +++ python/branches/release26-maint/Lib/lib2to3/refactor.py Fri Nov 7 09:56:27 2008 @@ -36,9 +36,7 @@ pkg = __import__(fixer_pkg, [], [], ["*"]) fixer_dir = os.path.dirname(pkg.__file__) fix_names = [] - names = os.listdir(fixer_dir) - names.sort() - for name in names: + for name in sorted(os.listdir(fixer_dir)): if name.startswith("fix_") and name.endswith(".py"): if remove_prefix: name = name[4:] @@ -253,7 +251,7 @@ there were errors during the parse. """ try: - tree = self.driver.parse_string(data,1) + tree = self.driver.parse_string(data) except Exception, err: self.log_error("Can't parse %s: %s: %s", name, err.__class__.__name__, err) @@ -352,23 +350,13 @@ else: self.log_debug("Not writing changes to %s", filename) - def write_file(self, new_text, filename, old_text=None): + def write_file(self, new_text, filename, old_text): """Writes a string to a file. It first shows a unified diff between the old text and the new text, and then rewrites the file; the latter is only done if the write option is set. """ - backup = filename + ".bak" - if os.path.lexists(backup): - try: - os.remove(backup) - except os.error, err: - self.log_message("Can't remove backup %s", backup) - try: - os.rename(filename, backup) - except os.error, err: - self.log_message("Can't rename %s to %s", filename, backup) try: f = open(filename, "w") except os.error, err: Modified: python/branches/release26-maint/Lib/lib2to3/tests/data/README ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/data/README (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/data/README Fri Nov 7 09:56:27 2008 @@ -1,5 +1,6 @@ -Files in this directory: +In this directory: - py2_test_grammar.py -- test file that exercises most/all of Python 2.x's grammar. - py3_test_grammar.py -- test file that exercises most/all of Python 3.x's grammar. - infinite_recursion.py -- test file that causes lib2to3's faster recursive pattern matching scheme to fail, but passes when lib2to3 falls back to iterative pattern matching. +- fixes/ -- for use by test_refactor.py Modified: python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py Fri Nov 7 09:56:27 2008 @@ -3385,6 +3385,134 @@ """ self.check_both(b, a) + +class Test_set_literal(FixerTestCase): + + fixer = "set_literal" + + def test_basic(self): + b = """set([1, 2, 3])""" + a = """{1, 2, 3}""" + self.check(b, a) + + b = """set((1, 2, 3))""" + a = """{1, 2, 3}""" + self.check(b, a) + + b = """set((1,))""" + a = """{1}""" + self.check(b, a) + + b = """set([1])""" + self.check(b, a) + + b = """set((a, b))""" + a = """{a, b}""" + self.check(b, a) + + b = """set([a, b])""" + self.check(b, a) + + b = """set((a*234, f(args=23)))""" + a = """{a*234, f(args=23)}""" + self.check(b, a) + + b = """set([a*23, f(23)])""" + a = """{a*23, f(23)}""" + self.check(b, a) + + b = """set([a-234**23])""" + a = """{a-234**23}""" + self.check(b, a) + + def test_listcomps(self): + b = """set([x for x in y])""" + a = """{x for x in y}""" + self.check(b, a) + + b = """set([x for x in y if x == m])""" + a = """{x for x in y if x == m}""" + self.check(b, a) + + b = """set([x for x in y for a in b])""" + a = """{x for x in y for a in b}""" + self.check(b, a) + + b = """set([f(x) - 23 for x in y])""" + a = """{f(x) - 23 for x in y}""" + self.check(b, a) + + def test_whitespace(self): + b = """set( [1, 2])""" + a = """{1, 2}""" + self.check(b, a) + + b = """set([1 , 2])""" + a = """{1 , 2}""" + self.check(b, a) + + b = """set([ 1 ])""" + a = """{ 1 }""" + self.check(b, a) + + b = """set( [1] )""" + a = """{1}""" + self.check(b, a) + + b = """set([ 1, 2 ])""" + a = """{ 1, 2 }""" + self.check(b, a) + + b = """set([x for x in y ])""" + a = """{x for x in y }""" + self.check(b, a) + + b = """set( + [1, 2] + ) + """ + a = """{1, 2}\n""" + self.check(b, a) + + def test_comments(self): + b = """set((1, 2)) # Hi""" + a = """{1, 2} # Hi""" + self.check(b, a) + + # This isn't optimal behavior, but the fixer is optional. + b = """ + # Foo + set( # Bar + (1, 2) + ) + """ + a = """ + # Foo + {1, 2} + """ + self.check(b, a) + + def test_unchanged(self): + s = """set()""" + self.unchanged(s) + + s = """set(a)""" + self.unchanged(s) + + s = """set(a, b, c)""" + self.unchanged(s) + + # Don't transform generators because they might have to be lazy. + s = """set(x for x in y)""" + self.unchanged(s) + + s = """set(x for x in y if z)""" + self.unchanged(s) + + s = """set(a*823-23**2 + f(23))""" + self.unchanged(s) + + class Test_sys_exc(FixerTestCase): fixer = "sys_exc" Modified: python/branches/release26-maint/Lib/lib2to3/tests/test_pytree.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/test_pytree.py (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/test_pytree.py Fri Nov 7 09:56:27 2008 @@ -353,29 +353,29 @@ # Build a pattern matching a leaf pl = pytree.LeafPattern(100, "foo", name="pl") r = {} - self.assertEqual(pl.match(root, results=r), False) + self.assertFalse(pl.match(root, results=r)) self.assertEqual(r, {}) - self.assertEqual(pl.match(n1, results=r), False) + self.assertFalse(pl.match(n1, results=r)) self.assertEqual(r, {}) - self.assertEqual(pl.match(n2, results=r), False) + self.assertFalse(pl.match(n2, results=r)) self.assertEqual(r, {}) - self.assertEqual(pl.match(l1, results=r), True) + self.assertTrue(pl.match(l1, results=r)) self.assertEqual(r, {"pl": l1}) r = {} - self.assertEqual(pl.match(l2, results=r), False) + self.assertFalse(pl.match(l2, results=r)) self.assertEqual(r, {}) # Build a pattern matching a node pn = pytree.NodePattern(1000, [pl], name="pn") - self.assertEqual(pn.match(root, results=r), False) + self.assertFalse(pn.match(root, results=r)) self.assertEqual(r, {}) - self.assertEqual(pn.match(n1, results=r), False) + self.assertFalse(pn.match(n1, results=r)) self.assertEqual(r, {}) - self.assertEqual(pn.match(n2, results=r), True) + self.assertTrue(pn.match(n2, results=r)) self.assertEqual(r, {"pn": n2, "pl": l3}) r = {} - self.assertEqual(pn.match(l1, results=r), False) + self.assertFalse(pn.match(l1, results=r)) self.assertEqual(r, {}) - self.assertEqual(pn.match(l2, results=r), False) + self.assertFalse(pn.match(l2, results=r)) self.assertEqual(r, {}) def testWildcardPatterns(self): @@ -391,11 +391,11 @@ pn = pytree.NodePattern(1000, [pl], name="pn") pw = pytree.WildcardPattern([[pn], [pl, pl]], name="pw") r = {} - self.assertEqual(pw.match_seq([root], r), False) + self.assertFalse(pw.match_seq([root], r)) self.assertEqual(r, {}) - self.assertEqual(pw.match_seq([n1], r), False) + self.assertFalse(pw.match_seq([n1], r)) self.assertEqual(r, {}) - self.assertEqual(pw.match_seq([n2], r), True) + self.assertTrue(pw.match_seq([n2], r)) # These are easier to debug self.assertEqual(sorted(r.keys()), ["pl", "pn", "pw"]) self.assertEqual(r["pl"], l1) @@ -404,7 +404,7 @@ # But this is equivalent self.assertEqual(r, {"pl": l1, "pn": n2, "pw": [n2]}) r = {} - self.assertEqual(pw.match_seq([l1, l3], r), True) + self.assertTrue(pw.match_seq([l1, l3], r)) self.assertEqual(r, {"pl": l3, "pw": [l1, l3]}) self.assert_(r["pl"] is l3) r = {} Modified: python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py Fri Nov 7 09:56:27 2008 @@ -123,7 +123,6 @@ def test_refactor_file(self): test_file = os.path.join(FIXER_DIR, "parrot_example.py") - backup = test_file + ".bak" old_contents = open(test_file, "r").read() rt = self.rt() @@ -133,14 +132,8 @@ rt.refactor_file(test_file, True) try: self.assertNotEqual(old_contents, open(test_file, "r").read()) - self.assertTrue(os.path.exists(backup)) - self.assertEqual(old_contents, open(backup, "r").read()) finally: open(test_file, "w").write(old_contents) - try: - os.unlink(backup) - except OSError: - pass def test_refactor_docstring(self): rt = self.rt() Modified: python/branches/release26-maint/Lib/optparse.py ============================================================================== --- python/branches/release26-maint/Lib/optparse.py (original) +++ python/branches/release26-maint/Lib/optparse.py Fri Nov 7 09:56:27 2008 @@ -1,21 +1,13 @@ -"""optparse - a powerful, extensible, and easy-to-use option parser. +"""A powerful, extensible, and easy-to-use option parser. By Greg Ward -Originally distributed as Optik; see http://optik.sourceforge.net/ . - -If you have problems with this module, please do not file bugs, -patches, or feature requests with Python; instead, use Optik's -SourceForge project page: - http://sourceforge.net/projects/optik +Originally distributed as Optik. For support, use the optik-users at lists.sourceforge.net mailing list (http://lists.sourceforge.net/lists/listinfo/optik-users). """ -# Python developers: please do not make changes to this file, since -# it is automatically generated from the Optik source code. - __version__ = "1.5.3" __all__ = ['Option', @@ -1274,9 +1266,19 @@ self.usage = usage def enable_interspersed_args(self): + """Set parsing to not stop on the first non-option, allowing + interspersing switches with command arguments. This is the + default behavior. See also disable_interspersed_args() and the + class documentation description of the attribute + allow_interspersed_args.""" self.allow_interspersed_args = True def disable_interspersed_args(self): + """Set parsing to stop on the first non-option. Use this if + you have a command processor which runs another command that + has options of its own and you want to make sure these options + don't get confused. + """ self.allow_interspersed_args = False def set_process_default_values(self, process): Modified: python/branches/release26-maint/Lib/test/test_bisect.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_bisect.py (original) +++ python/branches/release26-maint/Lib/test/test_bisect.py Fri Nov 7 09:56:27 2008 @@ -196,6 +196,17 @@ def test_backcompatibility(self): self.assertEqual(self.module.insort, self.module.insort_right) + def test_listDerived(self): + class List(list): + data = [] + def insert(self, index, item): + self.data.insert(index, item) + + lst = List() + self.module.insort_left(lst, 10) + self.module.insort_right(lst, 5) + self.assertEqual([5, 10], lst.data) + class TestInsortPython(TestInsort): module = py_bisect Modified: python/branches/release26-maint/Lib/test/test_bytes.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_bytes.py (original) +++ python/branches/release26-maint/Lib/test/test_bytes.py Fri Nov 7 09:56:27 2008 @@ -397,7 +397,7 @@ self.assertEqual(b.rpartition(b'i'), (b'mississipp', b'i', b'')) def test_pickling(self): - for proto in range(pickle.HIGHEST_PROTOCOL): + for proto in range(pickle.HIGHEST_PROTOCOL + 1): for b in b"", b"a", b"abc", b"\xffab\x80", b"\0\0\377\0\0": b = self.type2test(b) ps = pickle.dumps(b, proto) @@ -947,7 +947,7 @@ a = ByteArraySubclass(b"abcd") a.x = 10 a.y = ByteArraySubclass(b"efgh") - for proto in range(pickle.HIGHEST_PROTOCOL): + for proto in range(pickle.HIGHEST_PROTOCOL + 1): b = pickle.loads(pickle.dumps(a, proto)) self.assertNotEqual(id(a), id(b)) self.assertEqual(a, b) Modified: python/branches/release26-maint/Lib/test/test_descr.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_descr.py (original) +++ python/branches/release26-maint/Lib/test/test_descr.py Fri Nov 7 09:56:27 2008 @@ -1136,14 +1136,10 @@ def __del__(self_): self.assertEqual(self_.a, 1) self.assertEqual(self_.b, 2) - - save_stderr = sys.stderr - sys.stderr = sys.stdout - h = H() - try: + with test_support.captured_output('stderr') as s: + h = H() del h - finally: - sys.stderr = save_stderr + self.assertEqual(s.getvalue(), '') def test_slots_special(self): # Testing __dict__ and __weakref__ in __slots__... Modified: python/branches/release26-maint/Lib/test/test_fileio.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_fileio.py (original) +++ python/branches/release26-maint/Lib/test/test_fileio.py Fri Nov 7 09:56:27 2008 @@ -7,7 +7,7 @@ from array import array from weakref import proxy -from test.test_support import TESTFN, findfile, run_unittest +from test.test_support import TESTFN, findfile, check_warnings, run_unittest from UserList import UserList import _fileio @@ -241,6 +241,14 @@ def testInvalidInit(self): self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) + def testWarnings(self): + with check_warnings() as w: + self.assertEqual(w.warnings, []) + self.assertRaises(TypeError, _fileio._FileIO, []) + self.assertEqual(w.warnings, []) + self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt") + self.assertEqual(w.warnings, []) + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. Modified: python/branches/release26-maint/Lib/test/test_io.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_io.py (original) +++ python/branches/release26-maint/Lib/test/test_io.py Fri Nov 7 09:56:27 2008 @@ -1236,13 +1236,6 @@ else: self.assert_(issubclass(obj, io.IOBase)) - def test_fileio_warnings(self): - with test_support.check_warnings() as w: - self.assertEqual(w.warnings, []) - self.assertRaises(TypeError, io.FileIO, []) - self.assertEqual(w.warnings, []) - self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt") - self.assertEqual(w.warnings, []) def test_main(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, Modified: python/branches/release26-maint/Lib/test/test_urllib.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_urllib.py (original) +++ python/branches/release26-maint/Lib/test/test_urllib.py Fri Nov 7 09:56:27 2008 @@ -98,7 +98,6 @@ class ProxyTests(unittest.TestCase): def setUp(self): - unittest.TestCase.setUp(self) # Save all proxy related env vars self._saved_environ = dict([(k, v) for k, v in os.environ.iteritems() if k.lower().find('proxy') >= 0]) @@ -107,9 +106,8 @@ del os.environ[k] def tearDown(self): - unittest.TestCase.tearDown(self) # Restore all proxy related env vars - for k, v in self._saved_environ: + for k, v in self._saved_environ.iteritems(): os.environ[k] = v def test_getproxies_environment_keep_no_proxies(self): Modified: python/branches/release26-maint/Lib/test/test_xrange.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_xrange.py (original) +++ python/branches/release26-maint/Lib/test/test_xrange.py Fri Nov 7 09:56:27 2008 @@ -61,7 +61,7 @@ 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 proto in range(pickle.HIGHEST_PROTOCOL + 1): for t in testcases: r = xrange(*t) self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Fri Nov 7 09:56:27 2008 @@ -49,6 +49,8 @@ - Issue #4092: Return ArgInfo as promised in the documentation from inspect.getargvalues. +- Issue #3935: Properly support list subclasses in bisect's C implementation. + - Issue #4014: Don't claim that Python has an Alpha release status, in addition to claiming it is Mature. Modified: python/branches/release26-maint/Modules/_bisectmodule.c ============================================================================== --- python/branches/release26-maint/Modules/_bisectmodule.c (original) +++ python/branches/release26-maint/Modules/_bisectmodule.c Fri Nov 7 09:56:27 2008 @@ -82,7 +82,7 @@ index = internal_bisect_right(list, item, lo, hi); if (index < 0) return NULL; - if (PyList_Check(list)) { + if (PyList_CheckExact(list)) { if (PyList_Insert(list, index, item) < 0) return NULL; } else { @@ -183,7 +183,7 @@ index = internal_bisect_left(list, item, lo, hi); if (index < 0) return NULL; - if (PyList_Check(list)) { + if (PyList_CheckExact(list)) { if (PyList_Insert(list, index, item) < 0) return NULL; } else { Modified: python/branches/release26-maint/Modules/_fileio.c ============================================================================== --- python/branches/release26-maint/Modules/_fileio.c (original) +++ python/branches/release26-maint/Modules/_fileio.c Fri Nov 7 09:56:27 2008 @@ -251,7 +251,7 @@ self->closefd = 1; if (!closefd) { PyErr_SetString(PyExc_ValueError, - "Cannot use closefd=True with file name"); + "Cannot use closefd=False with file name"); goto error; } Modified: python/branches/release26-maint/Modules/_json.c ============================================================================== --- python/branches/release26-maint/Modules/_json.c (original) +++ python/branches/release26-maint/Modules/_json.c Fri Nov 7 09:56:27 2008 @@ -179,11 +179,13 @@ errmsg_fn = PyObject_GetAttrString(decoder, "errmsg"); if (errmsg_fn == NULL) return; - Py_XDECREF(decoder); + Py_DECREF(decoder); } pymsg = PyObject_CallFunction(errmsg_fn, "(zOn)", msg, s, end); - PyErr_SetObject(PyExc_ValueError, pymsg); - Py_DECREF(pymsg); + if (pymsg) { + PyErr_SetObject(PyExc_ValueError, pymsg); + Py_DECREF(pymsg); + } /* def linecol(doc, pos): @@ -269,6 +271,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -370,6 +373,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -379,8 +383,7 @@ if (rval == NULL) { goto bail; } - Py_DECREF(chunks); - chunks = NULL; + Py_CLEAR(chunks); return Py_BuildValue("(Nn)", rval, end); bail: Py_XDECREF(chunks); @@ -429,6 +432,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -530,6 +534,7 @@ goto bail; } if (PyList_Append(chunks, chunk)) { + Py_DECREF(chunk); goto bail; } Py_DECREF(chunk); @@ -539,8 +544,7 @@ if (rval == NULL) { goto bail; } - Py_DECREF(chunks); - chunks = NULL; + Py_CLEAR(chunks); return Py_BuildValue("(Nn)", rval, end); bail: Py_XDECREF(chunks); Modified: python/branches/release26-maint/Objects/dictobject.c ============================================================================== --- python/branches/release26-maint/Objects/dictobject.c (original) +++ python/branches/release26-maint/Objects/dictobject.c Fri Nov 7 09:56:27 2008 @@ -2065,12 +2065,12 @@ "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D"); PyDoc_STRVAR(pop__doc__, -"D.pop(k[,d]) -> v, remove specified key and return the corresponding value\n\ +"D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n\ If key is not found, d is returned if given, otherwise KeyError is raised"); PyDoc_STRVAR(popitem__doc__, "D.popitem() -> (k, v), remove and return some (key, value) pair as a\n\ -2-tuple; but raise KeyError if D is empty"); +2-tuple; but raise KeyError if D is empty."); PyDoc_STRVAR(keys__doc__, "D.keys() -> list of D's keys"); @@ -2082,8 +2082,10 @@ "D.values() -> list of D's values"); PyDoc_STRVAR(update__doc__, -"D.update(E, **F) -> None. Update D from E and F: for k in E: D[k] = E[k]\n\ -(if E has keys else: for (k, v) in E: D[k] = v) then: for k in F: D[k] = F[k]"); +"D.update(E, **F) -> None. Update D from dict/iterable E and F.\n" +"If E has a .keys() method, does: for k in E: D[k] = E[k]\n\ +If E lacks .keys() method, does: for (k, v) in E: D[k] = v\n\ +In either case, this is followed by: for k in F: D[k] = F[k]"); PyDoc_STRVAR(fromkeys__doc__, "dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.\n\ Modified: python/branches/release26-maint/Parser/asdl_c.py ============================================================================== --- python/branches/release26-maint/Parser/asdl_c.py (original) +++ python/branches/release26-maint/Parser/asdl_c.py Fri Nov 7 09:56:27 2008 @@ -824,12 +824,30 @@ return 0; } +static int add_ast_fields(void) +{ + PyObject *empty_tuple, *d; + if (PyType_Ready(&AST_type) < 0) + return -1; + d = AST_type.tp_dict; + empty_tuple = PyTuple_New(0); + if (!empty_tuple || + PyDict_SetItemString(d, "_fields", empty_tuple) < 0 || + PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) { + Py_XDECREF(empty_tuple); + return -1; + } + Py_DECREF(empty_tuple); + return 0; +} + """, 0, reflow=False) self.emit("static int init_types(void)",0) self.emit("{", 0) self.emit("static int initialized;", 1) self.emit("if (initialized) return 1;", 1) + self.emit("if (add_ast_fields() < 0) return 0;", 1) for dfn in mod.dfns: self.visit(dfn) self.emit("initialized = 1;", 1) Modified: python/branches/release26-maint/Python/Python-ast.c ============================================================================== --- python/branches/release26-maint/Python/Python-ast.c (original) +++ python/branches/release26-maint/Python/Python-ast.c Fri Nov 7 09:56:27 2008 @@ -615,11 +615,29 @@ return 0; } +static int add_ast_fields(void) +{ + PyObject *empty_tuple, *d; + if (PyType_Ready(&AST_type) < 0) + return -1; + d = AST_type.tp_dict; + empty_tuple = PyTuple_New(0); + if (!empty_tuple || + PyDict_SetItemString(d, "_fields", empty_tuple) < 0 || + PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) { + Py_XDECREF(empty_tuple); + return -1; + } + Py_DECREF(empty_tuple); + return 0; +} + static int init_types(void) { static int initialized; if (initialized) return 1; + if (add_ast_fields() < 0) return 0; mod_type = make_type("mod", &AST_type, NULL, 0); if (!mod_type) return 0; if (!add_attributes(mod_type, NULL, 0)) return 0; Modified: python/branches/release26-maint/Tools/scripts/findnocoding.py ============================================================================== --- python/branches/release26-maint/Tools/scripts/findnocoding.py (original) +++ python/branches/release26-maint/Tools/scripts/findnocoding.py Fri Nov 7 09:56:27 2008 @@ -12,7 +12,7 @@ # our pysource module finds Python source files try: import pysource -except: +except ImportError: # emulate the module with a simple os.walk class pysource: has_python_ext = looks_like_python = can_be_compiled = None Modified: python/branches/release26-maint/Tools/scripts/reindent.py ============================================================================== --- python/branches/release26-maint/Tools/scripts/reindent.py (original) +++ python/branches/release26-maint/Tools/scripts/reindent.py Fri Nov 7 09:56:27 2008 @@ -99,7 +99,8 @@ for name in names: fullname = os.path.join(file, name) if ((recurse and os.path.isdir(fullname) and - not os.path.islink(fullname)) + not os.path.islink(fullname) and + not os.path.split(fullname)[1].startswith(".")) or name.lower().endswith(".py")): check(fullname) return From python-checkins at python.org Fri Nov 7 09:57:11 2008 From: python-checkins at python.org (georg.brandl) Date: Fri, 7 Nov 2008 09:57:11 +0100 (CET) Subject: [Python-checkins] r67147 - python/branches/release26-maint Message-ID: <20081107085711.BEF711E400C@bag.python.org> Author: georg.brandl Date: Fri Nov 7 09:57:11 2008 New Revision: 67147 Log: Blocked revisions 66822-66823,66832,66836,66852,66868,66878,66894,66902,66912,66989,66994,67013,67015,67049,67065 via svnmerge ........ r66822 | skip.montanaro | 2008-10-07 03:55:20 +0200 (Tue, 07 Oct 2008) | 2 lines Simplify individual tests by defining setUp and tearDown methods. ........ r66823 | skip.montanaro | 2008-10-07 04:02:00 +0200 (Tue, 07 Oct 2008) | 2 lines Pay attention to -R entries in LDFLAGS. ........ r66832 | skip.montanaro | 2008-10-07 17:03:40 +0200 (Tue, 07 Oct 2008) | 1 line save/restore stdout/stderr instead of relying on __*__ versions ........ r66836 | amaury.forgeotdarc | 2008-10-07 22:32:10 +0200 (Tue, 07 Oct 2008) | 5 lines #4069: aSet.remove(otherSet) would always report the empty frozenset([]) as the missing key. Now it correctly refers to the initial otherset. Reviewed by Raymond. Will backport to 2.6. ........ r66852 | andrew.kuchling | 2008-10-08 15:21:27 +0200 (Wed, 08 Oct 2008) | 1 line Note how bytes alias is expected to be used ........ r66868 | matthias.klose | 2008-10-10 09:24:20 +0200 (Fri, 10 Oct 2008) | 2 lines - Makefile.pre.in(PROFILE_TASK): search files in srcdir ........ r66878 | benjamin.peterson | 2008-10-11 19:25:36 +0200 (Sat, 11 Oct 2008) | 4 lines give poplib a real test suite #4088 from Giampaolo Rodola'x ........ r66894 | benjamin.peterson | 2008-10-15 00:37:18 +0200 (Wed, 15 Oct 2008) | 1 line remove set compat cruft ........ r66902 | skip.montanaro | 2008-10-15 13:49:10 +0200 (Wed, 15 Oct 2008) | 1 line easter egg ........ r66912 | hirokazu.yamamoto | 2008-10-16 08:25:25 +0200 (Thu, 16 Oct 2008) | 2 lines removed unused _PyUnicode_FromFileSystemEncodedObject. made win32_chdir, win32_wchdir static. ........ r66989 | matthias.klose | 2008-10-21 11:12:25 +0200 (Tue, 21 Oct 2008) | 2 lines - install versioned manpage ........ r66994 | amaury.forgeotdarc | 2008-10-22 00:01:38 +0200 (Wed, 22 Oct 2008) | 6 lines #4157 move two test functions out of platform.py. Turn them into unit tests, and correct an obvious typo: (("a", "b") ("c", "d") ("e", "f")) compiles even with the missing commas, but does not execute very well... ........ r67013 | benjamin.peterson | 2008-10-25 04:53:28 +0200 (Sat, 25 Oct 2008) | 1 line give a py3k warning when 'nonlocal' is used as a variable name ........ r67015 | georg.brandl | 2008-10-25 09:00:52 +0200 (Sat, 25 Oct 2008) | 2 lines Typo fix. ........ r67049 | amaury.forgeotdarc | 2008-10-30 22:18:34 +0100 (Thu, 30 Oct 2008) | 8 lines Issue #4176: Pickle would crash the interpreter when a __reduce__ function does not return an iterator for the 4th and 5th items. (sequence-like and mapping-like state) A list is not an iterator... Will backport to 2.6 and 2.5. ........ r67065 | benjamin.peterson | 2008-10-31 00:59:18 +0100 (Fri, 31 Oct 2008) | 1 line move unprefixed error into .c file ........ Modified: python/branches/release26-maint/ (props changed) From buildbot at python.org Fri Nov 7 11:03:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 07 Nov 2008 10:03:13 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081107100313.55B981E4002@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/1252 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,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Nov 7 19:51:50 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 7 Nov 2008 19:51:50 +0100 (CET) Subject: [Python-checkins] r67149 - in python/trunk: Misc/NEWS Tools/msi/msi.py Message-ID: <20081107185150.D4B551E4002@bag.python.org> Author: martin.v.loewis Date: Fri Nov 7 19:51:50 2008 New Revision: 67149 Log: Issue #1656675: Register a drop handler for .py* files on Windows. Modified: python/trunk/Misc/NEWS python/trunk/Tools/msi/msi.py Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Nov 7 19:51:50 2008 @@ -57,6 +57,8 @@ Build ----- +- Issue #1656675: Register a drop handler for .py* files on Windows. + - Issue #4120: Exclude manifest from extension modules in VS2008. - Issue #4091: Install pythonxy.dll in system32 again. Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Fri Nov 7 19:51:50 2008 @@ -1182,6 +1182,7 @@ ewi = "Edit with IDLE" pat2 = r"Software\Classes\%sPython.%sFile\DefaultIcon" pat3 = r"Software\Classes\%sPython.%sFile" + pat4 = r"Software\Classes\%sPython.%sFile\shellex\DropHandler" tcl_verbs = [] if have_tcl: tcl_verbs=[ @@ -1229,6 +1230,13 @@ "Python File (no console)", "REGISTRY.def"), ("pyc.txt", -1, pat3 % (testprefix, "Compiled"), "", "Compiled Python File", "REGISTRY.def"), + # Drop Handler + ("py.drop", -1, pat4 % (testprefix, ""), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), + ("pyw.drop", -1, pat4 % (testprefix, "NoCon"), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), + ("pyc.drop", -1, pat4 % (testprefix, "Compiled"), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), ]) # Registry keys From python-checkins at python.org Fri Nov 7 19:54:47 2008 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 7 Nov 2008 19:54:47 +0100 (CET) Subject: [Python-checkins] r67150 - in python/branches/release26-maint: Misc/NEWS Tools/msi/msi.py Message-ID: <20081107185447.C7AF61E4002@bag.python.org> Author: martin.v.loewis Date: Fri Nov 7 19:54:47 2008 New Revision: 67150 Log: Merged revisions 67149 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67149 | martin.v.loewis | 2008-11-07 19:51:50 +0100 (Fr, 07 Nov 2008) | 1 line Issue #1656675: Register a drop handler for .py* files on Windows. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Tools/msi/msi.py Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Fri Nov 7 19:54:47 2008 @@ -57,6 +57,8 @@ Build ----- +- Issue #1656675: Register a drop handler for .py* files on Windows. + - Issue #4120: Exclude manifest from extension modules in VS2008. - Issue #4091: Install pythonxy.dll in system32 again. Modified: python/branches/release26-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release26-maint/Tools/msi/msi.py (original) +++ python/branches/release26-maint/Tools/msi/msi.py Fri Nov 7 19:54:47 2008 @@ -1181,6 +1181,7 @@ ewi = "Edit with IDLE" pat2 = r"Software\Classes\%sPython.%sFile\DefaultIcon" pat3 = r"Software\Classes\%sPython.%sFile" + pat4 = r"Software\Classes\%sPython.%sFile\shellex\DropHandler" tcl_verbs = [] if have_tcl: tcl_verbs=[ @@ -1228,6 +1229,13 @@ "Python File (no console)", "REGISTRY.def"), ("pyc.txt", -1, pat3 % (testprefix, "Compiled"), "", "Compiled Python File", "REGISTRY.def"), + # Drop Handler + ("py.drop", -1, pat4 % (testprefix, ""), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), + ("pyw.drop", -1, pat4 % (testprefix, "NoCon"), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), + ("pyc.drop", -1, pat4 % (testprefix, "Compiled"), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), ]) # Registry keys From buildbot at python.org Fri Nov 7 20:30:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 07 Nov 2008 19:30:09 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081107193010.1CD3C1E4002@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/1055 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_io test_largefile ====================================================================== ERROR: test_large_file_ops (test.test_io.IOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_io.py", line 214, in test_large_file_ops self.large_file_ops(f) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_io.py", line 140, in large_file_ops self.assertEqual(f.write(b"xxx"), 3) IOError: [Errno 28] No space left on device ====================================================================== ERROR: Test seek/tell using the StatefulIncrementalDecoder. ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_io.py", line 1023, in testSeekAndTell testSeekAndTellWithData(input) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_io.py", line 1003, in testSeekAndTellWithData decoded = f.read() File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\io.py", line 1721, in read decoder = self._decoder or self._get_decoder() File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\io.py", line 1510, in _get_decoder decoder = make_decoder(self._errors) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_io.py", line 600, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_seek (test.test_largefile.TestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_largefile.py", line 42, in test_seek f.flush() IOError: [Errno 28] No space left on device ====================================================================== FAIL: test_osstat (test.test_largefile.TestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_largefile.py", line 50, in test_osstat self.assertEqual(os.stat(TESTFN)[stat.ST_SIZE], size+1) AssertionError: 1L != 2500000001L ====================================================================== FAIL: test_seek_read (test.test_largefile.TestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_largefile.py", line 72, in test_seek_read self.assertEqual(f.tell(), size + 1 + 0) AssertionError: 1L != 2500000001L ====================================================================== FAIL: test_lseek (test.test_largefile.TestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_largefile.py", line 93, in test_lseek self.assertEqual(os.lseek(f.fileno(), 0, 2), size+1+0) AssertionError: 1L != 2500000001L ====================================================================== FAIL: test_truncate (test.test_largefile.TestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\test\test_largefile.py", line 110, in test_truncate self.assertEqual(f.tell(), size+1) AssertionError: 1L != 2500000001L sincerely, -The Buildbot From buildbot at python.org Fri Nov 7 20:35:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 07 Nov 2008 19:35:01 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081107193502.668CF1E4002@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/2073 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: georg.brandl,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Fri Nov 7 23:14:17 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 7 Nov 2008 17:14:17 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081107221417.GA1853@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_cmd_line leaked [-50, 25, 25] references, sum=0 test_file leaked [-83, 0, 77] references, sum=-6 test_filecmp leaked [0, 0, -77] references, sum=-77 test_smtplib leaked [-1, 89, -88] references, sum=0 test_sys leaked [0, 42, -21] references, sum=21 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From python-checkins at python.org Sat Nov 8 00:13:34 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 8 Nov 2008 00:13:34 +0100 (CET) Subject: [Python-checkins] r67152 - sandbox/trunk/io-c/_fileio.c Message-ID: <20081107231334.5E41E1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Sat Nov 8 00:13:33 2008 New Revision: 67152 Log: Silent some compiler warnings Modified: sandbox/trunk/io-c/_fileio.c Modified: sandbox/trunk/io-c/_fileio.c ============================================================================== --- sandbox/trunk/io-c/_fileio.c (original) +++ sandbox/trunk/io-c/_fileio.c Sat Nov 8 00:13:33 2008 @@ -75,7 +75,8 @@ return NULL; } - return PyObject_CallMethod(&PyRawIOBase_Type, "close", "O", self); + return PyObject_CallMethod((PyObject*)&PyRawIOBase_Type, + "close", "O", self); } static PyObject * @@ -388,8 +389,6 @@ return PyLong_FromSsize_t(n); } -#define DEFAULT_BUFFER_SIZE (8*1024) - static PyObject * fileio_readall(PyFileIOObject *self) { From python-checkins at python.org Sat Nov 8 03:05:22 2008 From: python-checkins at python.org (brett.cannon) Date: Sat, 8 Nov 2008 03:05:22 +0100 (CET) Subject: [Python-checkins] r67153 - peps/trunk/pep-0000.txt Message-ID: <20081108020522.5D97B1E4002@bag.python.org> Author: brett.cannon Date: Sat Nov 8 03:05:22 2008 New Revision: 67153 Log: Create PEP 374: Migrating from svn to a distributed VCS. Modified: peps/trunk/pep-0000.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Sat Nov 8 03:05:22 2008 @@ -100,6 +100,7 @@ S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes S 372 Adding an ordered dictionary to collections Ronacher + P 374 Migrating from svn to a distributed VCS Cannon S 3135 New Super Spealman, Delaney Finished PEPs (done, implemented in Subversion) From python-checkins at python.org Sat Nov 8 04:46:18 2008 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sat, 8 Nov 2008 04:46:18 +0100 (CET) Subject: [Python-checkins] r67154 - python/trunk/Modules/posixmodule.c Message-ID: <20081108034618.668021E4002@bag.python.org> Author: hirokazu.yamamoto Date: Sat Nov 8 04:46:17 2008 New Revision: 67154 Log: Issue #4071: ntpath.abspath returned an empty string for long unicode path. Modified: python/trunk/Modules/posixmodule.c Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Sat Nov 8 04:46:17 2008 @@ -2389,13 +2389,27 @@ if (unicode_file_names()) { PyUnicodeObject *po; if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { - Py_UNICODE woutbuf[MAX_PATH*2]; + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; Py_UNICODE *wtemp; - if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po), - sizeof(woutbuf)/sizeof(woutbuf[0]), - woutbuf, &wtemp)) - return win32_error("GetFullPathName", ""); - return PyUnicode_FromUnicode(woutbuf, wcslen(woutbuf)); + DWORD result; + PyObject *v; + result = GetFullPathNameW(wpath, + sizeof(woutbuf)/sizeof(woutbuf[0]), + woutbuf, &wtemp); + if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { + woutbufp = malloc(result * sizeof(Py_UNICODE)); + if (!woutbufp) + return PyErr_NoMemory(); + result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); + } + if (result) + v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); + else + v = win32_error_unicode("GetFullPathNameW", wpath); + if (woutbufp != woutbuf) + free(woutbufp); + return v; } /* Drop the argument parsing error as narrow strings are also valid. */ From python-checkins at python.org Sat Nov 8 06:03:25 2008 From: python-checkins at python.org (brett.cannon) Date: Sat, 8 Nov 2008 06:03:25 +0100 (CET) Subject: [Python-checkins] r67155 - peps/trunk/pep-0374.txt Message-ID: <20081108050325.EDAE51E4002@bag.python.org> Author: brett.cannon Date: Sat Nov 8 06:03:25 2008 New Revision: 67155 Log: It helps to check in the PEP you want to add. Added: peps/trunk/pep-0374.txt Added: peps/trunk/pep-0374.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0374.txt Sat Nov 8 06:03:25 2008 @@ -0,0 +1,14 @@ +PEP: 374 +Title: Migrating from svn to a distributed VCS +Version: $Revision: 65628 $ +Last-Modified: $Date: 2008-08-10 06:59:20 -0700 (Sun, 10 Aug 2008) $ +Author: Brett Cannon +Status: Draft +Type: Process +Content-Type: text/x-rst +Created: 07-Nov-2008 +Post-History: 07-Nov-2008 + +.. note:: + While the PEP is under active editing, it can be viewed at + http://docs.google.com/Doc?id=dg7fctr4_40dvjkdg64 . From buildbot at python.org Sat Nov 8 06:51:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 08 Nov 2008 05:51:59 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081108055200.04CA11E4002@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/805 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: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_ssl test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Sat Nov 8 07:24:19 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 8 Nov 2008 01:24:19 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081108062419.GA20048@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5, building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5, building text loading pickled environment... done building [text]: targets for 25 source files that are out of date updating environment: 0 added, 0 changed, 0 removed preparing documents... done writing output... c-api/index c-api/init contents library/2to3 library/codecs library/collections library/datatypes library/development library/dis library/email library/email.parser library/filesys library/ftplib library/functions library/heapq library/index library/internet library/ipc library/language library/persistence library/select library/socket library/someos library/sqlite3 library/stdtypes library/strings library/subprocess library/tempfile library/thread library/threading reference/datamodel reference/index reference/simple_stmts tutorial/controlflow tutorial/index using/cmdline using/index whatsnew/2.3 whatsnew/2.4 whatsnew/2.5 whatsnew/2.6 whatsnew/index build succeeded. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5, building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... PyObject* PyObject PyObject* PyTypeObject Py_INCREF Py_DECREF Py_DECREF Py_DECREF Py_DECREF Py_DECREF Py_XDECREF PyList_SetItem PyTuple_SetItem PyInt_FromLong PyTuple_SetItem Py_INCREF PyTuple_SetItem PySequence_SetItem PyObject_SetItem PyTuple_SetItem PyList_New PyList_SetItem Py_BuildValue PyObject_SetItem PyObject_GetItem PySequence_GetItem PyList_GetItem PySequence_GetItem PyList_GetItem PySequence_GetItem PyErr_Occurred PyErr_Occurred PyErr_SetString PyErr_Clear PyErr_ExceptionMatches PyErr_Clear Py_XDECREF Py_DECREF Py_Initialize Py_Initialize Py_Initialize Py_Initialize Py_Initialize Py_GetPath Py_GetPrefix Py_GetExecPrefix Py_GetProgramFullPath Py_Initialize Py_Finalize Py_IsInitialized Py_Finalize PyObject Py_eval_input Py_file_input Py_single_input PyRun_AnyFileExFlags PyRun_AnyFileExFlags PyRun_AnyFileExFlags PyRun_InteractiveLoop PyRun_SimpleFile PyRun_SimpleStringFlags PyRun_SimpleFileExFlags PyRun_SimpleFileExFlags PyRun_SimpleFileExFlags PyRun_SimpleStringFlags PyRun_InteractiveOneFlags PyRun_InteractiveLoopFlags PyParser_SimpleParseStringFlagsFilename PyParser_SimpleParseStringFlagsFilename PyParser_SimpleParseFileFlags PyParser_SimpleParseStringFlagsFilename PyRun_StringFlags PyRun_FileExFlags PyRun_FileExFlags PyRun_FileExFlags PyRun_StringFlags PyRun_FileExFlags Py_CompileStringFlags Py_eval_input Py_file_input Py_single_input PyEval_EvalCodeEx Py_CompileString Py_CompileString Py_CompileString PEP 238 Py_XINCREF Py_XDECREF Py_DECREF Py_DECREF Py_DECREF Py_DECREF Py_DECREF Py_XINCREF Py_XDECREF PyErr_Restore Py_DECREF PyErr_ExceptionMatches PyErr_Fetch PyErr_Fetch PyErr_SetString PyErr_CheckSignals PyErr_SetFromErrno PyErr_SetFromWindowsErr PyErr_SetFromWindowsErr PyErr_SetFromWindowsErrWithFilename PyErr_WarnEx Py_DECREF PyObject* PyErr_Warn PyErr_WarnEx PyErr_WarnEx PyErr_CheckSignals PyObject* Py_Finalize Py_Finalize Py_AtExit PyImport_ImportModuleEx PyImport_ImportModule PyImport_ImportModuleNoBlock PyImport_ImportModule PyImport_ImportModuleLevel PyImport_ImportModule PyImport_ExecCodeModule PyImport_ReloadModule PyImport_ImportModule PyImport_ExtendInittab Py_Initialize PyImport_ExtendInittab Py_Initialize PyMarshal_ReadObjectFromFile PyArg_ParseTuple PyArg_ParseTupleAndKeywords PyArg_Parse Py_UNICODE Py_UNICODE PyArg_ParseTuple PyMem_Free PyMem_Free PyArg_ParseTuple Py_complex PyObject* PyArg_Parse* PyObject* PyObject* PyArg_ParseTuple PyArg_ParseTuple PyArg_Parse* PyArg_Parse* PyArg_ParseTuple PyArg_ParseTupleAndKeywords METH_OLDARGS METH_VARARGS PyObject* PyArg_UnpackTuple PyArg_ParseTuple PyArg_Parse* Py_BuildValue Py_BuildValue Py_BuildValue Py_BuildValue Py_complex Py_BuildValue PyOS_snprintf PyOS_vsnprintf PyOS_ascii_strtod PyEval_GetFuncName PyList_New PyErr_Occurred PyObject_Str PyObject_IsInstance PyObject_IsSubclass Py_BuildValue PyObject * PyObject_CallFunctionObjArgs Py_BuildValue PyObject * PyObject_CallMethodObjArgs PyObject* PyObject* PyTypeObject* PyErr_Occurred Py_None Py_None Py_None PyObject* PyNumber_Coerce PyNumber_Index PySequence_Size PySequence_Fast_GET_ITEM PySequence_Fast PySequence_Fast PySequence_GetItem PySequence_Fast PySequence_Size PySequence_Fast_GET_SIZE PyDict_Check Py_TPFLAGS_HAVE_GC PyTypeObject Py_None PyObject PyTypeObject PyInt_Type PyInt_Type PyInt_Type PyInt_Type PyIntObject PyLongObject PyLongObject PyIntObject PyIntObject PyLongObject PyIntObject PyLongObject PyIntObject PyLongObject Py_False Py_True Py_False Py_True Py_True Py_False PyObject PyTypeObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLongObject PyLong_AsVoidPtr PyLong_FromVoidPtr PyObject PyTypeObject PyFloatObject PyFloatObject PyFloatObject PyFloatObject PyFloatObject PyFloatObject Py_complex Py_complex Py_complex Py_complex Py_complex Py_complex PyObject PyTypeObject PyComplexObject PyComplexObject PyComplexObject PyComplexObject Py_complex PyComplexObject Py_complex PyObject PyTypeObject PyByteArray_Size PyByteArray_AsString PyObject PyTypeObject PyString_FromFormat PyString_Size PyString_AsString PyString_AsString PyString_AsStringAndSize PyString_FromString PyString_InternInPlace Py_UNICODE Py_UNICODE Py_UNICODE Py_UNICODE PyObject PyTypeObject PyUnicodeObject PyUnicodeObject Py_UNICODE PyUnicodeObject PyUnicodeObject Py_UNICODE Py_UNICODE Py_UNICODE PyUnicode_DecodeUTF8 Py_UNICODE PyUnicode_DecodeUTF32 PyUnicode_DecodeUTF32Stateful PyUnicode_DecodeUTF16 PyUnicode_DecodeUTF16Stateful Py_UNICODE Py_UNICODE Py_UNICODE Py_UNICODE Py_UNICODE Py_UNICODE Py_UNICODE Py_UNICODE PyUnicode_DecodeMBCS PyUnicode_DecodeMBCSStateful Py_UNICODE Py_True Py_False PyArg_ParseTuple Buffer Object Structures PyBufferProcs PyObject PyTypeObject PyBuffer_FromObject PyBuffer_FromReadWriteObject PyBufferObject PyBuffer_Type Py_END_OF_BUFFER PyBuffer_FromObject Py_END_OF_BUFFER PyBuffer_FromMemory PyObject_AsWriteBuffer PyObject PyTypeObject PyTuple_GetItem PyTuple_SetItem PyObject PyTypeObject PySequence_SetItem PyList_SetItem PyList_Size PyList_GetItem PyList_SetItem PyList_SetItem PyObject PyTypeObject PyDict_GetItem PyObject* PyListObject PyListObject PyListObject PyObject* PyMapping_Keys() PyObject_GetItem() Type Objects PyTypeObject PyFunction_Type PyTypeObject PyMethod_Type PyMethod_Class PyMethod_Function PyMethod_Self PyObject PyTypeObject PyFileObject PyFileObject PyFileObject PyFileObject PyFileObject PyTypeObject PyModule_Type PySeqIter_New PySeqIter_Type PyCallIter_New PyCallIter_Type PySlice_GetIndicesEx PySlice_GetIndices PyWeakref_GetObject PyObject PyCObject PyCObject PyCObject PyCObject PyCObject PyCObject PyGen_New PyObject_CallMethod PyObject_RichCompareBool PyObject_Hash PyObject_Repr PyObject_IsTrue PyObject_Print PyObject_GetIter PyNumber_And PyNumber_Subtract PyNumber_Or PyNumber_Xor PyNumber_InPlaceAnd PyNumber_InPlaceSubtract PyNumber_InPlaceOr PyNumber_InPlaceXor PyObject PyDictObject PyTypeObject PyTypeObject PySet_Add() PySet_Size PyTuple_SetItem Py_SetProgramName PyEval_InitThreads PyEval_ReleaseLock PyEval_AcquireLock PySys_SetArgv Py_Finalize Py_Initialize Py_Finalize Py_Initialize Py_Initialize Py_NewInterpreter Py_Initialize Py_Initialize Py_Initialize Py_Finalize Py_Finalize Py_Initialize Py_Finalize Py_Initialize Py_GetPath Py_SetProgramName Py_SetProgramName Py_SetProgramName Py_SetProgramName Py_SetProgramName Py_FatalError PyThreadState PyThreadState Py_BEGIN_ALLOW_THREADS Py_END_ALLOW_THREADS PyEval_RestoreThread PyEval_SaveThread PyEval_RestoreThread PyEval_ReleaseLock PyEval_AcquireLock Py_Initialize Py_NewInterpreter PyInterpreterState * PyEval_ReleaseLock PyEval_SaveThread PyEval_RestoreThread Py_Initialize PyEval_InitThreads PyEval_InitThreads PyOS_AfterFork Py_END_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS Py_END_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS PyInterpreterState_Clear PyThreadState_Clear PyGILState_Release PyGILState_Ensure PyGILState_Release Py_BEGIN_ALLOW_THREADS Py_END_ALLOW_THREADS PyGILState_Ensure PyGILState_Release PyGILState_Ensure PyGILState_Release PyGILState_Ensure PyGILState_Ensure PyGILState_Release PyEval_SetProfile PyEval_SetTrace PyTrace_CALL PyTrace_EXCEPTION PyTrace_LINE PyTrace_RETURN PyTrace_C_CALL PyTrace_C_EXCEPTION PyTrace_C_RETURN PyTrace_CALL PyTrace_EXCEPTION PyTrace_LINE PyTrace_RETURN PyTrace_C_CALL PyTrace_C_EXCEPTION PyTrace_C_RETURN Py_tracefunc Py_tracefunc Py_tracefunc Py_tracefunc Py_tracefunc Py_tracefunc PyEval_SetProfile PyThreadState PyInterpreterState PyMem_Malloc PyMem_Realloc PyMem_Realloc PyMem_Malloc PyMem_Realloc PyMem_Malloc PyMem_Realloc PyMem_Free Overview PyObject_New PyObject_NewVar PyObject_Del PyObject_Init tp_basicsize tp_itemsize PyObject_New PyObject_NewVar tp_dealloc Py_InitModule3 PyObject PyVarObject PyObject ob_size PyObject PyVarObject PyObject PyObject_HEAD PyVarObject PyObject_HEAD PyObject* PyObject* PyCFunction PyCFunction PyObject* METH_VARARGS METH_KEYWORDS METH_KEYWORDS PyCFunction PyObject* Py_InitModule4 Py_InitModule PyArg_ParseTuple PyArg_UnpackTuple METH_VARARGS PyArg_ParseTupleAndKeywords METH_NOARGS PyCFunction METH_O PyArg_ParseTuple PyCFunction PyObject* PyCFunction tp_getattro tp_getattr PyTypeObject PyTypeObject PyVarObject ob_size PyType_Type tp_itemsize ob_size ob_type PyType_Ready ob_type ob_type PyType_Ready tp_name tp_name tp_itemsize tp_itemsize tp_basicsize ob_size tp_basicsize tp_itemsize ob_size ob_size ob_size ob_size PyObject_HEAD PyObject_VAR_HEAD _ob_prev _ob_next tp_basicsize tp_basicsize tp_itemsize tp_itemsize tp_basicsize tp_itemsize tp_basicsize Py_DECREF Py_XDECREF tp_free Py_TPFLAGS_BASETYPE tp_free PyObject_Del PyObject_New PyObject_GC_Del PyObject_GC_New tp_repr tp_str tp_print tp_print tp_repr tp_str PyObject_Print tp_str tp_repr tp_print tp_print tp_repr tp_str tp_getattro PyObject_GetAttrString tp_getattro tp_getattr tp_getattro tp_getattr tp_getattro tp_setattro PyObject_SetAttrString tp_setattro tp_setattr tp_setattro tp_setattr tp_setattro PyObject_Compare tp_richcompare tp_hash tp_compare tp_richcompare tp_hash tp_compare tp_richcompare tp_hash PyObject_Repr Number Object Structures tp_as_number Sequence Object Structures tp_as_sequence Mapping Object Structures tp_as_mapping PyObject_Hash PyObject_HashNotImplemented PyObject_HashNotImplemented tp_compare tp_richcompare tp_richcompare tp_compare tp_compare tp_richcompare tp_hash tp_compare tp_richcompare tp_hash PyObject_Call PyObject_Str PyObject_Str PyObject_Str PyObject_Repr PyObject_GetAttr tp_getattr tp_getattr tp_getattro tp_getattr tp_getattro PyObject_SetAttr tp_setattr tp_setattr tp_setattro tp_setattr tp_setattro Buffer Object Structures tp_as_buffer tp_as_number tp_as_sequence tp_as_mapping tp_as_buffer Py_TPFLAGS_HAVE_GC tp_traverse tp_clear Py_TPFLAGS_HAVE_GC tp_traverse tp_clear Py_TPFLAGS_HAVE_RICHCOMPARE tp_flags PyType_HasFeature PyBufferProcs tp_as_buffer PySequenceMethods tp_as_sequence sq_contains PySequenceMethods tp_as_sequence PyNumberMethods tp_as_number PyNumberMethods PySequenceMethods sq_inplace_concat sq_inplace_repeat PyNumberMethods tp_as_number tp_richcompare tp_traverse tp_clear tp_weaklistoffset tp_weaklistoffset tp_iter tp_iternext tp_methods tp_members tp_getset tp_base tp_dict tp_descr_get tp_descr_set tp_dictoffset tp_init tp_alloc tp_new tp_free tp_is_gc tp_bases tp_mro tp_cache tp_subclasses tp_weaklist ob_type PyType_Ready PyType_Ready PyObject_GC_New PyObject_GC_Del Supporting Cyclic Garbage Collection tp_traverse tp_clear Py_TPFLAGS_HAVE_GC Py_TPFLAGS_HAVE_RICHCOMPARE Py_TPFLAGS_HAVE_GETCHARBUFFER Py_TPFLAGS_HAVE_SEQUENCE_IN Py_TPFLAGS_HAVE_INPLACEOPS Py_TPFLAGS_HAVE_RICHCOMPARE Py_TPFLAGS_HAVE_WEAKREFS Py_TPFLAGS_HAVE_ITER Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_HAVE_RICHCOMPARE Py_TPFLAGS_HAVE_GC Supporting Cyclic Garbage Collection tp_traverse tp_traverse Py_VISIT Py_VISIT Py_VISIT tp_clear Py_TPFLAGS_HAVE_GC tp_traverse tp_clear Py_TPFLAGS_HAVE_RICHCOMPARE Py_TPFLAGS_HAVE_GC tp_clear tp_clear tp_clear tp_clear tp_clear tp_clear tp_clear Py_CLEAR Py_CLEAR tp_clear tp_dealloc tp_clear Supporting Cyclic Garbage Collection tp_traverse Py_TPFLAGS_HAVE_GC tp_traverse tp_clear Py_TPFLAGS_HAVE_RICHCOMPARE tp_compare tp_hash tp_compare tp_richcompare tp_hash tp_compare tp_richcompare tp_hash tp_richcompare PyObject_RichCompare Py_TPFLAGS_HAVE_WEAKREFS PyObject* tp_weaklist tp_weaklistoffset tp_weaklistoffset tp_weaklistoffset tp_weaklistoffset Py_TPFLAGS_HAVE_CLASS PyObject_GetIter tp_iter PyIter_Next tp_weaklist Py_TPFLAGS_HAVE_CLASS PyMethodDef tp_dict tp_dict tp_dict PyType_Ready PyType_Ready tp_dict tp_basicsize tp_dictoffset tp_dictoffset tp_basicsize tp_itemsize tp_dictoffset ob_size ob_size tp_dictoffset tp_dictoffset tp_dictoffset tp_init tp_new tp_new tp_init tp_new tp_init tp_init tp_new ob_refcnt ob_type tp_itemsize ob_size tp_basicsize tp_new PyType_GenericAlloc tp_new tp_new tp_init tp_new tp_init tp_base PyType_GenericAlloc Py_TPFLAGS_HAVE_GC tp_flags Py_TPFLAGS_HAVE_GC PyType_Type PyType_Ready tp_allocs Number Protocol Py_TPFLAGS_CHECKTYPES Py_TPFLAGS_CHECKTYPES nb_coerce PyNumber_CoerceEx Py_TPFLAGS_CHECKTYPES PyMapping_Length PyObject_Size PyObject_GetItem PyMapping_Check PyObject_SetItem PySequence_Size PyObject_Size PySequence_Concat PySequence_Repeat PySequence_GetItem PySequence_Check sq_length sq_item sq_length PySequence_SetItem PySequence_Contains PySequence_Contains PySequence_InPlaceConcat PySequence_InPlaceRepeat tp_as_buffer PyTypeObject tp_as_buffer PyBufferProcs PyTypeObject Py_TPFLAGS_DEFAULT tp_flags PyBufferProcs PyString_Type PyBuffer_Type Py_TPFLAGS_HAVE_GETCHARBUFFER tp_flags PyTypeObject PyType_HasFeature tp_flags Py_TPFLAGS_HAVE_GC tp_traverse tp_clear PyObject_GC_New PyObject_GC_Track PyObject_New Py_TPFLAGS_HAVE_GC PyObject_NewVar Py_TPFLAGS_HAVE_GC PyObject_NewVar tp_traverse PyObject_GC_Track PyObject_GC_UnTrack PyObject_GC_Del PyObject_GC_New PyObject_GC_NewVar PyObject_GC_Track tp_dealloc tp_traverse PyObject_GC_UnTrack tp_traverse tp_traverse tp_traverse tp_traverse tp_traverse Py_VISIT tp_traverse tp_traverse tp_clear inquiry Py_DECREF Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... distutils-sig at python.org Writing the Setup Script A Simple Example A Simple Example Additional meta-data A Simple Example distutils.core distutils.sysconfig distutils.core.setup() PyPI website http://docutils.sf.net/ A Simple Example Creating a source distribution: the sdist command Writing the Setup Script Writing the Setup Configuration File The .pypirc file The .pypirc file Distutils Cookbook distutils.cmd distutils.core.setup() distutils.command distutils.command distutils.core distutils.core setup() distutils.cmd.Command distutils.version distutils.core.Extension http://pypi.python.org/pypi?:action=list_classifiers Distribution distutils.core.Distribution PEP 314 Command setup() setup() Distribution setup() Distribution Distribution setup() distutils.core Extension distutils.extension Command distutils.cmd Distribution distutils.dist Distribution setup() setup() Command distutils.ccompiler CCompiler CCompiler CCompiler CCompiler add_include_dir() add_include_dir() add_include_dir() set_include_dirs() add_library() set_libraries() add_library() set_libraries() add_library_dir() set_library_dirs() define_macro() undefine_macro() distutils.util.split_quoted() add_link_object() set_link_objects() add_library() set_libraries() add_library_dir() set_library_dirs() create_static_lib() create_static_lib() link() link() link() define_macro() undefine_macro() add_include_dir() CCompiler distutils.util.execute() distutils.dir_util.mkpath() distutils.file_util.move_file() CCompiler distutils.unixccompiler distutils.msvccompiler distutils.bcppcompiler distutils.emxccompiler distutils.mwerkscompiler distutils.archive_util distutils.dep_util newer() distutils.dir_util mkpath() mkpath() distutils.file_util distutils.file_util copy_file() copy_file() distutils.util get_platform() check_environ() byte_compile() RFC 822 distutils.dist distutils.extension distutils.debug distutils.errors distutils.fancy_getopt fancy_getopt() FancyGetopt FancyGetopt FancyGetopt getopt() getopt() getopt() FancyGetopt distutils.filelist distutils.log distutils.spawn distutils.sysconfig distutils.sysconfig PREFIX EXEC_PREFIX PREFIX EXEC_PREFIX distutils.ccompiler.CCompiler distutils.sysconfig distutils.text_file TextFile warn() unreadline() TextFile readline() close() TextFile TextFile readline() readline() readline() readline() unreadline() warn() readline() readline() unreadline() readline() unreadline() readline() distutils.version distutils.cmd Command distutils.command distutils.command.bdist distutils.command.bdist_packager distutils.command.bdist_dumb distutils.command.bdist_msi distutils.command.bdist_rpm distutils.command.bdist_wininst distutils.command.sdist distutils.command.build distutils.command.build_clib distutils.command.build_ext distutils.command.build_py distutils.command.build_scripts distutils.command.clean distutils.command.config distutils.command.install distutils.command.install_data distutils.command.install_headers distutils.command.install_lib distutils.command.install_scripts distutils.command.register PEP 301 distutils.command distutils.cmd.Command initialize_options() initialize_options() initialize_options() finalize_options() run() Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... reStructuredText docutils Apple Publications Style Guide reStructuredText User Documentation Cross-linking markup The build configuration file Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... Building C and C++ Extensions with distutils Building C and C++ Extensions on Windows The Module's Method Table and Initialization Function Extracting Parameters in Extension Functions Reference Counts philbrick at hks.com The Module's Method Table and Initialization Function A Simple Example older versions of this documentation Python FAQ Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing install.tex... install/index resolving references... writing... The new standard: Distutils Distutils Configuration Files Alternate Installation Custom Installation Alternate Installation Modifying Python's Search Path Distutils Configuration Files Distutils Configuration Files Distutils Configuration Files C++Builder Compiler Creating Python Extensions Using Borland's Free Compiler http://www.emmestech.com/software/cygwin/pexports-0.43/download_pexports.html Distutils Configuration Files Building Python modules on MS Windows platform with MinGW http://sources.redhat.com/cygwin/ http://www.mingw.org/ Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... Python Package Index random Built-in Objects imp __import__() __import__() getattr() __import__() str unicode str unicode int False True bool int bool False True False True False ord() ValueError unichr() staticmethod() eval() PEP 236 __future__ SyntaxError TypeError int() long() float() Numeric Types --- int, float, long, complex setattr() Mapping Types --- dict list set tuple collections dir() dir() dir() divmod() next() enumerate() enumerate() __builtin__ eval() compile() eval() execfile() globals() locals() eval() execfile() execfile() locals() execfile() execfile() file File Objects open() open() file Numeric Types --- int, float, long, complex Set Types --- set, frozenset dict list tuple collections AttributeError site id() SyntaxError readline input() raw_input() TypeError Numeric Types --- int, float, long, complex TypeError TypeError TypeError next() StopIteration list Sequence Types --- str, unicode, list, tuple, buffer, xrange dict set tuple collections locals() int() Numeric Types --- int, float, long, complex map() next() StopIteration object file File Objects IOError open() file fileinput os os.path tempfile shutil chr() unichr() TypeError str() print() sys.stdout print() object property() ValueError EOFError readline raw_input() reload() sys __main__ __builtin__ reload() eval() Set Types --- set, frozenset dict list tuple collections getattr() Mutable Sequence Types classmethod() eval() Sequence Types --- str, unicode, list, tuple, buffer, xrange String Methods String Formatting Operations String Services unicode() super() super() super() tuple Sequence Types --- str, unicode, list, tuple, buffer, xrange dict list set collections isinstance() type() type ord() ValueError chr() LookupError ValueError codecs Sequence Types --- str, unicode, list, tuple, buffer, xrange String Methods String Formatting Operations String Services str() range() xrange() range() xrange() xrange() zip() map() zip() zip() TypeError apply() apply() TypeError intern() bool bool types.NoneType SyntaxError __debug__ SyntaxError site site SystemExit repr() str() print() bool False True TypeError int float long complex int() long() float() complex() math.floor() math.ceil() Built-in Functions divmod() abs() numbers.Real int long float ValueError OverflowError ValueError float.hex() float.fromhex() float.hex() float.fromhex() StopIteration next() StopIteration next() str unicode list tuple buffer xrange dict list set tuple collections String Methods buffer() xrange() min() max() Mutable Sequence Types str.join() Sequence Types --- str, unicode, list, tuple, buffer, xrange String Formatting Operations re UnicodeError codecs.register_error() Codec Base Classes UnicodeError codecs.register_error() Codec Base Classes Standard Encodings Format String Syntax String Formatting Operations ValueError ValueError string codecs repr() str() unicode unicode PEP 237 string re xrange xrange xrange len() ValueError ValueError set frozenset dict list tuple collections set frozenset set frozenset frozenset set frozenset set frozenset set frozenset set frozenset frozenset set frozenset KeyError KeyError Comparison to the built-in set types sets dict list set tuple collections dict KeyError KeyError collections.defaultdict KeyError KeyError zip() dict.items() dict.items() dict.items() dict.items() KeyError KeyError dict.items() open() os.popen() os.fdopen() tempfile shutil IOError ValueError contextlib.closing() fcntl os.read() next() StopIteration next() next() open() open() open() decimal.localcontext() contextlib TypeError TypeError compile() code eval() type() types Ellipsis bool() dir() dir() dir() exceptions exceptions BaseException Exception BaseException Exception str() unicode() BaseException StopIteration GeneratorExit KeyboardInterrupt SystemExit StandardError Exception OverflowError ZeroDivisionError FloatingPointError IndexError KeyError sys.setdefaultencoding() IOError OSError EnvironmentError TypeError input() raw_input() file.read() file.readline() BaseException StandardError BaseException open() EnvironmentError socket.error TypeError input() raw_input() BaseException Exception BaseException RuntimeError EnvironmentError errno MemoryError weakref.proxy() weakref weakref.ReferenceError next() Exception StandardError eval() input() str() sys.exit() BaseException StandardError sys.exit() os._exit() BaseException StandardError Exception Exception BaseException NameError ValueError UnicodeError UnicodeError UnicodeError IndexError OSError warnings Sequence Types --- str, unicode, list, tuple, buffer, xrange String Methods String Formatting Operations re string string Sequence Types --- str, unicode, list, tuple, buffer, xrange String Methods String Formatting Operations re ascii_lowercase ascii_uppercase lowercase uppercase locale.setlocale() upper() swapcase() locale.setlocale() digits letters punctuation whitespace lower() swapcase() locale.setlocale() strip() split() str.format() PEP 3101 Formatter string Formatter format() format() vformat() vformat() Formatter vformat() parse() PEP 3101 vformat() get_value() vformat() get_value() get_value() getattr() IndexError KeyError check_unused_args() format_field() format() get_field() parse() str.format() Formatter Formatter field_name conversion format_spec identifier integer attribute_name identifier integer getattr() str() repr() Format String Syntax str() fill align sign width precision type integer integer PEP 292 ValueError string Template Template substitute() KeyError substitute() ValueError safe_substitute() Template Template re.escape() split() capitalize() join() translate() lowercase uppercase lower() upper() String Methods float() float() int() int() eval() long() atoi() long() find() find() ValueError rfind() ValueError split() split() split() splitfields() join() join() joinfields() joinfields() join() re re Kodos DOTALL MULTILINE MULTILINE MULTILINE LOCALE UNICODE re.I re.L re.M re.S re.U re.X Module Contents compile() search() match() UNICODE UNICODE UNICODE UNICODE LOCALE UNICODE LOCALE UNICODE LOCALE UNICODE LOCALE UNICODE LOCALE UNICODE LOCALE UNICODE LOCALE UNICODE LOCALE UNICODE MULTILINE match() search() compile() search() sub() search() match() split() findall() finditer() sub() subn() True match() sub() IndexError IndexError IndexError search() match() search() match() match() search() match() search() RuntimeError match() search() match() split() split() sub() sub() findall() search() findall() finditer() finditer() struct pack() unpack() True False array xdrlib struct struct pack() pack_into() unpack() unpack_from() format difflib filecmp SequenceMatcher SequenceMatcher Differ HtmlDiff HtmlDiff make_file() file.readlines() file.writelines() time.ctime() A command-line interface to difflib Differ IS_LINE_JUNK() SequenceMatcher IS_CHARACTER_JUNK() Differ.compare() ndiff() file.readlines() file.writelines() time.ctime() A command-line interface to difflib ndiff() ndiff() Pattern Matching: The Gestalt Approach Dr. Dobb's Journal SequenceMatcher SequenceMatcher SequenceMatcher set_seq2() set_seq1() find_longest_match() get_opcodes() get_opcodes() get_matching_blocks() get_opcodes() quick_ratio() real_quick_ratio() ratio() ratio() ratio() ratio() ratio() quick_ratio() get_close_matches() SequenceMatcher Differ Differ Differ Differ Differ() StringIO StringIO File Objects str unicode StringIO StringIO StringIO UnicodeError getvalue() StringIO StringIO close() UnicodeError cStringIO StringIO cStringIO StringIO StringIO.StringIO StringIO StringIO StringIO textwrap textwrap wrap() fill() TextWrapper dedent() TextWrapper TextWrapper fill() fill() wrap() wrap() fill() TextWrapper TextWrapper TextWrapper.break_long_words dedent() TextWrapper TextWrapper TextWrapper width TextWrapper width expand_tabs replace_whitespace TextWrapper fix_sentence_endings width width width width break_long_words TextWrapper width TextWrapper codecs IncrementalEncoder IncrementalDecoder StreamWriter StreamReader register_error() LookupError lookup() LookupError LookupError LookupError LookupError LookupError LookupError UnicodeEncodeError IndexError UnicodeDecodeError UnicodeTranslateError LookupError ValueError open() ValueError BOM_UTF16 BOM_UTF16_BE BOM_UTF16_LE BOM BOM_UTF16 BOM_LE BOM_UTF16_LE BOM_BE BOM_UTF16_BE codecs UnicodeError register_error() IncrementalEncoder IncrementalDecoder IncrementalEncoder IncrementalEncoder IncrementalEncoder ValueError IncrementalEncoder register_error() encode() IncrementalDecoder IncrementalDecoder IncrementalDecoder ValueError IncrementalDecoder register_error() decode() StreamWriter StreamReader StreamWriter StreamWriter StreamWriter ValueError StreamWriter register_error() write() StreamWriter StreamReader StreamReader StreamReader ValueError StreamReader register_error() read() readline() read() StreamReader StreamReaderWriter lookup() StreamReaderWriter StreamReader StreamWriter StreamReaderWriter StreamReader StreamWriter StreamRecoder lookup() StreamRecoder StreamReader StreamWriter StreamRecoder StreamReader StreamWriter UnicodeEncodeError RFC 3490 encodings.idna RFC 3492 encodings.idna RFC 3490 RFC 3492 stringprep socket httplib ftplib httplib encodings.idna RFC 3490 RFC 3490 encodings.utf_8_sig unicodedata ftp://ftp.unicode.org/ http://www.unicode.org/Public/5.1.0/ucd/UCD.html KeyError ValueError ValueError ValueError ValueError stringprep RFC 3454 stringprep stringprep fpformat fpformat fpformat String Formatting Operations fpformat fix() sci() ValueError dict list set frozenset sets tuple str unicode datetime datetime time calendar datetime datetime datetime time tzinfo tzinfo tzinfo tzinfo datetime datetime date datetime MINYEAR date datetime MAXYEAR calendar time year month day hour minute second microsecond tzinfo year month day hour minute second microsecond tzinfo date time datetime datetime time date time datetime timedelta timedelta timedelta OverflowError timedelta timedelta timedelta timedelta timedelta timedelta ZeroDivisionError timedelta timedelta date datetime timedelta timedelta timedelta TypeError False True timedelta timedelta date date ValueError time.time() ValueError fromtimestamp() ValueError MINYEAR MAXYEAR OverflowError MINYEAR MAXYEAR TypeError date date TypeError False True date time.struct_time time.localtime() date isoweekday() weekday() isocalendar() http://www.phys.uu.nl/ time.ctime() date.ctime() strftime() Behavior date datetime datetime date time date datetime datetime tzinfo ValueError tzinfo now() fromtimestamp() today() time.time() tzinfo today() utcnow() tzinfo now() datetime now() time.time() datetime tzinfo fromtimestamp() ValueError fromtimestamp() datetime utcfromtimestamp() datetime tzinfo ValueError fromtimestamp() datetime ValueError tzinfo datetime date tzinfo time datetime datetime tzinfo datetime ValueError time.strptime() datetime datetime datetime MINYEAR MAXYEAR datetime datetime datetime tzinfo OverflowError MINYEAR MAXYEAR tzinfo datetime datetime TypeError tzinfo tzinfo timedelta tzinfo TypeError tzinfo tzinfo tzinfo TypeError datetime datetime TypeError False True datetime datetime date time tzinfo timetz() time time() datetime tzinfo tzinfo utcoffset() dst() tzinfo tzinfo.fromutc() tzinfo astimezone() astimezone() tzinfo timedelta tzinfo timedelta tzinfo time.struct_time time.localtime() dst() tzinfo dst() dst() datetime time.struct_time MINYEAR MAXYEAR isoweekday() weekday() isocalendar() microsecond utcoffset() microsecond datetime time.ctime() datetime.ctime() strftime() Behavior time tzinfo tzinfo ValueError None time time time time time time time TypeError tzinfo tzinfo tzinfo time TypeError False True time time time time utcoffset() strftime() Behavior tzinfo timedelta tzinfo timedelta tzinfo tzinfo tzinfo tzinfo datetime datetime tzinfo tzinfo datetime time tzinfo tzinfo tzinfo datetime tzinfo utcoffset() timedelta utcoffset() utcoffset() dst() utcoffset() NotImplementedError timedelta utcoffset() utcoffset() dst() datetime.timetuple() tzinfo dst() tzinfo.fromutc() dst() tzinfo datetime tzinfo datetime.astimezone() tzinfo tzinfo.fromutc() dst() dst() NotImplementedError datetime datetime tzinfo tzinfo tzname() NotImplementedError datetime time datetime time tzinfo datetime tzinfo datetime datetime tzinfo tzinfo tzinfo tzinfo datetime.astimezone() fromutc() tzinfo fromutc() fromutc() fromutc() fromutc() tzinfo tzinfo tzinfo.dst() tzinfo tzinfo date datetime time time time date date time datetime calendar setfirstweekday() datetime time datetime Calendar Calendar Calendar firstweekday datetime.date itermonthdates() itermonthdates() datetime.date datetime.date yeardatescalendar() yeardatescalendar() TextCalendar setfirstweekday() formatmonth() setfirstweekday() formatyear() HTMLCalendar None TextCalendar HTMLCalendar True False setfirstweekday() month() TextCalendar calendar() TextCalendar time time.gmtime() timegm() calendar datetime time time collections deque defaultdict namedtuple() defaultdict namedtuple() dict list set tuple bsddb bsddb.btopen() abc PEP 3119 deque append() list IndexError IndexError ValueError deque deque deque defaultdict defaultdict dict dict default_factory dict defaultdict dict default_factory KeyError default_factory default_factory dict defaultdict __missing__() defaultdict list list dict.setdefault() int defaultdict int() int() itertools.repeat() set defaultdict namedtuple() keyword csv sqlite3 getattr() heapq heapify() IndexError heappush() heappop() IndexError heappop() heappush() sorted() min() max() bisect bisect bisect_left() bisect_right() insort_left() insort_right() bisect() bisect() array array() TypeError RuntimeError TypeError EOFError read() fromfile() ValueError fromfile() EOFError read() tofile() ValueError tofile() eval() array() struct xdrlib The Numerical Python Manual http://numpy.sourceforge.net/ http://numpy.sourceforge.net/numdoc/numdoc.pdf sets sets Set ImmutableSet Set ImmutableSet ImmutableSet Set Protocol for automatic conversion to immutable ImmutableSet Protocol for automatic conversion to immutable ImmutableSet ImmutableSet Set ImmutableSet Set ImmutableSet ImmutableSet Set Set ImmutableSet KeyError KeyError set() frozenset() Set ImmutableSet Set ImmutableSet Set Set set set frozenset sets Set ImmutableSet set frozenset repr() sorted() sched sched scheduler scheduler threading.Timer scheduler cancel() enterabs() RuntimeError run() mutex mutex mutex threading mutex lock() mutex unlock() Queue Queue Queue threading heapq Queue Queue Queue Queue LifoQueue PriorityQueue Full Full Empty Empty get() task_done() join() task_done() put() ValueError task_done() weakref weakref WeakKeyDictionary WeakValueDictionary weakref WeakValueDictionary WeakKeyDictionary WeakValueDictionary weakref bsddb list dict None None hash() TypeError object ref() WeakKeyDictionary WeakKeyDictionary WeakKeyDictionary WeakValueDictionary WeakValueDictionary WeakValueDictionary WeakKeyDictionary ReferenceError PEP 0205 None ref WeakValueDictionary ref UserDict DictMixin UserDict dict dict UserDict UserDict UserDict DictMixin UserDict UserDict UserDict Mapping Types --- dict UserDict IterableUserDict UserDict DictMixin UserList list UserList UserList data UserList UserList UserList collections Sequence Types --- str, unicode, list, tuple, buffer, xrange UserList UserList UserList UserString UserString str UserString MutableString MutableString UserString UserString UserString str() UserString collections UserString MutableString String Methods UserString UserString types int() str() types type() type bool bool int long float str unicode tuple list dict compile() len() sys.exit() file xrange() xrange slice() slice buffer() property property new new new new copy pickle dict.copy() pickle copy copy_reg pickle pprint pprint PrettyPrinter set frozenset pprint PrettyPrinter PrettyPrinter PrettyPrinter PrettyPrinter PrettyPrinter eval() PrettyPrinter PrettyPrinter PrettyPrinter eval() PrettyPrinter saferepr() id() format() pprint() repr repr() repr repr repr() Repr repr() repr() repr() Repr maxdict maxarray maxset maxfrozenset set Repr maxstring repr() repr() repr1() repr1() Repr.repr1() Repr numbers math cmath decimal numbers numbers PEP 3141 complex complex bool real imag abs() conjugate() Real Real Complex Real float round() math.floor() math.ceil() divmod() complex() Complex.real Complex.imag Complex.conjugate() Real Rational.numerator Rational.denominator float() Rational int float() Rational.numerator Rational.denominator fractions.Fraction hash() Complex Real Integral Complex Complex NotImplemented Complex complex fractions.Fraction math cmath ValueError fmod() frexp() frexp() modf() ceil() floor() modf() ValueError atan2() math ValueError OverflowError OverflowError ValueError ValueError OverflowError cmath cmath complex phase() complex complex acos() log() log() math cmath decimal decimal float Clamped InvalidOperation DivisionByZero Inexact Rounded Subnormal Overflow Underflow The General Decimal Arithmetic Specification Unofficial IEEE 854 Text getcontext() float getcontext() setcontext() BasicContext ExtendedContext Decimal Decimal Decimal tuple tuple InvalidOperation Decimal float int float long Decimal compare() compare() compare() Decimal Decimal compare_total() True False Decimal True True False True False True False True False True False True False True False True False True False Decimal DivisionByZero logical_and() Logical operands logical_invert() Logical operands logical_or() Logical operands logical_xor() Logical operands max() min() InvalidOperation Decimal to_integral_value() Inexact Rounded Inexact Rounded Decimal getcontext() setcontext() localcontext() Context Inexact Rounded Subnormal Context Context Context None DefaultContext None Context Decimal Context Decimal Etiny Decimal Decimal DivisionByZero DivisionByZero ArithmeticError Inexact Rounded Inexact Subnormal decimal decimal DivisionByZero Overflow InvalidOperation False True InvalidOperation False getcontext() Context setcontext() setcontext() getcontext() getcontext() getcontext() Decimal Inexact Decimal Inexact Context.create_decimal() fractions fractions numbers.Integral Fraction ZeroDivisionError numbers.Rational Fraction Fraction numbers.Rational Fraction Fraction Fraction float Fraction decimal.Decimal Fraction numbers random random() jumpahead() random() seed() getstate() setstate() jumpahead() getrandbits() randrange() getrandbits() random WichmannHill os.urandom() setstate() getstate() setstate() setstate() setstate() seed() jumpahead() long getrandbits() randrange() IndexError random() xrange() normalvariate() whseed() seed() whseed() os.urandom() seed() jumpahead() getstate() setstate() NotImplementedError itertools imap() count() operator The Standard ML Basis Library Definition of Haskell and the Standard Libraries chain() combinations() permutations() imap() izip() groupby() groupby() groupby() groupby() imap() map() map() imap() islice() zip() TypeError izip() izip_longest() izip_longest() islice() takewhile() permutations() product() imap() izip() imap() imap() starmap() starmap() tee() list() tee() functools functools functools reduce() partial partial() partial() int() partial partial partial() partial func partial partial partial partial operator operator cmp() __not__() True False bool invert() __invert__() __contains__() contains() contains() operator isCallable() callable() __getitem__() __getitem__() operator map() sorted() itertools.groupby() __getitem__() __getitem__() itemgetter() operator os.path open() os splitunc() ismount() basename() os.stat() exists() os.lstat() pwd time os.error os.stat_float_times() time os.error os.stat_float_times() time os.error os.error islink() isfile() islink() isdir() normcase() os.curdir os.stat() samefile() sameopenfile() walk() walk() os.walk() os.listdir() fileinput open() input() input() FileInput() IOError fileinput.input() FileInput() FileInput FileInput fileinput.input() RuntimeError FileInput filename() fileno() lineno() filelineno() isfirstline() isstdin() nextfile() close() open() fileinput.input() FileInput gzip bz2 open() codecs.open() FileInput stat stat os.stat() os.fstat() os.lstat() stat os.chmod() os.path os.stat() os.fstat() os.lstat() os.stat() os.fstat() os.lstat() statvfs os.statvfs() statvfs statvfs os.statvfs() os.statvfs() filecmp filecmp difflib filecmp os.stat() os.stat() filecmp.cmp() dircmp dircmp dircmp dircmp os.stat() common_dirs dircmp tempfile NamedTemporaryFile() mkstemp() mkdtemp() mktemp() mkstemp() mkstemp() file TemporaryFile() file TemporaryFile() TemporaryFile() os.O_EXCL os.open() TemporaryFile() mkstemp() mkstemp() mkstemp() os.open() mkdtemp() mkstemp() mkdtemp() mkstemp() mkstemp() mktemp() NamedTemporaryFile() tempdir gettempprefix() mktemp() os.fork() glob glob os.listdir() fnmatch.fnmatch() os.path.expanduser() os.path.expandvars() glob() glob() fnmatch fnmatch re glob glob fnmatch() fnmatchcase() glob linecache linecache traceback linecache PEP 302 getline() shutil shutil os copy() copy2() copy() IOError copy() copy() copystat() copytree() copystat() copy2() copytree() os.listdir() copytree() ignore_patterns() Error Error copystat() os.path.islink() os.listdir() os.remove() os.rmdir() sys.exc_info() OSError copytree() copytree() ignore_patterns() dircache dircache dircache dircache os.listdir() listdir() listdir() macpath os.path os.path File Objects os pickle marshal bsddb pickle pickle marshal pickle cPickle pickle cPickle cPickle pickle Pickler() Unpickler() cPickle cPickle pickle cPickle marshal pickle marshal pickle marshal pickle marshal pickle marshal pickle marshal pickle pickle pickle pickle shelve pickle pickle pickle PEP 307 HIGHEST_PROTOCOL dump() load() pickle pickle HIGHEST_PROTOCOL StringIO StringIO HIGHEST_PROTOCOL pickle Exception dump() AttributeError EOFError ImportError IndexError pickle Pickler Unpickler HIGHEST_PROTOCOL StringIO Pickler clear_memo() cPickle pickle pickle clear_memo() dump() Pickler load() Unpickler dump() load() Unpickler Pickler StringIO Unpickler load() The pickle protocol noload() Unpickler cPickle pickle Unpickler noload() __setstate__() The pickle protocol PicklingError RuntimeError sys.setrecursionlimit() __setstate__() Subclassing Unpicklers __getinitargs__() __getinitargs__() __getnewargs__() __getnewargs__() __getnewargs__() __getstate__() __getstate__() __setstate__() __setstate__() __getstate__() __setstate__() __getstate__() __setstate__() __reduce__() __reduce__() __reduce__() __setstate__() Pickling and unpickling normal class instances __setstate__() __reduce__() __reduce_ex__() __reduce__() __reduce_ex__() __reduce__() __reduce__() __reduce_ex__() object __reduce__() __reduce_ex__() __reduce__() __reduce_ex__() __reduce_ex__() __reduce__() __reduce__() copy_reg __reduce__() pickle pickle pickle cPickle pickle cPickle pickle cPickle pickle cPickle pickle cPickle __setstate__() __getstate__() pickle copy_reg shelve pickle copy marshal cPickle pickle cPickle pickle cPickle pickle cPickle cPickle pickle cPickle pickle cPickle cPickle pickle pickle pickle cPickle Subclassing Unpicklers ImportError AttributeError copy copy_reg pickle copy_reg copy_reg pickle cPickle copy TypeError pickle TypeError pickle shelve pickle anydbm.open() dbm gdbm bsddb dbm dbm Shelf shelve UserDict.DictMixin pickle Shelf next() bsddb bsddb.hashopen() bsddb.btopen() bsddb.rnopen() Shelf Shelf anydbm.open() open() Shelf anydbm bsddb dbhash bsddb open() dbm dumbdbm gdbm pickle shelve cPickle pickle marshal pickle shelve marshal pickle marshal open() os.popen() ValueError load() EOFError ValueError TypeError dump() load() ValueError EOFError ValueError TypeError anydbm anydbm dbm anydbm dbhash bsddb gdbm dbm dumbdbm whichdb anydbm.error anydbm.error open() dbhash dbm dumbdbm gdbm shelve whichdb whichdb whichdb dbm dbm gdbm dbhash dbm dbm dbm KeyError anydbm gdbm whichdb gdbm gdbm dbm gdbm KeyError error nextkey() anydbm whichdb dbhash dbhash dbhash bsddb dbhash KeyError anydbm bsddb whichdb open() next() previous() last() bsddb bsddb bsddb marshal.dumps() pickle.dumps() bsddb http://www.jcea.es/programacion/pybsddb.htm http://www.oracle.com/database/berkeley-db/ bsddb bsddb dbhash bsddb open() bsddb btopen() KeyError hashopen() hashopen() dumbdbm dumbdbm dumbdbm anydbm dumbdbm dumbdbm gdbm bsddb KeyError anydbm dbm gdbm shelve whichdb UserDict.DictMixin sync() sqlite3 PEP 249 Connection Connection Cursor execute() execute() fetchone() fetchall() http://www.pysqlite.org http://www.sqlite.org PEP 249 connect() sqlite3 connect() Cursor.description Connection.isolation_level Connection register_converter() PARSE_DECLTYPES PARSE_COLNAMES sqlite3 Connection Connection connect() SQLite and Python types sqlite3 connect() True False None Controlling Transactions sqlite3.Cursor commit() commit() commit() execute() executemany() executescript() sqlite3 None None sqlite3 None row_factory sqlite3.Row Row unicode sqlite3 str sqlite3 execute() executescript() sqlite3 None fetchmany() Cursor sqlite3 rowcount executemany() rowcount rowcount execute() executemany() lastrowid None None Row row_factory Connection len() Row Cursor.description Row None int long float str unicode buffer None int long float text_factory unicode buffer sqlite3 sqlite3 sqlite3 PEP 246 sqlite3 register_adapter() object sqlite3 datetime.date datetime.datetime datetime.datetime sqlite3 Module functions and constants PARSE_DECLTYPES PARSE_COLNAMES datetime.date datetime.datetime sqlite3 sqlite3 connect() Connection Cursor Cursor Connection sqlite3 sqlite3.Row zlib http://www.zlib.net http://www.zlib.net/manual.html gzip bz2 zipfile tarfile error error compress() flush() compress() decompress() unused_data decompress() decompress() decompress() unconsumed_tail decompress() unconsumed_tail flush() decompress() gzip http://www.zlib.net http://www.zlib.net/manual.html gzip gzip GzipFile GzipFile bz2 zipfile tarfile GzipFile GzipFile zlib bz2 gzip zipfile tarfile BZ2File BZ2File BZ2File BZ2File BZ2Compressor BZ2Decompressor compress() decompress() BZ2File file close() BZ2File file close() BZ2Compressor BZ2Decompressor compress() flush() decompress() EOFError compress() decompress() BZ2Compressor BZ2Decompressor zipfile PKZIP Application Note ZipInfo Objects bz2 gzip tarfile ZipFile Objects ZipFile zipfile ZipInfo Objects PKZIP Application Note Info-ZIP Home Page ZIP_STORED ZIP_DEFLATED RuntimeError ZIP_DEFLATED zlib RuntimeError ZIP_STORED zipfile close() ZipInfo getinfo() KeyError ZipInfo ZipInfo open() RuntimeError read() next() open() open() open() open() read() extract() ZipInfo ZipInfo ZipInfo namelist() ZipInfo setpassword() read() RuntimeError ZipInfo testzip() RuntimeError write() RuntimeError write() RuntimeError write() ZipInfo writestr() RuntimeError writestr() RuntimeError ZipInfo ZipInfo ZipInfo ZIP_STORED ZipFile ZipFile.close() PyZipFile ZipFile ZipFile RuntimeError writepy() ZipInfo ZipFile PKZIP Application Note tarfile tarfile zipfile gzip bz2 TarFile TarFile TarFile Objects ReadError CompressionError tarfile.open() TarFile TarFile Examples tarfile.open() TarFile Objects True tarfile zipfile zipfile gzip TarFileCompat tarfile tarfile TarFile TarFile.extract() TarInfo.frombuf() tarfile Supported tar formats GNU_FORMAT sys.getfilesystemencoding() sys.getdefaultencoding() zipfile zipfile GNU tar manual, Basic Tar Format TarFile TarInfo TarInfo Objects TarFile USTAR_FORMAT GNU_FORMAT PAX_FORMAT TarInfo False True False True TarFile.extract() OSError IOError TarError Unicode issues PAX_FORMAT tarfile.open() TarInfo KeyError TarInfo getmembers() False True TarInfo TarFile None getmembers() TarInfo extract() extractall() extractall() TarInfo None False True False TarInfo TarInfo gettarinfo() TarInfo os.fstat() TarInfo addfile() TarFile True USTAR_FORMAT False GNU_FORMAT False TarInfo TarFile TarInfo TarFile TarInfo TarInfo HeaderError TarFile TarInfo TarInfo TarFile TarInfo TarInfo TarInfo True isfile() True True True True True True True TarFile.extractall() tarfile USTAR_FORMAT GNU_FORMAT tarfile PAX_FORMAT TarFile sys.getfilesystemencoding() sys.getdefaultencoding() PAX_FORMAT Codec Base Classes csv csv csv reader writer DictReader DictWriter csv Examples PEP 305 csv next() Dialect list_dialects() Dialects and Formatting Parameters Dialect list_dialects() Dialects and Formatting Parameters None str() Dialect Dialects and Formatting Parameters Error Error Dialect csv reader ValueError writer DictReader DictWriter dict Dialect reader writer excel excel_tab Sniffer Sniffer Dialect True Sniffer csv writer writer writer writer Error reader csv Dialect reader writer Dialect Dialect True False True False Error QUOTE_NONE False None writer reader Module Contents QUOTE_MINIMAL True False DictReader reader() DictWriter writer() str() DictWriter csv csv.reader ConfigParser ConfigParser ConfigParser ConfigParser RFC 822 ConfigParser ConfigParser RawConfigParser get() items() ConfigParser MAX_INTERPOLATION_DEPTH InterpolationError InterpolationError InterpolationError ConfigParser shlex RawConfigParser DuplicateSectionError ValueError True False ConfigParser readfp() read() ValueError NoSectionError RawConfigParser ConfigParser read() NoSectionError True False str() ConfigParser RawConfigParser get() SafeConfigParser ConfigParser NoSectionError str unicode TypeError ConfigParser SafeConfigParser robotparser robotparser RobotFileParser http://www.robotstxt.org/orig.html netrc netrc netrc NetrcParseError netrc netrc netrc xdrlib xdrlib RFC 1014 xdrlib Packer Packer RFC 1014 RFC 1832 RFC 1832 Packer pack_fstring() pack_fstring() pack_string() pack_string() ValueError pack_farray() Unpacker get_position() set_position() Error Packer Unpacker unpack_float() unpack_fstring() unpack_fstring() unpack_string() unpack_string() unpack_farray() Error Error plistlib Data datetime.datetime Data Data xml.parsers.expat TypeError hashlib RFC 1321 zlib update() digest_size digest() hmac base64 http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf http://www.cryptography.com/cnews/hash.html hmac RFC 2104 update() digest() hashlib md5 hashlib RFC 1321 new() new() new() update() digest() sha sha hashlib md5 new() new() update() digest() Secure Hash Standard Secure Hash Standard Cryptographic Toolkit (Secure Hashing) http://www.amk.ca/python/code/crypto.html os open() os.path fileinput tempfile shutil os OSError OSError os.path os putenv() putenv() putenv() putenv() unsetenv() unsetenv() Files and Directories os.system() popen() fork() execv() putenv() putenv() putenv() ValueError socket.gethostname() os.system() popen() fork() execv() unsetenv() unsetenv() unsetenv() open() open() ValueError open() wait() close() subprocess Replacing Older Functions with the subprocess Module subprocess os.spawnv() os.system() subprocess Flow Control Issues subprocess Replacing Older Functions with the subprocess Module subprocess Replacing Older Functions with the subprocess Module subprocess Replacing Older Functions with the subprocess Module popen2 open() pipe() open() popen() fdopen() close() chmod() ValueError OSError errno.EINVAL stat() statvfs() SEEK_SET SEEK_CUR os.SEEK_END O_RDONLY O_WRONLY open() read() write() fdopen() pty open() pipe() open() popen() fdopen() sys.stdin read() open() open() open() pipe() open() popen() fdopen() sys.stdout sys.stderr write() open() open() open() open() open() lseek() F_OK R_OK W_OK X_OK True False access() open() access() access() access() access() access() stat stat chmod() chflags() chmod() stat() stat() os.unlink() mkfifo() stat os.makedev() tempfile tempfile.mkdtemp() mkdir() error makedirs() os.pardir ValueError OSError errno.EINVAL pathconf() fpathconf() OSError rmdir() unlink() rmdir() removedirs() OSError OSError OSError rename() removedirs() stat_float_times() stat_float_times() stat() stat stat() statvfs tempnam() tempnam() tmpfile() File Object Creation tmpnam() tmpnam() tmpfile() File Object Creation tmpnam() tmpnam() remove() unlink() stat() stat() walk() walk() walk() listdir() OSError walk() walk() walk() walk() rmdir() signal.signal() OSError os.fsync() execlp() execlpe() execvp() execvpe() execl() execle() execv() execve() execle() execlpe() execve() execvpe() execl() execlp() execv() execvp() _exit() fork() _exit() OSError pty OSError signal File Object Creation subprocess P_NOWAIT P_WAIT waitpid() spawnlp() spawnlpe() spawnvp() spawnvpe() spawnl() spawnle() spawnv() spawnve() spawnle() spawnlpe() spawnve() spawnvpe() spawnl() spawnlp() spawnv() spawnvp() spawnlp() spawnvpe() spawnlp() spawnlpe() spawnvp() spawnvpe() P_DETACH P_NOWAIT P_OVERLAY startfile() os.path.normpath() os.environ sys.stdin wait() subprocess subprocess Replacing Older Functions with the subprocess Module wait() waitpid() OSError P_NOWAIT waitpid() resource waitpid() wait4() waitpid() resource wait4() waitpid() waitpid() system() wait() waitpid() ValueError OSError errno.EINVAL confstr() OSError confstr() sysconf() os.path os.path os.path os.path.split() os.path.join() os.path os.path os.path os.path os.path os.path NotImplementedError io io open() IOBase IOError IOBase RawIOBase FileIO RawIOBase BufferedIOBase RawIOBase BufferedWriter BufferedReader BufferedRWPair BufferedRandom BytesIO IOBase TextIOBase TextIOWrapper BufferedIOBase StringIO open() open() os.stat() IOError os.fdopen() codecs ValueError codecs.register_error() os.linesep open() open() TextIOWrapper BufferedReader BufferedWriter BufferedRandom StringIO BytesIO IOError IOError BlockingIOError IOError ValueError IOBase IOError str IOError IOBase IOBase IOError IOError open() seek() tell() truncate() IOError tell() truncate() IOError IOBase IOBase IOError FileIO RawIOBase IOBase IOBase RawIOBase FileIO len() FileIO IOBase RawIOBase read() readinto() read() readinto() write() BlockingIOError RawIOBase BufferedWriter BufferedReader BufferedIOBase IOBase BlockingIOError read() BlockingIOError IOError BlockingIOError BufferedIOBase BytesIO BufferedIOBase IOBase BytesIO RawIOBase BufferedIOBase BufferedReader DEFAULT_BUFFER_SIZE BufferedReader BufferedIOBase IOBase BufferedIOBase BufferedWriter BufferedWriter BufferedIOBase IOBase BlockingIOError BlockingIOError BufferedIOBase RawIOBase DEFAULT_BUFFER_SIZE BufferedRWPair BufferedIOBase BufferedReader BufferedWriter DEFAULT_BUFFER_SIZE BufferedRandom BufferedReader BufferedWriter IOBase TextIOBase IOBase str BufferedIOBase TextIOBase locale.getpreferredencoding() ValueError codecs.register_error() os.linesep TextIOWrapper TextIOBase TextIOWrapper TextIOWrapper StringIO TextIOWrapper codecs.IncrementalDecoder time datetime calendar struct_time time() sleep() time() sleep() gmtime() localtime() strptime() asctime() mktime() strftime() gmtime() localtime() strptime() strftime() mktime() struct_time TypeError struct_time struct_time gmtime() localtime() localtime() asctime() None time() ctime() None struct_time None time() struct_time calendar.timegm() None gmtime() None time() None localtime() struct_time time() OverflowError ValueError sleep() struct_time gmtime() localtime() localtime() ValueError ValueError strftime() strptime() strptime() RFC 2822 RFC 822 RFC 2822 RFC 822 struct_time gmtime() localtime() strftime() ctime() ValueError gmtime() localtime() strptime() localtime() tzset() datetime locale time calendar gmtime() optparse getopt optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse type help optparse optparse Extending optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse Extending optparse optparse optparse optparse Reference Guide Option Callbacks optparse optparse optparse help optparse optparse optparse optparse optparse optparse optparse optparse str() optparse optparse optparse optparse TypeError optparse optparse optparse optparse exit() optparse optparse optparse optparse Conflicts between options optparse optparse optparse Tutorial optparse optparse optparse optparse help type optparse optparse optparse type optparse type type type type optparse optparse optparse optparse type optparse type optparse optparse type Option Callbacks help help help optparse help optparse optparse help optparse optparse optparse type optparse optparse type optparse Option Callbacks help help Tutorial optparse Extending optparse optparse optparse ValueError optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse type optparse type optparse optparse type optparse type type optparse optparse type optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse optparse type optparse optparse optparse getattr() getopt optparse GetoptError getopt() getopt() GetoptError error GetoptError optparse logging debug() info() warning() error() critical() log() basicConfig() basicConfig() RotatingFileHandler Logger.setLevel() Logger.addFilter() Logger.removeFilter() Logger.debug() Logger.info() Logger.warning() Logger.error() Logger.critical() Logger.exception() Logger.error() Logger.exception() Logger.log() getLogger() getLogger() StreamHandler FileHandler Handler.setLevel() Formatter Objects LogRecord LogRecord LogRecord LogRecord StreamHandler FileHandler RotatingFileHandler TimedRotatingFileHandler RotatingFileHandler TimedRotatingFileHandler SocketHandler DatagramHandler SMTPHandler SysLogHandler NTEventLogHandler MemoryHandler HTTPHandler StreamHandler FileHandler Formatter Filter Filter setLoggerClass() sys.exc_info() sys.exc_info() Formatter Formatter Formatter debug() debug() debug() debug() debug() debug() Formatter addLevelName() LogRecord LogRecord LogRecord StreamHandler Formatter debug() info() warning() error() critical() basicConfig() basicConfig() PEP 282 Original Python logging package logging logging getEffectiveLevel() setLevel() sys.exc_info() sys.exc_info() Formatter Formatter Formatter debug() debug() debug() debug() debug() debug() filter() LogRecord basicConfig() logging basicConfig() String Formatting Operations Formatter LogRecord time basicConfig() LoggerAdapter debug() info() warning() error() exception() critical() log() LoggerAdapter LoggerAdapter LoggerAdapter LoggerAdapter LogRecord Formatter LoggerAdapter LoggerAdapter SocketHandler SocketServer Handler.__init__() createLock() createLock() acquire() Formatter shutdown() close() emit() NotImplementedError StreamHandler logging StreamHandler traceback.print_exception() flush() flush() FileHandler logging StreamHandler FileHandler emit() WatchedFileHandler FileHandler WatchedFileHandler emit() RotatingFileHandler RotatingFileHandler emit() TimedRotatingFileHandler TimedRotatingFileHandler SocketHandler SocketHandler LogRecord makeLogRecord() emit() socket.SOCK_STREAM DatagramHandler SocketHandler DatagramHandler LogRecord makeLogRecord() SocketHandler socket.SOCK_DGRAM SysLogHandler SysLogHandler NTEventLogHandler NTEventLogHandler SMTPHandler SMTPHandler MemoryHandler MemoryHandler BufferingHandler shouldFlush() flush() MemoryHandler setTarget() flush() None MemoryHandler HTTPHandler HTTPHandler Formatter LogRecord Formatter LogRecord LogRecord String Formatting Operations LogRecord LogRecord time.time() LogRecord LogRecord Formatter formatTime() formatException() Formatter format() time.strftime() sys.exc_info() traceback.print_exception() Filter Filter LogRecord LogRecord sys.exc_info() None LogRecord LoggerAdapter adding contextual information to your logging output LoggerAdapter LoggerAdapter debug() info() warning() error() exception() critical() log() logging logging fileConfig() stopListening() listen() listen() fileConfig() eval() eval() eval() Formatter Formatter getpass getpass GetPassWarning UserWarning pwd curses curses locale.setlocale() str.encode() curses.ascii curses.panel curses.textpad curses.wrapper curses curses raw() cbreak() pair_number() reset_prog_mode() reset_shell_mode() doupdate() doupdate() doupdate() filter() initscr() beep() nocbreak() init_color() can_change_color() endwin() initscr() noqiflush() color_pair() noqiflush() def_prog_mode() def_shell_mode() initscr() start_color() curses initscr() initscr() newwin() ord() border() touchline() erase() refresh() refresh() clrtoeol() derwin() subwin() refresh() getch() curses refresh() instr() refresh() curses.error refresh() curses getch() doupdate() overlay() overwrite() getwin() refresh() refresh() newpad() idlok() refresh() syncup() getch() getch() refresh() curses ERR napms() OK initscr() curses.textpad curses.textpad Textbox curses.textpad Textbox stripspaces Textbox stripspaces stripspaces curses.wrapper wrapper() wrapper() wrapper() wrapper() curses.ascii curses.ascii ord() string curses.panel curses.panel curses.doupdate() new_panel() platform system_alias() machine() os.uname() popen() http://www.rgaros.nl/gestalt/ linux_distribution() errno os.strerror() ctypes c_int c_long c_long c_int HRESULT c_char c_wchar c_byte c_ubyte c_short c_ushort c_int c_uint c_long c_ulong c_longlong c_ulonglong c_float c_double c_longdouble c_char_p c_wchar_p c_void_p c_char_p c_wchar_p c_void_p GetLastError() byref() byref() Structure Union c_int c_int c_int HRESULT HRESULT WinDLL OleDLL CDLL GetLastError() LibraryLoader CDLL PyDLL WinDLL OleDLL CDLL WinDLL OleDLL PyDLL PyDLL restype errcheck argtypes c_char_p argtypes restype WINFUNCTYPE() CFUNCTYPE() c_char c_wchar FormatError() _objects _b_base_ c_char_p c_char_p c_void_p c_double c_long c_byte c_short c_int c_longlong c_ulong c_ubyte c_ushort c_uint c_ulonglong HRESULT _fields_ c_int _fields_ _fields_ _fields_ _fields_ _fields_ _pack_ _fields_ _fields_ Pointers Arrays select Edge and Level Trigger Polling (epoll) Objects Polling Objects Kqueue Objects Kevent Objects open() os.popen() socket.socket() http://linux.die.net/man/4/epoll poll() IOError register() KeyError None http://www.freebsd.org/cgi/man.cgi?query=kqueue&sektion=2 threading thread mutex Queue dummy_threading threading thread multiprocessing Thread enumerate() Thread threading Thread current_thread() set() local ValueError threading sys.settrace() threading sys.setprofile() ValueError Thread run() run() run() join() join() isAlive() join() join() join() join() RuntimeError join() name thread.get_ident() start() run() enumerate() daemon start() RuntimeError thread RuntimeError RuntimeError RuntimeError Lock RLock RLock RuntimeError notify() notifyAll() RLock release() RLock RuntimeError wait() notify() notify() RuntimeError ValueError release() acquire() release() Semaphore set() wait() wait() set() set() Timer Thread Lock RLock Condition Semaphore BoundedSemaphore thread thread threading threading thread dummy_thread KeyboardInterrupt SystemExit error ValueError KeyboardInterrupt signal sys.exit() SystemExit exit() time.sleep() file.read() select.select() KeyboardInterrupt dummy_threading threading threading thread dummy_thread thread dummy_thread dummy_threading thread thread multiprocessing multiprocessing threading multiprocessing multiprocessing ImportError issue 3770 Process multiprocessing Process start() Process threading.Thread Programming guidelines multiprocessing Queue Queue.Queue Pipe() Pipe() send() recv() multiprocessing threading multiprocessing Array array multiprocessing.sharedctypes list dict Lock RLock Semaphore BoundedSemaphore Condition Event Queue Array multiprocessing threading Process Process threading.Thread threading.Thread run() run() run() join() start() start() Process multiprocessing Process authkey Authentication keys start() join() is_alive() Process Connection.recv_bytes_into() BufferTooShort Pipe() Queue JoinableQueue Queue.Queue Queue task_done() join() Queue.Queue JoinableQueue JoinableQueue.task_done() Managers multiprocessing Queue.Empty Queue.Full multiprocessing Queue Process.terminate() os.kill() Queue Programming guidelines Examples Connection Queue.Empty Queue.Full Queue Queue Queue.Queue task_done() join() NotImplementedError Queue.Full Queue.Full Queue.Empty Queue.Empty multiprocessing.Queue Queue.Queue close() cancel_join_thread() join_thread() join_thread() join_thread() JoinableQueue Queue task_done() join() get() task_done() task_done() put() ValueError task_done() NotImplementedError Process threading.current_thread() multiprocessing RuntimeError freeze_support() sys.executable multiprocessing threading.active_count() threading.enumerate() threading.settrace() threading.setprofile() threading.Timer threading.local Pipe() Listeners and Clients recv() send() EOFError EOFError IOError EOFError BufferTooShort Connection.recv() Pipe() recv() send() Authentication keys threading Managers threading.BoundedSemaphore Semaphore threading.Condition Lock RLock multiprocessing threading.Event threading.Lock threading.RLock threading.Semaphore BoundedSemaphore Lock RLock Semaphore threading KeyboardInterrupt threading ctypes ctypes array Lock RLock array Lock RLock ctypes.c_char multiprocessing.sharedctypes multiprocessing.sharedctypes ctypes array Array() array Value() ctypes.c_char ctypes RawArray() RawValue() multiprocessing.RLock ctypes.Structure SyncManager multiprocessing.managers start() serve_forever() start() from_address() BaseProxy BaseManager BaseManager threading.BoundedSemaphore threading.Condition threading.Lock threading.RLock threading.Event threading.Lock Namespace Queue.Queue threading.RLock threading.Semaphore BaseManager str() repr() multiprocessing BaseProxy BaseManager.register() _call_method() _call_method() _call_method() apply() apply() map() map() itertools.imap() map() next() imap() imap() terminate() close() terminate() join() AssertionError multiprocessing.connection hmac AuthenticationError AuthenticationError Connection Address Formats AuthenticationError Authentication keys Address Formats tempfile.mkstemp() AuthenticationError Authentication keys AuthenticationError Client() Listener Client() hmac Process Process os.urandom() logging multiprocessing sys.stderr multiprocessing.dummy multiprocessing.dummy multiprocessing threading multiprocessing threading multiprocessing os.fork() RuntimeError multiprocessing threading mmap re seek() mmap os.open() TypeError mmap mmap TypeError TypeError TypeError TypeError readline readline rlcompleter raw_input() input() readline write_history_file() get_history_length() rlcompleter readline code.InteractiveConsole rlcompleter rlcompleter readline readline readline rlcompleter readline __main__ __builtin__ keyword dir() None signal subprocess subprocess subprocess subprocess PEP 324 Popen os.execvp() Popen True True stdout stdin stderr OSError OSError ValueError Popen Popen returncode returncode communicate() communicate() terminate() kill() terminate() poll() wait() communicate() OSError socket RFC 3493 socket() AF_UNIX AF_INET AF_INET6 socket socket.error socket os.error errno socket.error IOError gethostbyname_ex() gethostbyaddr() getaddrinfo() getnameinfo() socket() AF_UNIX socket() SOCK_STREAM SOCK_DGRAM getdefaulttimeout() getaddrinfo() socket() socket gethostbyaddr() gethostname() gethostbyname_ex() gethostbyname() getaddrinfo() gethostbyname_ex() getaddrinfo() gethostname() getfqdn() gethostbyaddr() socket() SOCK_RAW AF_INET AF_INET6 AF_UNIX SOCK_STREAM SOCK_DGRAM socket() AF_UNIX AF_INET socket() socket.error inet_aton() getnameinfo() socket.error inet_ntoa() getnameinfo() inet_pton() inet_aton() AF_INET AF_INET6 socket.error inet_ntop() inet_ntoa() AF_INET AF_INET6 ValueError socket.error inet_ntop() SocketServer AF_INET AF_INET AF_INET select.select() os.fdopen() struct ioctl() File Objects file() recv() recv() send() recv() recv() send() error timeout setblocking() settimeout() socket struct socket socket() socket() ssl socket.socket socket.error IOError socket.socket socket.socket wrap_socket() SSLError Certificates CERT_NONE CERT_OPTIONAL CERT_REQUIRED CERT_NONE Certificates SSLSocket.do_handshake() SSLSocket.do_handshake() SSLSocket.read() True False ssl.RAND_egd() ssl.RAND_add() http://egd.sourceforge.net/ http://prngd.sourceforge.net/ RFC 1750 wrap_socket() False dict RFC 3280 True None CERT_OPTIONAL CERT_REQUIRED CERT_NONE SSLError RFC 1422 CACert.org Thawte Verisign Positive SSL Equifax and GeoTrust RFC 4158 wrap_socket() socket.socket socket Introducing SSL and Certificates using OpenSSL RFC 1422: Privacy Enhancement for Internet Electronic Mail: Part II: Certificate-Based Key Management RFC 1750: Randomness Recommendations for Security RFC 3280: Internet X.509 Public Key Infrastructure Certificate and CRL Profile signal KeyboardInterrupt signal() alarm() getsignal() pause() setitimer() getitimer() signal signal signal setitimer() getitimer() setitimer() IOError signal signal.SIG_IGN signal.SIG_DFL None signal.SIG_IGN signal.SIG_DFL signal.ITIMER_REAL signal.ITIMER_VIRTUAL signal.ITIMER_PROF alarm() signal.ITIMER_REAL signal.ITIMER_VIRTUAL signal.ITIMER_PROF ItimerError ValueError False signal() signal.SIG_IGN signal.SIG_DFL getsignal() ValueError inspect alarm() os.open() popen2 subprocess Replacing Older Functions with the subprocess Module subprocess subprocess popen2 os.spawnv() os.system() Popen3 Popen4 popen2() popen3() popen4() os os popen2 Popen3 popen2() popen3() Popen3 Popen3 popen4() Popen3 Popen4 wait() os Process Management Popen4 Popen4 os os.close() subprocess asyncore asyncore asynchat asyncore.dispatcher asynchat.async_chat loop() loop() asyncore.dispatcher asynchat.async_chat dispatcher readable() writable() connect() socket dispatcher file_wrapper os.dup() file_dispatcher dispatcher asynchat asyncore asynchat async_chat asyncore asyncore.dispatcher asynchat.async_chat asyncore.dispatcher asynchat.async_chat asyncore.dispatcher async_chat collect_incoming_data() found_terminator() asyncore.dispatcher asyncore.dispatcher async_chat async_chat asyncore.dispatcher async_chat async_chat handle_write() set_terminator() async_chat collect_incoming_data() found_terminator() NotImplementedError _get_data() found_terminator() set_terminator() NotImplementedError _collect_incoming_data() set_terminator() handle_read() found_terminator() collect_incoming_data() refill_buffer() simple_producer found_terminator() found_terminator() found_terminator() simple_producer more() fifo fifo push() asynchat async_chat email email RFC 2822 rfc822 mimetools multifile RFC 2821 smtplib nntplib email RFC 2822 RFC 2045 RFC 2046 RFC 2047 RFC 2231 email email email email email email email email email Message email.message email Message Message RFC 2822 Message Message Message Message is_multipart() Message Message set_payload() Message is_multipart() is_multipart() get_payload() is_multipart() IndexError is_multipart() TypeError set_charset() email.charset TypeError RFC 2822 keys() Message KeyError get_all() __getitem__() __setitem__() KeyError get_default_type() RFC 2045 get_content_type() RFC 2045 RFC 2045 get_content_type() get_content_type() get_param() RFC 2231 RFC 2231 get_param() RFC 2045 RFC 2231 ValueError set_boundary() add_header() set_boundary() get_charset() walk() walk() Message email.parser email.generator email.errors email email Parser FeedParser Parser FeedParser FeedParser email FeedParser FeedParser Parser FeedParser FeedParser email.errors FeedParser FeedParser email.message.Message FeedParser FeedParser FeedParser FeedParser Parser email.parser email.parser Parser Parser email.message Parser FeedParser Parser Parser RFC 2822 parse() parse() parse() email email.errors email smtplib nntplib Generator email.parser Generator email.generator Generator write() WHY THE CONTENT-LENGTH FORMAT IS BAD RFC 2822 Generator Generator RFC 2822 Generator Generator Generator email.message email.generator DecodedGenerator Generator Generator Generator email email MIMEBase MIMEBase MIMEBase MIMEBase MIMEBase MIMENonMultipart MIMEApplication MIMEApplication email.encoders MIMENonMultipart MIMEAudio sndhdr TypeError MIMEAudio email.encoders MIMENonMultipart MIMEImage imghdr TypeError MIMEImage email.encoders MIMEBase MIMENonMultipart MIMEMessage TypeError MIMENonMultipart MIMEText MIMENonMultipart email RFC 2822 RFC 822 RFC 2822 RFC 2822 RFC 2045 RFC 2046 RFC 2047 RFC 2231 email email.header email.charset Header Header Header email.header Header RFC 2047 Header append() append() append() append() append() RFC 2822 append() email.charset UnicodeError RFC 2822 RFC 2047 UnicodeError unicode() RFC 2822 RFC 2047 Header Header.encode() unicode() Header Header email.header Header decode_header() decode_header() Header Header email Charset Charset email email.charset Charset Charset email.header header_encode() Charset __str__() Charset Charset email.charset Charset.convert() add_codec() codecs unicode() email email encode_quopri() email email.errors email Exception MessageError RFC 2822 MessageParseError RFC 2822 RFC 2822 RFC 2822 MessageParseError MultipartConversionError MessageError TypeError email email.utils parseaddr() RFC 2822 parsedate() RFC 2822 parsedate() time.mktime() parsedate() time.mktime() RFC 2822 parsedate_tz() mktime_tz() RFC 2822 time.gmtime() time.localtime() RFC 2822 RFC 2231 RFC 2231 RFC 2231 collapse_rfc2231_value() unicode() RFC 2231 collapse_rfc2231_value() RFC 2231 formataddr() email email.iterators typed_subpart_iterator() email email smtplib nntplib email PEP 8 email.message email.mime email.mime RFC 2231 email DeprecationWarning DeprecationWarning email email email email email.message_from_file() email.message_from_string() email mimelib email email email email message_from_string() message_from_file() email.generator email.iterators RFC 1894 email.generator rfc822 email.utils email.iterators json http://json.org json marshal pickle JSONEncoder str unicode int long float bool TypeError unicode str unicode unicode codecs.getwriter() OverflowError ValueError float TypeError TypeError str unicode dump() str unicode unicode dict decimal.Decimal float str unicode str unicode default() TypeError TypeError str OverflowError ValueError TypeError TypeError mailcap RFC 1524 os.system() RFC 1524 findmatch() findmatch() mailbox Mailbox Message Mailbox Message Message email Mailbox Mailbox Mailbox Mailbox Mailbox Mailbox Mailbox add() remove() discard() Mailbox Message Mailbox Mailbox Mailbox KeyError lock() unlock() Mailbox Message Message mboxMessage mbox KeyError remove() __delitem__() discard() discard() KeyError add() Message Message mboxMessage mbox iterkeys() keys() itervalues() __iter__() values() Message Mailbox __iter__() iteritems() items() Message Mailbox get() KeyError __getitem__() Message Mailbox Message KeyError KeyError KeyError Mailbox KeyError Message Mailbox KeyError Message Mailbox __setitem__() __setitem__() KeyError Mailbox Mailbox flush() ExternalClashError Mailbox Maildir Mailbox MaildirMessage rfc822.Message Maildir Mailbox Maildir Maildir Mailbox Maildir NoSuchMailboxError Maildir NotEmptyError Mailbox Maildir Maildir maildir man page from qmail Using maildir format maildir man page from Courier mbox Mailbox mboxMessage mbox Mailbox mbox mbox mbox man page from qmail mbox man page from tin Configuring Netscape Mail on Unix: Why The Content-Length Format is Bad "mbox" is a family of several mutually incompatible mailbox formats MH Mailbox MHMessage MH MH Mailbox MH NoSuchMailboxError MH NotEmptyError get_sequences() Mailbox MH MH unlock() nmh - Message Handling System MH & nmh: Email for Users & Programmers Babyl Mailbox BabylMessage Babyl Mailbox Mailbox Babyl StringIO Format of Version 5 Babyl Files Reading Mail with Rmail MMDF Mailbox MMDFMessage Mailbox MMDF MMDF mmdf man page from tin MMDF Message Message mailbox.Message Message RFC 2822 Message Mailbox Message Mailbox Mailbox MaildirMessage Message MaildirMessage MaildirMessage mboxMessage MMDFMessage mboxMessage MMDFMessage MaildirMessage MHMessage MHMessage MaildirMessage BabylMessage BabylMessage mboxMessage Message mboxMessage time.strftime() time.gmtime() mboxMessage MaildirMessage MaildirMessage MaildirMessage mboxMessage MHMessage MHMessage mboxMessage BabylMessage BabylMessage Message MMDFMessage MMDFMessage MHMessage Message MHMessage MHMessage MaildirMessage MaildirMessage MHMessage mboxMessage MMDFMessage mboxMessage MMDFMessage MHMessage BabylMessage BabylMessage BabylMessage Message BabylMessage BabylMessage Message Message BabylMessage BabylMessage MaildirMessage MaildirMessage BabylMessage mboxMessage MMDFMessage mboxMessage MMDFMessage BabylMessage MHMessage MHMessage MMDFMessage Message MMDFMessage mboxMessage time.strftime() time.gmtime() MMDFMessage MaildirMessage MaildirMessage MaildirMessage MMDFMessage MHMessage MHMessage MMDFMessage BabylMessage BabylMessage MMDFMessage mboxMessage mboxMessage mailbox Mailbox MH mailbox rfc822.Message rfc822 Maildir Maildir next() next() rfc822.Message rfc822 UnixMailbox PortableUnixMailbox UnixMailbox UnixMailbox UnixMailbox UnixMailbox BabylMailbox UnixMailbox email rfc822 mhlib mhlib mailbox mhlib MH Folder Message MH Folder Message mimetools.Message MH Folder Message mimetools.Message mimetools email mimetools rfc822 Message Message rfc822.Message rfc822.Message decode() email mimetools rfc822 mimetools.Message multifile http://faqs.cs.uu.nl/na-dir/mail/mime-faq/.html Message rfc822.Message getplist() getplist() mimetypes mimetypes init() init() registered with IANA guess_type() guess_type() guess_type() guess_type() knownfiles knownfiles init() init() MimeTypes read() readfp() MimeTypes mimetypes guess_extension() guess_type() readfp() MimeWriter email MimeWriter MimeWriter MimeWriter MimeWriter MimeWriter MimeWriter addheader() startbody() nextpart() MimeWriter startmultipartbody() nextpart() mimify email mimify mimify MAXLEN CHARSET quopri multifile email multifile MultiFile MultiFile open() MultiFile readline() seek() tell() MultiFile seek() tell() MultiFile email multifile MultiFile RFC 2045 pop() next() MultiFile MultiFile rfc822 email rfc822 Message RFC 2822 RFC 822 RFC 2822 RFC 822 RFC 2822 RFC 822 AddressList RFC 2822 RFC 2822 mailbox Message rewindbody() Message AddressList RFC 2822 parseaddr() RFC 2822 parsedate() RFC 2822 parsedate() time.mktime() parsedate() time.mktime() RFC 2822 parsedate_tz() email rfc822 mailbox mimetools rfc822.Message Message RFC 2822 getheader() getheader() time.mktime() getheader() time.mktime() getdate() Message KeyError Message Message Message AddressList host at domain AddressList AddressList __add__() AddressList AddressList AddressList __sub__() AddressList base64 RFC 3548 TypeError RFC 3548 TypeError TypeError encode() encodestring() binascii RFC 1521 binhex binhex binascii hexbin() binascii binascii uu base64 binhex binascii binascii Incomplete b2a_hex() TypeError base64 binhex uu quopri quopri RFC 1521 base64 RFC 1522 RFC 1521 decode() encode() encode() mimify base64 uu uu uu.Error decode() Exception uu.decode() binascii xml.parsers.expat PyXML add-on package xml.dom xml.sax HTMLParser HTMLParser HTMLParser htmllib sgmllib HTMLParser HTMLParser HTMLParser htmllib HTMLParser HTMLParser close() HTMLParser close() htmlentitydefs handle_starttag() handle_starttag() handle_endtag() HTMLParser HTMLParser sgmllib sgmllib SGMLParser htmllib HTMLParser SGMLParser SGMLParser SGMLParser close() close() convert_charref() handle_data() convert_charref() convert_codepoint() handle_charref() str sgmllib convert_entityref() handle_data() convert_entityref() str handle_entityref() handle_charref() handle_starttag() handle_starttag() htmllib htmllib HTMLParser sgmllib HTMLParser RFC 1866 formatter sgmllib.SGMLParser http://www.w3.org/TR/xhtml1 HTMLParser formatter HTMLParser htmlentitydefs sgmllib HTMLParser HTMLParser save_end() anchor_bgn() save_end() save_bgn() save_end() save_bgn() nofill save_bgn() TypeError htmlentitydefs htmlentitydefs htmllib entitydefs xml.parsers.expat xml.parsers.expat ExpatError Exceptions ExpatError ParserCreate() xml.parsers.expat http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl http://www.iana.org/assignments/character-sets ValueError The Expat XML Parser ExternalEntityRefHandler() NotationDeclHandler() UnparsedEntityDeclHandler() SetBase() SetBase() ExternalEntityRefHandler() ordered_attributes returns_unicode specified_attributes ExternalEntityRefHandler None ExternalEntityRefHandler StartDoctypeDeclHandler EndDoctypeDeclHandler Parse() ParseFile() ExpatError buffer_text CharacterDataHandler() buffer_text buffer_text returns_unicode False True xml.parsers.expat.ExpatError ErrorString() returns_unicode StartCdataSectionHandler EndCdataSectionHandler ElementDeclHandler EntityDeclHandler StartElementHandler StartNamespaceDeclHandler EndElementHandler EndCdataSectionHandler DefaultHandler() SetBase() DefaultHandler ExpatError xml.parsers.expat xml.parsers.expat ExpatError xml.parsers.expat xml.dom getDOMImplementation() Conformance Document Object Model (DOM) Level 2 Specification Document Object Model (DOM) Level 1 Specification xml.dom.minidom Python Language Mapping Specification xml.dom ImportError Namespaces in XML Document Object Model (DOM) Level 2 Core Specification XHTML 1.0: The Extensible HyperText Markup Language xml.dom DOMImplementation Objects Node Objects NodeList Objects DocumentType Objects Document Objects Element Objects Attr Objects Comment Objects Text and CDATASection Objects ProcessingInstruction Objects createDocumentType() previousSibling nodeName ValueError ValueError ValueError len() NotFoundErr NotFoundErr InuseAttributeErr InuseAttributeErr DOMException DOMException Namespaces in XML DomstringSizeErr HierarchyRequestErr IndexSizeErr InuseAttributeErr InvalidAccessErr InvalidCharacterErr InvalidModificationErr InvalidStateErr NamespaceErr NotFoundErr NotSupportedErr NoDataAllowedErr NoModificationAllowedErr SyntaxErr WrongDocumentErr AttributeError xml.dom.minidom xml.dom.minidom xml.dom.minidom parse() parseString() parse() parse() parseString() xml.dom xml.dom.minidom xml.dom.minidom xml.dom PyXML package xml.dom.minidom Document Object Model (DOM) Level 1 Specification xml.dom.minidom xml.dom xml.dom.minidom http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl http://www.iana.org/assignments/character-sets UnicodeError writexml() writexml() xml.dom.minidom xml.dom.minidom xml.dom.minidom xml.dom.minidom xml.dom.minidom xml.dom.minidom TypeError AttributeError xml.dom.minidom xml.dom.pulldom xml.dom.pulldom xml.sax.handler.ContentHandler xml.sax.handler.ContentHandler parse() parse() xml.sax xml.sax SAXParseException parse() xml.sax.xmlreader xml.sax.handler xml.sax xml.sax SAXException SAXException SAXException SAXException SAX: The Simple API for XML xml.sax.handler xml.sax.saxutils xml.sax.xmlreader SAXException xml.sax.handler xml.sax.handler xml.sax.handler ContentHandler setDocumentLocator() startPrefixMapping() endPrefixMapping() startPrefixMapping() endPrefixMapping() startPrefixMapping() startElement() endPrefixMapping() endElement() startPrefixMapping() endElement() endPrefixMapping() The Attributes Interface startElement() The AttributesNS Interface startElementNS() DTDHandler xml.sax.saxutils xml.sax.saxutils escape() quoteattr() XMLGenerator xml.sax.xmlreader XMLReader xml.sax.make_parser() XMLReader XMLReader.parse() InputSource XMLReader InputSource The Attributes Interface AttributesImpl AttributesImpl The AttributesNS Interface XMLReader InputSource parse() xml.sax.handler xml.sax.handler IncrementalParser Locator InputSource InputSource InputSource InputSource InputSource InputSource InputSource The Attributes Interface xml.etree.ElementTree ElementTree http://effbot.org/zone/element-index.htm http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl http://www.iana.org/assignments/character-sets QName XMLTreeBuilder.feed() XMLTreeBuilder.close() XMLTreeBuilder Python/XML Libraries socket webbrowser webbrowser open() open_new() get() get() get() ic open_new() open_new() cgi cgitb len() file file type list file AttributeError urlparse.parse_qs() urlparse.parse_qs() urlparse.parse_qsl() urlparse.parse_qs() xml.sax.saxutils os.system() os.popen() cgi test() cgitb cgitb cgitb cgitb enable() cgitb sys.excepthook cgitb sys.exc_info() sys.exc_info() wsgiref wsgiref PEP 333 http://www.wsgi.org wsgiref.util PEP 333 PEP 333 PEP 333 request_uri() shift_path_info() PEP 333 wsgiref.util RFC 2616 wsgiref.headers Headers PEP 333 Headers Headers Headers Headers Headers Headers Headers wsgiref.simple_server BaseHTTPServer wsgiref.util PEP 333 wsgiref.simple_server WSGIServer BaseHTTPServer.BaseHTTPRequestHandler make_server() WSGIServer BaseHTTPServer.HTTPServer WSGIServer set_app() make_server() get_app() WSGIServer WSGIServer make_server() WSGIServer PEP 333 wsgiref.handlers wsgiref.validate wsgiref.validate PEP 333 AssertionError wsgiref.simple_server wsgiref.handlers warnings PEP 333 warnings wsgiref.handlers BaseCGIHandler sys os CGIHandler sys os SimpleHandler SimpleHandler BaseCGIHandler BaseCGIHandler BaseHandler BaseHandler BaseHandler BaseHandler _write() BaseHandler BaseHandler BaseHandler BaseHandler CGIHandler wsgiref.handlers origin_server BaseCGIHandler CGIHandler wsgiref.util get_stdin() get_stderr() add_cgi_vars() wsgi_file_wrapper origin_server server_software log_exception() PEP 333 error_status error_headers error_body PEP 333 PEP 333 PEP 333 wsgiref.util wsgi_file_wrapper _write() _flush() BaseHandler BaseCGIHandler CGIHandler origin_server urllib urllib urllib.urlopen() urllib2.urlopen() urlopen() open() IOError File Objects mimetools.Message mimetools urlopen() urlencode() urlopen() urlopen() urlopen() urllib2.urlopen() urlopen() urlopen() urlencode() urlretrieve() ContentTooShortError urlopen() urlretrieve() FancyURLopener URLopener FancyURLopener URLopener urlretrieve() quote() unquote() urlopen() quote_plus() urlparse quote() unquote() FancyURLopener URLopener urllib URLopener FancyURLopener version urlopen() URLopener IOError open_unknown() urlopen() mimetools.Message tempfile.mktemp() urlencode() urllib FancyURLopener URLopener RFC 2616 urllib URLopener FancyURLopener prompt_user_passwd() FancyURLopener urlretrieve() urllib urlretrieve() urlopen() urlretrieve() urlopen() urlretrieve() htmllib ftplib urllib urlparse urllib2 urllib2 urllib2 urllib2 Request urllib.urlencode() Quick Reference to HTTP Headers URLError OpenerDirector UnknownHandler OpenerDirector OpenerDirector.open() urlopen() OpenerDirector OpenerDirector BaseHandler BaseHandler ProxyHandler UnknownHandler HTTPHandler HTTPDefaultErrorHandler HTTPRedirectHandler FTPHandler FileHandler ssl HTTPSHandler BaseHandler IOError socket.error OSError URLError HTTPError urlopen() RFC 2616 BaseHTTPServer.BaseHTTPRequestHandler.responses urllib.urlencode() add_header() urllib2 RFC 2965 OpenerDirector BaseHandler HTTPError HTTPPasswordMgr HTTPPasswordMgr Objects HTTPPasswordMgr HTTPPasswordMgr Objects HTTPPasswordMgr HTTPPasswordMgr Objects HTTPPasswordMgr HTTPPasswordMgr Objects HTTPPasswordMgr HTTPPasswordMgr Objects HTTPPasswordMgr HTTPPasswordMgr Objects Request Request RFC 2965 Request Request OpenerDirector BaseHandler urlopen() open() OpenerDirector urlopen() None URLError None None OpenerDirector open() BaseHandler BaseHandler OpenerDirector BaseHandler OpenerDirector open() OpenerDirector URLError MemoryError URLError BaseHandler OpenerDirector default_open() BaseHandler parent OpenerDirector default_open() BaseHandler OpenerDirector Request urlopen() BaseHandler http_error_default() BaseHandler OpenerDirector Request Request BaseHandler OpenerDirector Request urlopen() urlopen() HTTPError RFC 2616 Request Request HTTPError RFC 2616 OpenerDirector http_error_301() http_error_301() http_error_301() HTTPCookieProcessor cookielib.CookieJar ProxyHandler HTTPPasswordMgr HTTPPasswordMgrWithDefaultRealm HTTPPasswordMgrWithDefaultRealm Request Request CacheFTPHandler FTPHandler URLError OpenerDirector.error() urllib2.HTTPDefaultErrorHandler HTTPError build_opener() ProxyHandler ProxyHandler ProxyHandler ProxyBasicAuthHandler Request OpenerDirector Request Request urlopen() OpenerDirector.open() httplib httplib urllib socket HTTPConnection HTTPConnection Exception HTTPException HTTPException HTTPException HTTPException HTTPException HTTPException HTTPException ImproperConnectionState ImproperConnectionState ImproperConnectionState HTTPException RFC 2616, Section 10.1.1 RFC 2616, Section 10.1.2 RFC 2518, Section 10.1 RFC 2616, Section 10.2.1 RFC 2616, Section 10.2.2 RFC 2616, Section 10.2.3 RFC 2616, Section 10.2.4 RFC 2616, Section 10.2.5 RFC 2616, Section 10.2.6 RFC 2616, Section 10.2.7 RFC 2518, Section 10.2 RFC 3229 RFC 2616, Section 10.3.1 RFC 2616, Section 10.3.2 RFC 2616, Section 10.3.3 RFC 2616, Section 10.3.4 RFC 2616, Section 10.3.5 RFC 2616, Section 10.3.6 RFC 2616, Section 10.3.8 RFC 2616, Section 10.4.1 RFC 2616, Section 10.4.2 RFC 2616, Section 10.4.3 RFC 2616, Section 10.4.4 RFC 2616, Section 10.4.5 RFC 2616, Section 10.4.6 RFC 2616, Section 10.4.7 RFC 2616, Section 10.4.8 RFC 2616, Section 10.4.9 RFC 2616, Section 10.4.10 RFC 2616, Section 10.4.11 RFC 2616, Section 10.4.12 RFC 2616, Section 10.4.13 RFC 2616, Section 10.4.14 RFC 2616, Section 10.4.15 RFC 2616, Section 10.4.16 RFC 2616, Section 10.4.17 RFC 2616, Section 10.4.18 RFC 2518, Section 10.3 RFC 2518, Section 10.4 RFC 2518, Section 10.5 RFC 2817 RFC 2616, Section 10.5.1 RFC 2616, Section 10.5.2 RFC 2616, Section 10.5.3 RFC 2616, Section 10.5.4 RFC 2616, Section 10.5.5 RFC 2616, Section 10.5.6 RFC 2518, Section 10.6 RFC 2774 HTTPConnection HTTPResponse RFC 822 endheaders() getresponse() HTTPResponse mimetools.Message ftplib FTP FTP urllib RFC 959 ftplib FTP FTP socket.error IOError netrc ftplib FTP transfercmd() retrbinary() storbinary() transfercmd() error_reply transfercmd() transfercmd() transfercmd() retrlines() error_perm error_reply close() FTP quit() FTP close() quit() login() poplib POP3 RFC 1725 POP3 POP3_SSL imaplib.IMAP4 poplib POP3 poplib socket imaplib Frequently Asked Questions About Fetchmail POP3 quit() POP3_SSL imaplib IMAP4 IMAP4_SSL IMAP4_stream RFC 2060 RFC 1730 imaplib IMAP4 IMAP4 IMAP4.error IMAP4.error IMAP4 IMAP4 time time http://www.washington.edu/imap/ IMAP4 RFC 2060 IMAP4_SSL IMAP4 nntplib NNTP RFC 977 NNTP NNTPPermanentError Exception nntplib newgroups() descriptions() stat() stat() stat() stat() stat() head() stat() head() post() post() newnews() newgroups() descriptions() description() smtplib smtplib RFC 821 RFC 1869 SMTP connect() SMTPConnectError sendmail() quit() SMTP_SSL SMTP SMTP_SSL SMTP SMTPResponseException SMTP.sendmail() RFC 821 RFC 1869 SMTP SMTPServerDisconnected sendmail() has_extn() has_extn() sendmail() ehlo() helo() True False RFC 822 SMTPHeloError SMTPAuthenticationError SMTPException ehlo() socket SMTPHeloError SMTPException RuntimeError RFC 822 RFC 822 SMTP SMTPRecipientsRefused SMTPHeloError SMTPSenderRefused SMTPDataError RFC 822 smtpd SMTPServer asyncore.dispatcher asyncore NotImplementedError RFC 2822 SMTPServer SMTPServer SMTPServer telnetlib telnetlib Telnet RFC 854 Telnet open() EOFError RFC 854 Telnet EOFError EOFError EOFError EOFError EOFError socket.error interact() EOFError uuid UUID UUID uuid1() uuid3() uuid4() uuid5() RFC 4122 uuid1() uuid4() uuid1() uuid4() UUID RESERVED_NCS RFC_4122 RESERVED_MICROSOFT RESERVED_FUTURE RFC_4122 uuid getnode() uuid uuid3() uuid5() uuid RFC 4122 RFC 4122 uuid urlparse urlparse urlparse True tuple None None None None Results of urlparse() and urlsplit() ValueError urllib.urlencode() ValueError urllib.urlencode() urlparse() urlparse() RFC 2396 tuple None None None None Results of urlparse() and urlsplit() urlsplit() urlparse() urlsplit() urlunsplit() RFC 1738 RFC 1808 RFC 2396 urlparse() urlsplit() urlparse() urlsplit() tuple tuple urlparse() urlsplit() SocketServer SocketServer SocketServer handle() handle_request() serve_forever() False handle() handle() asyncore select.select() get_request() verify_request() process_request() handle() handle_error() handle_timeout() handle_request() shutdown() serve_forever() socket.AF_INET socket.AF_UNIX False request_queue_size socket.SOCK_STREAM socket.SOCK_DGRAM None handle_request() handle_timeout() RequestHandlerClass handle() RequestHandlerClass handle() timeout None finish_request() RequestHandlerClass True False True handle() handle() setup() handle() setup() finish() handle() BaseHTTPServer BaseHTTPServer SimpleHTTPServer CGIHTTPServer HTTPServer BaseHTTPRequestHandler BaseHTTPRequestHandler MessageClass BaseHTTPRequestHandler version_string server_version send_header() rfc822.Message mimetools.Message error_message_format BaseHTTPRequestHandler handle_one_request() error_message_format version_string() date_time_string() log_message() log_message() server_version sys_version time.time() CGIHTTPServer SimpleHTTPServer SimpleHTTPServer SimpleHTTPServer SimpleHTTPServer SimpleHTTPRequestHandler BaseHTTPServer.BaseHTTPRequestHandler SimpleHTTPServer BaseHTTPServer.BaseHTTPRequestHandler do_GET() do_HEAD() SimpleHTTPRequestHandler SimpleHTTPRequestHandler do_GET() os.listdir() IOError BaseHTTPServer CGIHTTPServer CGIHTTPServer CGIHTTPServer BaseHTTPServer.BaseHTTPRequestHandler SimpleHTTPServer.SimpleHTTPRequestHandler CGIHTTPRequestHandler CGIHTTPServer SimpleHTTPServer.SimpleHTTPRequestHandler CGIHTTPRequestHandler CGIHTTPRequestHandler BaseHTTPServer cookielib cookielib cookielib RFC 2965 RFC 2109 cookielib FileCookieJar IOError LoadError IOError CookiePolicy CookieJar CookieJar CookiePolicy CookieJar load() revert() FileCookieJar subclasses and co-operation with web browsers None CookiePolicy DefaultCookiePolicy DefaultCookiePolicy rfc2109_as_netscape CookieJar Cookie DefaultCookiePolicy cookielib Cookie CookieJar urllib2 Cookie cookielib Cookie http://wwwsearch.sf.net/ClientCookie/ http://wp.netscape.com/newsref/std/cookie_spec.html cookielib RFC 2109 RFC 2965 http://kristol.org/cookie/errata.html RFC 2964 CookieJar Cookie CookieJar CookieJar CookiePolicy urllib2.Request urllib2 CookieJar CookieJar CookiePolicy.set_ok() urllib2.urlopen() mimetools.Message urllib2.Request urllib2 CookiePolicy Cookie extract_cookies() Cookie Cookie KeyError FileCookieJar NotImplementedError None ValueError load() revert() save() LoadError IOError IOError LoadError IOError revert() load() FileCookieJar CookieJar FileCookieJar CookieJar CookieJar http://wwwsearch.sf.net/ClientCookie/ FileCookieJar FileCookieJar CookiePolicy cookielib.Cookie CookieJar.extract_cookies() cookielib.Cookie CookieJar.add_cookie_header() domain_return_ok() path_return_ok() return_ok() domain_return_ok() path_return_ok() path_return_ok() return_ok() path_return_ok() return_ok() Cookie return_ok() domain_return_ok() path_return_ok() return_ok() domain_return_ok() CookiePolicy CookiePolicy DefaultCookiePolicy CookiePolicy CookiePolicy None DefaultCookiePolicy None None DefaultCookiePolicy CookieJar Cookie None Cookie cookielib CookiePolicy None version cookielib version None None None is_expired() None None cookielib version Cookie cookielib DefaultCookiePolicy Cookie Cookie Cookie RFC 2109 RFC 2068 CookieError CookieError RFC 2109 Morsel Morsel load() BaseCookie str() BaseCookie pickle.loads() pickle.dumps() BaseCookie pickle.loads() pickle.dumps() SerialCookie Cookie SmartCookie SerialCookie cookielib cookielib Cookie RFC 2109 BaseCookie BaseCookie value_encode() value_decode() Morsel output() output() Morsel RFC 2109 RFC 2109 Morsel output() output() Cookie xmlrpclib xmlrpclib ServerProxy TypeError http://ontosys.com/xml-rpc/extensions.php datetime.datetime datetime.datetime ServerProxy boolean True False datetime.datetime ServerProxy ServerProxy XML-RPC HOWTO XML-RPC Introspection XML-RPC Specification Unofficial XML-RPC Errata ServerProxy datetime.datetime RFC 2045 section 6.8 http://www.xmlrpc.com/discuss/msgReader%241208 MultiCall None datetime.datetime SimpleXMLRPCServer Example SimpleXMLRPCServer SimpleXMLRPCServer SimpleXMLRPCServer SimpleXMLRPCServer CGIXMLRPCRequestHandler SimpleXMLRPCRequestHandler xmlrpclib xmlrpclib SimpleXMLRPCServer SimpleXMLRPCServer register_function() CGIXMLRPCRequestHandler register_function() DocXMLRPCServer DocXMLRPCServer DocXMLRPCServer SimpleXMLRPCServer DocXMLRPCServer DocCGIXMLRPCRequestHandler SimpleXMLRPCServer.SimpleXMLRPCServer DocXMLRPCRequestHandler DocXMLRPCServer DocXMLRPCServer SimpleXMLRPCServer.SimpleXMLRPCServer DocCGIXMLRPCRequestHandler SimpleXMLRPCServer.CGIXMLRPCRequestHandler audioop audioop al sunaudiodev lin2adpcm() findfactor() findfactor() lin2adpcm() ratecv() mul() max() lin2adpcm() imageop imageop imageop imgfile mono2grey() dither2mono() aifc ImportError aifc open() getmarkers() readframes() open() getparams() setparams() close() setmark() writeframes() sunau sunau aifc wave sunau open() sunau sunau open() getcomptype() tell() aifc open() AU_read.tell() AU_read.setpos() wave wave wave open() open() getcomptype() aifc open() Wave_read.tell() Wave_read.setpos() wave.Error chunk Chunk EOFError read() seek() tell() Chunk IOError close() read() colorsys colorsys http://www.poynton.com/ColorFAQ.html http://www.cambridgeincolour.com/tutorials/color-spaces.htm colorsys imghdr imghdr imghdr what() imghdr what() sndhdr sndhdr whathdr() ossaudiodev Open Sound System Programmer's Guide ossaudiodev ossaudiodev IOError ossaudiodev OSSAudioError ossaudiodev open() read() writeall() write() writeall() IOError getfmts() sync() reset() setfmt() channels() speed() setparameters() OSSAudioError setfmt() channels() speed() IOError controls() controls() controls() OSSAudioError IOError OSSAudioError IOError gettext gettext gettext gettext gettext bindtextdomain() gettext() gettext() bind_textdomain_codeset() gettext() dgettext() bind_textdomain_codeset() gettext() ngettext() bind_textdomain_codeset() ngettext() dngettext() bind_textdomain_codeset() gettext gettext textdomain() bindtextdomain() find() find() find() IOError NullTranslations translation() install() install() NullTranslations NullTranslations NullTranslations add_fallback() gettext() lgettext() ugettext() ngettext() ngettext() ungettext() gettext NullTranslations RFC 822 gettext() IOError gettext() gettext() ugettext() ngettext() gettext() ungettext() gettext translation() gettext gettext gettext install() gettext() lgettext() lgettext() gettext() lgettext() locale.getpreferredencoding() lgettext() bindtextdomain() locale locale locale locale setlocale() setlocale() Error setlocale() LC_NUMERIC CHAR_MAX LC_MONETARY CHAR_MAX RFC 1766 LC_ALL LC_CTYPE RFC 1766 setlocale() setlocale() setlocale() getdefaultlocale() LC_ALL LC_COLLATE cmp() LC_NUMERIC format_string() LC_MONETARY setlocale() LC_NUMERIC LC_NUMERIC string strcoll() strxfrm() locale time.strftime() localeconv() os.strerror() format() atoi() atof() str() locale localeconv() nl_langinfo() re setlocale() string.lower() time.strftime() string setlocale() LC_CTYPE setlocale() atof() atoi() format() str() setlocale() locale gettext gettext cmd Cmd Cmd Cmd Cmd readline None readline sys.stdin sys.stdout use_rawinput Cmd intro readline postcmd() postcmd() Cmd precmd() postcmd() default() Cmd onecmd() precmd() Cmd postcmd() onecmd() cmdloop() Cmd cmdloop() Cmd Cmd cmdloop() cmdloop() raw_input() readline shlex shlex shlex shlex False shlex split() shlex shlex shlex infile shlex shlex ConfigParser shlex push_token() shlex source open() push_source() pop_source() sourcehook() shlex shlex quotes escape shlex shlex shlex shlex shlex shlex None Tkinter Tix Tkinter Tkinter Tkinter Tkinter Tkinter Other Graphical User Interface Packages Tkinter Tkinter Tkinter Tkinter Python Tkinter Resources An Introduction to Tkinter Tkinter reference: a GUI for Python Tkinter for JPython Python and Tkinter Programming Tkinter Tkinter Tkinter Tk Tcl() Tk Tcl() ScrolledText Tkinter turtle Tkinter ActiveState Tcl Home Page Tcl and the Tk Toolkit Practical Programming in Tcl and Tk Tk Mapping Basic Tk into Tkinter Tkinter Setting Options Tkinter Tix Tkinter Tkinter Tkinter Tkinter set() Tkinter set() Tkinter Tix Tix Tix HList ComboBox Control Tix NoteBook FileEntry PanedWindow Tix Tix Homepage Tix Tix Man Pages Tix Programming Guide Tix Development Applications Tix Tkinter Tix Tix Tkinter.Tk Tix Tix Tix Tix Tkinter Tix Balloon ButtonBox ComboBox Control LabelEntry LabelFrame Meter OptionMenu PopupMenu Tix PopupMenu Select StdButtonBox DirList DirTree DirSelectDialog DirSelectBox ExFileSelectBox ExFileSelectBox FileSelectBox ComboBox FileEntry HList CheckList Tree TList TList TList PanedWindow ListNoteBook NoteBook Tix pixmap Tix Tkinter Compound InputOnly Tix Tkinter Form tix commands Tix Tix tix_addbitmapdir() tix_getbitmap() tix_getimage() tix_getbitmap() tix_addbitmapdir() tix_getimage() tix_getbitmap() tix_filedialog() tix_addbitmapdir() tix_getimage() tix_resetoptions() ScrolledText ScrolledText ScrolledText turtle turtle Tkinter TurtleScreen turtle Screen() TurtleScreen turtle RawTurtle RawPen TurtleScreen Turtle Screen Screen Turtle forward() fd() backward() bk() back() right() rt() left() lt() goto() setpos() setposition() setx() sety() setheading() seth() home() circle() dot() stamp() clearstamp() clearstamps() undo() speed() position() pos() towards() xcor() ycor() heading() distance() degrees() radians() pendown() pd() down() penup() pu() up() pensize() width() pen() isdown() color() pencolor() fillcolor() fill() begin_fill() end_fill() reset() clear() write() showturtle() st() hideturtle() ht() isvisible() shape() resizemode() shapesize() settiltangle() tiltangle() tilt() onclick() onrelease() ondrag() begin_poly() end_poly() get_poly() clone() getturtle() getscreen() setundobuffer() undobufferentries() tracer() window_width() window_height() bgcolor() bgpic() clear() clearscreen() reset() resetscreen() screensize() setworldcoordinates() delay() tracer() update() listen() onkey() onclick() onscreenclick() ontimer() mode() colormode() getcanvas() getshapes() register_shape() addshape() turtles() window_height() window_width() bye() exitonclick() setup() title() degrees() radians() mode() degrees() radians() mode() Vec2D pos() mode() stamp() Vec2D mode() pen() colormode() colormode() pencolor() fillcolor() pencolor() colormode() begin_fill() register_shape() shapesize() shapesize() TurtleScreen undo() Shape Shape register_shape() delay() speed() listen() listen() turtle Shape turtle TurtleScreen Screen four methods added addcomponent() Excursus about the use of compound shapes help() turtle glingl at aon.at turtle exitonclick() turtle turtle tracer() update() ondrag() onclick() stamp() Vec2D clone() clone() undo() circle() Tkinter Python megawidgets Tkinter Tkinter3000 Widget Construction Kit (WCK) PyGTK GTK GNOME PythonCAD tutorial PyQt GUI Programming with Python: QT Edition Rapid GUI Programming with Python and Qt wxPython wxWidgets wxPython in Action GUI Programming pydoc doctest unittest pydoc pydoc help() pydoc sys Tkinter http://docs.python.org/library/ doctest doctest doctest doctest doctest doctest testmod() testmod() testmod() testmod() testmod() Basic API testfile() testmod() testfile() testmod() testfile() Basic API testmod() testfile() testfile() doctest testfile() testmod() testfile() Basic API DocTestParser doctest testmod() testfile() ValueError ValueError ELLIPSIS ValueError IGNORE_EXCEPTION_DETAIL SyntaxError SyntaxError SyntaxError IGNORE_EXCEPTION_DETAIL DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE TypeError ELLIPSIS IGNORE_EXCEPTION_DETAIL IGNORE_EXCEPTION_DETAIL REPORT_ONLY_FIRST_FAILURE directive_options directive_option directive_option on_or_off directive_option_name DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE COMPARISON_FLAGS REPORTING_FLAGS SKIP doctest register_optionflag() OutputChecker DocTestRunner register_optionflag() doctest ELLIPSIS testmod() testfile() Simple Usage: Checking Examples in Docstrings Simple Usage: Checking Examples in a Text File dict.update() Option Flags and Directives DocTestParser __main__ testmod() DocTestFinder testfile() testfile() doctest unittest doctest doctest unittest unittest unittest.TestSuite unittest.TestSuite unittest.TestSuite DocTest DocTest Option Flags and Directives set_unittest_reportflags() DocTestParser DocFileSuite() unittest.TestSuite unittest.TestSuite DocTestFinder DocFileSuite() testmod() DocTestSuite() unittest.TestSuite unittest.TestCase unittest DocFileSuite() unittest.TestSuite unittest.TestSuite doctest doctest doctest unittest unittest doctest unittest doctest doctest doctest unittest doctest Option Flags and Directives unittest doctest unittest DocTestRunner doctest unittest unittest Example DocTest Example DocTestFinder DocTestParser DocTest DocTestParser DocTest DocTestRunner DocTest OutputChecker OutputChecker DocTest Example globs DocTest DocTest DocTest filename DocTest Example want traceback.format_exception_only() exc_msg DocTestRunner DocTest DocTest DocTestParser DocTestFinder.find() DocTestFinder.find() DocTestFinder DocTest DocTest DocTest DocTest DocTest DocTestParser DocTest DocTest DocTest Example Example Example DocTest OutputChecker Option Flags and Directives OutputChecker report_start() report_success() report_unexpected_exception() report_failure() OutputChecker DocTestRunner Option Flags and Directives DocTestParser DocTestRunner DocTestRunner.run() DocTestRunner DocTestRunner.run() DocTestRunner DocTestRunner.run() DocTestRunner sys.exc_info() DocTestRunner.run() DocTest DocTestRunner DocTestRunner OutputChecker check_output() output_difference() OutputChecker Option Flags and Directives pdb DebugRunner DocTestRunner unittest DocTestSuite() debug() unittest.TestCase pdb.set_trace() pdb.set_trace() script_from_examples() testsource() pdb pdb.post_mortem() execfile() pdb.run() debug() debug() DebugRunner DebugRunner DocTestRunner UnexpectedException DocTestFailure DocTestRunner Advanced API DebugRunner DocTestRunner DocTestFailure DocTest Example DocTestRunner UnexpectedException DocTest Example sys.exc_info() doctest doctest testfile() DocFileSuite() unittest unittest unittest unittest unittest TestCase TestCase FunctionTestCase unittest TestCase FunctionTestCase TestCase TestSuite TestCase TestSuite TestResult unittest TextTestRunner doctest Simple Smalltalk Testing: With Patterns unittest unittest random unittest.TestCase unittest.main() unittest.main() unittest unittest unittest TestCase TestCase FunctionTestCase TestCase TestCase TestCase TestCase unittest TypeError unittest unittest unittest TestSuite TestCase unittest TestLoader TestLoader cmp() TestSuite TestSuite TestCase TestSuite unittest TestCase unittest FunctionTestCase TestCase unittest AssertionError unittest AssertionError FunctionTestCase unittest TestCase TestCase unittest TestCase TestCase unittest TestSuite TestSuite TestCase TestLoader TestLoader doctest unittest.TestSuite doctest TestCase TestCase setUp() None run() TestCase None None failUnlessEqual() failUnless() None failIfEqual() failUnless() None None assertRaises() failUnless() failIf() None None AssertionError TestCase run() TestCase TestResult TestCase None None TestSuite TestCase TestSuite TestCase TestSuite TestCase TestSuite addTest() TestSuite TestCase TestCase.run() TestSuite.run() TestSuite TestResult TestCase TestSuite unittest TestResult TestResult TestResult TestCase sys.exc_info() TestCase sys.exc_info() True False TestResult True TextTestRunner TestResult sys.exc_info() sys.exc_info() TestLoader unittest TestLoader TestCase TestCase TestCase TestSuite TestCase TestSuite TestCase loadTestsFromName() TestCase TestLoader getTestCaseNames() getTestCaseNames() cmp() None TestSuite lib2to3 lib2to3 lib2to3 lib2to3 test test test.test_support test.test_support test unittest doctest unittest doctest test unittest test test.test_support test.test_support test.test_support unittest unittest.TestCase TestFailed TestSkipped requires() test.test_support True True True test.test_support True ResourceDenied ResourceDenied unittest.TestCase None StringIO.StringIO test.test_support ResourceDenied ResourceDenied check_warnings() bdb bdb Bdb bdb Breakpoint Breakpoint Bdb Bdb How It Works user_line() BdbQuit user_line() trace_dispatch() user_call() BdbQuit user_call() trace_dispatch() user_return() BdbQuit user_return() trace_dispatch() user_exception() BdbQuit user_exception() trace_dispatch() dispatch_call() dispatch_line() stop_here() break_here() dispatch_return() stop_here() dispatch_exception() stop_here() BdbQuit canonic() eval() run() run() Bdb pdb pdb bdb cmd __main__ eval() runeval() run() runcall() pprint cProfile cProfile pstats cProfile cProfile hotshot cProfile cProfile cProfile hotshot cProfile pstats cProfile.run() pstats cmd cProfile cProfile.run() pstats.Stats run() pstats Stats cProfile Stats add() Stats Stats Stats strip_dirs() Stats cProfile.run() Stats Stats Stats Stats sort_stats() add() strip_dirs() re Stats print_stats() cProfile Stats print_callers() cProfile cProfile os.times() os.times() hotshot hotshot cProfile hotshot hotshot __main__ pstats pstats.Stats timeit timeit() repeat() timeit() timeit() timeit() timeit() timeit() timeit() min() timeit() Timer repeat() Timer timeit() time.time() time.clock() time.clock() time.time() time.clock() time.time() time.clock() hasattr() timeit trace trace trace Trace sys fileinput traceback exc_clear() exc_info() exc_info() exc_info() SystemExit atexit atexit dont_write_bytecode unicode max min setcheckinterval() dl None getfilesystemencoding() getrefcount() setrecursionlimit() ValueError setprofile() settrace() gettrace() hex() pdb --- The Python Debugger exc_info() reload() sys.path platform str() LookupError site site sys dl The Python Profilers settrace() How It Works settrace() settrace() input() raw_input() input() raw_input() os.popen() os.system() os warnings version sys site __builtin__ open() Built-in Objects open() open() future_builtins print() repr() repr() ascii() future_builtins.ascii() repr() itertools.ifilter() hex() itertools.imap() oct() itertools.izip() __main__ warnings warn() filterwarnings() resetwarnings() showwarning() formatwarning() Warning Exception UserWarning warn() DeprecationWarning SyntaxWarning RuntimeWarning FutureWarning PendingDeprecationWarning ImportWarning UnicodeWarning Warning Warning Warning Exception warnings catch_warnings catch_warnings showwarning() UserWarning Warning warn() Warning Warning warn() Warning warnpy3k() DeprecationWarning showwarning() DeprecationWarning formatwarning() filterwarnings() filterwarnings() simplefilter() showwarning() False None True showwarning() showwarning() warnings warnings catch_warnings contextlib Context Manager Types PEP 0343 abc PEP 3119 PEP 3141 numbers collections collections issubclass() super() ABCMeta register() __subclasshook__() ABCMeta ABCMeta abstractmethod() super() property() ABCMeta ABCMeta atexit atexit os._exit() atexit atexit atexit register() sys.exit() SystemExit readline atexit readline atexit register() traceback sys.exc_info() print_tb() SyntaxError sys.exc_info() print_exception() extract_tb() print_stack() extract_tb() extract_stack() SyntaxError print_exception() print_exception() code __future__ __future__ __future__ __future__ compile() __future__ gc gc ValueError int float collect() get_referrers() get_referrers() get_referrers() DEBUG_SAVEALL set_debug() DEBUG_COLLECTABLE DEBUG_UNCOLLECTABLE DEBUG_COLLECTABLE DEBUG_UNCOLLECTABLE inspect inspect getmembers() getmembers() getmembers() dir() open() imp ismethod() isclass() isfunction() ismethoddescriptor() ismethod() cleandoc() TypeError TypeError IOError IOError getargspec() getargvalues() gc.disable() site ImportError user user user execfile() user user getattr() site fpectl fpectl Limitations and other considerations fpectl FloatingPointError fpectl turnon_sigfpe() fpectl fpectl fpectl fpectl code codeop code InteractiveInterpreter InteractiveConsole raw_input() InteractiveConsole interact() SyntaxError OverflowError ValueError compile_command() compile_command() SyntaxError OverflowError showsyntaxerror() runsource() compile_command() runsource() compile_command() runcode() SystemExit runsource() showtraceback() SystemExit KeyboardInterrupt write() write() InteractiveConsole InteractiveInterpreter EOFError raw_input() codeop codeop code code codeop SyntaxError OverflowError ValueError ValueError compile() __future__ compile_command() Compile CommandCompiler rexec Bastion open() open() IOError __builtin__ rexec rexec RExec eval() execfile() RExec rexec rexec RExec RExec rexec RExec RExec sys.exit() SystemExit sys.exit() SystemExit Grail Home Page rexec RExec __main__ __main__ __main__ RExec ImportError open() open() RExec r_open() ImportError RExec RExec RExec RExec RExec os RExec sys RExec imp RExec RExec RExec Bastion Bastion rexec AttributeError BastionClass BastionClass Bastion() repr() BastionClass Grail Home Page imp open() PY_SOURCE PY_COMPILED C_EXTENSION get_suffixes() C_BUILTIN PY_FROZEN get_suffixes() ImportError PKG_DIRECTORY find_module() load_module() find_module() find_module() reload() get_suffixes() ImportError find_module() init_frozen() find_module() load_module() init_builtin() init_frozen() NullImporter PEP 302 ImportError NullImporter find_module() load_module() reload() imputil imputil imputil Importer zipimport zipimport reload() reload() PKZIP Application Note PEP 0273 PEP 0302 ImportError ImportError zipimporter ZipImportError None ZipImportError IOError ZipImportError None ZipImportError ZipImportError archive prefix zipimporter zipimport pkgutil site os.path.isdir() get_data() get_data() modulefinder ModuleFinder run_script() report() Example usage of ModuleFinder ModuleFinder runpy runpy runpy __builtin__ sys sys PEP 338 parser parser ast parser parser expr() suite() sequence2st() st2list() st2tuple() symbol token parser symbol token expr() suite() ParserError compilest() MemoryError sequence2st() st2tuple() st2list() eval() SyntaxError SyntaxError parser expr() suite() sequence2st() compilest() compile() isexpr() SyntaxError sequence2st() sequence2st() compilest() expr() suite() MemoryError OverflowError SyntaxError SystemError pickle expr() suite() sequence2st() compile() compile() parser parser symbol token suite suite suite ast compile() parse() ast.AST compile() below ast _fields compile() lineno col_offset lineno col_offset ast ast inspect.cleandoc() compile() generic_visit() visit() generic_visit() NodeVisitor NodeTransformer NodeVisitor symtable symtable SymbolTable compile() get_type() get_children() Symbol Symbol SymbolTable SymbolTable SymbolTable ValueError symbol parser parser symbol token parser parser symbol keyword __future__ tokenize tokenize generate_tokens() File Objects tokenize() tokenize() File Objects StopIteration StopIteration generate_tokens() token tokenize tokenize() tabnanny check() tokeneater() check() check() tokenize.tokenize() tokenize pyclbr pyclbr readmodule() readmodule() readmodule_ex() readmodule() file readmodule_ex() file py_compile py_compile PyCompileError main() compileall compileall compile_dir() py_compile dis dis dis __import__() next() slice() pickletools pickle pickle cPickle pickle pickletools distutils distutils distutils compiler compiler parser compiler compiler SyntaxError eval() compile() compiler ast compiler.ast parser compiler.ast compiler.ast.Node Node Node Node Node Node Node getChildren() Node Node Node compiler.ast Node AssertionError Ellipsis locals globals list iter list vars Node compiler.ast compiler ASTVisitor preorder() preorder() ASTVisitor default() ASTVisitor formatter htmllib add_flowing_data() add_flowing_data() AS_IS AS_IS AS_IS AS_IS push_style() AS_IS NullWriter NullFormatter AbstractFormatter AS_IS send_line_break() send_line_break() NullWriter msilib msilib distutils add_data() FCICreateFile UuidCreate UuidToString MSIDatabaseOpenView MSIDatabaseCommit MSIGetSummaryInformation MsiViewExecute MSIViewGetColumnInfo MsiViewFetch MsiViewModify MsiViewClose GetProperty() MsiSummaryInfoGetProperty MsiSummaryInfoGetPropertyCount MsiSummaryInfoSetProperty MsiSummaryInfoPersist MsiRecordGetFieldCount MsiRecordSetString MsiRecordSetStream MsiRecordSetInteger MsiRecordClear CAB start_component() Directory Table File Table Component Table FeatureComponents Table Directory msilib Feature Table msilib Dialog Control Dialog Table Control Table Control Types ControlCondition Table ControlEvent Table EventMapping Table RadioButton Table msilib msvcrt getpass IOError IOError IOError os.O_TEXT os.O_BINARY os.O_APPEND os.O_RDONLY os.O_TEXT os.fdopen() IOError getch() getch() getche() putch() getch() getche() ungetch() IOError _winreg _winreg EnvironmentError EnvironmentError EnvironmentError EnvironmentError EnvironmentError FlushKey() CloseKey() FlushKey() FlushKey() FlushKey() SaveKey() ConnectRegistry() EnvironmentError OpenKeyEx() OpenKey() SetValue() LoadKey() SetValueEx() OpenKey() CloseKey() int() __enter__() __exit__() winsound winsound RuntimeError RuntimeError SND_ALIAS SND_NODEFAULT RuntimeError SND_FILENAME PlaySound() SND_ASYNC SND_MEMORY PlaySound() SND_ASYNC RuntimeError posix os os posix posix os os posix os OSError os posix os os posix pwd KeyError crypt spwd grp spwd spwd KeyError grp pwd grp KeyError KeyError pwd spwd crypt dl dl ctypes dl dl SystemError dl RTLD_LAZY RTLD_NOW RTLD_LAZY RTLD_NOW dl open() open() hasattr() dl open() termios termios tcgetattr() tty tcgetattr() tty tty termios tty termios.tcsetattr() termios.tcsetattr() termios pty pty pty os.openpty() fcntl fcntl struct.pack() IOError fcntl() termios fcntl() ioctl() ioctl() ioctl() fcntl() IOError flock() os os os.open() lockf() flock() pipes pipes os.system() os.popen() pipes append() posixfile fcntl.lockf() fcntl.fcntl() open() posixfile posixfile posixfile open() SEEK_SET SEEK_CUR SEEK_END SEEK_SET IOError resource setrlimit() ValueError error ValueError error setrlimit() getrlimit() signal RLIMIT_NOFILE ValueError error getrusage() getrusage() RUSAGE_SELF getrusage() getrusage() nis nis nis nis.error nis syslog openlog() openlog() syslog() syslog() commands commands os.popen() subprocess subprocess commands getstatus() getstatusoutput() getoutput() subprocess commands os.popen() getstatusoutput() getoutput() getstatusoutput() subprocess MacPython OSA Modules Undocumented Mac OS modules ic ic error ic ic IC ic IC MacOS macerrors open() macostools macostools mkalias() findertools findertools EasyDialogs EasyDialogs EasyDialogs AskString() None AskString() AskString() ProgressBar getopt.getopt() getopt.getopt() SystemExit None str unicode EasyDialogs None AskFileForOpen() None AskFileForOpen() Navigation Services Reference ProgressBar KeyboardInterrupt set() ProgressBar ProgressBar curval maxval curval maxval maxval curval maxval maxval curval curval maxval FrameWork FrameWork FrameWork FrameWork FrameWork W FrameWork FrameWork mainloop() getscrollbarvalues() getscrollbarvalues() autoGIL autoGIL installAutoGIL() Inside Macintosh Carbon.AE Carbon.AH Carbon.App Carbon.CF Carbon.CG Carbon.CarbonEvt Carbon.Cm Carbon.Ctl Carbon.Dlg Carbon.Evt Carbon.Fm Carbon.Folder Carbon.Help Carbon.List Carbon.Menu Carbon.Mlte Carbon.Qd Carbon.Qdoffs Carbon.Qt Carbon.Res Carbon.Scrap Scrap Manager Carbon.Snd Carbon.TE Carbon.Win ColorPicker ColorPicker GetColor() gensuitemodule gensuitemodule gensuitemodule aetools aetools aetypes aepack gensuitemodule aetools aetools Carbon.AE aetools aetools aepack aepack Carbon.AE aepack aetypes.ObjectSpecifier gensuitemodule Carbon.AE aetypes aetypes aetypes aepack aetypes gensuitemodule aepack aetypes MiniAEFrame MiniAEFrame FrameWork MiniAEFrame MiniApplication FrameWork.Application FrameWork.Application AEServer aetools.packevent() al al AL newconfig() queryparams() queryparams() newconfig() openport() AL al AL al cd cd open() createparser() open() cd PAUSED open() ERROR NODISC READY PLAYING PAUSED STILL CDROM msftoframe() createparser() cd fl fl FL fl.make_form() fl fl fl do_forms() show_file_selector() fl.do_forms() fl.qread() make_form() fl.do_forms() fl.check_forms() type input FL fl FL fl flp flp fl fm fm fm gl gl PyOpenGL: The Python OpenGL Binding http://pyopengl.sourceforge.net/ DEVICE gl DEVICE GL gl GL imgfile imgfile imgfile readscaled() jpeg jpeg jpeg http://www.pythonware.com/products/pil/ jpeg compress() decompress() compress() compress() compress() decompress() Information Technology - Digital Compression and Coding of Continuous-tone Still Images - Requirements and Guidelines sunaudiodev sunaudiodev SUNAUDIODEV open() SUNAUDIODEV sunaudiodev SUNAUDIODEV sunaudiodev docs at python.org rexec os.path os.path os.path ossaudiodev applesingle buildtools cfmfile cfmfile icopen open() icopen open() macerrors macerrors macresource macresource Nav PixMapWrapper PixMapWrapper videoreader videoreader W FrameWork W time.clock() Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... the Jython website Python for .NET home page the IronPython website the PyPy project's home page lc_letter lc_letter letter letter digit lowercase uppercase as with The with statement as with The import statement Special method names Identifiers (Names) stringprefix shortstring longstring shortstringitem shortstringitem longstringitem longstringitem shortstringchar escapeseq longstringchar escapeseq stringprefix Encoding declarations integer decimalinteger octinteger hexinteger bininteger nonzerodigit digit octdigit octdigit hexdigit bindigit digit pointfloat exponentfloat intpart fraction intpart intpart pointfloat exponent digit digit digit floatnumber intpart is try except try finally del del Dictionary displays Calls Function definitions yield The yield statement yield return __new__() __new__() __init__() __init__() __init__() __init__() __call__() import The import statement Class definitions http://www.python.org/download/releases/2.3/mro/ Implementing Descriptors Implementing Descriptors __getattr__() __setattr__() __delattr__() Special method names The try statement try http://www.python.org/doc/newstyle/ __getitem__() __new__() __new__() __new__() __new__() __init__() __new__() __new__() __init__() __new__() __init__() __init__() __del__() __del__() __del__() __del__() __del__() __del__() __del__() __del__() __del__() __del__() __del__() __repr__() __str__() __repr__() print __repr__() __cmp__() __eq__() __ne__() __hash__() __lt__() __gt__() __le__() __ge__() __eq__() __ne__() __cmp__() __eq__() __ne__() __hash__() __cmp__() __cmp__() __eq__() __hash__() __cmp__() __eq__() __hash__() __cmp__() __eq__() __hash__() __cmp__() __hash__() __hash__() __cmp__() __eq__() __hash__() __hash__() __len__() __len__() __nonzero__() __getattr__() __getattr__() __setattr__() __getattr__() __getattribute__() __setattr__() __setattr__() __getattr__() __getattribute__() Special method lookup for new-style classes __get__() __set__() __delete__() __get__() __set__() __get__() Implementing Descriptors __new__() __call__() __getslice__() __getitem__() __setitem__() __delitem__() __add__() __radd__() __iadd__() __mul__() __rmul__() __imul__() __coerce__() __contains__() __iter__() __iter__() __nonzero__() __len__() __getitem__() for __getitem__() __getitem__() __getitem__() __getitem__() __reversed__() __len__() __getitem__() __reversed__() in not in __getslice__() __getitem__() __getslice__() __len__() __getslice__() __getitem__() __getslice__() __setslice__() __setitem__() __setslice__() __getslice__() __delslice__() __delitem__() __delslice__() __getitem__() __setitem__() __delitem__() __getitem__() __setitem__() __delitem__() __add__() __divmod__() __floordiv__() __mod__() __truediv__() __pow__() __truediv__() __div__() __add__() __rsub__() __rpow__() __iadd__() __iadd__() __coerce__() __coerce__() __add__() __radd__() __iadd__() __eq__() __cmp__() __coerce__() with with The with statement with as __exit__() PEP 0343 with __hash__() __repr__() __getattribute__() __getattribute__() __get__() __set__() __delete__() __get__() __set__() __delete__() exec import for except import del import exec exec exec exec raise try except finally except except try The try statement raise The raise statement Coercion rules identifier literal enclosure parenth_form list_display generator_expression dict_display string_conversion yield_atom Identifiers and keywords Naming and binding stringliteral integer longinteger floatnumber imagnumber Literals expression_list expression_list list_comprehension expression list_for target_list old_expression_list list_iter old_expression old_expression list_for list_if old_expression list_iter for for if for if expression genexpr_for target_list or_test genexpr_iter genexpr_for genexpr_if old_expression genexpr_iter for for if for if in for for if for Calls key_datum_list key_datum key_datum expression expression The standard type hierarchy expression_list yield_expression expression_list yield yield yield expression_list yield yield yield yield yield expression_list yield yield PEP 0342 atom attributeref subscription slicing call primary identifier primary expression_list del simple_slicing extended_slicing primary short_slice primary slice_list slice_item slice_item expression proper_slice ellipsis short_slice long_slice lower_bound upper_bound short_slice stride expression expression expression The standard type hierarchy primary argument_list expression genexpr_for positional_arguments keyword_arguments expression keyword_arguments expression keyword_arguments expression expression expression expression expression expression expression expression keyword_item keyword_item identifier expression Function definitions Function definitions return __call__() primary u_expr power u_expr u_expr u_expr u_expr m_expr u_expr m_expr u_expr m_expr u_expr m_expr u_expr m_expr a_expr m_expr a_expr m_expr a_expr shift_expr a_expr shift_expr and_expr shift_expr and_expr xor_expr and_expr xor_expr or_expr xor_expr or_expr comp_operator or_expr Special method names in not in in not in __contains__() __contains__() __getitem__() in not in in is is not is conditional_expression lambda_form or_test old_lambda_form or_test or_test expression and_test or_test and_test not_test and_test not_test comparison not_test __nonzero__() not and or not parameter_list expression parameter_list old_expression Function definitions expression expression Comparisons lambda or and not in not in is is not expression_stmt assert_stmt assignment_stmt augmented_assignment_stmt pass_stmt del_stmt print_stmt return_stmt yield_stmt raise_stmt break_stmt continue_stmt import_stmt global_stmt exec_stmt expression_list The print statement target_list expression_list yield_expression target target identifier target_list target_list attributeref subscription slicing Primaries The standard type hierarchy global target augop expression_list yield_expression Primaries assert expression expression pass pass del target_list global print expression expression expression expression print print print print print print return expression_list return return return try finally finally return expression_list return yield yield_expression yield yield yield expression_list yield yield try try finally finally yield PEP 0255 yield PEP 0342 yield try finally raise expression expression expression raise raise The standard type hierarchy raise raise Exceptions The try statement break break for while else for break break try finally finally continue continue for while finally continue try finally finally import module name module name relative_module identifier name identifier name relative_module identifier name identifier name module identifier identifier module identifier import from from import as as from import as import from exec global identifier identifier global global global global global for class import global global global exec exec exec global exec exec or_expr expression expression File input return yield exec in exec if while for try if else print if_stmt while_stmt for_stmt try_stmt with_stmt funcdef classdef decorated stmt_list statement stmt_list compound_stmt simple_stmt simple_stmt else if if if expression suite expression suite suite Boolean operations if else while while expression suite suite else break else continue for for target_list expression_list suite suite else break else continue else try try suite expression target suite suite suite suite suite try except finally try except try finally except try try finally try The standard type hierarchy else try else except finally try except else finally finally finally return break finally return break continue try try finally finally continue finally Exceptions raise The raise statement with with With Statement Context Managers try except finally expression target suite with __enter__() with __enter__() with __enter__() __exit__() __exit__() __exit__() __exit__() with __exit__() with PEP 0343 with The standard type hierarchy decorator dotted_name argument_list funcname parameter_list suite identifier identifier defparameter identifier identifier identifier defparameter parameter expression parameter parameter identifier sublist identifier Calls Expression lists def def Naming and binding The standard type hierarchy classname inheritance suite expression_list identifier Naming and binding return continue break statement exec stmt_list compound_stmt expression_list expression_list Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... http://www.python.org/ Interactive Input Editing and History Substitution http://www.unicode.org/ Documentation Strings Tuples and Sequences PEP 8 A First Look at Classes Unpacking Argument Lists Standard Modules Classes http://www.python.org/download/releases/2.3/mro/ http://www.python.org http://docs.python.org http://pypi.python.org http://aspn.activestate.com/ASPN/Python/Cookbook/ python-list at python.org Frequently Asked Questions http://mail.python.org/pipermail/ The Perils of Floating Point Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... -c PEP 338 -i -i PYTHONDONTWRITEBYTECODE PYTHONDEBUG PYTHONPATH PYTHONHOME -c PYTHONSTARTUP PYTHONINSPECT PYTHONOPTIMIZE -O PEP 238 PEP 370 PYTHONUNBUFFERED PYTHONVERBOSE -W -W PEP 230 PYTHONHOME PYTHONHOME PYTHONPATH PYTHONHOME PYTHONPATH PYTHONPATH Interface options -O -O -d -d -i -u -v -v PEP 370 PEP 370 http://www.linux.com/articles/60383 http://linuxmafia.com/pub/linux/suse-linux-internals/chapter35.html http://docs.fedoraproject.org/drafts/rpm-guide-en/ch-creating-rpms.html http://www.slackbook.org/html/package-management-making-packages.html http://www.blastwave.org/howto.html source checkout http://www.vim.org/scripts/script.php?script_id=790 http://sourceforge.net/projects/python-mode http://geany.uvena.de/ http://www.activestate.com/store/productdetail.aspx?prdGuid=20f4ed15-6684-4118-a78b-d37ff4058c5f release PEP 11 Windows CE Cygwin Python interpreter Cygwin package source Maintainer releases Python for Windows (and DOS) Python on XP Installing on Windows Dive into Python: Python from novice to pro For Windows users A Byte of Python ActivePython Python Enthought Edition http://support.microsoft.com/kb/100843 http://support.microsoft.com/kb/310519 http://www.chem.gla.ac.uk/~louis/software/faq/q1.html Command line PYTHONPATH Environment variables PyWin32 Component Object Model Microsoft Foundation Classes PythonWin Win32 How Do I...? Python and COM Py2exe WConio source checkout Python + Windows + distutils + SWIG + gcc MinGW MingW -- Python extensions Python Programming On Win32 A Python for Windows Tutorial bobsavage at mac.com http://www.cwi.nl/~jack/macpython http://www.python.org The IDE http://www.barebones.com/products/bbedit/index.shtml http://macromates.com/ http://macvim.org http://aquamacs.org PYTHONPATH Installing Additional Python Packages http://hkn.eecs.berkeley.edu/ http://pythonmac.org/packages/ http://pyobjc.sourceforge.net http://www.tcl.tk http://www.activestate.com http://www.wxpython.org http://www.riverbankcomputing.co.uk/pyqt/ http://undefined.org/python/#py2app http://appscript.sourceforge.net http://www.python.org/community/sigs/current/pythonmac-sig/ http://wiki.python.org/moin/MacPython Guido van Rossum PEP 343 reStructuredText docs at python.org Docutils Alternative Python Reference docs at python.org http://www.cwi.nl/ http://www.cnri.reston.va.us/ http://www.zope.com/ http://www.python.org/psf/ http://www.opensource.org/ http://www.pythonlabs.com/logos.html http://hdl.handle.net/1895.22/1013 http://www.math.keio.ac.jp/ http://www.wide.ad.jp/ done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... PEP 361 PEP 3000 PEP 3100 Jira Launchpad Roundup Trac http://bugs.python.org Upfront Systems http://svn.python.org/view/tracker/importer/ http://bugs.python.org http://bugs.jython.org http://roundup.sourceforge.net/ http://svn.python.org/view/tracker/importer/ http://sphinx.pocoo.org/ listed on the Sphinx web site Sphinx Docutils PEP 343 PEP 370 PEP 371 PEP 3101 PEP 3105 PEP 3110 PEP 3112 PEP 3116 PEP 3118 PEP 3119 PEP 3127 PEP 3129 PEP 3141 Scheme's numerical tower Scheme's number datatypes issue 2196 issue 1686487 issue 3473 issue 2719 issue 1635 issue 1640 issue 3008 issue 1507 issue 2235 PEP 352 issue 1537 issue 1473257 issue 1444529 issue 1491866 issue 1193128 issue 1591665 issue 1631171 issue 1700288 issue 1878 issue 1819 issue 1736190 www.jcea.es/programacion/pybsddb.htm issue 1551443 issue 1817 issue 600362 issue 1381 issue 1638033 issue 1158 the General Decimal Specification issue 1221598 issue 1739906 issue 1001604 issue 2138 issue 2819 PEP 3141's type hierarchy for numbers issue 711019 issue 1640 issue 1663329 issue 1181 issue 1273829 issue 115886 issue 1339796 issue 957650 issue 1393667 issue 1106316 issue 2439 issue 1137 issue 1727780 issue 1681432 issue 846388 issue 3487 issue 2250 issue 1861 issue 1657 issue 2663 issue 1583 issue 2240 RFC 2033 issue 957003 RFC 3207 issue 829951 http://tipc.sf.net issue 1646 issue 742598 issue 1193577 issue 1534 issue 2898 issue 1648 issue 1537850 issue 2021 issue 3781 issue 1581073 issue 2871 issue 1533909 issue 2906 issue 1513695 issue 3811 issue 1631171 issue 3781 issue 1599845 issue 1330538 issue 2014 issue 2985 issue 467924 issue 1775025 issue 1734346 http://www.json.org issue 1649190 issue 1798 OpenSSL issue 1551895 the PEP 3118 section issue 1534 issue 1675423 issue 1635 issue 1629 issue 1530959 issue 957650 issue 1753245 issue 2125 issue 1490190 issue 1683368 issue 1706815 issue 1330538 done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... http://www.catb.org/~esr/jargon/html/C/compact.html http://www.cwi.nl/~steven/abc/ http://www.m3.org http://www.jython.org/ http://www.opensource.org http://wiki.python.org/moin/OrganizationsUsingPython http://www.pythonology.com/success http://home.pacbell.net/ouster/scripting.html http://www.python.org/workshops/1997-10/proceedings/beazley.html http://pythonjournal.cognizor.com/pyj1/Everitt-Feit_interview98-V1.html http://www.python.org/workshops/1997-10/proceedings/stein.ps http://www.opensource.org http://www.faqs.org/docs/Linux-mini/Advocacy.html done processing howto-functional.tex... howto/functional resolving references... writing... amk at amk.ca http://www.haskell.org http://wiki.python.org/moin/HowTo/Sorting lazy evaluation functional module the project's website fully curried http://mitpress.mit.edu/sicp/ http://www.defmacro.org/ramblings/fp.html http://en.wikipedia.org/wiki/Functional_programming http://en.wikipedia.org/wiki/Coroutine http://en.wikipedia.org/wiki/Currying http://gnosis.cx/TPiP/ part 1 part 2 part 3 PEP 289 PEP 342 done processing howto-regex.tex... howto/regex resolving references... writing... Kodos More Metacharacters done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... Michael Foord urllib2 - Le Manuel manquant Basic Authentication Python ftp://python.org/ RFC 2616 Writing Web Applications in Python HTML Specification, Form Submission Quick Reference to HTTP Headers info and geturl Quick Reference to HTTP Headers Basic Authentication Tutorial http://example.com/ Basic Authentication ASPN Cookbook Recipe PyGoogle Voidspace Google done processing howto-webservers.tex... howto/webservers resolving references... writing... Web Programming CGI scripts Apache HTTPd lighttpd Dynamic Content with CGI CGI module mod_python mod_python FastCGI, SCGI, and Apache: Background and Future mod_fastcgi mod_fcgid FastCGI module SCGI module FastCGI flup setting up Django with FastCGI mod_wsgi PEP 333 number of middlewares AJP WSGI wiki WSGI servers MoinMoin Model-View-Controller pattern Web Components framework frameworks Templating MySQL PostgreSQL SQL ORM frameworks SQLite Frameworks Persistence Tools Database Programming SQLAlchemy Elixir SQLObject ZODB Durus Zope Django online documentation Django book Django FAQ TurboGears TurboGears wiki TurboGears book Pylons Repoze Grok Pylons Paste web frameworks #python.web done processing howto-curses.tex... howto/curses resolving references... writing... http://effbot.org/zone/console-index.htm http://invisible-island.net/ncurses/ncurses.faq.html done processing howto-cporting.tex... howto/cporting resolving references... writing... PEP 3121 Cython done processing howto-unicode.tex... howto/unicode resolving references... writing... http://www.unicode.org http://www.unicode.org/history/ http://www.cs.tut.fi/~jkorpela/unicode/guide.html http://www.joelonsoftware.com/articles/Unicode.html http://www.jorendorff.com/articles/unicode/ http://en.wikipedia.org/wiki/Character_encoding http://en.wikipedia.org/wiki/UTF-8 http://www.unicode.org/Public/UNIDATA/UCD.html#General_Category_Values http://downloads.egenix.com/python/Unicode-EPC2002-Talk.pdf http://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Sat Nov 8 09:14:59 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 8 Nov 2008 09:14:59 +0100 (CET) Subject: [Python-checkins] r67156 - in doctools/trunk/sphinx: application.py builder.py ext/pngmath.py latexwriter.py Message-ID: <20081108081459.C28971E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 8 09:14:59 2008 New Revision: 67156 Log: More fixes. Modified: doctools/trunk/sphinx/application.py doctools/trunk/sphinx/builder.py doctools/trunk/sphinx/ext/pngmath.py doctools/trunk/sphinx/latexwriter.py Modified: doctools/trunk/sphinx/application.py ============================================================================== --- doctools/trunk/sphinx/application.py (original) +++ doctools/trunk/sphinx/application.py Sat Nov 8 09:14:59 2008 @@ -108,7 +108,8 @@ if buildername not in self.builderclasses: raise SphinxError('Builder name %s not registered' % buildername) - self.info(bold('Sphinx v%s, building %s' % (sphinx.__version__, buildername))) + self.info(bold('Sphinx v%s, building %s' % (sphinx.__released__, + buildername))) builderclass = self.builderclasses[buildername] self.builder = builderclass(self, freshenv=freshenv) Modified: doctools/trunk/sphinx/builder.py ============================================================================== --- doctools/trunk/sphinx/builder.py (original) +++ doctools/trunk/sphinx/builder.py Sat Nov 8 09:14:59 2008 @@ -1033,7 +1033,7 @@ # extract toctree nodes from the tree and put them in a fresh document new_tree = new_document('') new_sect = nodes.section() - new_sect += nodes.title('', '') + new_sect += nodes.title(u'', u'') new_tree += new_sect for node in tree.traverse(addnodes.toctree): new_sect += node Modified: doctools/trunk/sphinx/ext/pngmath.py ============================================================================== --- doctools/trunk/sphinx/ext/pngmath.py (original) +++ doctools/trunk/sphinx/ext/pngmath.py Sat Nov 8 09:14:59 2008 @@ -14,7 +14,7 @@ import shutil import tempfile import posixpath -from os import path +from os import path, getcwd, chdir from subprocess import Popen, PIPE try: from hashlib import sha1 as sha @@ -96,20 +96,30 @@ tf.write(latex) tf.close() + # build latex command; old versions of latex don't have the + # --output-directory option, so we have to manually chdir to the + # temp dir to run it. ltx_args = shlex.split(self.builder.config.pngmath_latex) - ltx_args += ['--interaction=nonstopmode', '--output-directory=' + tempdir, - 'math.tex'] + ltx_args += ['--interaction=nonstopmode', 'math.tex'] + + curdir = getcwd() + chdir(tempdir) + try: - p = Popen(ltx_args, stdout=PIPE, stderr=PIPE) - except OSError, err: - if err.errno != 2: # No such file or directory - raise - if not hasattr(self.builder, '_mathpng_warned_latex'): - self.builder.warn('LaTeX command %r cannot be run (needed for math ' - 'display), check the pngmath_latex setting' % - self.builder.config.pngmath_latex) - self.builder._mathpng_warned_latex = True - return relfn, None + try: + p = Popen(ltx_args, stdout=PIPE, stderr=PIPE) + except OSError, err: + if err.errno != 2: # No such file or directory + raise + if not hasattr(self.builder, '_mathpng_warned_latex'): + self.builder.warn('LaTeX command %r cannot be run (needed for math ' + 'display), check the pngmath_latex setting' % + self.builder.config.pngmath_latex) + self.builder._mathpng_warned_latex = True + return relfn, None + finally: + chdir(curdir) + stdout, stderr = p.communicate() if p.returncode != 0: raise MathExtError('latex exited with error:\n[stderr]\n%s\n[stdout]\n%s' Modified: doctools/trunk/sphinx/latexwriter.py ============================================================================== --- doctools/trunk/sphinx/latexwriter.py (original) +++ doctools/trunk/sphinx/latexwriter.py Sat Nov 8 09:14:59 2008 @@ -877,7 +877,6 @@ raise nodes.SkipNode def visit_reference(self, node): - print node uri = node.get('refuri', '') if self.in_title or not uri: self.context.append('') From python-checkins at python.org Sat Nov 8 12:47:44 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 8 Nov 2008 12:47:44 +0100 (CET) Subject: [Python-checkins] r67157 - python/trunk/Doc/conf.py Message-ID: <20081108114744.C46981E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 8 12:47:44 2008 New Revision: 67157 Log: Don't use "HOWTO" as the title for all howto .tex files. Modified: python/trunk/Doc/conf.py Modified: python/trunk/Doc/conf.py ============================================================================== --- python/trunk/Doc/conf.py (original) +++ python/trunk/Doc/conf.py Sat Nov 8 12:47:44 2008 @@ -128,7 +128,7 @@ ] # Collect all HOWTOs individually latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', - 'HOWTO', _stdauthor, 'howto') + '', _stdauthor, 'howto') for fn in os.listdir('howto') if fn.endswith('.rst') and fn != 'index.rst') From python-checkins at python.org Sat Nov 8 12:48:21 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 8 Nov 2008 12:48:21 +0100 (CET) Subject: [Python-checkins] r67158 - in python/trunk/Doc/documenting: index.rst markup.rst rest.rst sphinx.rst Message-ID: <20081108114821.24DC81E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 8 12:48:20 2008 New Revision: 67158 Log: Update "Documenting" a bit. Concentrate on Python-specifics. Removed: python/trunk/Doc/documenting/sphinx.rst Modified: python/trunk/Doc/documenting/index.rst python/trunk/Doc/documenting/markup.rst python/trunk/Doc/documenting/rest.rst Modified: python/trunk/Doc/documenting/index.rst ============================================================================== --- python/trunk/Doc/documenting/index.rst (original) +++ python/trunk/Doc/documenting/index.rst Sat Nov 8 12:48:20 2008 @@ -8,7 +8,7 @@ The Python language has a substantial body of documentation, much of it contributed by various authors. The markup used for the Python documentation is `reStructuredText`_, developed by the `docutils`_ project, amended by custom -directives and using a toolset named *Sphinx* to postprocess the HTML output. +directives and using a toolset named `Sphinx`_ to postprocess the HTML output. This document describes the style guide for our documentation, the custom reStructuredText markup introduced to support Python documentation and how it @@ -16,6 +16,7 @@ .. _reStructuredText: http://docutils.sf.net/rst.html .. _docutils: http://docutils.sf.net/ +.. _Sphinx: http://sphinx.pocoo.org/ If you're interested in contributing to Python's documentation, there's no need to write reStructuredText if you're not so inclined; plain text contributions @@ -28,7 +29,3 @@ rest.rst markup.rst fromlatex.rst - sphinx.rst - -.. XXX add credits, thanks etc. - Modified: python/trunk/Doc/documenting/markup.rst ============================================================================== --- python/trunk/Doc/documenting/markup.rst (original) +++ python/trunk/Doc/documenting/markup.rst Sat Nov 8 12:48:20 2008 @@ -8,24 +8,11 @@ Documentation for "standard" reST constructs is not included here, though they are used in the Python documentation. -File-wide metadata ------------------- - -reST has the concept of "field lists"; these are a sequence of fields marked up -like this:: - - :Field name: Field content - -A field list at the very top of a file is parsed as the "docinfo", which in -normal documents can be used to record the author, date of publication and -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: +.. note:: -``nocomments`` - If set, the web application won't display a comment form for a page generated - from this source file. + This is just an overview of Sphinx' extended markup capabilities; full + coverage can be found in `its own documentation + `_. Meta-information markup @@ -88,7 +75,6 @@ authors of the module code, just like ``sectionauthor`` names the author(s) of a piece of documentation. It too does not result in any output currently. - .. note:: It is important to make the section title of a module-describing file @@ -272,7 +258,7 @@ This language is used until the next ``highlightlang`` directive is encountered. -* The valid values for the highlighting language are: +* The values normally used for the highlighting language are: * ``python`` (the default) * ``c`` Modified: python/trunk/Doc/documenting/rest.rst ============================================================================== --- python/trunk/Doc/documenting/rest.rst (original) +++ python/trunk/Doc/documenting/rest.rst Sat Nov 8 12:48:20 2008 @@ -67,12 +67,6 @@ #. This is a numbered list. #. It has two items too. -Note that Sphinx disables the use of enumerated lists introduced by alphabetic -or roman numerals, such as :: - - 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:: @@ -247,5 +241,3 @@ * **Separation of inline markup:** As said above, inline markup spans must be separated from the surrounding text by non-word characters, you have to use an escaped space to get around that. - -.. XXX more? Deleted: python/trunk/Doc/documenting/sphinx.rst ============================================================================== --- python/trunk/Doc/documenting/sphinx.rst Sat Nov 8 12:48:20 2008 +++ (empty file) @@ -1,76 +0,0 @@ -.. highlightlang:: rest - -The Sphinx build system -======================= - -.. XXX: intro... - -.. _doc-build-config: - -The build configuration file ----------------------------- - -The documentation root, that is the ``Doc`` subdirectory of the source -distribution, contains a file named ``conf.py``. This file is called the "build -configuration file", and it contains several variables that are read and used -during a build run. - -These variables are: - -version : string - A string that is used as a replacement for the ``|version|`` reST - substitution. It should be the Python version the documentation refers to. - This consists only of the major and minor version parts, e.g. ``2.5``, even - for version 2.5.1. - -release : string - A string that is used as a replacement for the ``|release|`` reST - substitution. It should be the full version string including - alpha/beta/release candidate tags, e.g. ``2.5.2b3``. - -Both ``release`` and ``version`` can be ``'auto'``, which means that they are -determined at runtime from the ``Include/patchlevel.h`` file, if a complete -Python source distribution can be found, or else from the interpreter running -Sphinx. - -today_fmt : string - A ``strftime`` format that is used to format a replacement for the - ``|today|`` reST substitution. - -today : string - A string that can contain a date that should be written to the documentation - output literally. If this is nonzero, it is used instead of - ``strftime(today_fmt)``. - -unused_files : list of strings - A list of reST filenames that are to be disregarded during building. This - could be docs for temporarily disabled modules or documentation that's not - yet ready for public consumption. - -add_function_parentheses : bool - If true, ``()`` will be appended to the content of ``:func:``, ``:meth:`` and - ``:cfunc:`` cross-references. - -add_module_names : bool - If true, the current module name will be prepended to all description unit - titles (such as ``.. function::``). - -Builder-specific variables -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -html_download_base_url : string - The base URL for download links on the download page. - -html_last_updated_fmt : string - If this is not an empty string, it will be given to ``time.strftime()`` and - written to each generated output file after "last updated on:". - -html_use_smartypants : bool - If true, use SmartyPants to convert quotes and dashes to the typographically - correct entities. - -latex_paper_size : "letter" or "a4" - The paper size option for the LaTeX document class. - -latex_font_size : "10pt", "11pt" or "12pt" - The font size option for the LaTeX document class. \ No newline at end of file From python-checkins at python.org Sat Nov 8 13:52:26 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 8 Nov 2008 13:52:26 +0100 (CET) Subject: [Python-checkins] r67159 - python/trunk/Doc/documenting/markup.rst Message-ID: <20081108125226.50A131E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 8 13:52:25 2008 New Revision: 67159 Log: Fix warning. Modified: python/trunk/Doc/documenting/markup.rst Modified: python/trunk/Doc/documenting/markup.rst ============================================================================== --- python/trunk/Doc/documenting/markup.rst (original) +++ python/trunk/Doc/documenting/markup.rst Sat Nov 8 13:52:25 2008 @@ -785,7 +785,7 @@ ------------- The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file, see :ref:`doc-build-config`. +They are set in the build configuration file :file:`conf.py`. .. describe:: |release| From buildbot at python.org Sat Nov 8 16:38:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 08 Nov 2008 15:38:46 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081108153846.3BB311E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/395 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi 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 Sat Nov 8 17:55:33 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 8 Nov 2008 17:55:33 +0100 (CET) Subject: [Python-checkins] r67162 - in python/trunk/Doc/library: ast.rst functions.rst Message-ID: <20081108165533.6E3971E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 8 17:55:33 2008 New Revision: 67162 Log: a few compile() and ast doc improvements Modified: python/trunk/Doc/library/ast.rst python/trunk/Doc/library/functions.rst Modified: python/trunk/Doc/library/ast.rst ============================================================================== --- python/trunk/Doc/library/ast.rst (original) +++ python/trunk/Doc/library/ast.rst Sat Nov 8 17:55:33 2008 @@ -21,13 +21,12 @@ 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` +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`. +classes all inherit from :class:`ast.AST`. An abstract syntax tree can be +compiled into a Python code object using the built-in :func:`compile` function. -A modified abstract syntax tree can be compiled into a Python code object using -the built-in :func:`compile` function. Node classes ------------ @@ -126,7 +125,7 @@ .. function:: parse(expr, filename='', mode='exec') Parse an expression into an AST node. Equivalent to ``compile(expr, - filename, mode, PyCF_ONLY_AST)``. + filename, mode, ast.PyCF_ONLY_AST)``. .. function:: literal_eval(node_or_string) Modified: python/trunk/Doc/library/functions.rst ============================================================================== --- python/trunk/Doc/library/functions.rst (original) +++ python/trunk/Doc/library/functions.rst Sat Nov 8 17:55:33 2008 @@ -199,15 +199,8 @@ Compile the *source* into a code or AST object. Code objects can be executed by an :keyword:`exec` statement or evaluated by a call to :func:`eval`. - *source* can either be a string or an AST object. Refer to the :mod:`_ast` - module documentation for information on how to compile into and from AST - objects. - - When compiling a string with multi-line statements, two caveats apply: line - endings must be represented by a single newline character (``'\n'``), and the - input must be terminated by at least one newline character. If line endings - are represented by ``'\r\n'``, use the string :meth:`replace` method to - change them into ``'\n'``. + *source* can either be a string or an AST object. Refer to the :mod:`ast` + module documentation for information on how to work with AST objects. The *filename* argument should give the file from which the code was read; pass some recognizable value if it wasn't read from a file (``''`` is @@ -237,6 +230,14 @@ This function raises :exc:`SyntaxError` if the compiled source is invalid, and :exc:`TypeError` if the source contains null bytes. + .. note:: + + When compiling a string with multi-line statements, line endings must be + represented by a single newline character (``'\n'``), and the input must + be terminated by at least one newline character. If line endings are + represented by ``'\r\n'``, use :meth:`str.replace` to change them into + ``'\n'``. + .. versionadded:: 2.6 Support for compiling AST objects. From python-checkins at python.org Sat Nov 8 18:04:19 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 8 Nov 2008 18:04:19 +0100 (CET) Subject: [Python-checkins] r67163 - python/trunk/Doc/library/functions.rst Message-ID: <20081108170419.236CD1E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 8 18:04:18 2008 New Revision: 67163 Log: move context clue to versionchanged tag Modified: python/trunk/Doc/library/functions.rst Modified: python/trunk/Doc/library/functions.rst ============================================================================== --- python/trunk/Doc/library/functions.rst (original) +++ python/trunk/Doc/library/functions.rst Sat Nov 8 18:04:18 2008 @@ -212,15 +212,15 @@ interactive statement (in the latter case, expression statements that evaluate to something else than ``None`` will be printed). - The optional arguments *flags* and *dont_inherit* (which are new in Python 2.2) - control which future statements (see :pep:`236`) affect the compilation of - *source*. If neither is present (or both are zero) the code is compiled with - those future statements that are in effect in the code that is calling compile. - If the *flags* argument is given and *dont_inherit* is not (or is zero) then the + The optional arguments *flags* and *dont_inherit* control which future + statements (see :pep:`236`) affect the compilation of *source*. If neither + is present (or both are zero) the code is compiled with those future + statements that are in effect in the code that is calling compile. If the + *flags* argument is given and *dont_inherit* is not (or is zero) then the future statements specified by the *flags* argument are used in addition to those that would be used anyway. If *dont_inherit* is a non-zero integer then - the *flags* argument is it -- the future statements in effect around the call to - compile are ignored. + the *flags* argument is it -- the future statements in effect around the call + to compile are ignored. Future statements are specified by bits which can be bitwise ORed together to specify multiple statements. The bitfield required to specify a given feature @@ -238,7 +238,10 @@ represented by ``'\r\n'``, use :meth:`str.replace` to change them into ``'\n'``. - .. versionadded:: 2.6 + .. versionchanged:: 2.3 + The *flags* and *dont_inherit* arguments. + + .. versionchanged:: 2.6 Support for compiling AST objects. From python-checkins at python.org Sat Nov 8 18:07:06 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 8 Nov 2008 18:07:06 +0100 (CET) Subject: [Python-checkins] r67166 - python/trunk/Doc/library/functions.rst Message-ID: <20081108170706.72C541E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 8 18:07:06 2008 New Revision: 67166 Log: clarify what was added Modified: python/trunk/Doc/library/functions.rst Modified: python/trunk/Doc/library/functions.rst ============================================================================== --- python/trunk/Doc/library/functions.rst (original) +++ python/trunk/Doc/library/functions.rst Sat Nov 8 18:07:06 2008 @@ -239,7 +239,7 @@ ``'\n'``. .. versionchanged:: 2.3 - The *flags* and *dont_inherit* arguments. + The *flags* and *dont_inherit* arguments were added. .. versionchanged:: 2.6 Support for compiling AST objects. From python-checkins at python.org Sat Nov 8 18:55:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 8 Nov 2008 18:55:29 +0100 (CET) Subject: [Python-checkins] r67169 - peps/trunk/pep-0000.txt Message-ID: <20081108175529.86D551E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 8 18:55:29 2008 New Revision: 67169 Log: add pep 374 to numerical pep index Modified: peps/trunk/pep-0000.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Sat Nov 8 18:55:29 2008 @@ -481,6 +481,7 @@ SA 371 Addition of the multiprocessing package Noller, Oudkerk S 372 Adding an ordered dictionary to collections Ronacher I 373 Python 2.7 Release Schedule Peterson + P 374 Migrating from svn to a distributed VCS Cannon SR 666 Reject Foolish Indentation Creighton SR 754 IEEE 754 Floating Point Special Values Warnes P 3000 Python 3000 GvR From python-checkins at python.org Sat Nov 8 19:28:31 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 8 Nov 2008 19:28:31 +0100 (CET) Subject: [Python-checkins] r67170 - in sandbox/trunk/2to3/lib2to3: fixes/fix_imports.py tests/test_fixers.py Message-ID: <20081108182831.E9AF11E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 8 19:28:31 2008 New Revision: 67170 Log: fix #4271: fix_imports didn't recognize imports with parenthesis (ie from x import (a, b)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Sat Nov 8 19:28:31 2008 @@ -66,9 +66,9 @@ yield """import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) - yield """import_from< 'from' (%s) 'import' + yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | - import_as_names< any* >) > + import_as_names< any* >) [')'] > """ % mod_name_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > 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 Sat Nov 8 19:28:31 2008 @@ -1470,6 +1470,12 @@ a = "from %s import *" % new self.check(b, a) + def test_parenthesis(self): + for old, new in self.modules.items(): + b = "from %s import (yes, no)" % old + a = "from %s import (yes, no)" % new + self.check(b, a) + def test_import_module_usage(self): for old, new in self.modules.items(): b = """ From python-checkins at python.org Sat Nov 8 19:38:55 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 8 Nov 2008 19:38:55 +0100 (CET) Subject: [Python-checkins] r67171 - in python/trunk: Lib/test/test_syntax.py Python/ast.c Python/compile.c Message-ID: <20081108183855.3FDA11E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 8 19:38:54 2008 New Revision: 67171 Log: check for assignment to __debug__ during AST generation Also, give assignment to None a better error message Modified: python/trunk/Lib/test/test_syntax.py python/trunk/Python/ast.c python/trunk/Python/compile.c Modified: python/trunk/Lib/test/test_syntax.py ============================================================================== --- python/trunk/Lib/test/test_syntax.py (original) +++ python/trunk/Lib/test/test_syntax.py Sat Nov 8 19:38:54 2008 @@ -27,15 +27,13 @@ Errors from set_context(): -TODO(jhylton): "assignment to None" is inconsistent with other messages - >>> obj.None = 1 Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> None = 1 Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) It's a syntax error to assign to the empty tuple. Why isn't it an error to assign to the empty list? It will always raise some error at @@ -95,7 +93,7 @@ >>> def f(None=1): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) From ast_for_arguments(): @@ -108,17 +106,17 @@ >>> def f(x, None): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> def f(*None): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> def f(**None): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) From ast_for_funcdef(): @@ -126,7 +124,7 @@ >>> def None(x): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) From ast_for_call(): @@ -231,7 +229,7 @@ SyntaxError: augmented assignment to generator expression not possible (, line 1) >>> None += 1 Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> f() += 1 Traceback (most recent call last): SyntaxError: illegal expression for augmented assignment (, line 1) Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Nov 8 19:38:54 2008 @@ -130,7 +130,9 @@ forbidden_check(struct compiling *c, const node *n, const char *x) { if (!strcmp(x, "None")) - return ast_error(n, "assignment to None"); + return ast_error(n, "cannot assign to None"); + if (!strcmp(x, "__debug__")) + return ast_error(n, "cannot assign to __debug__"); if (Py_Py3kWarningFlag) { if (!(strcmp(x, "True") && strcmp(x, "False")) && !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sat Nov 8 19:38:54 2008 @@ -2344,12 +2344,6 @@ PyObject *mangled; /* XXX AugStore isn't used anywhere! */ - /* First check for assignment to __debug__. Param? */ - if ((ctx == Store || ctx == AugStore || ctx == Del) - && !strcmp(PyString_AS_STRING(name), "__debug__")) { - return compiler_error(c, "can not assign to __debug__"); - } - mangled = _Py_Mangle(c->u->u_private, name); if (!mangled) return 0; From buildbot at python.org Sat Nov 8 20:04:07 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 08 Nov 2008 19:04:07 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20081108190407.94C101E4002@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/4280 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,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 Nov 9 00:42:09 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 9 Nov 2008 00:42:09 +0100 (CET) Subject: [Python-checkins] r67173 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20081108234209.231F01E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 9 00:42:08 2008 New Revision: 67173 Log: consolidate test Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Sun Nov 9 00:42:08 2008 @@ -1448,6 +1448,10 @@ a = "from %s import foo, bar" % new self.check(b, a) + b = "from %s import (yes, no)" % old + a = "from %s import (yes, no)" % new + self.check(b, a) + def test_import_module_as(self): for old, new in self.modules.items(): b = "import %s as foo_bar" % old @@ -1470,12 +1474,6 @@ a = "from %s import *" % new self.check(b, a) - def test_parenthesis(self): - for old, new in self.modules.items(): - b = "from %s import (yes, no)" % old - a = "from %s import (yes, no)" % new - self.check(b, a) - def test_import_module_usage(self): for old, new in self.modules.items(): b = """ From python-checkins at python.org Sun Nov 9 02:44:33 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 9 Nov 2008 02:44:33 +0100 (CET) Subject: [Python-checkins] r67175 - python/trunk/Doc/documenting/style.rst Message-ID: <20081109014433.2CD0C1E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 9 02:44:32 2008 New Revision: 67175 Log: update link Modified: python/trunk/Doc/documenting/style.rst Modified: python/trunk/Doc/documenting/style.rst ============================================================================== --- python/trunk/Doc/documenting/style.rst (original) +++ python/trunk/Doc/documenting/style.rst Sun Nov 9 02:44:32 2008 @@ -66,5 +66,5 @@ 1970s. -.. _Apple Publications Style Guide: http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/AppleStyleGuide2006.pdf +.. _Apple Publications Style Guide: http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2008.pdf From python-checkins at python.org Sun Nov 9 02:52:32 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 9 Nov 2008 02:52:32 +0100 (CET) Subject: [Python-checkins] r67176 - python/trunk/Lib/string.py Message-ID: <20081109015232.48D3D1E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 9 02:52:32 2008 New Revision: 67176 Log: fix comment Modified: python/trunk/Lib/string.py Modified: python/trunk/Lib/string.py ============================================================================== --- python/trunk/Lib/string.py (original) +++ python/trunk/Lib/string.py Sun Nov 9 02:52:32 2008 @@ -532,9 +532,8 @@ # the Formatter class # see PEP 3101 for details and purpose of this class -# The hard parts are reused from the C implementation. They're -# exposed here via the sys module. sys was chosen because it's always -# available and doesn't have to be dynamically loaded. +# The hard parts are reused from the C implementation. They're exposed as "_" +# prefixed methods of str and unicode. # The overall parser is implemented in str._formatter_parser. # The field name parser is implemented in str._formatter_field_name_split From buildbot at python.org Sun Nov 9 03:21:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 09 Nov 2008 02:21:30 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081109022130.470941E4002@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/314 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: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 522, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ftplib.py", line 203, in run asyncore.loop(timeout=0.1, count=1) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 204, in loop poll_fun(timeout, map) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 141, in poll read(obj) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 413, in handle_read_event self.handle_read() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ssl.py", line 408, in handle_read self.send(data.lower()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 519, in send self.initiate_send() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 506, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 349, in send result = self.socket.send(data) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/socket.py", line 165, in _dummy raise error(EBADF, 'Bad file descriptor') error: [Errno 9] Bad file descriptor 1 test failed: test_ftplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Sun Nov 9 07:22:30 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 9 Nov 2008 01:22:30 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081109062230.GA17397@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Mon Nov 10 04:52:53 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 10 Nov 2008 04:52:53 +0100 (CET) Subject: [Python-checkins] r67177 - in sandbox/trunk/2to3/lib2to3: fixes/fix_metaclass.py tests/test_fixers.py Message-ID: <20081110035253.C97F41E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 10 04:52:52 2008 New Revision: 67177 Log: let the metclass fixer handle complex assignments in the class body gracefully Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py Mon Nov 10 04:52:52 2008 @@ -35,8 +35,9 @@ elif node.type == syms.simple_stmt and node.children: expr_node = node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + left_side = expr_node.children[0] + if isinstance(left_side, Leaf) and \ + left_side.value == '__metaclass__': return True return False 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 Nov 10 04:52:52 2008 @@ -3626,6 +3626,12 @@ """ self.unchanged(s) + s = """ + class X: + a[23] = 74 + """ + self.unchanged(s) + def test_comments(self): b = """ class X: From nnorwitz at gmail.com Mon Nov 10 07:22:29 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 10 Nov 2008 01:22:29 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081110062229.GA9757@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Mon Nov 10 22:26:44 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 10 Nov 2008 22:26:44 +0100 (CET) Subject: [Python-checkins] r67178 - in sandbox/trunk/2to3/lib2to3: fixes/fix_metaclass.py tests/test_fixers.py Message-ID: <20081110212644.054791E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 10 22:26:43 2008 New Revision: 67178 Log: the metaclass fixers shouldn't die when bases are not a simple name Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py Mon Nov 10 22:26:43 2008 @@ -166,12 +166,10 @@ if node.children[3].type == syms.arglist: arglist = node.children[3] # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite]) - elif isinstance(node.children[3], Leaf): + else: parent = node.children[3].clone() arglist = Node(syms.arglist, [parent]) node.set_child(3, arglist) - else: - raise ValueError("Unexpected class inheritance arglist") elif len(node.children) == 6: # Node(classdef, ['class', 'name', '(', ')', ':', suite]) # 0 1 2 3 4 5 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 Nov 10 22:26:43 2008 @@ -3740,6 +3740,26 @@ a = """class m(a, arg=23, metaclass=Meta): pass""" self.check(b, a) + b = """ + class X(expression(2 + 4)): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), metaclass=Meta): + pass + """ + self.check(b, a) + + b = """ + class X(expression(2 + 4), x**4): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), x**4, metaclass=Meta): + pass + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): From python-checkins at python.org Mon Nov 10 22:29:58 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 10 Nov 2008 22:29:58 +0100 (CET) Subject: [Python-checkins] r67179 - in sandbox/trunk/2to3/lib2to3: fixes/fix_import.py tests/test_fixers.py Message-ID: <20081110212958.533391E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 10 22:29:58 2008 New Revision: 67179 Log: allow the fix_import pattern to catch from imports with parenthesis Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_import.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Nov 10 22:29:58 2008 @@ -18,7 +18,7 @@ class FixImport(fixer_base.BaseFix): PATTERN = """ - import_from< type='from' imp=any 'import' any > + import_from< type='from' imp=any 'import' ['('] any [')'] > | import_name< type='import' imp=any > """ 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 Nov 10 22:29:58 2008 @@ -3347,6 +3347,10 @@ a = "from .foo import bar" self.check_both(b, a) + b = "from foo import (bar, baz)" + a = "from .foo import (bar, baz)" + self.check_both(b, a) + def test_dotted_from(self): b = "from green.eggs import ham" a = "from .green.eggs import ham" From python-checkins at python.org Mon Nov 10 23:11:13 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 10 Nov 2008 23:11:13 +0100 (CET) Subject: [Python-checkins] r67180 - in python/trunk/Lib/lib2to3: fixes/fix_import.py fixes/fix_imports.py fixes/fix_metaclass.py refactor.py tests/test_fixers.py Message-ID: <20081110221113.613071E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 10 23:11:12 2008 New Revision: 67180 Log: Merged revisions 66985,67170,67173,67177-67179 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r66985 | benjamin.peterson | 2008-10-20 16:43:46 -0500 (Mon, 20 Oct 2008) | 1 line no need to use nested try, except, finally ........ r67170 | benjamin.peterson | 2008-11-08 12:28:31 -0600 (Sat, 08 Nov 2008) | 1 line fix #4271: fix_imports didn't recognize imports with parenthesis (ie from x import (a, b)) ........ r67173 | benjamin.peterson | 2008-11-08 17:42:08 -0600 (Sat, 08 Nov 2008) | 1 line consolidate test ........ r67177 | benjamin.peterson | 2008-11-09 21:52:52 -0600 (Sun, 09 Nov 2008) | 1 line let the metclass fixer handle complex assignments in the class body gracefully ........ r67178 | benjamin.peterson | 2008-11-10 15:26:43 -0600 (Mon, 10 Nov 2008) | 1 line the metaclass fixers shouldn't die when bases are not a simple name ........ r67179 | benjamin.peterson | 2008-11-10 15:29:58 -0600 (Mon, 10 Nov 2008) | 1 line allow the fix_import pattern to catch from imports with parenthesis ........ Modified: python/trunk/Lib/lib2to3/ (props changed) python/trunk/Lib/lib2to3/fixes/fix_import.py python/trunk/Lib/lib2to3/fixes/fix_imports.py python/trunk/Lib/lib2to3/fixes/fix_metaclass.py python/trunk/Lib/lib2to3/refactor.py python/trunk/Lib/lib2to3/tests/test_fixers.py 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 Mon Nov 10 23:11:12 2008 @@ -18,7 +18,7 @@ class FixImport(fixer_base.BaseFix): PATTERN = """ - import_from< type='from' imp=any 'import' any > + import_from< type='from' imp=any 'import' ['('] any [')'] > | import_name< type='import' imp=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 Mon Nov 10 23:11:12 2008 @@ -66,9 +66,9 @@ yield """import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) - yield """import_from< 'from' (%s) 'import' + yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | - import_as_names< any* >) > + import_as_names< any* >) [')'] > """ % mod_name_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > Modified: python/trunk/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_metaclass.py Mon Nov 10 23:11:12 2008 @@ -35,8 +35,9 @@ elif node.type == syms.simple_stmt and node.children: expr_node = node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + left_side = expr_node.children[0] + if isinstance(left_side, Leaf) and \ + left_side.value == '__metaclass__': return True return False @@ -165,12 +166,10 @@ if node.children[3].type == syms.arglist: arglist = node.children[3] # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite]) - elif isinstance(node.children[3], Leaf): + else: parent = node.children[3].clone() arglist = Node(syms.arglist, [parent]) node.set_child(3, arglist) - else: - raise ValueError("Unexpected class inheritance arglist") elif len(node.children) == 6: # Node(classdef, ['class', 'name', '(', ')', ':', suite]) # 0 1 2 3 4 5 Modified: python/trunk/Lib/lib2to3/refactor.py ============================================================================== --- python/trunk/Lib/lib2to3/refactor.py (original) +++ python/trunk/Lib/lib2to3/refactor.py Mon Nov 10 23:11:12 2008 @@ -363,10 +363,9 @@ self.log_error("Can't create %s: %s", filename, err) return try: - try: - f.write(new_text) - except os.error, err: - self.log_error("Can't write %s: %s", filename, err) + f.write(new_text) + except os.error, err: + self.log_error("Can't write %s: %s", filename, err) finally: f.close() self.log_debug("Wrote changes to %s", filename) 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 Mon Nov 10 23:11:12 2008 @@ -1450,6 +1450,10 @@ a = "from %s import foo, bar" % new self.check(b, a) + b = "from %s import (yes, no)" % old + a = "from %s import (yes, no)" % new + self.check(b, a) + def test_import_module_as(self): for old, new in self.modules.items(): b = "import %s as foo_bar" % old @@ -3345,6 +3349,10 @@ a = "from .foo import bar" self.check_both(b, a) + b = "from foo import (bar, baz)" + a = "from .foo import (bar, baz)" + self.check_both(b, a) + def test_dotted_from(self): b = "from green.eggs import ham" a = "from .green.eggs import ham" @@ -3624,6 +3632,12 @@ """ self.unchanged(s) + s = """ + class X: + a[23] = 74 + """ + self.unchanged(s) + def test_comments(self): b = """ class X: @@ -3732,6 +3746,26 @@ a = """class m(a, arg=23, metaclass=Meta): pass""" self.check(b, a) + b = """ + class X(expression(2 + 4)): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), metaclass=Meta): + pass + """ + self.check(b, a) + + b = """ + class X(expression(2 + 4), x**4): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), x**4, metaclass=Meta): + pass + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): From nnorwitz at gmail.com Mon Nov 10 23:14:23 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 10 Nov 2008 17:14:23 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081110221423.GA14236@python.psfb.org> More important issues: ---------------------- test_poplib leaked [-213, 0, 0] references, sum=-213 Less important issues: ---------------------- test_asynchat leaked [0, 131, -131] references, sum=0 test_cmd_line leaked [-50, 50, 0] references, sum=0 test_smtplib leaked [-88, 88, -7] references, sum=-7 test_socketserver leaked [0, 0, 84] references, sum=84 test_sys leaked [0, -21, 0] references, sum=-21 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From python-checkins at python.org Mon Nov 10 23:21:32 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 10 Nov 2008 23:21:32 +0100 (CET) Subject: [Python-checkins] r67181 - in python/branches/release26-maint: Lib/lib2to3 Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/test_fixers.py Message-ID: <20081110222132.B98981E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 10 23:21:32 2008 New Revision: 67181 Log: Merged revisions 67180 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r67180 | benjamin.peterson | 2008-11-10 16:11:12 -0600 (Mon, 10 Nov 2008) | 29 lines Merged revisions 66985,67170,67173,67177-67179 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r66985 | benjamin.peterson | 2008-10-20 16:43:46 -0500 (Mon, 20 Oct 2008) | 1 line no need to use nested try, except, finally ........ r67170 | benjamin.peterson | 2008-11-08 12:28:31 -0600 (Sat, 08 Nov 2008) | 1 line fix #4271: fix_imports didn't recognize imports with parenthesis (ie from x import (a, b)) ........ r67173 | benjamin.peterson | 2008-11-08 17:42:08 -0600 (Sat, 08 Nov 2008) | 1 line consolidate test ........ r67177 | benjamin.peterson | 2008-11-09 21:52:52 -0600 (Sun, 09 Nov 2008) | 1 line let the metclass fixer handle complex assignments in the class body gracefully ........ r67178 | benjamin.peterson | 2008-11-10 15:26:43 -0600 (Mon, 10 Nov 2008) | 1 line the metaclass fixers shouldn't die when bases are not a simple name ........ r67179 | benjamin.peterson | 2008-11-10 15:29:58 -0600 (Mon, 10 Nov 2008) | 1 line allow the fix_import pattern to catch from imports with parenthesis ........ ................ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/lib2to3/ (props changed) python/branches/release26-maint/Lib/lib2to3/fixes/fix_import.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py python/branches/release26-maint/Lib/lib2to3/refactor.py python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_import.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_import.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_import.py Mon Nov 10 23:21:32 2008 @@ -18,7 +18,7 @@ class FixImport(fixer_base.BaseFix): PATTERN = """ - import_from< type='from' imp=any 'import' any > + import_from< type='from' imp=any 'import' ['('] any [')'] > | import_name< type='import' imp=any > """ Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py Mon Nov 10 23:21:32 2008 @@ -66,9 +66,9 @@ yield """import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) - yield """import_from< 'from' (%s) 'import' + yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | - import_as_names< any* >) > + import_as_names< any* >) [')'] > """ % mod_name_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_metaclass.py Mon Nov 10 23:21:32 2008 @@ -35,8 +35,9 @@ elif node.type == syms.simple_stmt and node.children: expr_node = node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + left_side = expr_node.children[0] + if isinstance(left_side, Leaf) and \ + left_side.value == '__metaclass__': return True return False @@ -165,12 +166,10 @@ if node.children[3].type == syms.arglist: arglist = node.children[3] # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite]) - elif isinstance(node.children[3], Leaf): + else: parent = node.children[3].clone() arglist = Node(syms.arglist, [parent]) node.set_child(3, arglist) - else: - raise ValueError("Unexpected class inheritance arglist") elif len(node.children) == 6: # Node(classdef, ['class', 'name', '(', ')', ':', suite]) # 0 1 2 3 4 5 Modified: python/branches/release26-maint/Lib/lib2to3/refactor.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/refactor.py (original) +++ python/branches/release26-maint/Lib/lib2to3/refactor.py Mon Nov 10 23:21:32 2008 @@ -363,10 +363,9 @@ self.log_error("Can't create %s: %s", filename, err) return try: - try: - f.write(new_text) - except os.error, err: - self.log_error("Can't write %s: %s", filename, err) + f.write(new_text) + except os.error, err: + self.log_error("Can't write %s: %s", filename, err) finally: f.close() self.log_debug("Wrote changes to %s", filename) Modified: python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py Mon Nov 10 23:21:32 2008 @@ -1450,6 +1450,10 @@ a = "from %s import foo, bar" % new self.check(b, a) + b = "from %s import (yes, no)" % old + a = "from %s import (yes, no)" % new + self.check(b, a) + def test_import_module_as(self): for old, new in self.modules.items(): b = "import %s as foo_bar" % old @@ -3345,6 +3349,10 @@ a = "from .foo import bar" self.check_both(b, a) + b = "from foo import (bar, baz)" + a = "from .foo import (bar, baz)" + self.check_both(b, a) + def test_dotted_from(self): b = "from green.eggs import ham" a = "from .green.eggs import ham" @@ -3624,6 +3632,12 @@ """ self.unchanged(s) + s = """ + class X: + a[23] = 74 + """ + self.unchanged(s) + def test_comments(self): b = """ class X: @@ -3732,6 +3746,26 @@ a = """class m(a, arg=23, metaclass=Meta): pass""" self.check(b, a) + b = """ + class X(expression(2 + 4)): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), metaclass=Meta): + pass + """ + self.check(b, a) + + b = """ + class X(expression(2 + 4), x**4): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), x**4, metaclass=Meta): + pass + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): From python-checkins at python.org Tue Nov 11 04:51:34 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 11 Nov 2008 04:51:34 +0100 (CET) Subject: [Python-checkins] r67183 - in sandbox/trunk/2to3/lib2to3: fixes/fix_import.py tests/test_fixers.py Message-ID: <20081111035134.63CB91E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 11 04:51:33 2008 New Revision: 67183 Log: handle 'import x as y' in fix_imports; this still needs more work... Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_import.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Tue Nov 11 04:51:33 2008 @@ -13,7 +13,7 @@ # Local imports from .. import fixer_base from os.path import dirname, join, exists, pathsep -from ..fixer_util import FromImport +from ..fixer_util import FromImport, syms class FixImport(fixer_base.BaseFix): @@ -26,11 +26,14 @@ def transform(self, node, results): imp = results['imp'] - if unicode(imp).startswith('.'): + mod_name = unicode(imp.children[0] if imp.type == syms.dotted_as_name \ + else imp) + + if mod_name.startswith('.'): # Already a new-style import return - if not probably_a_local_import(unicode(imp), self.filename): + if not probably_a_local_import(mod_name, self.filename): # I guess this is a global import -- skip it! return 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 Tue Nov 11 04:51:33 2008 @@ -3370,6 +3370,11 @@ a = "from . import foo, bar" self.check_both(b, a) + def test_import_as(self): + b = "import foo as x" + a = "from . import foo as x" + self.check_both(b, a) + def test_dotted_import(self): b = "import foo.bar" a = "from . import foo.bar" From nnorwitz at gmail.com Tue Nov 11 07:22:31 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 11 Nov 2008 01:22:31 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081111062231.GA13181@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Tue Nov 11 12:41:00 2008 From: python-checkins at python.org (thomas.lee) Date: Tue, 11 Nov 2008 12:41:00 +0100 (CET) Subject: [Python-checkins] r67184 - in python/branches/tlee-ast-optimize: Doc/conf.py Doc/documenting/index.rst Doc/documenting/markup.rst Doc/documenting/rest.rst Doc/documenting/sphinx.rst Doc/documenting/style.rst Doc/library/ast.rst Doc/library/email.parser.rst Doc/library/functions.rst Doc/library/select.rst Doc/library/socket.rst Doc/library/sqlite3.rst Doc/library/threading.rst Doc/tutorial/controlflow.rst Doc/using/cmdline.rst Lib/lib-tk/Tkinter.py Lib/lib2to3 Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/test_fixers.py Lib/string.py Lib/test/test_fileio.py Lib/test/test_io.py Lib/test/test_parser.py Lib/test/test_syntax.py Misc/ACKS Misc/NEWS Modules/_multiprocessing/multiprocessing.h Modules/parsermodule.c Modules/posixmodule.c Modules/readline.c PCbuild/pyd.vsprops PCbuild/pyd_d.vsprops Python/ast.c Python/compile.c Tools/msi/msi.py configure configure.in setup.py Message-ID: <20081111114100.F38C61E4022@bag.python.org> Author: thomas.lee Date: Tue Nov 11 12:40:58 2008 New Revision: 67184 Log: Merged revisions 67077,67082,67089,67091,67098,67101,67117-67120,67123-67125,67143,67149,67154,67157-67159,67162-67163,67166,67171,67175-67176,67180 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r67077 | benjamin.peterson | 2008-11-04 02:14:51 +1100 (Tue, 04 Nov 2008) | 1 line #4048 make the parser module accept relative imports as valid ................ r67082 | hirokazu.yamamoto | 2008-11-04 05:03:06 +1100 (Tue, 04 Nov 2008) | 2 lines Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. Written by Guilherme Polo (gpolo). ................ r67089 | benjamin.peterson | 2008-11-04 07:43:20 +1100 (Tue, 04 Nov 2008) | 1 line clarify by splitting into multiple paragraphs ................ r67091 | benjamin.peterson | 2008-11-04 09:34:57 +1100 (Tue, 04 Nov 2008) | 1 line move a FileIO test to test_fileio ................ r67098 | martin.v.loewis | 2008-11-05 07:40:09 +1100 (Wed, 05 Nov 2008) | 2 lines Issue #4204: Fixed module build errors on FreeBSD 4. ................ r67101 | georg.brandl | 2008-11-05 07:49:35 +1100 (Wed, 05 Nov 2008) | 2 lines #4167: fix markup glitches. ................ r67117 | georg.brandl | 2008-11-06 21:17:58 +1100 (Thu, 06 Nov 2008) | 2 lines #4268: Use correct module for two toplevel functions. ................ r67118 | georg.brandl | 2008-11-06 21:19:11 +1100 (Thu, 06 Nov 2008) | 2 lines #4267: small fixes in sqlite3 docs. ................ r67119 | georg.brandl | 2008-11-06 21:20:49 +1100 (Thu, 06 Nov 2008) | 2 lines #4245: move Thread section to the top. ................ r67120 | martin.v.loewis | 2008-11-07 03:43:00 +1100 (Fri, 07 Nov 2008) | 2 lines Issue #4120: Exclude manifest from extension modules in VS2008. ................ r67123 | georg.brandl | 2008-11-07 05:49:15 +1100 (Fri, 07 Nov 2008) | 2 lines #4247: add "pass" examples to tutorial. ................ r67124 | andrew.kuchling | 2008-11-07 06:23:02 +1100 (Fri, 07 Nov 2008) | 1 line Fix grammar error; reword two paragraphs ................ r67125 | martin.v.loewis | 2008-11-07 06:46:03 +1100 (Fri, 07 Nov 2008) | 2 lines Stop including fake manifest file in DLLs directory. ................ r67143 | georg.brandl | 2008-11-07 19:27:39 +1100 (Fri, 07 Nov 2008) | 2 lines Fix syntax. ................ r67149 | martin.v.loewis | 2008-11-08 05:51:50 +1100 (Sat, 08 Nov 2008) | 1 line Issue #1656675: Register a drop handler for .py* files on Windows. ................ r67154 | hirokazu.yamamoto | 2008-11-08 14:46:17 +1100 (Sat, 08 Nov 2008) | 1 line Issue #4071: ntpath.abspath returned an empty string for long unicode path. ................ r67157 | georg.brandl | 2008-11-08 22:47:44 +1100 (Sat, 08 Nov 2008) | 2 lines Don't use "HOWTO" as the title for all howto .tex files. ................ r67158 | georg.brandl | 2008-11-08 22:48:20 +1100 (Sat, 08 Nov 2008) | 2 lines Update "Documenting" a bit. Concentrate on Python-specifics. ................ r67159 | georg.brandl | 2008-11-08 23:52:25 +1100 (Sat, 08 Nov 2008) | 2 lines Fix warning. ................ r67162 | benjamin.peterson | 2008-11-09 03:55:33 +1100 (Sun, 09 Nov 2008) | 1 line a few compile() and ast doc improvements ................ r67163 | benjamin.peterson | 2008-11-09 04:04:18 +1100 (Sun, 09 Nov 2008) | 1 line move context clue to versionchanged tag ................ r67166 | benjamin.peterson | 2008-11-09 04:07:06 +1100 (Sun, 09 Nov 2008) | 1 line clarify what was added ................ r67171 | benjamin.peterson | 2008-11-09 05:38:54 +1100 (Sun, 09 Nov 2008) | 4 lines check for assignment to __debug__ during AST generation Also, give assignment to None a better error message ................ r67175 | benjamin.peterson | 2008-11-09 12:44:32 +1100 (Sun, 09 Nov 2008) | 1 line update link ................ r67176 | benjamin.peterson | 2008-11-09 12:52:32 +1100 (Sun, 09 Nov 2008) | 1 line fix comment ................ r67180 | benjamin.peterson | 2008-11-11 09:11:12 +1100 (Tue, 11 Nov 2008) | 29 lines Merged revisions 66985,67170,67173,67177-67179 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r66985 | benjamin.peterson | 2008-10-20 16:43:46 -0500 (Mon, 20 Oct 2008) | 1 line no need to use nested try, except, finally ........ r67170 | benjamin.peterson | 2008-11-08 12:28:31 -0600 (Sat, 08 Nov 2008) | 1 line fix #4271: fix_imports didn't recognize imports with parenthesis (ie from x import (a, b)) ........ r67173 | benjamin.peterson | 2008-11-08 17:42:08 -0600 (Sat, 08 Nov 2008) | 1 line consolidate test ........ r67177 | benjamin.peterson | 2008-11-09 21:52:52 -0600 (Sun, 09 Nov 2008) | 1 line let the metclass fixer handle complex assignments in the class body gracefully ........ r67178 | benjamin.peterson | 2008-11-10 15:26:43 -0600 (Mon, 10 Nov 2008) | 1 line the metaclass fixers shouldn't die when bases are not a simple name ........ r67179 | benjamin.peterson | 2008-11-10 15:29:58 -0600 (Mon, 10 Nov 2008) | 1 line allow the fix_import pattern to catch from imports with parenthesis ........ ................ Removed: python/branches/tlee-ast-optimize/Doc/documenting/sphinx.rst Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/conf.py python/branches/tlee-ast-optimize/Doc/documenting/index.rst python/branches/tlee-ast-optimize/Doc/documenting/markup.rst python/branches/tlee-ast-optimize/Doc/documenting/rest.rst python/branches/tlee-ast-optimize/Doc/documenting/style.rst python/branches/tlee-ast-optimize/Doc/library/ast.rst python/branches/tlee-ast-optimize/Doc/library/email.parser.rst python/branches/tlee-ast-optimize/Doc/library/functions.rst python/branches/tlee-ast-optimize/Doc/library/select.rst python/branches/tlee-ast-optimize/Doc/library/socket.rst python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst python/branches/tlee-ast-optimize/Doc/library/threading.rst python/branches/tlee-ast-optimize/Doc/tutorial/controlflow.rst python/branches/tlee-ast-optimize/Doc/using/cmdline.rst python/branches/tlee-ast-optimize/Lib/lib-tk/Tkinter.py python/branches/tlee-ast-optimize/Lib/lib2to3/ (props changed) 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_metaclass.py python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py python/branches/tlee-ast-optimize/Lib/string.py python/branches/tlee-ast-optimize/Lib/test/test_fileio.py python/branches/tlee-ast-optimize/Lib/test/test_io.py python/branches/tlee-ast-optimize/Lib/test/test_parser.py python/branches/tlee-ast-optimize/Lib/test/test_syntax.py python/branches/tlee-ast-optimize/Misc/ACKS python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/_multiprocessing/multiprocessing.h python/branches/tlee-ast-optimize/Modules/parsermodule.c python/branches/tlee-ast-optimize/Modules/posixmodule.c python/branches/tlee-ast-optimize/Modules/readline.c python/branches/tlee-ast-optimize/PCbuild/pyd.vsprops python/branches/tlee-ast-optimize/PCbuild/pyd_d.vsprops python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/compile.c python/branches/tlee-ast-optimize/Tools/msi/msi.py python/branches/tlee-ast-optimize/configure python/branches/tlee-ast-optimize/configure.in python/branches/tlee-ast-optimize/setup.py Modified: python/branches/tlee-ast-optimize/Doc/conf.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/conf.py (original) +++ python/branches/tlee-ast-optimize/Doc/conf.py Tue Nov 11 12:40:58 2008 @@ -128,7 +128,7 @@ ] # Collect all HOWTOs individually latex_documents.extend(('howto/' + fn[:-4], 'howto-' + fn[:-4] + '.tex', - 'HOWTO', _stdauthor, 'howto') + '', _stdauthor, 'howto') for fn in os.listdir('howto') if fn.endswith('.rst') and fn != 'index.rst') Modified: python/branches/tlee-ast-optimize/Doc/documenting/index.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/documenting/index.rst (original) +++ python/branches/tlee-ast-optimize/Doc/documenting/index.rst Tue Nov 11 12:40:58 2008 @@ -8,7 +8,7 @@ The Python language has a substantial body of documentation, much of it contributed by various authors. The markup used for the Python documentation is `reStructuredText`_, developed by the `docutils`_ project, amended by custom -directives and using a toolset named *Sphinx* to postprocess the HTML output. +directives and using a toolset named `Sphinx`_ to postprocess the HTML output. This document describes the style guide for our documentation, the custom reStructuredText markup introduced to support Python documentation and how it @@ -16,6 +16,7 @@ .. _reStructuredText: http://docutils.sf.net/rst.html .. _docutils: http://docutils.sf.net/ +.. _Sphinx: http://sphinx.pocoo.org/ If you're interested in contributing to Python's documentation, there's no need to write reStructuredText if you're not so inclined; plain text contributions @@ -28,7 +29,3 @@ rest.rst markup.rst fromlatex.rst - sphinx.rst - -.. XXX add credits, thanks etc. - Modified: python/branches/tlee-ast-optimize/Doc/documenting/markup.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/documenting/markup.rst (original) +++ python/branches/tlee-ast-optimize/Doc/documenting/markup.rst Tue Nov 11 12:40:58 2008 @@ -8,24 +8,11 @@ Documentation for "standard" reST constructs is not included here, though they are used in the Python documentation. -File-wide metadata ------------------- - -reST has the concept of "field lists"; these are a sequence of fields marked up -like this:: - - :Field name: Field content - -A field list at the very top of a file is parsed as the "docinfo", which in -normal documents can be used to record the author, date of publication and -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: +.. note:: -``nocomments`` - If set, the web application won't display a comment form for a page generated - from this source file. + This is just an overview of Sphinx' extended markup capabilities; full + coverage can be found in `its own documentation + `_. Meta-information markup @@ -88,7 +75,6 @@ authors of the module code, just like ``sectionauthor`` names the author(s) of a piece of documentation. It too does not result in any output currently. - .. note:: It is important to make the section title of a module-describing file @@ -272,7 +258,7 @@ This language is used until the next ``highlightlang`` directive is encountered. -* The valid values for the highlighting language are: +* The values normally used for the highlighting language are: * ``python`` (the default) * ``c`` @@ -799,7 +785,7 @@ ------------- The documentation system provides three substitutions that are defined by default. -They are set in the build configuration file, see :ref:`doc-build-config`. +They are set in the build configuration file :file:`conf.py`. .. describe:: |release| Modified: python/branches/tlee-ast-optimize/Doc/documenting/rest.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/documenting/rest.rst (original) +++ python/branches/tlee-ast-optimize/Doc/documenting/rest.rst Tue Nov 11 12:40:58 2008 @@ -67,12 +67,6 @@ #. This is a numbered list. #. It has two items too. -Note that Sphinx disables the use of enumerated lists introduced by alphabetic -or roman numerals, such as :: - - 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:: @@ -247,5 +241,3 @@ * **Separation of inline markup:** As said above, inline markup spans must be separated from the surrounding text by non-word characters, you have to use an escaped space to get around that. - -.. XXX more? Deleted: python/branches/tlee-ast-optimize/Doc/documenting/sphinx.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/documenting/sphinx.rst Tue Nov 11 12:40:58 2008 +++ (empty file) @@ -1,76 +0,0 @@ -.. highlightlang:: rest - -The Sphinx build system -======================= - -.. XXX: intro... - -.. _doc-build-config: - -The build configuration file ----------------------------- - -The documentation root, that is the ``Doc`` subdirectory of the source -distribution, contains a file named ``conf.py``. This file is called the "build -configuration file", and it contains several variables that are read and used -during a build run. - -These variables are: - -version : string - A string that is used as a replacement for the ``|version|`` reST - substitution. It should be the Python version the documentation refers to. - This consists only of the major and minor version parts, e.g. ``2.5``, even - for version 2.5.1. - -release : string - A string that is used as a replacement for the ``|release|`` reST - substitution. It should be the full version string including - alpha/beta/release candidate tags, e.g. ``2.5.2b3``. - -Both ``release`` and ``version`` can be ``'auto'``, which means that they are -determined at runtime from the ``Include/patchlevel.h`` file, if a complete -Python source distribution can be found, or else from the interpreter running -Sphinx. - -today_fmt : string - A ``strftime`` format that is used to format a replacement for the - ``|today|`` reST substitution. - -today : string - A string that can contain a date that should be written to the documentation - output literally. If this is nonzero, it is used instead of - ``strftime(today_fmt)``. - -unused_files : list of strings - A list of reST filenames that are to be disregarded during building. This - could be docs for temporarily disabled modules or documentation that's not - yet ready for public consumption. - -add_function_parentheses : bool - If true, ``()`` will be appended to the content of ``:func:``, ``:meth:`` and - ``:cfunc:`` cross-references. - -add_module_names : bool - If true, the current module name will be prepended to all description unit - titles (such as ``.. function::``). - -Builder-specific variables -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -html_download_base_url : string - The base URL for download links on the download page. - -html_last_updated_fmt : string - If this is not an empty string, it will be given to ``time.strftime()`` and - written to each generated output file after "last updated on:". - -html_use_smartypants : bool - If true, use SmartyPants to convert quotes and dashes to the typographically - correct entities. - -latex_paper_size : "letter" or "a4" - The paper size option for the LaTeX document class. - -latex_font_size : "10pt", "11pt" or "12pt" - The font size option for the LaTeX document class. \ No newline at end of file Modified: python/branches/tlee-ast-optimize/Doc/documenting/style.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/documenting/style.rst (original) +++ python/branches/tlee-ast-optimize/Doc/documenting/style.rst Tue Nov 11 12:40:58 2008 @@ -66,5 +66,5 @@ 1970s. -.. _Apple Publications Style Guide: http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/AppleStyleGuide2006.pdf +.. _Apple Publications Style Guide: http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2008.pdf 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 Tue Nov 11 12:40:58 2008 @@ -21,13 +21,12 @@ 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` +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`. +classes all inherit from :class:`ast.AST`. An abstract syntax tree can be +compiled into a Python code object using the built-in :func:`compile` function. -A modified abstract syntax tree can be compiled into a Python code object using -the built-in :func:`compile` function. Node classes ------------ @@ -126,7 +125,7 @@ .. function:: parse(expr, filename='', mode='exec') Parse an expression into an AST node. Equivalent to ``compile(expr, - filename, mode, PyCF_ONLY_AST)``. + filename, mode, ast.PyCF_ONLY_AST)``. .. function:: literal_eval(node_or_string) Modified: python/branches/tlee-ast-optimize/Doc/library/email.parser.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/email.parser.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/email.parser.rst Tue Nov 11 12:40:58 2008 @@ -159,6 +159,7 @@ a common task, two functions are provided as a convenience. They are available in the top-level :mod:`email` package namespace. +.. currentmodule:: email .. function:: message_from_string(s[, _class[, strict]]) Modified: python/branches/tlee-ast-optimize/Doc/library/functions.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/functions.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/functions.rst Tue Nov 11 12:40:58 2008 @@ -199,15 +199,8 @@ Compile the *source* into a code or AST object. Code objects can be executed by an :keyword:`exec` statement or evaluated by a call to :func:`eval`. - *source* can either be a string or an AST object. Refer to the :mod:`_ast` - module documentation for information on how to compile into and from AST - objects. - - When compiling a string with multi-line statements, two caveats apply: line - endings must be represented by a single newline character (``'\n'``), and the - input must be terminated by at least one newline character. If line endings - are represented by ``'\r\n'``, use the string :meth:`replace` method to - change them into ``'\n'``. + *source* can either be a string or an AST object. Refer to the :mod:`ast` + module documentation for information on how to work with AST objects. The *filename* argument should give the file from which the code was read; pass some recognizable value if it wasn't read from a file (``''`` is @@ -219,15 +212,15 @@ interactive statement (in the latter case, expression statements that evaluate to something else than ``None`` will be printed). - The optional arguments *flags* and *dont_inherit* (which are new in Python 2.2) - control which future statements (see :pep:`236`) affect the compilation of - *source*. If neither is present (or both are zero) the code is compiled with - those future statements that are in effect in the code that is calling compile. - If the *flags* argument is given and *dont_inherit* is not (or is zero) then the + The optional arguments *flags* and *dont_inherit* control which future + statements (see :pep:`236`) affect the compilation of *source*. If neither + is present (or both are zero) the code is compiled with those future + statements that are in effect in the code that is calling compile. If the + *flags* argument is given and *dont_inherit* is not (or is zero) then the future statements specified by the *flags* argument are used in addition to those that would be used anyway. If *dont_inherit* is a non-zero integer then - the *flags* argument is it -- the future statements in effect around the call to - compile are ignored. + the *flags* argument is it -- the future statements in effect around the call + to compile are ignored. Future statements are specified by bits which can be bitwise ORed together to specify multiple statements. The bitfield required to specify a given feature @@ -237,7 +230,18 @@ This function raises :exc:`SyntaxError` if the compiled source is invalid, and :exc:`TypeError` if the source contains null bytes. - .. versionadded:: 2.6 + .. note:: + + When compiling a string with multi-line statements, line endings must be + represented by a single newline character (``'\n'``), and the input must + be terminated by at least one newline character. If line endings are + represented by ``'\r\n'``, use :meth:`str.replace` to change them into + ``'\n'``. + + .. versionchanged:: 2.3 + The *flags* and *dont_inherit* arguments were added. + + .. versionchanged:: 2.6 Support for compiling AST objects. Modified: python/branches/tlee-ast-optimize/Doc/library/select.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/select.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/select.rst Tue Nov 11 12:40:58 2008 @@ -363,7 +363,7 @@ Filter specific flags - *:const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags* + :const:`KQ_FILTER_READ` and :const:`KQ_FILTER_WRITE` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -372,7 +372,7 @@ +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_VNODE` filter flags* + :const:`KQ_FILTER_VNODE` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -393,7 +393,7 @@ +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_PROC` filter flags* + :const:`KQ_FILTER_PROC` filter flags +----------------------------+--------------------------------------------+ | Constant | Meaning | @@ -416,7 +416,7 @@ | :const:`KQ_NOTE_TRACKERR` | unable to attach to a child | +----------------------------+--------------------------------------------+ - *:const:`KQ_FILTER_NETDEV` filter flags* [not available on Mac OS X] + :const:`KQ_FILTER_NETDEV` filter flags [not available on Mac OS X] +----------------------------+--------------------------------------------+ | Constant | Meaning | 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 Tue Nov 11 12:40:58 2008 @@ -276,11 +276,15 @@ .. function:: gethostname() Return a string containing the hostname of the machine where the Python - interpreter is currently executing. If you want to know the current machine's IP - address, you may want to use ``gethostbyname(gethostname())``. This operation - assumes that there is a valid address-to-host mapping for the host, and the - assumption does not always hold. Note: :func:`gethostname` doesn't always return - the fully qualified domain name; use ``getfqdn()`` (see above). + interpreter is currently executing. + + If you want to know the current machine's IP address, you may want to use + ``gethostbyname(gethostname())``. This operation assumes that there is a + valid address-to-host mapping for the host, and the assumption does not + always hold. + + Note: :func:`gethostname` doesn't always return the fully qualified domain + name; use ``getfqdn()`` (see above). .. function:: gethostbyaddr(ip_address) Modified: python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst Tue Nov 11 12:40:58 2008 @@ -64,10 +64,10 @@ c.execute('select * from stocks where symbol=?', t) # Larger example - for t in (('2006-03-28', 'BUY', 'IBM', 1000, 45.00), + for t in [('2006-03-28', 'BUY', 'IBM', 1000, 45.00), ('2006-04-05', 'BUY', 'MSOFT', 1000, 72.00), ('2006-04-06', 'SELL', 'IBM', 500, 53.00), - ): + ]: c.execute('insert into stocks values (?,?,?,?,?)', t) To retrieve data after executing a SELECT statement, you can either treat the @@ -426,10 +426,9 @@ import sqlite3, os con = sqlite3.connect('existing_db.db') - full_dump = os.linesep.join(con.iterdump()) - f = open('dump.sql', 'w') - f.writelines(full_dump) - f.close() + with open('dump.sql', 'w') as f: + for line in con.iterdump(): + f.write('%s\n' % line) .. _sqlite3-cursor-objects: @@ -813,8 +812,8 @@ If you want **autocommit mode**, then set :attr:`isolation_level` to None. Otherwise leave it at its default, which will result in a plain "BEGIN" -statement, or set it to one of SQLite's supported isolation levels: DEFERRED, -IMMEDIATE or EXCLUSIVE. +statement, or set it to one of SQLite's supported isolation levels: "DEFERRED", +"IMMEDIATE" or "EXCLUSIVE". 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 Tue Nov 11 12:40:58 2008 @@ -180,6 +180,166 @@ All of the methods described below are executed atomically. +.. _thread-objects: + +Thread Objects +-------------- + +This class represents an activity that is run in a separate thread of control. +There are two ways to specify the activity: by passing a callable object to the +constructor, or by overriding the :meth:`run` method in a subclass. No other +methods (except for the constructor) should be overridden in a subclass. In +other words, *only* override the :meth:`__init__` and :meth:`run` methods of +this class. + +Once a thread object is created, its activity must be started by calling the +thread's :meth:`start` method. This invokes the :meth:`run` method in a +separate thread of control. + +Once the thread's activity is started, the thread is considered 'alive'. It +stops being alive when its :meth:`run` method terminates -- either normally, or +by raising an unhandled exception. The :meth:`is_alive` method tests whether the +thread is alive. + +Other threads can call a thread's :meth:`join` method. This blocks the calling +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, and read or +changed through the :attr:`name` attribute. + +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 +through the :attr:`daemon` attribute. + +There is a "main thread" object; this corresponds to the initial thread of +control in the Python program. It is not a daemon thread. + +There is the possibility that "dummy thread objects" are created. These are +thread objects corresponding to "alien threads", which are threads of control +started outside the threading module, such as directly from C code. Dummy +thread objects have limited functionality; they are always considered alive and +daemonic, and cannot be :meth:`join`\ ed. They are never deleted, since it is +impossible to detect the termination of alien threads. + + +.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}) + + This constructor should always be called with keyword arguments. Arguments are: + + *group* should be ``None``; reserved for future extension when a + :class:`ThreadGroup` class is implemented. + + *target* is the callable object to be invoked by the :meth:`run` method. + Defaults to ``None``, meaning nothing is called. + + *name* is the thread name. By default, a unique name is constructed of the form + "Thread-*N*" where *N* is a small decimal number. + + *args* is the argument tuple for the target invocation. Defaults to ``()``. + + *kwargs* is a dictionary of keyword arguments for the target invocation. + Defaults to ``{}``. + + If the subclass overrides the constructor, it must make sure to invoke the base + class constructor (``Thread.__init__()``) before doing anything else to the + thread. + + +.. method:: Thread.start() + + Start the thread's activity. + + It must be called at most once per thread object. It arranges for the object's + :meth:`run` method to be invoked in a separate thread of control. + + This method will raise a :exc:`RuntimeException` if called more than once on the + same thread object. + + +.. method:: Thread.run() + + Method representing the thread'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:: Thread.join([timeout]) + + Wait until the thread terminates. This blocks the calling thread until the + thread whose :meth:`join` method is called terminates -- either normally or + through an unhandled exception -- or until the optional timeout occurs. + + When the *timeout* argument is present and not ``None``, it should be a floating + point number specifying a timeout for the operation in seconds (or fractions + thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive` + after :meth:`join` to decide whether a timeout happened -- if the thread is + still alive, the :meth:`join` call timed out. + + When the *timeout* argument is not present or ``None``, the operation will block + until the thread terminates. + + A thread can be :meth:`join`\ ed many times. + + :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join + the current thread as that would cause a deadlock. It is also an error to + :meth:`join` a thread before it has been started and attempts to do so + raises the same exception. + + +.. method:: Thread.getName() + Thread.setName() + + Old API for :attr:`~Thread.name`. + + +.. attribute:: Thread.name + + A string used for identification purposes only. It has no semantics. + Multiple threads may be given the same name. The initial name is set by the + constructor. + + +.. attribute:: Thread.ident + + 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()` + function. Thread identifiers may be recycled when a thread exits and another + thread is created. The identifier is available even after the thread has + exited. + + .. versionadded:: 2.6 + + +.. method:: Thread.is_alive() + Thread.isAlive() + + Return whether the thread is alive. + + Roughly, a thread is alive from the moment the :meth:`start` method returns + until its :meth:`run` method terminates. The module function :func:`enumerate` + returns a list of all alive threads. + + +.. method:: Thread.isDaemon() + Thread.setDaemon() + + Old API for :attr:`~Thread.daemon`. + + +.. attribute:: Thread.daemon + + The thread's daemon flag. This must be set before :meth:`start` is called, + otherwise :exc:`RuntimeError` is raised. + + The initial value is inherited from the creating thread. + + The entire Python program exits when no alive non-daemon threads are left. + + .. _lock-objects: Lock Objects @@ -539,166 +699,6 @@ thereof). -.. _thread-objects: - -Thread Objects --------------- - -This class represents an activity that is run in a separate thread of control. -There are two ways to specify the activity: by passing a callable object to the -constructor, or by overriding the :meth:`run` method in a subclass. No other -methods (except for the constructor) should be overridden in a subclass. In -other words, *only* override the :meth:`__init__` and :meth:`run` methods of -this class. - -Once a thread object is created, its activity must be started by calling the -thread's :meth:`start` method. This invokes the :meth:`run` method in a -separate thread of control. - -Once the thread's activity is started, the thread is considered 'alive'. It -stops being alive when its :meth:`run` method terminates -- either normally, or -by raising an unhandled exception. The :meth:`is_alive` method tests whether the -thread is alive. - -Other threads can call a thread's :meth:`join` method. This blocks the calling -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, and read or -changed through the :attr:`name` attribute. - -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 -through the :attr:`daemon` attribute. - -There is a "main thread" object; this corresponds to the initial thread of -control in the Python program. It is not a daemon thread. - -There is the possibility that "dummy thread objects" are created. These are -thread objects corresponding to "alien threads", which are threads of control -started outside the threading module, such as directly from C code. Dummy -thread objects have limited functionality; they are always considered alive and -daemonic, and cannot be :meth:`join`\ ed. They are never deleted, since it is -impossible to detect the termination of alien threads. - - -.. class:: Thread(group=None, target=None, name=None, args=(), kwargs={}) - - This constructor should always be called with keyword arguments. Arguments are: - - *group* should be ``None``; reserved for future extension when a - :class:`ThreadGroup` class is implemented. - - *target* is the callable object to be invoked by the :meth:`run` method. - Defaults to ``None``, meaning nothing is called. - - *name* is the thread name. By default, a unique name is constructed of the form - "Thread-*N*" where *N* is a small decimal number. - - *args* is the argument tuple for the target invocation. Defaults to ``()``. - - *kwargs* is a dictionary of keyword arguments for the target invocation. - Defaults to ``{}``. - - If the subclass overrides the constructor, it must make sure to invoke the base - class constructor (``Thread.__init__()``) before doing anything else to the - thread. - - -.. method:: Thread.start() - - Start the thread's activity. - - It must be called at most once per thread object. It arranges for the object's - :meth:`run` method to be invoked in a separate thread of control. - - This method will raise a :exc:`RuntimeException` if called more than once on the - same thread object. - - -.. method:: Thread.run() - - Method representing the thread'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:: Thread.join([timeout]) - - Wait until the thread terminates. This blocks the calling thread until the - thread whose :meth:`join` method is called terminates -- either normally or - through an unhandled exception -- or until the optional timeout occurs. - - When the *timeout* argument is present and not ``None``, it should be a floating - point number specifying a timeout for the operation in seconds (or fractions - thereof). As :meth:`join` always returns ``None``, you must call :meth:`isAlive` - after :meth:`join` to decide whether a timeout happened -- if the thread is - still alive, the :meth:`join` call timed out. - - When the *timeout* argument is not present or ``None``, the operation will block - until the thread terminates. - - A thread can be :meth:`join`\ ed many times. - - :meth:`join` raises a :exc:`RuntimeError` if an attempt is made to join - the current thread as that would cause a deadlock. It is also an error to - :meth:`join` a thread before it has been started and attempts to do so - raises the same exception. - - -.. method:: Thread.getName() - Thread.setName() - - Old API for :attr:`~Thread.name`. - - -.. attribute:: Thread.name - - A string used for identification purposes only. It has no semantics. - Multiple threads may be given the same name. The initial name is set by the - constructor. - - -.. attribute:: Thread.ident - - 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()` - function. Thread identifiers may be recycled when a thread exits and another - thread is created. The identifier is available even after the thread has - exited. - - .. versionadded:: 2.6 - - -.. method:: Thread.is_alive() - Thread.isAlive() - - Return whether the thread is alive. - - Roughly, a thread is alive from the moment the :meth:`start` method returns - until its :meth:`run` method terminates. The module function :func:`enumerate` - returns a list of all alive threads. - - -.. method:: Thread.isDaemon() - Thread.setDaemon() - - Old API for :attr:`~Thread.daemon`. - - -.. attribute:: Thread.daemon - - The thread's daemon flag. This must be set before :meth:`start` is called, - otherwise :exc:`RuntimeError` is raised. - - The initial value is inherited from the creating thread. - - The entire Python program exits when no alive non-daemon threads are left. - - .. _timer-objects: Timer Objects 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 Tue Nov 11 12:40:58 2008 @@ -166,6 +166,41 @@ ... pass # Busy-wait for keyboard interrupt (Ctrl+C) ... +This is commonly used for creating minimal classes such as exceptions, or +for ignoring unwanted exceptions:: + + >>> class ParserError(Exception): + ... pass + ... + >>> try: + ... import audioop + ... except ImportError: + ... pass + ... + +Another place :keyword:`pass` can be used is as a place-holder for a function or +conditional body when you are working on new code, allowing you to keep +thinking at a more abstract level. However, as :keyword:`pass` is silently +ignored, a better choice may be to raise a :exc:`NotImplementedError` +exception:: + + >>> def initlog(*args): + ... raise NotImplementedError # Open logfile if not already open + ... if not logfp: + ... raise NotImplementedError # Set up dummy log back-end + ... raise NotImplementedError('Call log initialization handler') + ... + +If :keyword:`pass` were used here and you later ran tests, they may fail +without indicating why. Using :exc:`NotImplementedError` causes this code +to raise an exception, telling you exactly where the incomplete code +is. Note the two calling styles of the exceptions above. +The first style, with no message but with an accompanying comment, +lets you easily leave the comment when you remove the exception, +which ideally would be a good description for +the block of code the exception is a placeholder for. However, the +third example, providing a message for the exception, will produce +a more useful traceback. .. _tut-functions: 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 Tue Nov 11 12:40:58 2008 @@ -143,8 +143,7 @@ an empty string (``""``) and the current directory will be added to the start of :data:`sys.path`. - .. seealso:: - :ref:`tut-invoking` +.. seealso:: :ref:`tut-invoking` Generic options 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 Tue Nov 11 12:40:58 2008 @@ -1921,6 +1921,8 @@ cnf = _cnfmerge((cnf, kw)) self.widgetName = widgetName BaseWidget._setup(self, master, cnf) + if self._tclCommands is None: + self._tclCommands = [] classes = [] for k in cnf.keys(): if type(k) is ClassType: @@ -2658,20 +2660,20 @@ """Add separator at INDEX.""" self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): - """Delete menu items between INDEX1 and INDEX2 (not included).""" + """Delete menu items between INDEX1 and INDEX2 (included).""" if index2 is None: index2 = index1 - cmds = [] - (num_index1, num_index2) = (self.index(index1), self.index(index2)) - if (num_index1 is not None) and (num_index2 is not None): - for i in range(num_index1, num_index2 + 1): - if 'command' in self.entryconfig(i): - c = str(self.entrycget(i, 'command')) - if c in self._tclCommands: - cmds.append(c) + + num_index1, num_index2 = self.index(index1), self.index(index2) + if (num_index1 is None) or (num_index2 is None): + num_index1, num_index2 = 0, -1 + + for i in range(num_index1, num_index2 + 1): + if 'command' in self.entryconfig(i): + c = str(self.entrycget(i, 'command')) + if c: + self.deletecommand(c) self.tk.call(self._w, 'delete', index1, index2) - for c in cmds: - self.deletecommand(c) def entrycget(self, index, option): """Return the resource value of an menu item for OPTION at INDEX.""" return self.tk.call(self._w, 'entrycget', index, '-' + option) 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 Tue Nov 11 12:40:58 2008 @@ -18,7 +18,7 @@ class FixImport(fixer_base.BaseFix): PATTERN = """ - import_from< type='from' imp=any 'import' any > + import_from< type='from' imp=any 'import' ['('] any [')'] > | import_name< type='import' imp=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 Tue Nov 11 12:40:58 2008 @@ -66,9 +66,9 @@ yield """import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) - yield """import_from< 'from' (%s) 'import' + yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | - import_as_names< any* >) > + import_as_names< any* >) [')'] > """ % mod_name_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py Tue Nov 11 12:40:58 2008 @@ -35,8 +35,9 @@ elif node.type == syms.simple_stmt and node.children: expr_node = node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + left_side = expr_node.children[0] + if isinstance(left_side, Leaf) and \ + left_side.value == '__metaclass__': return True return False @@ -165,12 +166,10 @@ if node.children[3].type == syms.arglist: arglist = node.children[3] # Node(classdef, ['class', 'name', '(', 'Parent', ')', ':', suite]) - elif isinstance(node.children[3], Leaf): + else: parent = node.children[3].clone() arglist = Node(syms.arglist, [parent]) node.set_child(3, arglist) - else: - raise ValueError("Unexpected class inheritance arglist") elif len(node.children) == 6: # Node(classdef, ['class', 'name', '(', ')', ':', suite]) # 0 1 2 3 4 5 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 Tue Nov 11 12:40:58 2008 @@ -363,10 +363,9 @@ self.log_error("Can't create %s: %s", filename, err) return try: - try: - f.write(new_text) - except os.error, err: - self.log_error("Can't write %s: %s", filename, err) + f.write(new_text) + except os.error, err: + self.log_error("Can't write %s: %s", filename, err) finally: f.close() self.log_debug("Wrote changes to %s", filename) 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 Tue Nov 11 12:40:58 2008 @@ -1450,6 +1450,10 @@ a = "from %s import foo, bar" % new self.check(b, a) + b = "from %s import (yes, no)" % old + a = "from %s import (yes, no)" % new + self.check(b, a) + def test_import_module_as(self): for old, new in self.modules.items(): b = "import %s as foo_bar" % old @@ -3345,6 +3349,10 @@ a = "from .foo import bar" self.check_both(b, a) + b = "from foo import (bar, baz)" + a = "from .foo import (bar, baz)" + self.check_both(b, a) + def test_dotted_from(self): b = "from green.eggs import ham" a = "from .green.eggs import ham" @@ -3624,6 +3632,12 @@ """ self.unchanged(s) + s = """ + class X: + a[23] = 74 + """ + self.unchanged(s) + def test_comments(self): b = """ class X: @@ -3732,6 +3746,26 @@ a = """class m(a, arg=23, metaclass=Meta): pass""" self.check(b, a) + b = """ + class X(expression(2 + 4)): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), metaclass=Meta): + pass + """ + self.check(b, a) + + b = """ + class X(expression(2 + 4), x**4): + __metaclass__ = Meta + """ + a = """ + class X(expression(2 + 4), x**4, metaclass=Meta): + pass + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): Modified: python/branches/tlee-ast-optimize/Lib/string.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/string.py (original) +++ python/branches/tlee-ast-optimize/Lib/string.py Tue Nov 11 12:40:58 2008 @@ -532,9 +532,8 @@ # the Formatter class # see PEP 3101 for details and purpose of this class -# The hard parts are reused from the C implementation. They're -# exposed here via the sys module. sys was chosen because it's always -# available and doesn't have to be dynamically loaded. +# The hard parts are reused from the C implementation. They're exposed as "_" +# prefixed methods of str and unicode. # The overall parser is implemented in str._formatter_parser. # The field name parser is implemented in str._formatter_field_name_split Modified: python/branches/tlee-ast-optimize/Lib/test/test_fileio.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_fileio.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_fileio.py Tue Nov 11 12:40:58 2008 @@ -7,7 +7,7 @@ from array import array from weakref import proxy -from test.test_support import TESTFN, findfile, run_unittest +from test.test_support import TESTFN, findfile, check_warnings, run_unittest from UserList import UserList import _fileio @@ -241,6 +241,14 @@ def testInvalidInit(self): self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) + def testWarnings(self): + with check_warnings() as w: + self.assertEqual(w.warnings, []) + self.assertRaises(TypeError, _fileio._FileIO, []) + self.assertEqual(w.warnings, []) + self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt") + self.assertEqual(w.warnings, []) + def test_main(): # Historically, these tests have been sloppy about removing TESTFN. Modified: python/branches/tlee-ast-optimize/Lib/test/test_io.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_io.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_io.py Tue Nov 11 12:40:58 2008 @@ -1236,13 +1236,6 @@ else: self.assert_(issubclass(obj, io.IOBase)) - def test_fileio_warnings(self): - with test_support.check_warnings() as w: - self.assertEqual(w.warnings, []) - self.assertRaises(TypeError, io.FileIO, []) - self.assertEqual(w.warnings, []) - self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt") - self.assertEqual(w.warnings, []) def test_main(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, Modified: python/branches/tlee-ast-optimize/Lib/test/test_parser.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_parser.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_parser.py Tue Nov 11 12:40:58 2008 @@ -1,4 +1,5 @@ import parser +import os import unittest import sys from test import test_support @@ -179,6 +180,7 @@ "from sys.path import (dirname, basename as my_basename)") self.check_suite( "from sys.path import (dirname, basename as my_basename,)") + self.check_suite("from .bogus import x") def test_basic_import_statement(self): self.check_suite("import sys") Modified: python/branches/tlee-ast-optimize/Lib/test/test_syntax.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_syntax.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_syntax.py Tue Nov 11 12:40:58 2008 @@ -27,15 +27,13 @@ Errors from set_context(): -TODO(jhylton): "assignment to None" is inconsistent with other messages - >>> obj.None = 1 Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> None = 1 Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) It's a syntax error to assign to the empty tuple. Why isn't it an error to assign to the empty list? It will always raise some error at @@ -95,7 +93,7 @@ >>> def f(None=1): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) From ast_for_arguments(): @@ -108,17 +106,17 @@ >>> def f(x, None): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> def f(*None): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> def f(**None): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) From ast_for_funcdef(): @@ -126,7 +124,7 @@ >>> def None(x): ... pass Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) From ast_for_call(): @@ -231,7 +229,7 @@ SyntaxError: augmented assignment to generator expression not possible (, line 1) >>> None += 1 Traceback (most recent call last): -SyntaxError: assignment to None (, line 1) +SyntaxError: cannot assign to None (, line 1) >>> f() += 1 Traceback (most recent call last): SyntaxError: illegal expression for augmented assignment (, line 1) Modified: python/branches/tlee-ast-optimize/Misc/ACKS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/ACKS (original) +++ python/branches/tlee-ast-optimize/Misc/ACKS Tue Nov 11 12:40:58 2008 @@ -62,6 +62,7 @@ Steven Bethard Stephen Bevan Ron Bickers +David Binger Dominic Binks Philippe Biondi Stuart Bishop Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Tue Nov 11 12:40:58 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4048: The parser module now correctly validates relative imports. + - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an exec statement. @@ -36,6 +38,9 @@ Library ------- +- Issue #3774: Fixed an error when create a Tkinter menu item without command + and then remove it. + - Fixed a modulefinder crash on certain relative imports. - Issue #4150: Pdb's "up" command now works for generator frames in post-mortem @@ -52,12 +57,18 @@ Build ----- +- Issue #1656675: Register a drop handler for .py* files on Windows. + +- Issue #4120: Exclude manifest from extension modules in VS2008. + - Issue #4091: Install pythonxy.dll in system32 again. - Issue #4018: Disable "for me" installations on Vista. - Issue #3758: Add ``patchcheck`` build target to .PHONY. +- Issue #4204: Fixed module build errors on FreeBSD 4. + C-API ----- 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 Tue Nov 11 12:40:58 2008 @@ -20,7 +20,9 @@ # define SEM_VALUE_MAX LONG_MAX #else # include /* O_CREAT and O_EXCL */ +# include # include +# include # include /* htonl() and ntohl() */ # if HAVE_SEM_OPEN # include 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 Tue Nov 11 12:40:58 2008 @@ -1879,10 +1879,10 @@ count_from_dots(node *tree) { int i; - for (i = 0; i < NCH(tree); i++) + for (i = 1; i < NCH(tree); i++) if (TYPE(CHILD(tree, i)) != DOT) break; - return i; + return i-1; } /* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' | 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 Tue Nov 11 12:40:58 2008 @@ -2389,13 +2389,27 @@ if (unicode_file_names()) { PyUnicodeObject *po; if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { - Py_UNICODE woutbuf[MAX_PATH*2]; + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; Py_UNICODE *wtemp; - if (!GetFullPathNameW(PyUnicode_AS_UNICODE(po), - sizeof(woutbuf)/sizeof(woutbuf[0]), - woutbuf, &wtemp)) - return win32_error("GetFullPathName", ""); - return PyUnicode_FromUnicode(woutbuf, wcslen(woutbuf)); + DWORD result; + PyObject *v; + result = GetFullPathNameW(wpath, + sizeof(woutbuf)/sizeof(woutbuf[0]), + woutbuf, &wtemp); + if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { + woutbufp = malloc(result * sizeof(Py_UNICODE)); + if (!woutbufp) + return PyErr_NoMemory(); + result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); + } + if (result) + v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); + else + v = win32_error_unicode("GetFullPathNameW", wpath); + if (woutbufp != woutbuf) + free(woutbufp); + return v; } /* Drop the argument parsing error as narrow strings are also valid. */ 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 Tue Nov 11 12:40:58 2008 @@ -35,7 +35,11 @@ #define completion_matches(x, y) \ rl_completion_matches((x), ((rl_compentry_func_t *)(y))) #else +#if defined(_RL_FUNCTION_TYPEDEF) extern char **completion_matches(char *, rl_compentry_func_t *); +#else +extern char **completion_matches(char *, CPFunction *); +#endif #endif static void @@ -213,7 +217,11 @@ default completion display. */ rl_completion_display_matches_hook = completion_display_matches_hook ? +#if defined(_RL_FUNCTION_TYPEDEF) (rl_compdisp_func_t *)on_completion_display_matches_hook : 0; +#else + (VFunction *)on_completion_display_matches_hook : 0; +#endif #endif return result; Modified: python/branches/tlee-ast-optimize/PCbuild/pyd.vsprops ============================================================================== --- python/branches/tlee-ast-optimize/PCbuild/pyd.vsprops (original) +++ python/branches/tlee-ast-optimize/PCbuild/pyd.vsprops Tue Nov 11 12:40:58 2008 @@ -1,4 +1,4 @@ - + + + u->u_private, name); if (!mangled) return 0; 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 Tue Nov 11 12:40:58 2008 @@ -940,10 +940,12 @@ root.add_file(manifest[0], **manifest[1]) root.add_file(crtdll[0], **crtdll[1]) # Copy the manifest - manifest_dlls = manifest[0]+".root" - open(manifest_dlls, "w").write(open(manifest[1]['src']).read().replace("msvcr","../msvcr")) - DLLs.start_component("msvcr90_dlls", feature=private_crt) - DLLs.add_file(manifest[0], src=os.path.abspath(manifest_dlls)) + # Actually, don't do that anymore - no DLL in DLLs should have a manifest + # dependency on msvcr90.dll anymore, so this should not be necessary + #manifest_dlls = manifest[0]+".root" + #open(manifest_dlls, "w").write(open(manifest[1]['src']).read().replace("msvcr","../msvcr")) + #DLLs.start_component("msvcr90_dlls", feature=private_crt) + #DLLs.add_file(manifest[0], src=os.path.abspath(manifest_dlls)) # Now start the main component for the DLLs directory; # no regular files have been added to the directory yet. @@ -1180,6 +1182,7 @@ ewi = "Edit with IDLE" pat2 = r"Software\Classes\%sPython.%sFile\DefaultIcon" pat3 = r"Software\Classes\%sPython.%sFile" + pat4 = r"Software\Classes\%sPython.%sFile\shellex\DropHandler" tcl_verbs = [] if have_tcl: tcl_verbs=[ @@ -1227,6 +1230,13 @@ "Python File (no console)", "REGISTRY.def"), ("pyc.txt", -1, pat3 % (testprefix, "Compiled"), "", "Compiled Python File", "REGISTRY.def"), + # Drop Handler + ("py.drop", -1, pat4 % (testprefix, ""), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), + ("pyw.drop", -1, pat4 % (testprefix, "NoCon"), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), + ("pyc.drop", -1, pat4 % (testprefix, "Compiled"), "", + "{60254CA5-953B-11CF-8C96-00AA00B8708C}", "REGISTRY.def"), ]) # Registry keys Modified: python/branches/tlee-ast-optimize/configure ============================================================================== --- python/branches/tlee-ast-optimize/configure (original) +++ python/branches/tlee-ast-optimize/configure Tue Nov 11 12:40:58 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 66295 . +# From configure.in Revision: 66764 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.7. # @@ -2105,11 +2105,18 @@ # but used in struct sockaddr.sa_family. Reported by Tim Rice. SCO_SV/3.2) define_xopen_source=no;; - # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that - # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently, - # this is fixed in 10.3, which identifies itself as Darwin/7.* - # This should hopefully be fixed in FreeBSD 4.9 - FreeBSD/4.8* | Darwin/6* ) + # On FreeBSD 4, the math functions C89 does not cover are never defined + # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. + FreeBSD/4.*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which + # identifies itself as Darwin/7.* + # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # disables platform specific features beyond repair. + # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # has no effect, don't bother defining them + Darwin/[6789].*) define_xopen_source=no;; # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined @@ -2121,13 +2128,6 @@ define_xopen_source=no fi ;; - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - 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) Modified: python/branches/tlee-ast-optimize/configure.in ============================================================================== --- python/branches/tlee-ast-optimize/configure.in (original) +++ python/branches/tlee-ast-optimize/configure.in Tue Nov 11 12:40:58 2008 @@ -276,11 +276,18 @@ # but used in struct sockaddr.sa_family. Reported by Tim Rice. SCO_SV/3.2) define_xopen_source=no;; - # On FreeBSD 4.8 and MacOS X 10.2, a bug in ncurses.h means that - # it craps out if _XOPEN_EXTENDED_SOURCE is defined. Apparently, - # this is fixed in 10.3, which identifies itself as Darwin/7.* - # This should hopefully be fixed in FreeBSD 4.9 - FreeBSD/4.8* | Darwin/6* ) + # On FreeBSD 4, the math functions C89 does not cover are never defined + # with _XOPEN_SOURCE and __BSD_VISIBLE does not re-enable them. + FreeBSD/4.*) + define_xopen_source=no;; + # On MacOS X 10.2, a bug in ncurses.h means that it craps out if + # _XOPEN_EXTENDED_SOURCE is defined. Apparently, this is fixed in 10.3, which + # identifies itself as Darwin/7.* + # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # disables platform specific features beyond repair. + # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE + # has no effect, don't bother defining them + Darwin/@<:@6789@:>@.*) define_xopen_source=no;; # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 500 but # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not defined @@ -292,13 +299,6 @@ define_xopen_source=no fi ;; - # On Mac OS X 10.4, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # disables platform specific features beyond repair. - # On Mac OS X 10.3, defining _POSIX_C_SOURCE or _XOPEN_SOURCE - # has no effect, don't bother defining them - 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) Modified: python/branches/tlee-ast-optimize/setup.py ============================================================================== --- python/branches/tlee-ast-optimize/setup.py (original) +++ python/branches/tlee-ast-optimize/setup.py Tue Nov 11 12:40:58 2008 @@ -1261,7 +1261,7 @@ ) libraries = [] - elif platform in ('freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): + elif platform in ('freebsd4', '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 From buildbot at python.org Tue Nov 11 14:16:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 11 Nov 2008 13:16:41 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081111131641.8D3F81E4013@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/1258 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: christian.heimes BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 11 15:19:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 11 Nov 2008 14:19:15 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081111141915.EF6EC1E4002@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/663 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: christian.heimes BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess ====================================================================== ERROR: test_no_leaking (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_subprocess.py", line 423, in test_no_leaking data = p.communicate(b"lime")[0] File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 671, in communicate return self._communicate(input) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 1171, in _communicate bytes_written = os.write(self.stdin.fileno(), chunk) OSError: [Errno 32] Broken pipe make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 11 21:31:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 11 Nov 2008 20:31:32 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081111203132.40CB71E4002@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/484 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: 3 tests failed: test_calendar test_email test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Nov 11 22:56:06 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 11 Nov 2008 22:56:06 +0100 (CET) Subject: [Python-checkins] r67189 - python/trunk/Doc/library/multiprocessing.rst Message-ID: <20081111215606.A9C091E4022@bag.python.org> Author: benjamin.peterson Date: Tue Nov 11 22:56:06 2008 New Revision: 67189 Log: use correct name 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 Tue Nov 11 22:56:06 2008 @@ -1782,7 +1782,7 @@ Below is an example session with logging turned on:: >>> import multiprocessing, logging - >>> logger = multiprocessing.getLogger() + >>> logger = multiprocessing.get_logger() >>> logger.setLevel(logging.INFO) >>> logger.warning('doomed') [WARNING/MainProcess] doomed From nnorwitz at gmail.com Tue Nov 11 23:14:08 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 11 Nov 2008 17:14:08 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081111221408.GA20613@python.psfb.org> More important issues: ---------------------- test_poplib leaked [-213, 0, 0] references, sum=-213 Less important issues: ---------------------- test_cmd_line leaked [0, 0, -50] references, sum=-50 test_smtplib leaked [88, 0, 0] references, sum=88 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From python-checkins at python.org Wed Nov 12 00:24:51 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 12 Nov 2008 00:24:51 +0100 (CET) Subject: [Python-checkins] r67191 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20081111232451.C534F1E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 12 00:24:51 2008 New Revision: 67191 Log: super() is good Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Wed Nov 12 00:24:51 2008 @@ -2620,7 +2620,7 @@ def check(self, b, a): self.unchanged("from future_builtins import map; " + b, a) - FixerTestCase.check(self, b, a) + super(Test_map, self).check(b, a) def test_prefix_preservation(self): b = """x = map( f, 'abc' )""" @@ -2727,7 +2727,7 @@ def check(self, b, a): self.unchanged("from future_builtins import zip; " + b, a) - FixerTestCase.check(self, b, a) + super(Test_zip, self).check(b, a) def test_zip_basic(self): b = """x = zip(a, b, c)""" @@ -3272,7 +3272,7 @@ fixer = "import" def setUp(self): - FixerTestCase.setUp(self) + super(Test_import, self).setUp() # Need to replace fix_import's exists method # so we can check that it's doing the right thing self.files_checked = [] @@ -3291,9 +3291,9 @@ def check_both(self, b, a): self.always_exists = True - FixerTestCase.check(self, b, a) + super(Test_import, self).check(b, a) self.always_exists = False - FixerTestCase.unchanged(self, b) + super(Test_import, self).unchanged(b) def test_files_checked(self): def p(path): From buildbot at python.org Wed Nov 12 00:36:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 11 Nov 2008 23:36:13 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20081111233613.BACBF1E4002@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/1678 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: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== ERROR: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_cmd_line.py", line 141, in test_run_code self.exit_code('-c', command), File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_cmd_line.py", line 44, in exit_code stderr=subprocess.PIPE) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/subprocess.py", line 399, in call return Popen(*popenargs, **kwargs).wait() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/subprocess.py", line 594, in __init__ errread, errwrite) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/subprocess.py", line 1097, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 00:39:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 11 Nov 2008 23:39:24 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian 3.0 Message-ID: <20081111233925.0C8311E4002@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%203.0/builds/1781 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== ERROR: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_cmd_line.py", line 141, in test_run_code self.exit_code('-c', command), File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_cmd_line.py", line 44, in exit_code stderr=subprocess.PIPE) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/subprocess.py", line 399, in call return Popen(*popenargs, **kwargs).wait() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/subprocess.py", line 594, in __init__ errread, errwrite) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/subprocess.py", line 1097, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 00:43:22 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 11 Nov 2008 23:43:22 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20081111234322.D71101E4002@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/712 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: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== ERROR: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_cmd_line.py", line 141, in test_run_code self.exit_code('-c', command), File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_cmd_line.py", line 44, in exit_code stderr=subprocess.PIPE) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/subprocess.py", line 399, in call return Popen(*popenargs, **kwargs).wait() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/subprocess.py", line 594, in __init__ errread, errwrite) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/subprocess.py", line 1097, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 01:08:33 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 00:08:33 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081112000834.049001E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/399 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,christian.heimes BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 01:30:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 00:30:41 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081112003042.0C26D1E4002@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/745 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: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== ERROR: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_cmd_line.py", line 141, in test_run_code self.exit_code('-c', command), File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_cmd_line.py", line 44, in exit_code stderr=subprocess.PIPE) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/subprocess.py", line 399, in call return Popen(*popenargs, **kwargs).wait() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/subprocess.py", line 594, in __init__ errread, errwrite) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/subprocess.py", line 1097, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 01:30:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 00:30:41 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081112003042.0D9431E4013@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/665 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: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== ERROR: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_cmd_line.py", line 141, in test_run_code self.exit_code('-c', command), File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_cmd_line.py", line 44, in exit_code stderr=subprocess.PIPE) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 399, in call return Popen(*popenargs, **kwargs).wait() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 594, in __init__ errread, errwrite) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 1097, in _execute_child raise child_exception TypeError: execv() arg 2 must contain only strings make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 01:36:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 00:36:40 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081112003640.3DB661E4002@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/1261 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 test Excerpt from the test logfile: 1 test failed: test_doctest make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Nov 12 03:55:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 02:55:30 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081112025530.B016A1E4002@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/488 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 nnorwitz at gmail.com Wed Nov 12 07:22:30 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 12 Nov 2008 01:22:30 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081112062230.GA11174@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Wed Nov 12 07:48:01 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 12 Nov 2008 07:48:01 +0100 (CET) Subject: [Python-checkins] r67195 - python/branches/release24-maint/Misc/NEWS Message-ID: <20081112064801.813151E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 12 07:48:00 2008 New Revision: 67195 Log: - Moved entries added after the 2.4.5 release to a new 2.4.6. entry. Modified: python/branches/release24-maint/Misc/NEWS Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Nov 12 07:48:00 2008 @@ -4,21 +4,15 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) -What's New in Python 2.4.5? +What's New in Python 2.4.6c1? ============================= -*Release date: 11-Mar-2008* - -What's New in Python 2.4.5c1? -============================= - -*Release date: 02-Mar-2008* - +*Release date: xx-XXX-2008* Core and builtins ----------------- -- Apply security patches from Apple. +- Apply security patches from Apple. CVE-2008-2315. - Issue #2620: Overflow checking when allocating or reallocating memory was not always being done properly in some python types and extension @@ -27,6 +21,32 @@ would previously leak memory on the error path when such an allocation failed have been fixed. +Extension Modules +----------------- + +Library +------- + +Tests +----- + +Build +----- + +What's New in Python 2.4.5? +============================= + +*Release date: 11-Mar-2008* + +What's New in Python 2.4.5c1? +============================= + +*Release date: 02-Mar-2008* + + +Core and builtins +----------------- + - 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. From python-checkins at python.org Wed Nov 12 07:54:34 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 12 Nov 2008 07:54:34 +0100 (CET) Subject: [Python-checkins] r67196 - in python/branches/release24-maint: Misc/NEWS Modules/imageop.c Modules/rgbimgmodule.c Message-ID: <20081112065434.2DFFE1E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 12 07:54:33 2008 New Revision: 67196 Log: - Issue #1179: Fix CVE-2007-4965 and CVE-2008-1679, multiple integer overflows in the imageop and rgbimgmodule modules. Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/imageop.c python/branches/release24-maint/Modules/rgbimgmodule.c Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Nov 12 07:54:33 2008 @@ -21,6 +21,9 @@ would previously leak memory on the error path when such an allocation failed have been fixed. +- Issue #1179: Fix CVE-2007-4965 and CVE-2008-1679, multiple integer + overflows in the imageop and rgbimgmodule modules. + Extension Modules ----------------- Modified: python/branches/release24-maint/Modules/imageop.c ============================================================================== --- python/branches/release24-maint/Modules/imageop.c (original) +++ python/branches/release24-maint/Modules/imageop.c Wed Nov 12 07:54:33 2008 @@ -78,7 +78,7 @@ char *cp, *ncp; short *nsp; Py_Int32 *nlp; - int len, size, x, y, newx1, newx2, newy1, newy2; + int len, size, x, y, newx1, newx2, newy1, newy2, nlen; int ix, iy, xstep, ystep; PyObject *rv; @@ -90,13 +90,19 @@ PyErr_SetString(ImageopError, "Size should be 1, 2 or 4"); return 0; } - if ( len != size*x*y ) { + if (( len != size*x*y ) || + ( size != ((len / x) / y) )) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } xstep = (newx1 < newx2)? 1 : -1; ystep = (newy1 < newy2)? 1 : -1; + nlen = (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size; + if ( size != ((nlen / (abs(newx2-newx1)+1)) / (abs(newy2-newy1)+1)) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } rv = PyString_FromStringAndSize(NULL, (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size); if ( rv == 0 ) @@ -132,7 +138,7 @@ char *cp, *ncp; short *nsp; Py_Int32 *nlp; - int len, size, x, y, newx, newy; + int len, size, x, y, newx, newy, nlen; int ix, iy; int oix, oiy; PyObject *rv; @@ -145,12 +151,18 @@ PyErr_SetString(ImageopError, "Size should be 1, 2 or 4"); return 0; } - if ( len != size*x*y ) { + if ( ( len != size*x*y ) || + ( size != ((len / x) / y) ) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } + nlen = newx*newy*size; + if ( size != ((nlen / newx) / newy) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } - rv = PyString_FromStringAndSize(NULL, newx*newy*size); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; ncp = (char *)PyString_AsString(rv); @@ -190,7 +202,8 @@ PyErr_SetString(ImageopError, "Size should be 1 or 4"); return 0; } - if ( maxx*maxy*width != len ) { + if ( ( maxx*maxy*width != len ) || + ( maxx != ((len / maxy) / width) ) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } @@ -240,7 +253,8 @@ if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) ) return 0; - if ( x*y != len ) { + if ( ( x*y != len ) || + ( x != len / y ) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } @@ -281,7 +295,8 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( x*y != len ) { + if ( ( x*y != len ) || + ( x != len / y ) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } @@ -320,7 +335,8 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( x*y != len ) { + if ( ( x*y != len ) || + ( x != len / y ) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } @@ -358,7 +374,8 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( x*y != len ) { + if ( ( x*y != len ) || + ( x != len / y ) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } @@ -404,7 +421,8 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( x*y != len ) { + if ( ( x*y != len ) || + ( x != len / y ) ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } @@ -443,7 +461,11 @@ if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) ) return 0; - nlen = x*y; + nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( (nlen+7)/8 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; @@ -481,6 +503,10 @@ return 0; nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( (nlen+3)/4 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; @@ -517,6 +543,10 @@ return 0; nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( (nlen+1)/2 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; @@ -554,6 +584,10 @@ return 0; nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( nlen*4 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; @@ -598,10 +632,19 @@ return 0; nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( nlen != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } + + if ( nlen / x != y || nlen > INT_MAX / 4) { + PyErr_SetString(ImageopError, "Image is too large"); + return 0; + } rv = PyString_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) @@ -648,6 +691,10 @@ return 0; nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( nlen*4 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; @@ -693,10 +740,19 @@ return 0; nlen = x*y; + if ( x != (nlen / y) ) { + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; + } if ( nlen != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } + + if ( nlen / x != y || nlen > INT_MAX / 4) { + PyErr_SetString(ImageopError, "Image is too large"); + return 0; + } rv = PyString_FromStringAndSize(NULL, nlen*4); if ( rv == 0 ) Modified: python/branches/release24-maint/Modules/rgbimgmodule.c ============================================================================== --- python/branches/release24-maint/Modules/rgbimgmodule.c (original) +++ python/branches/release24-maint/Modules/rgbimgmodule.c Wed Nov 12 07:54:33 2008 @@ -299,6 +299,11 @@ xsize = image.xsize; ysize = image.ysize; zsize = image.zsize; + tablen = xsize * ysize * zsize * sizeof(Py_Int32); + if (xsize != (((tablen / ysize) / zsize) / sizeof(Py_Int32))) { + PyErr_NoMemory(); + goto finally; + } if (rle) { tablen = ysize * zsize * sizeof(Py_Int32); rlebuflen = (int) (1.05 * xsize +10); From python-checkins at python.org Wed Nov 12 08:02:25 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 12 Nov 2008 08:02:25 +0100 (CET) Subject: [Python-checkins] r67197 - in python/branches/release24-maint: Misc/NEWS Modules/zlibmodule.c Message-ID: <20081112070225.192A91E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 12 08:02:24 2008 New Revision: 67197 Log: - Issue #2586: Fix CVE-2008-1721, zlib crash from zlib.decompressobj().flush(val) when val is not positive. Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/zlibmodule.c Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Nov 12 08:02:24 2008 @@ -24,6 +24,9 @@ - Issue #1179: Fix CVE-2007-4965 and CVE-2008-1679, multiple integer overflows in the imageop and rgbimgmodule modules. +- Issue #2586: Fix CVE-2008-1721, zlib crash from + zlib.decompressobj().flush(val) when val is not positive. + Extension Modules ----------------- Modified: python/branches/release24-maint/Modules/zlibmodule.c ============================================================================== --- python/branches/release24-maint/Modules/zlibmodule.c (original) +++ python/branches/release24-maint/Modules/zlibmodule.c Wed Nov 12 08:02:24 2008 @@ -669,6 +669,10 @@ if (!PyArg_ParseTuple(args, "|i:flush", &length)) return NULL; + if (length <= 0) { + PyErr_SetString(PyExc_ValueError, "length must be greater than zero"); + return NULL; + } if (!(retval = PyString_FromStringAndSize(NULL, length))) return NULL; From python-checkins at python.org Wed Nov 12 08:08:51 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 12 Nov 2008 08:08:51 +0100 (CET) Subject: [Python-checkins] r67198 - in python/branches/release24-maint: Misc/NEWS Python/mysnprintf.c Message-ID: <20081112070851.CF61C1E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 12 08:08:51 2008 New Revision: 67198 Log: - Issues #2588, #2589: Fix potential integer underflow and overflow conditions in the PyOS_vsnprintf C API function. CVE-2008-3144. Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Python/mysnprintf.c Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Nov 12 08:08:51 2008 @@ -27,6 +27,9 @@ - Issue #2586: Fix CVE-2008-1721, zlib crash from zlib.decompressobj().flush(val) when val is not positive. +- Issues #2588, #2589: Fix potential integer underflow and overflow + conditions in the PyOS_vsnprintf C API function. CVE-2008-3144. + Extension Modules ----------------- Modified: python/branches/release24-maint/Python/mysnprintf.c ============================================================================== --- python/branches/release24-maint/Python/mysnprintf.c (original) +++ python/branches/release24-maint/Python/mysnprintf.c Wed Nov 12 08:08:51 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 python-checkins at python.org Wed Nov 12 08:21:53 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 12 Nov 2008 08:21:53 +0100 (CET) Subject: [Python-checkins] r67199 - in python/branches/release24-maint: Misc/NEWS Objects/stringobject.c Message-ID: <20081112072153.6FFF21E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 12 08:21:52 2008 New Revision: 67199 Log: - Issue #2587: In the C API, PyString_FromStringAndSize() takes a signed size parameter but was not verifying that it was greater than zero. Values less than zero will now raise a SystemError and return NULL to indicate a bug in the calling C code. CVE-2008-1887. backport r62261, r62271 Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/stringobject.c Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Nov 12 08:21:52 2008 @@ -30,6 +30,11 @@ - Issues #2588, #2589: Fix potential integer underflow and overflow conditions in the PyOS_vsnprintf C API function. CVE-2008-3144. +- Issue #2587: In the C API, PyString_FromStringAndSize() takes a signed size + parameter but was not verifying that it was greater than zero. Values + less than zero will now raise a SystemError and return NULL to indicate a + bug in the calling C code. CVE-2008-1887. + Extension Modules ----------------- Modified: python/branches/release24-maint/Objects/stringobject.c ============================================================================== --- python/branches/release24-maint/Objects/stringobject.c (original) +++ python/branches/release24-maint/Objects/stringobject.c Wed Nov 12 08:21:52 2008 @@ -52,6 +52,13 @@ PyString_FromStringAndSize(const char *str, int 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++; From python-checkins at python.org Wed Nov 12 08:29:24 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 12 Nov 2008 08:29:24 +0100 (CET) Subject: [Python-checkins] r67200 - in python/branches/release24-maint: Lib/test/test_imageop.py Misc/NEWS Modules/imageop.c Message-ID: <20081112072924.26FDE1E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 12 08:29:23 2008 New Revision: 67200 Log: - Security Issue #2: imageop did not validate arguments correctly and could segfault as a result. CVE-2008-4864. backport r66689 Modified: python/branches/release24-maint/Lib/test/test_imageop.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/imageop.c Modified: python/branches/release24-maint/Lib/test/test_imageop.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_imageop.py (original) +++ python/branches/release24-maint/Lib/test/test_imageop.py Wed Nov 12 08:29:23 2008 @@ -5,11 +5,70 @@ Roger E. Masse """ -from test.test_support import verbose, unlink +from test.test_support import verbose, unlink, run_unittest -import imageop, uu, os +import imageop, uu, os, unittest -def main(use_rgbimg=1): +SIZES = (1, 2, 3, 4) +_VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1) +VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES +AAAAA = "A" * 1024 + + +class InputValidationTests(unittest.TestCase): + + def _check(self, name, size=None, *extra): + func = getattr(imageop, name) + for height in VALUES: + for width in VALUES: + strlen = abs(width * height) + if size: + strlen *= size + if strlen < 1024: + data = "A" * strlen + else: + data = AAAAA + if size: + arguments = (data, size, width, height) + extra + else: + arguments = (data, width, height) + extra + try: + func(*arguments) + except (ValueError, imageop.error): + pass + + def check_size(self, name, *extra): + for size in SIZES: + self._check(name, size, *extra) + + def check(self, name, *extra): + self._check(name, None, *extra) + + def test_input_validation(self): + self.check_size("crop", 0, 0, 0, 0) + self.check_size("scale", 1, 0) + self.check_size("scale", -1, -1) + self.check_size("tovideo") + self.check("grey2mono", 128) + self.check("grey2grey4") + self.check("grey2grey2") + self.check("dither2mono") + self.check("dither2grey2") + self.check("mono2grey", 0, 0) + self.check("grey22grey") + self.check("rgb2rgb8") # nlen*4 == len + self.check("rgb82rgb") + self.check("rgb2grey") + self.check("grey2rgb") + + +def test_main(use_rgbimg=True): + run_unittest(InputValidationTests) + + try: + import imgfile + except ImportError: + return # Create binary test files uu.decode(get_qualified_path('testrgb'+os.extsep+'uue'), 'test'+os.extsep+'rgb') @@ -165,7 +224,3 @@ if os.path.exists(fullname): return fullname return name - -# rgbimg (unlike imgfile) is portable to platforms other than SGI. -# So we prefer to use it. -main(use_rgbimg=1) Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Wed Nov 12 08:29:23 2008 @@ -35,6 +35,9 @@ less than zero will now raise a SystemError and return NULL to indicate a bug in the calling C code. CVE-2008-1887. +- Security Issue #2: imageop did not validate arguments correctly and could + segfault as a result. CVE-2008-4864. + Extension Modules ----------------- Modified: python/branches/release24-maint/Modules/imageop.c ============================================================================== --- python/branches/release24-maint/Modules/imageop.c (original) +++ python/branches/release24-maint/Modules/imageop.c Wed Nov 12 08:29:23 2008 @@ -26,6 +26,46 @@ static PyObject *ImageopError; static PyObject *ImageopDict; +/** + * Check a coordonnate, make sure that (0 < value). + * Return 0 on error. + */ +static int +check_coordonnate(int value, const char* name) +{ + if ( 0 < value) + return 1; + PyErr_Format(PyExc_ValueError, "%s value is negative or nul", name); + return 0; +} + +/** + * Check integer overflow to make sure that product == x*y*size. + * Return 0 on error. + */ +static int +check_multiply_size(int product, int x, const char* xname, int y, const char* yname, int size) +{ + if ( !check_coordonnate(x, xname) ) + return 0; + if ( !check_coordonnate(y, yname) ) + return 0; + if ( size == (product / y) / x ) + return 1; + PyErr_SetString(ImageopError, "String has incorrect length"); + return 0; +} + +/** + * Check integer overflow to make sure that product == x*y. + * Return 0 on error. + */ +static int +check_multiply(int product, int x, int y) +{ + return check_multiply_size(product, x, "x", y, "y", 1); +} + /* If this function returns true (the default if anything goes wrong), we're behaving in a backward-compatible way with respect to how multi-byte pixels are stored in the strings. The code in this module was originally written @@ -85,26 +125,21 @@ if ( !PyArg_ParseTuple(args, "s#iiiiiii", &cp, &len, &size, &x, &y, &newx1, &newy1, &newx2, &newy2) ) return 0; - + if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(ImageopError, "Size should be 1, 2 or 4"); return 0; } - if (( len != size*x*y ) || - ( size != ((len / x) / y) )) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(len, x, "x", y, "y", size) ) return 0; - } + xstep = (newx1 < newx2)? 1 : -1; ystep = (newy1 < newy2)? 1 : -1; - + nlen = (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size; - if ( size != ((nlen / (abs(newx2-newx1)+1)) / (abs(newy2-newy1)+1)) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(nlen, abs(newx2-newx1)+1, "abs(newx2-newx1)+1", abs(newy2-newy1)+1, "abs(newy2-newy1)+1", size) ) return 0; - } - rv = PyString_FromStringAndSize(NULL, - (abs(newx2-newx1)+1)*(abs(newy2-newy1)+1)*size); + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; ncp = (char *)PyString_AsString(rv); @@ -131,7 +166,7 @@ } return rv; } - + static PyObject * imageop_scale(PyObject *self, PyObject *args) { @@ -146,22 +181,17 @@ if ( !PyArg_ParseTuple(args, "s#iiiii", &cp, &len, &size, &x, &y, &newx, &newy) ) return 0; - + if ( size != 1 && size != 2 && size != 4 ) { PyErr_SetString(ImageopError, "Size should be 1, 2 or 4"); return 0; } - if ( ( len != size*x*y ) || - ( size != ((len / x) / y) ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(len, x, "x", y, "y", size) ) return 0; - } nlen = newx*newy*size; - if ( size != ((nlen / newx) / newy) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(nlen, newx, "newx", newy, "newy", size) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; @@ -193,8 +223,8 @@ unsigned char *cp, *ncp; int width; PyObject *rv; - - + + if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &width, &maxx, &maxy) ) return 0; @@ -202,12 +232,9 @@ PyErr_SetString(ImageopError, "Size should be 1 or 4"); return 0; } - if ( ( maxx*maxy*width != len ) || - ( maxx != ((len / maxy) / width) ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(len, maxx, "max", maxy, "maxy", width) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, len); if ( rv == 0 ) return 0; @@ -248,17 +275,14 @@ unsigned char ovalue; PyObject *rv; int i, bit; - - + + if ( !PyArg_ParseTuple(args, "s#iii", &cp, &len, &x, &y, &tres) ) return 0; - if ( ( x*y != len ) || - ( x != len / y ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; @@ -290,17 +314,14 @@ PyObject *rv; int i; int pos; - - + + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( ( x*y != len ) || - ( x != len / y ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, (len+1)/2); if ( rv == 0 ) return 0; @@ -330,17 +351,14 @@ PyObject *rv; int i; int pos; - - + + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( ( x*y != len ) || - ( x != len / y ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; @@ -369,17 +387,14 @@ unsigned char ovalue; PyObject *rv; int i, bit; - - + + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( ( x*y != len ) || - ( x != len / y ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, (len+7)/8); if ( rv == 0 ) return 0; @@ -416,17 +431,14 @@ int i; int pos; int sum = 0, nvalue; - - + + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( ( x*y != len ) || - ( x != len / y ) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, (len+3)/4); if ( rv == 0 ) return 0; @@ -457,20 +469,18 @@ unsigned char *cp, *ncp; PyObject *rv; int i, bit; - + if ( !PyArg_ParseTuple(args, "s#iiii", &cp, &len, &x, &y, &v0, &v1) ) return 0; nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(nlen, x, y) ) return 0; - } if ( (nlen+7)/8 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } - + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; @@ -498,20 +508,19 @@ unsigned char *cp, *ncp; PyObject *rv; int i, pos, value = 0, nvalue; - + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(nlen, x, y) ) { return 0; } if ( (nlen+3)/4 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } - + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; @@ -538,20 +547,18 @@ unsigned char *cp, *ncp; PyObject *rv; int i, pos, value = 0, nvalue; - + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(nlen, x, y) ) return 0; - } if ( (nlen+1)/2 != len ) { PyErr_SetString(ImageopError, "String has incorrect length"); return 0; } - + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; @@ -579,20 +586,16 @@ PyObject *rv; int i, r, g, b; int backward_compatible = imageop_backward_compatible(); - + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(len*4, x, "x", y, "y", 4) ) return 0; - } - if ( nlen*4 != len ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + nlen = x*y; + if ( !check_multiply(nlen, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; @@ -627,31 +630,22 @@ int i, r, g, b; unsigned char value; int backward_compatible = imageop_backward_compatible(); - + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); - return 0; - } - if ( nlen != len ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - - if ( nlen / x != y || nlen > INT_MAX / 4) { - PyErr_SetString(ImageopError, "Image is too large"); + nlen = x*y*4; + if ( !check_multiply_size(nlen, x, "x", y, "y", 4) ) return 0; - } - - rv = PyString_FromStringAndSize(NULL, nlen*4); + + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); - for ( i=0; i < nlen; i++ ) { + for ( i=0; i < len; i++ ) { /* Bits in source: RRRBBGGG ** Red and Green are multiplied by 36.5, Blue by 85 */ @@ -686,20 +680,16 @@ int i, r, g, b; int nvalue; int backward_compatible = imageop_backward_compatible(); - + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply_size(len, x, "x", y, "y", 4) ) return 0; - } - if ( nlen*4 != len ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + nlen = x*y; + if ( !check_multiply(nlen, x, y) ) return 0; - } - + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; @@ -735,31 +725,22 @@ int i; unsigned char value; int backward_compatible = imageop_backward_compatible(); - + if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - nlen = x*y; - if ( x != (nlen / y) ) { - PyErr_SetString(ImageopError, "String has incorrect length"); - return 0; - } - if ( nlen != len ) { - PyErr_SetString(ImageopError, "String has incorrect length"); + if ( !check_multiply(len, x, y) ) return 0; - } - - if ( nlen / x != y || nlen > INT_MAX / 4) { - PyErr_SetString(ImageopError, "Image is too large"); + nlen = x*y*4; + if ( !check_multiply_size(nlen, x, "x", y, "y", 4) ) return 0; - } - - rv = PyString_FromStringAndSize(NULL, nlen*4); + + rv = PyString_FromStringAndSize(NULL, nlen); if ( rv == 0 ) return 0; ncp = (unsigned char *)PyString_AsString(rv); - for ( i=0; i < nlen; i++ ) { + for ( i=0; i < len; i++ ) { value = *cp++; if (backward_compatible) { * (Py_UInt32 *) ncp = (Py_UInt32) value | ((Py_UInt32) value << 8 ) | ((Py_UInt32) value << 16); @@ -774,39 +755,6 @@ return rv; } -/* -static object * -imageop_mul(object *self, object *args) -{ - char *cp, *ncp; - int len, size, x, y; - object *rv; - int i; - - if ( !getargs(args, "(s#iii)", &cp, &len, &size, &x, &y) ) - return 0; - - if ( size != 1 && size != 4 ) { - err_setstr(ImageopError, "Size should be 1 or 4"); - return 0; - } - if ( len != size*x*y ) { - err_setstr(ImageopError, "String has incorrect length"); - return 0; - } - - rv = newsizedstringobject(NULL, XXXX); - if ( rv == 0 ) - return 0; - ncp = (char *)getstringvalue(rv); - - - for ( i=0; i < len; i += size ) { - } - return rv; -} -*/ - static PyMethodDef imageop_methods[] = { { "crop", imageop_crop, METH_VARARGS }, { "scale", imageop_scale, METH_VARARGS }, @@ -831,6 +779,7 @@ initimageop(void) { PyObject *m; + m = Py_InitModule("imageop", imageop_methods); if (m == NULL) return; From buildbot at python.org Wed Nov 12 23:02:41 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 22:02:41 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081112220241.459591E4002@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/1265 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_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 13 00:04:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 12 Nov 2008 23:04:45 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081112230447.0F2B51E4002@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/670 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Thu Nov 13 07:22:28 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 13 Nov 2008 01:22:28 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081113062228.GA7723@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Fri Nov 14 01:11:13 2008 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 14 Nov 2008 01:11:13 +0100 (CET) Subject: [Python-checkins] r67216 - python/branches/release25-maint/Lib/optparse.py Message-ID: <20081114001113.679861E4002@bag.python.org> Author: andrew.kuchling Date: Fri Nov 14 01:11:12 2008 New Revision: 67216 Log: Backport r66804: #1415508 from Rocky Bernstein: add docstrings for enable_interspersed_args(), disable_interspersed_args() Modified: python/branches/release25-maint/Lib/optparse.py Modified: python/branches/release25-maint/Lib/optparse.py ============================================================================== --- python/branches/release25-maint/Lib/optparse.py (original) +++ python/branches/release25-maint/Lib/optparse.py Fri Nov 14 01:11:12 2008 @@ -1281,9 +1281,19 @@ self.usage = usage def enable_interspersed_args(self): + """Set parsing to not stop on the first non-option, allowing + interspersing switches with command arguments. This is the + default behavior. See also disable_interspersed_args() and the + class documentation description of the attribute + allow_interspersed_args.""" self.allow_interspersed_args = True def disable_interspersed_args(self): + """Set parsing to stop on the first non-option. Use this if + you have a command processor which runs another command that + has options of its own and you want to make sure these options + don't get confused. + """ self.allow_interspersed_args = False def set_process_default_values(self, process): From python-checkins at python.org Fri Nov 14 01:17:12 2008 From: python-checkins at python.org (andrew.kuchling) Date: Fri, 14 Nov 2008 01:17:12 +0100 (CET) Subject: [Python-checkins] r67217 - python/branches/release25-maint/Lib/optparse.py Message-ID: <20081114001712.978C81E4002@bag.python.org> Author: andrew.kuchling Date: Fri Nov 14 01:17:12 2008 New Revision: 67217 Log: Backport r66813: per Greg Ward, optparse is no longer being externally maintained. Modified: python/branches/release25-maint/Lib/optparse.py Modified: python/branches/release25-maint/Lib/optparse.py ============================================================================== --- python/branches/release25-maint/Lib/optparse.py (original) +++ python/branches/release25-maint/Lib/optparse.py Fri Nov 14 01:17:12 2008 @@ -1,21 +1,13 @@ -"""optparse - a powerful, extensible, and easy-to-use option parser. +"""A powerful, extensible, and easy-to-use option parser. By Greg Ward -Originally distributed as Optik; see http://optik.sourceforge.net/ . - -If you have problems with this module, please do not file bugs, -patches, or feature requests with Python; instead, use Optik's -SourceForge project page: - http://sourceforge.net/projects/optik +Originally distributed as Optik. For support, use the optik-users at lists.sourceforge.net mailing list (http://lists.sourceforge.net/lists/listinfo/optik-users). """ -# Python developers: please do not make changes to this file, since -# it is automatically generated from the Optik source code. - __version__ = "1.5.3" __all__ = ['Option', From buildbot at python.org Fri Nov 14 01:25:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 14 Nov 2008 00:25:51 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20081114002552.129EE1E400C@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/57 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Fri Nov 14 03:23:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 14 Nov 2008 02:23:57 +0000 Subject: [Python-checkins] buildbot failure in MIPSEL Debian 2.5 Message-ID: <20081114022358.2E15C1E4002@bag.python.org> The Buildbot has detected a new failure of MIPSEL Debian 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/MIPSEL%20Debian%202.5/builds/3 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-mipsel Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: andrew.kuchling BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From nnorwitz at gmail.com Fri Nov 14 07:22:31 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 14 Nov 2008 01:22:31 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081114062231.GA16056@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Fri Nov 14 13:17:23 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 14 Nov 2008 13:17:23 +0100 (CET) Subject: [Python-checkins] r67218 - in sandbox/trunk/ttk-gsoc/src: 2.x/test/runtests.py 2.x/test/support.py 2.x/test/test_notebook.py 2.x/test/test_other_widgets.py 2.x/test/test_style.py 2.x/test/test_treeview.py 2.x/ttk.py 3.x/test/runtests.py 3.x/test/support.py 3.x/test/test_notebook.py 3.x/test/test_other_widgets.py 3.x/test/test_style.py 3.x/test/test_treeview.py 3.x/ttk.py Message-ID: <20081114121723.608DB1E4014@bag.python.org> Author: guilherme.polo Date: Fri Nov 14 13:17:22 2008 New Revision: 67218 Log: Style: * Checks _support_default_root before creating a master if one is not given; * Dropped support for passing an option with '-' as prefix in the methods configure, map and lookup; Methods that support option querying now have a simpler form to query a single option (instance.method(..., 'optionname')); Adjusted some tests to match the changes and added some new ones as well; version is now 0.3 Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/runtests.py sandbox/trunk/ttk-gsoc/src/2.x/test/support.py sandbox/trunk/ttk-gsoc/src/2.x/test/test_notebook.py sandbox/trunk/ttk-gsoc/src/2.x/test/test_other_widgets.py sandbox/trunk/ttk-gsoc/src/2.x/test/test_style.py sandbox/trunk/ttk-gsoc/src/2.x/test/test_treeview.py sandbox/trunk/ttk-gsoc/src/2.x/ttk.py sandbox/trunk/ttk-gsoc/src/3.x/test/runtests.py sandbox/trunk/ttk-gsoc/src/3.x/test/support.py sandbox/trunk/ttk-gsoc/src/3.x/test/test_notebook.py sandbox/trunk/ttk-gsoc/src/3.x/test/test_other_widgets.py sandbox/trunk/ttk-gsoc/src/3.x/test/test_style.py sandbox/trunk/ttk-gsoc/src/3.x/test/test_treeview.py sandbox/trunk/ttk-gsoc/src/3.x/ttk.py Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/runtests.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/test/runtests.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/test/runtests.py Fri Nov 14 13:17:22 2008 @@ -1,9 +1,16 @@ import os import sys +import _tkinter # tests in the following modules do not require a running GUI TEXTONLY = ('test_functions.py', ) +def show_tcl_tk(): + tk_ver = _tkinter.TK_VERSION + print "Tcl %s, Tk %s" % (_tkinter.TCL_VERSION, tk_ver) + if float(tk_ver) < 8.5: + print "Will run tests using tile" + def get_tests(gui_tests=True): testdir = os.path.dirname(sys.argv[0]) or os.curdir extension = ".py" @@ -23,6 +30,7 @@ if 'DISPLAY' in os.environ or (len(args) > 1 and "-g" in args): gui_tests = True + show_tcl_tk() run_tests(get_tests(gui_tests)) if not gui_tests: print "\n** GUI tests didn't run **" Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/support.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/test/support.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/test/support.py Fri Nov 14 13:17:22 2008 @@ -1,5 +1,6 @@ import sys import unittest +import _tkinter def run(*classes): suite = unittest.TestSuite() @@ -12,6 +13,7 @@ verbosity = 2 else: verbosity = 0 + runner = unittest.TextTestRunner(sys.stdout, verbosity=verbosity) runner.run(suite) Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/test_notebook.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/test/test_notebook.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/test/test_notebook.py Fri Nov 14 13:17:22 2008 @@ -157,8 +157,11 @@ self.failUnless(isinstance(self.nb.tab(self.child1), dict)) self.failUnlessEqual(self.nb.tab(self.child1, text=None), 'a') + # newer form for querying a single option + self.failUnlessEqual(self.nb.tab(self.child1, 'text'), 'a') self.nb.tab(self.child1, text='abc') self.failUnlessEqual(self.nb.tab(self.child1, text=None), 'abc') + self.failUnlessEqual(self.nb.tab(self.child1, 'text'), 'abc') def test_tabs(self): Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/test_other_widgets.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/test/test_other_widgets.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/test/test_other_widgets.py Fri Nov 14 13:17:22 2008 @@ -378,6 +378,8 @@ self.paned.add(child) self.failUnless(isinstance(self.paned.pane(0), dict)) self.failUnlessEqual(self.paned.pane(0, weight=None), 0) + # newer form for querying a single option + self.failUnlessEqual(self.paned.pane(0, 'weight'), 0) self.failUnlessEqual(self.paned.pane(0), self.paned.pane(str(child))) self.failUnlessRaises(Tkinter.TclError, self.paned.pane, 0, Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/test_style.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/test/test_style.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/test/test_style.py Fri Nov 14 13:17:22 2008 @@ -18,8 +18,6 @@ style = self.style style.configure('TButton', background='yellow') self.failUnlessEqual(style.configure('TButton', 'background'), - style.configure('TButton', '-background')) - self.failUnlessEqual(style.configure('TButton', 'background'), 'yellow') self.failUnless(isinstance(style.configure('TButton'), dict)) @@ -28,8 +26,6 @@ style = self.style style.map('TButton', background=[('active', 'background', 'blue')]) self.failUnlessEqual(style.map('TButton', 'background'), - style.map('TButton', '-background')) - self.failUnlessEqual(style.map('TButton', 'background'), [('active', 'background', 'blue')]) self.failUnless(isinstance(style.map('TButton'), dict)) @@ -39,8 +35,6 @@ style.configure('TButton', background='yellow') style.map('TButton', background=[('active', 'background', 'blue')]) - self.failUnlessEqual(style.lookup('TButton', 'background'), - style.lookup('TButton', '-background')) self.failUnlessEqual(style.lookup('TButton', 'background'), 'yellow') self.failUnlessEqual(style.lookup('TButton', 'background', ['active', 'background']), 'blue') Modified: sandbox/trunk/ttk-gsoc/src/2.x/test/test_treeview.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/2.x/test/test_treeview.py (original) +++ sandbox/trunk/ttk-gsoc/src/2.x/test/test_treeview.py Fri Nov 14 13:17:22 2008 @@ -79,6 +79,8 @@ self.failUnless(isinstance(self.tv.column('#0', width=None), int)) # set a new value for an option self.tv.column('#0', width=10) + # testing new way to get option value + self.failUnlessEqual(self.tv.column('#0', 'width'), 10) self.failUnlessEqual(self.tv.column('#0', width=None), 10) # check read-only option self.failUnlessRaises(Tkinter.TclError, self.tv.column, '#0', id='X') @@ -183,6 +185,7 @@ # check a value is returned self.tv.heading('#0', text='hi') + self.failUnlessEqual(self.tv.heading('#0', 'text'), 'hi') self.failUnlessEqual(self.tv.heading('#0', text=None), 'hi') # invalid option @@ -284,6 +287,7 @@ # unicode values value = u'\xe1ba' item = self.tv.insert('', 'end', values=(value, )) + self.failUnlessEqual(self.tv.item(item, 'values'), (value, )) self.failUnlessEqual(self.tv.item(item, values=None), (value, )) self.tv.item(item, values=list(self.tv.item(item, values=None))) @@ -380,6 +384,19 @@ self.failUnlessEqual(evt, (1, 2)) + def test_tag_configure(self): + # Just testing parameter passing for now + self.failUnlessRaises(TypeError, self.tv.tag_configure) + self.failUnlessRaises(Tkinter.TclError, self.tv.tag_configure, + 'test', sky='blue') + self.tv.tag_configure('test', foreground='blue') + self.failUnlessEqual(self.tv.tag_configure('test', 'foreground'), + 'blue') + self.failUnlessEqual(self.tv.tag_configure('test', foreground=None), + 'blue') + self.failUnless(isinstance(self.tv.tag_configure('test'), dict)) + + def test_main(): support.run(TreeviewTest) 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 Fri Nov 14 13:17:22 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.2.6" +__version__ = "0.3" __author__ = "Guilherme Polo " @@ -84,6 +84,7 @@ opts.append(("-%s" % opt, value)) + # Remember: _flatten skips over None return _flatten(opts) def _format_mapdict(mapdict, script=False): @@ -359,10 +360,12 @@ _name = "ttk::style" def __init__(self, master=None): - if not master: - if not Tkinter._default_root: - Tkinter._default_root = Tkinter.Tk() - master = Tkinter._default_root + if master is None: + if Tkinter._support_default_root: + master = Tkinter._default_root or Tkinter.Tk() + else: + raise RuntimeError("No master specified and Tkinter is " + "configured to not support default master") self.master = master self.tk = self.master.tk @@ -374,13 +377,9 @@ 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 - return self.tk.call(self._name, "configure", style, query_opt) - - return _dict_from_tcltuple( - self.tk.call( - self._name, "configure", style, *(_format_optdict(kw)))) + if query_opt is not None: + kw[query_opt] = None + return _val_or_dict(kw, self.tk.call, self._name, "configure", style) def map(self, style, query_opt=None, **kw): @@ -391,10 +390,9 @@ tuple (usually) containing statespecs grouped in tuples, or list, 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 + if query_opt is not None: return _list_from_statespec( - self.tk.call(self._name, "map", style, query_opt)) + self.tk.call(self._name, "map", style, '-%s' % query_opt)) return _dict_from_tcltuple( self.tk.call(self._name, "map", style, *(_format_mapdict(kw)))) @@ -407,9 +405,9 @@ 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 - return self.tk.call(self._name, "lookup", style, option, state, default) + return self.tk.call(self._name, "lookup", style, '-%s' % option, + state, default) def layout(self, style, layoutspec=None): @@ -898,12 +896,14 @@ return self.tk.call(self._w, "select", tab_id) - def tab(self, tab_id, **kw): + def tab(self, tab_id, option=None, **kw): """Query or modify the options of the specific tab. - If no option is specified, returns a dictionary of the tab option - values. If one option is specified, returns the value of that - option. Otherwise, sets the options to the corresponding values.""" + If kw is not given, returns a dict of the tab option values. If option + is specified, returns the value of that option. Otherwise, sets the + options to the corresponding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "tab", tab_id) @@ -972,13 +972,15 @@ self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw))) - def pane(self, pane, **kw): + def pane(self, pane, option=None, **kw): """Query or modify the options of the specified pane. - pane is either an integer index or the name of a managed - subwindow. If no options are specified, returns a dict of the - pane option values, if an option is specified without a value, - returns the value of that option. Otherwise, the options are set.""" + pane is either an integer index or the name of a managed subwindow. + If kw is not given, returns a dict of the pane option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the correspoding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "pane", pane) @@ -1209,13 +1211,14 @@ self.tk.call(self._w, "children", item, newchildren) - def column(self, column, **kw): + def column(self, column, option=None, **kw): """Query or modify the options for the specified column. - If no options are specified, returns a dictionary of option/value - pairs. If an option is specified with value None, returns the - value of that option. Otherwise, the options are updated with the - specified values.""" + If kw is not given, returns a dict of the column option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "column", column) @@ -1246,9 +1249,13 @@ return self.tk.call(self._w, "focus", item) - def heading(self, column, **kw): + def heading(self, column, option=None, **kw): """Query or modify the heading options for the specified column. + If kw is not given, returns a dict of the heading option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values. + Valid options/values are: text: text The text to display in the column heading @@ -1268,6 +1275,9 @@ # callback not registered yet, do it now kw['command'] = self.master.register(cmd, self._substitute) + if option is not None: + kw[option] = None + return _val_or_dict(kw, self.tk.call, self._w, 'heading', column) @@ -1338,13 +1348,14 @@ return res - def item(self, item, **kw): + def item(self, item, option=None, **kw): """Query or modify the options for the specified item. - If no options are specified, returns a dictionary of option/value - pairs. If a single option is specified with value None, returns - the value of that option. Otherwise, the item's options are - updated with the specified values.""" + If kw is not given, returns a dict of item option values. If option + is specified then the value for that option is returned. Otherwise, + sets the options to the corresponding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "item", item) @@ -1431,15 +1442,15 @@ self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0) - def tag_configure(self, tagname, **kw): + def tag_configure(self, tagname, option=None, **kw): """Query or modify the options for the specified tagname. - If one or more option/value pairs are specified, sets the value - of those options for the specified tag. If a single option - is specified with value None, returns the value of that option - (or the empty string if the option has not been specified for - tagname). With no additional arguments, returns a dictionary of - the option settings for tagname.""" + If kw is not given, returns a dict of the option settings for tagname. + If option is specified, returns the value for that option for the + specified tagname. Otherwise, sets the options to the corresponding + values for the given tagname.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "tag", "configure", tagname) Modified: sandbox/trunk/ttk-gsoc/src/3.x/test/runtests.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/test/runtests.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/test/runtests.py Fri Nov 14 13:17:22 2008 @@ -1,9 +1,16 @@ import os import sys +import _tkinter # tests in the following modules do not require a running GUI TEXTONLY = ('test_functions.py', ) +def show_tcl_tk(): + tk_ver = _tkinter.TK_VERSION + print("Tcl %s, Tk %s" % (_tkinter.TCL_VERSION, tk_ver)) + if float(tk_ver) < 8.5: + print("Will run tests using tile") + def get_tests(gui_tests=True): testdir = os.path.dirname(sys.argv[0]) or os.curdir extension = ".py" @@ -23,6 +30,7 @@ if 'DISPLAY' in os.environ or (len(args) > 1 and "-g" in args): gui_tests = True + show_tcl_tk() run_tests(get_tests(gui_tests)) if not gui_tests: print("\n** GUI tests didn't run **") Modified: sandbox/trunk/ttk-gsoc/src/3.x/test/support.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/test/support.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/test/support.py Fri Nov 14 13:17:22 2008 @@ -12,6 +12,7 @@ verbosity = 2 else: verbosity = 0 + runner = unittest.TextTestRunner(sys.stdout, verbosity=verbosity) runner.run(suite) Modified: sandbox/trunk/ttk-gsoc/src/3.x/test/test_notebook.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/test/test_notebook.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/test/test_notebook.py Fri Nov 14 13:17:22 2008 @@ -157,8 +157,11 @@ self.failUnless(isinstance(self.nb.tab(self.child1), dict)) self.failUnlessEqual(self.nb.tab(self.child1, text=None), 'a') + # newer form for querying a single option + self.failUnlessEqual(self.nb.tab(self.child1, 'text'), 'a') self.nb.tab(self.child1, text='abc') self.failUnlessEqual(self.nb.tab(self.child1, text=None), 'abc') + self.failUnlessEqual(self.nb.tab(self.child1, 'text'), 'abc') def test_tabs(self): Modified: sandbox/trunk/ttk-gsoc/src/3.x/test/test_other_widgets.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/test/test_other_widgets.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/test/test_other_widgets.py Fri Nov 14 13:17:22 2008 @@ -378,6 +378,8 @@ self.paned.add(child) self.failUnless(isinstance(self.paned.pane(0), dict)) self.failUnlessEqual(self.paned.pane(0, weight=None), 0) + # newer form for querying a single option + self.failUnlessEqual(self.paned.pane(0, 'weight'), 0) self.failUnlessEqual(self.paned.pane(0), self.paned.pane(str(child))) self.failUnlessRaises(tkinter.TclError, self.paned.pane, 0, Modified: sandbox/trunk/ttk-gsoc/src/3.x/test/test_style.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/test/test_style.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/test/test_style.py Fri Nov 14 13:17:22 2008 @@ -18,8 +18,6 @@ style = self.style style.configure('TButton', background='yellow') self.failUnlessEqual(style.configure('TButton', 'background'), - style.configure('TButton', '-background')) - self.failUnlessEqual(style.configure('TButton', 'background'), 'yellow') self.failUnless(isinstance(style.configure('TButton'), dict)) @@ -28,8 +26,6 @@ style = self.style style.map('TButton', background=[('active', 'background', 'blue')]) self.failUnlessEqual(style.map('TButton', 'background'), - style.map('TButton', '-background')) - self.failUnlessEqual(style.map('TButton', 'background'), [('active', 'background', 'blue')]) self.failUnless(isinstance(style.map('TButton'), dict)) @@ -39,8 +35,6 @@ style.configure('TButton', background='yellow') style.map('TButton', background=[('active', 'background', 'blue')]) - self.failUnlessEqual(style.lookup('TButton', 'background'), - style.lookup('TButton', '-background')) self.failUnlessEqual(style.lookup('TButton', 'background'), 'yellow') self.failUnlessEqual(style.lookup('TButton', 'background', ['active', 'background']), 'blue') Modified: sandbox/trunk/ttk-gsoc/src/3.x/test/test_treeview.py ============================================================================== --- sandbox/trunk/ttk-gsoc/src/3.x/test/test_treeview.py (original) +++ sandbox/trunk/ttk-gsoc/src/3.x/test/test_treeview.py Fri Nov 14 13:17:22 2008 @@ -79,6 +79,8 @@ self.failUnless(isinstance(self.tv.column('#0', width=None), int)) # set a new value for an option self.tv.column('#0', width=10) + # testing new way to get option value + self.failUnlessEqual(self.tv.column('#0', 'width'), 10) self.failUnlessEqual(self.tv.column('#0', width=None), 10) # check read-only option self.failUnlessRaises(tkinter.TclError, self.tv.column, '#0', id='X') @@ -183,6 +185,7 @@ # check a value is returned self.tv.heading('#0', text='hi') + self.failUnlessEqual(self.tv.heading('#0', 'text'), 'hi') self.failUnlessEqual(self.tv.heading('#0', text=None), 'hi') # invalid option @@ -284,6 +287,7 @@ # unicode values value = '\xe1ba' item = self.tv.insert('', 'end', values=(value, )) + self.failUnlessEqual(self.tv.item(item, 'values'), (value, )) self.failUnlessEqual(self.tv.item(item, values=None), (value, )) self.tv.item(item, values=list(self.tv.item(item, values=None))) @@ -380,6 +384,19 @@ self.failUnlessEqual(evt, (1, 2)) + def test_tag_configure(self): + # Just testing parameter passing for now + self.failUnlessRaises(TypeError, self.tv.tag_configure) + self.failUnlessRaises(tkinter.TclError, self.tv.tag_configure, + 'test', sky='blue') + self.tv.tag_configure('test', foreground='blue') + self.failUnlessEqual(self.tv.tag_configure('test', 'foreground'), + 'blue') + self.failUnlessEqual(self.tv.tag_configure('test', foreground=None), + 'blue') + self.failUnless(isinstance(self.tv.tag_configure('test'), dict)) + + def test_main(): support.run(TreeviewTest) 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 Fri Nov 14 13:17:22 2008 @@ -12,7 +12,7 @@ of the widgets appearance lies at Themes. """ -__version__ = "0.2.6" +__version__ = "0.3" __author__ = "Guilherme Polo " @@ -84,6 +84,7 @@ opts.append(("-%s" % opt, value)) + # Remember: _flatten skips over None return _flatten(opts) def _format_mapdict(mapdict, script=False): @@ -359,10 +360,12 @@ _name = "ttk::style" def __init__(self, master=None): - if not master: - if not tkinter._default_root: - tkinter._default_root = tkinter.Tk() - master = tkinter._default_root + if master is None: + if tkinter._support_default_root: + master = tkinter._default_root or tkinter.Tk() + else: + raise RuntimeError("No master specified and tkinter is " + "configured to not support default master") self.master = master self.tk = self.master.tk @@ -374,13 +377,9 @@ 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 - return self.tk.call(self._name, "configure", style, query_opt) - - return _dict_from_tcltuple( - self.tk.call( - self._name, "configure", style, *(_format_optdict(kw)))) + if query_opt is not None: + kw[query_opt] = None + return _val_or_dict(kw, self.tk.call, self._name, "configure", style) def map(self, style, query_opt=None, **kw): @@ -391,10 +390,9 @@ tuple (usually) containing statespecs grouped in tuples, or list, 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 + if query_opt is not None: return _list_from_statespec( - self.tk.call(self._name, "map", style, query_opt)) + self.tk.call(self._name, "map", style, '-%s' % query_opt)) return _dict_from_tcltuple( self.tk.call(self._name, "map", style, *(_format_mapdict(kw)))) @@ -407,9 +405,9 @@ 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 - return self.tk.call(self._name, "lookup", style, option, state, default) + return self.tk.call(self._name, "lookup", style, '-%s' % option, + state, default) def layout(self, style, layoutspec=None): @@ -785,7 +783,7 @@ """ Widget.__init__(self, master, "ttk::labelframe", kw) -LabelFrame = Labelframe # Tkinter name compatibility +LabelFrame = Labelframe # tkinter name compatibility class Menubutton(Widget): @@ -898,12 +896,14 @@ return self.tk.call(self._w, "select", tab_id) - def tab(self, tab_id, **kw): + def tab(self, tab_id, option=None, **kw): """Query or modify the options of the specific tab. - If no option is specified, returns a dictionary of the tab option - values. If one option is specified, returns the value of that - option. Otherwise, sets the options to the corresponding values.""" + If kw is not given, returns a dict of the tab option values. If option + is specified, returns the value of that option. Otherwise, sets the + options to the corresponding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "tab", tab_id) @@ -972,13 +972,15 @@ self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw))) - def pane(self, pane, **kw): + def pane(self, pane, option=None, **kw): """Query or modify the options of the specified pane. - pane is either an integer index or the name of a managed - subwindow. If no options are specified, returns a dict of the - pane option values, if an option is specified without a value, - returns the value of that option. Otherwise, the options are set.""" + pane is either an integer index or the name of a managed subwindow. + If kw is not given, returns a dict of the pane option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the correspoding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "pane", pane) @@ -992,7 +994,7 @@ Returns the new position of sash number index.""" return self.tk.call(self._w, "sashpos", index, newpos) -PanedWindow = Panedwindow # Tkinter name compatibility +PanedWindow = Panedwindow # tkinter name compatibility class Progressbar(Widget): @@ -1209,13 +1211,14 @@ self.tk.call(self._w, "children", item, newchildren) - def column(self, column, **kw): + def column(self, column, option=None, **kw): """Query or modify the options for the specified column. - If no options are specified, returns a dictionary of option/value - pairs. If an option is specified with value None, returns the - value of that option. Otherwise, the options are updated with the - specified values.""" + If kw is not given, returns a dict of the column option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "column", column) @@ -1246,9 +1249,13 @@ return self.tk.call(self._w, "focus", item) - def heading(self, column, **kw): + def heading(self, column, option=None, **kw): """Query or modify the heading options for the specified column. + If kw is not given, returns a dict of the heading option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values. + Valid options/values are: text: text The text to display in the column heading @@ -1268,6 +1275,9 @@ # callback not registered yet, do it now kw['command'] = self.master.register(cmd, self._substitute) + if option is not None: + kw[option] = None + return _val_or_dict(kw, self.tk.call, self._w, 'heading', column) @@ -1338,13 +1348,14 @@ return res - def item(self, item, **kw): + def item(self, item, option=None, **kw): """Query or modify the options for the specified item. - If no options are specified, returns a dictionary of option/value - pairs. If a single option is specified with value None, returns - the value of that option. Otherwise, the item's options are - updated with the specified values.""" + If kw is not given, returns a dict of item option values. If option + is specified then the value for that option is returned. Otherwise, + sets the options to the corresponding values.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "item", item) @@ -1431,15 +1442,15 @@ self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0) - def tag_configure(self, tagname, **kw): + def tag_configure(self, tagname, option=None, **kw): """Query or modify the options for the specified tagname. - If one or more option/value pairs are specified, sets the value - of those options for the specified tag. If a single option - is specified with value None, returns the value of that option - (or the empty string if the option has not been specified for - tagname). With no additional arguments, returns a dictionary of - the option settings for tagname.""" + If kw is not given, returns a dict of the option settings for tagname. + If option is specified, returns the value for that option for the + specified tagname. Otherwise, sets the options to the corresponding + values for the given tagname.""" + if option is not None: + kw[option] = None return _val_or_dict(kw, self.tk.call, self._w, "tag", "configure", tagname) @@ -1448,7 +1459,7 @@ """If item is specified, returns 1 or 0 depending on whether the specified item has the given tagname. Otherwise, returns a list of all items which have the specified tag. - + * Availability: Tk 8.6""" return self.tk.call(self._w, "tag", "has", tagname, item) @@ -1555,7 +1566,7 @@ class OptionMenu(Menubutton): - """Themed OptionMenu, based after Tkinter's OptionMenu, which allows + """Themed OptionMenu, based after tkinter's OptionMenu, which allows the user to select a value from a menu.""" def __init__(self, master, variable, default=None, *values, **kwargs): From python-checkins at python.org Fri Nov 14 13:33:42 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 14 Nov 2008 13:33:42 +0100 (CET) Subject: [Python-checkins] r67219 - in sandbox/trunk/ttk-gsoc/src: 2.x/ttk.py 3.x/ttk.py Message-ID: <20081114123342.CF2DB1E4002@bag.python.org> Author: guilherme.polo Date: Fri Nov 14 13:33:42 2008 New Revision: 67219 Log: Minor docstring correction 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 Fri Nov 14 13:33:42 2008 @@ -897,7 +897,7 @@ def tab(self, tab_id, option=None, **kw): - """Query or modify the options of the specific tab. + """Query or modify the options of the specific tab_id. If kw is not given, returns a dict of the tab option values. If option is specified, returns the value of that option. Otherwise, sets the 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 Fri Nov 14 13:33:42 2008 @@ -897,7 +897,7 @@ def tab(self, tab_id, option=None, **kw): - """Query or modify the options of the specific tab. + """Query or modify the options of the specific tab_id. If kw is not given, returns a dict of the tab option values. If option is specified, returns the value of that option. Otherwise, sets the From python-checkins at python.org Fri Nov 14 13:41:42 2008 From: python-checkins at python.org (guilherme.polo) Date: Fri, 14 Nov 2008 13:41:42 +0100 (CET) Subject: [Python-checkins] r67220 - sandbox/trunk/ttk-gsoc/Doc/library/ttk.rst Message-ID: <20081114124142.5FFE81E4002@bag.python.org> Author: guilherme.polo Date: Fri Nov 14 13:41:41 2008 New Revision: 67220 Log: Updated to match current method signatures 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 Fri Nov 14 13:41:41 2008 @@ -259,7 +259,7 @@ *x* and *y* are pixel coordinates relative to the widget. - .. method:: instate(statespec[, callback=None[, *args[, **kwargs]]]) + .. method:: instate(statespec[, callback=None[, *args[, **kw]]]) Test the widget's state. If a callback is not specified, returns True if the widget state matches *statespec* and False otherwise. If callback @@ -516,12 +516,12 @@ omitted, returns the widget name of the currently selected pane. - .. method:: tab(tab_id, **kw) + .. method:: tab(tab_id[, option=None[, **kw]]) Query or modify the options of the specific *tab_id*. - If no option is specified, returns a dictionary of the tab option values. - If one option is specified, returns the value of that option. Otherwise, + If *kw* is not given, returns a dict of the tab option values. If + *option* is specified, returns the value of that *option*. Otherwise, sets the options to the corresponding values. @@ -863,13 +863,13 @@ *item*'s children. - .. method:: column(column, **kw) + .. method:: column(column[, option=None[, **kw]]) Query or modify the options for the specified *column*. - If no options are specified, returns a dictionary of option/value pairs. - If an option is specified with value None, returns the value of that - option. Otherwise, the options are updated with the specified values. + If *kw* is not given, returns a dict of the column option values. If + *option* is specified then the value for that *option* is returned. + Otherwise, sets the options to the corresponding values. The valid options/values are: @@ -919,10 +919,14 @@ the current focus item, or '' if there is none. - .. method:: heading(column, **kw) + .. method:: heading(column[, option=None[, **kw]]) Query or modify the heading options for the specified *column*. + If *kw* is not given, returns a dict of the heading option values. If + *option* is specified then the value for that *option* is returned. + Otherwise, sets the options to the corresponding values. + The valid options/values are: * text: text @@ -1098,15 +1102,14 @@ item's tags option are called. - .. method:: tag_configure(tagname, **kw) + .. method:: tag_configure(tagname[, option=None[, **kw]]) Query or modify the options for the specified *tagname*. - If one or more option/value pairs are specified, sets the value of those - options for the specified tag. If a single option is specified with value - None, returns the value of that option (or the empty string if the option - has not been specified for tagname). With no additional arguments, - returns a dictionary of the option settings for *tagname*. + If *kw* is not given, returns a dict of the option settings for + *tagname*. If *option* is specified, returns the value for that *option* + for the specified *tagname*. Otherwise, sets the options to the + corresponding values for the given *tagname*. .. method:: tag_has(tagname[, item]) From stackless-checkins-bounces at stackless.com Fri Nov 14 15:45:57 2008 From: stackless-checkins-bounces at stackless.com (stackless-checkins-bounces at stackless.com) Date: Fri, 14 Nov 2008 15:45:57 +0100 Subject: [Python-checkins] Your message to Stackless-checkins awaits moderator approval Message-ID: Your mail to 'Stackless-checkins' with the subject r67221 - in stackless/branches/release26-maint: Doc/ACKS.txt Doc/Makefile Doc/c-api/init.rst Doc/conf.py Doc/contents.rst Doc/library/2to3.rst Doc/library/codecs.rst Doc/library/collections.rst Doc/library/cookielib.rst Doc/library/dis.rst Doc/library/email.parser.rst Doc/library/ftplib.rst Doc/library/functions.rst Doc/library/heapq.rst Doc/library/multiprocessing.rst Doc/library/select.rst Doc/library/socket.rst Doc/library/sqlite3.rst Doc/library/stdtypes.rst Doc/library/subprocess.rst Doc/library/tempfile.rst Doc/library/thread.rst Doc/library/threading.rst Doc/reference/compound_stmts.rst Doc/reference/datamodel.rst Doc/reference/lexical_analysis.rst Doc/reference/simple_stmts.rst Doc/tools/sphinxext/download.html Doc/tools/sphinxext/indexcontent.html Doc/tools/sphinxext/layout.html Doc/tutorial/controlflow.rst Doc/using/cmdline.rst Doc/whatsnew/2.2.rst Doc/whatsnew/2.3.rst Doc/whatsnew/2.4.rst Doc/whatsnew/2.5.rst Doc/whatsnew/2.6.rst Include/patchlevel.h Incl ude/unicodeobject.h Lib/ast.py Lib/bdb.py Lib/idlelib/PyShell.py Lib/idlelib/run.py Lib/inspect.py Lib/json/tests/test_scanstring.py Lib/lib-tk/Tkinter.py Lib/lib2to3 Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/main.py Lib/lib2to3/pytree.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_pytree.py Lib/lib2to3/tests/test_refactor.py Lib/modulefinder.py Lib/optparse.py Lib/pdb.py Lib/pydoc_topics.py Lib/test/pickletester.py Lib/test/test_atexit.py Lib/test/test_bisect.py Lib/test/test_bytes.py Lib/test/test_datetime.py Lib/test/test_dbm.py Lib/test/test_descr.py Lib/test/test_docxmlrpc.py Lib/test/test_fileio.py Lib/test/test_future.py Lib/test/test_modulefinder.py Lib/test/test_parser.py Lib/test/test_platform.py Lib/test/test_set.py Lib/test/test_urllib.py Lib/test/test_xrange.py Mac/BuildScript/build-installer.py Mac/BuildScript/scripts/postfligh t.patch-profile Makefile.pre.in Misc/ACKS Misc/NEWS Misc/build.sh Modules/_bisectmodule.c Modules/_codecsmodule.c Modules/_ctypes/libffi/src/x86/ffi.c Modules/_fileio.c Modules/_json.c Modules/_multiprocessing/multiprocessing.h Modules/_testcapimodule.c Modules/cPickle.c Modules/cjkcodecs/multibytecodec.c Modules/parsermodule.c Modules/posixmodule.c Modules/readline.c Modules/signalmodule.c Modules/tkappinit.c Objects/dictobject.c Objects/floatobject.c Objects/frameobject.c Objects/listobject.c Objects/setobject.c Objects/stringobject.c Objects/tupleobject.c Objects/unicodeobject.c PCbuild/pyd.vsprops PCbuild/pyd_d.vsprops Parser/asdl_c.py Parser/parser.c Python/Python-ast.c Python/_warnings.c Python/pythonrun.c Tools/msi/merge.py Tools/msi/msi.py Tools/scripts/findnocoding.py Tools/scripts/reindent.py configure configure.in setup.py Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 968856 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/45b284686bae904c66b76ef87d0d526ae781774c From stackless-checkins-bounces at stackless.com Fri Nov 14 16:53:33 2008 From: stackless-checkins-bounces at stackless.com (stackless-checkins-bounces at stackless.com) Date: Fri, 14 Nov 2008 16:53:33 +0100 Subject: [Python-checkins] Your message to Stackless-checkins awaits moderator approval Message-ID: Your mail to 'Stackless-checkins' with the subject r67223 - in stackless/branches/py3k: Demo/classes/Dates.py Demo/classes/bitvec.py Demo/distutils Demo/embed/demo.c Demo/embed/importexc.c Demo/md5test/md5driver.py Demo/pdist/cmptree.py Demo/rpc/nfsclient.py Demo/rpc/rpc.py Demo/rpc/xdr.py Demo/scripts/fact.py Demo/scripts/ftpstats.py Demo/scripts/lpwatch.py Demo/scripts/markov.py Demo/scripts/newslist.py Demo/scripts/pi.py Demo/scripts/unbirthday.py Demo/sockets/ftp.py Demo/sockets/udpecho.py Demo/sockets/unixclient.py Demo/threads/Coroutine.py Demo/threads/Generator.py Demo/tkinter/guido/hanoi.py Demo/tkinter/guido/solitaire.py Demo/tkinter/guido/sortvisu.py 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_forest.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/turtleDemo.py Demo/turtle/turtledemo_two_canvases.py Doc/ACKS.txt Doc/Makefile Doc/README.txt Doc/c-api/arg.rst Doc/c-api/buffer.rst Doc/c-api/init.rst Doc/c-api/number.rst Doc/c-api/object.rst Doc/c-api/typeobj.rst Doc/conf.py Doc/contents.rst Doc/distutils/apiref.rst Doc/distutils/builtdist.rst Doc/distutils/commandref.rst Doc/distutils/setupscript.rst Doc/extending/embedding.rst Doc/extending/extending.rst Doc/extending/windows.rst Doc/glossary.rst Doc/howto/cporting.rst Doc/howto/doanddont.rst Doc/howto/functional.rst Doc/howto/index.rst Doc/howto/sockets.rst Doc/howto/unicode.rst Doc/howto/urllib2.rst Doc/howto/webservers.rst Doc/includes/dbpickle.py Doc/library/2to3.rst Doc/library/ast.rst Doc/library/asynchat.rst Doc/library/binhex.rst Doc/library/bsddb.rst Doc/library/cgi.rst Doc/library/codecs.rst Doc/library/collec tions.rst Doc/library/compileall.rst Doc/library/ctypes.rst Doc/library/dbm.rst Doc/library/decimal.rst Doc/library/dis.rst Doc/library/email.parser.rst Doc/library/ftplib.rst Doc/library/functions.rst Doc/library/getopt.rst Doc/library/heapq.rst Doc/library/http.cookies.rst Doc/library/http.server.rst Doc/library/idle.rst Doc/library/imaplib.rst Doc/library/imp.rst Doc/library/index.rst Doc/library/inspect.rst Doc/library/io.rst Doc/library/itertools.rst Doc/library/json.rst Doc/library/logging.rst Doc/library/macpath.rst Doc/library/math.rst Doc/library/multiprocessing.rst Doc/library/optparse.rst Doc/library/os.path.rst Doc/library/os.rst Doc/library/persistence.rst Doc/library/pickle.rst Doc/library/platform.rst Doc/library/plistlib.rst Doc/library/random.rst Doc/library/reprlib.rst Doc/library/select.rst Doc/library/shelve.rst Doc/library/shutil.rst Doc/library/signal.rst Doc/library/site.rst Doc/library/smtplib.rst Doc/library/socket.rst Doc/library/socketserver.rst Do c/library/sqlite3.rst Doc/library/stdtypes.rst Doc/library/string.rst Doc/library/subprocess.rst Doc/library/sys.rst Doc/library/telnetlib.rst Doc/library/test.rst Doc/library/threading.rst Doc/library/time.rst Doc/library/tk.rst Doc/library/tkinter.rst Doc/library/tkinter.turtle.rst Doc/library/turtle.rst Doc/library/unicodedata.rst Doc/library/unittest.rst Doc/library/urllib.parse.rst Doc/library/warnings.rst Doc/library/weakref.rst Doc/library/webbrowser.rst Doc/library/xmlrpc.client.rst Doc/reference/compound_stmts.rst Doc/reference/datamodel.rst Doc/reference/expressions.rst Doc/reference/index.rst Doc/reference/lexical_analysis.rst Doc/reference/simple_stmts.rst Doc/tools/sphinxext/download.html Doc/tools/sphinxext/indexcontent.html Doc/tools/sphinxext/layout.html Doc/tutorial/appetite.rst Doc/tutorial/classes.rst Doc/tutorial/controlflow.rst Doc/tutorial/datastructures.rst Doc/tutorial/errors.rst Doc/tutorial/floatingpoint.rst Doc/tutorial/index.rst Doc/tutorial/inter preter.rst Doc/tutorial/introduction.rst Doc/using/cmdline.rst Doc/using/mac.rst Doc/using/windows.rst Doc/whatsnew/2.2.rst Doc/whatsnew/2.3.rst Doc/whatsnew/2.4.rst Doc/whatsnew/2.5.rst Doc/whatsnew/2.6.rst Doc/whatsnew/2.7.rst Doc/whatsnew/3.0.rst Doc/whatsnew/index.rst Include/ceval.h Include/compile.h Include/fileobject.h Include/intobject.h Include/object.h Include/patchlevel.h Include/pystate.h Include/unicodeobject.h Lib/abc.py Lib/antigravity.py Lib/ast.py Lib/bdb.py Lib/bsddb Lib/cgi.py Lib/collections.py Lib/ctypes/test/test_bitfields.py Lib/ctypes/test/test_pep3118.py Lib/dbm/__init__.py Lib/dbm/bsd.py Lib/distutils/__init__.py Lib/distutils/command/bdist_wininst.py Lib/distutils/command/build_py.py Lib/distutils/command/install.py Lib/distutils/file_util.py Lib/distutils/msvc9compiler.py Lib/distutils/tests/test_build_ext.py Lib/fnmatch.py Lib/formatter.py Lib/ftplib.py Lib/genericpath.py Lib/glob.py Lib/http/cookies.py Lib/idlelib/PyShell.py Lib/idlelib/idlever. py Lib/idlelib/run.py Lib/imaplib.py Lib/inspect.py Lib/io.py Lib/json/decoder.py Lib/json/tests/test_scanstring.py Lib/lib2to3 Lib/lib2to3/Grammar.txt Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/fix_getcwdu.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_paren.py Lib/lib2to3/fixes/fix_print.py Lib/lib2to3/fixes/fix_raw_input.py Lib/lib2to3/fixes/fix_set_literal.py Lib/lib2to3/fixes/fix_sys_exc.py Lib/lib2to3/main.py Lib/lib2to3/pytree.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/data/README Lib/lib2to3/tests/data/fixers Lib/lib2to3/tests/data/fixers/myfixes Lib/lib2to3/tests/data/infinite_recursion.py Lib/lib2to3/tests/data/py2_test_grammar.py Lib/lib2to3/tests/data/py3_test_grammar.py Lib/lib2to3/tests/support.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_pytree.py Lib/lib2to3/tests/test_refac tor.py Lib/logging/__init__.py Lib/logging/config.py Lib/macpath.py Lib/modulefinder.py Lib/multiprocessing/dummy/__init__.py Lib/multiprocessing/managers.py Lib/multiprocessing/synchronize.py Lib/nntplib.py Lib/ntpath.py Lib/optparse.py Lib/pdb.py Lib/pickle.py Lib/platform.py Lib/poplib.py Lib/posixpath.py Lib/pty.py Lib/pydoc_topics.py Lib/re.py Lib/socketserver.py Lib/sqlite3/test/regression.py Lib/sre_compile.py Lib/sre_parse.py Lib/ssl.py Lib/telnetlib.py Lib/test/crashers/iter.py Lib/test/pickletester.py Lib/test/regrtest.py Lib/test/string_tests.py Lib/test/support.py Lib/test/test___all__.py Lib/test/test_array.py Lib/test/test_asyncore.py Lib/test/test_atexit.py Lib/test/test_bisect.py Lib/test/test_bsddb.py Lib/test/test_bsddb3.py Lib/test/test_builtin.py Lib/test/test_bytes.py Lib/test/test_cProfile.py Lib/test/test_capi.py Lib/test/test_cgi.py Lib/test/test_class.py Lib/test/test_cmd_line.py Lib/test/test_collections.py Lib/test/test_contains.py Lib/test/test_cp rofile.py Lib/test/test_datetime.py Lib/test/test_dbm.py Lib/test/test_defaultdict.py Lib/test/test_descr.py Lib/test/test_docxmlrpc.py Lib/test/test_fileio.py Lib/test/test_float.py Lib/test/test_fnmatch.py Lib/test/test_format.py Lib/test/test_frozen.py Lib/test/test_ftplib.py Lib/test/test_future.py Lib/test/test_future5.py Lib/test/test_grammar.py Lib/test/test_hash.py Lib/test/test_hashlib.py Lib/test/test_hmac.py Lib/test/test_imp.py Lib/test/test_import.py Lib/test/test_io.py Lib/test/test_lib2to3.py Lib/test/test_logging.py Lib/test/test_long.py Lib/test/test_macpath.py Lib/test/test_memoryview.py Lib/test/test_modulefinder.py Lib/test/test_multiprocessing.py Lib/test/test_normalization.py Lib/test/test_ntpath.py Lib/test/test_os.py Lib/test/test_parser.py Lib/test/test_pep3120.py Lib/test/test_platform.py Lib/test/test_poplib.py Lib/test/test_posix.py Lib/test/test_posixpath.py Lib/test/test_profile.py Lib/test/test_pty.py Lib/test/test_range.py Lib/test/test_re.py Lib/test/test_richcmp.py Lib/test/test_sax.py Lib/test/test_set.py Lib/test/test_ssl.py Lib/test/test_struct.py Lib/test/test_structmembers.py Lib/test/test_subprocess.py Lib/test/test_sundry.py Lib/test/test_sys.py Lib/test/test_tarfile.py Lib/test/test_tempfile.py Lib/test/test_threadedtempfile.py Lib/test/test_threading.py Lib/test/test_traceback.py Lib/test/test_unicode.py Lib/test/test_unicode_file.py Lib/test/test_unicodedata.py Lib/test/test_urllib.py Lib/test/test_urlparse.py Lib/test/test_warnings.py Lib/test/test_weakref.py Lib/test/test_zipfile64.py Lib/test/test_zlib.py Lib/test/tf_inherit_check.py Lib/threading.py Lib/tkinter/__init__.py Lib/tkinter/scrolledtext.py Lib/tkinter/turtle.py Lib/traceback.py Lib/turtle.py Lib/urllib/parse.py Lib/urllib/request.py Lib/warnings.py Lib/weakref.py Lib/xml/sax/xmlreader.py Lib/zipfile.py Mac/BuildScript/build-installer.py Makefile.pre.in Misc/ACKS Misc/NEWS Misc/RPM/python-3.0.spec Misc/find_recursionlimit.py Modules/Setu p.dist Modules/_bisectmodule.c Modules/_bsddb.c Modules/_bytesio.c Modules/_codecsmodule.c Modules/_collectionsmodule.c Modules/_ctypes/cfield.c Modules/_ctypes/libffi/src/x86/ffi.c Modules/_dbmmodule.c Modules/_fileio.c Modules/_hashopenssl.c Modules/_json.c Modules/_localemodule.c Modules/_lsprof.c Modules/_multiprocessing/connection.h Modules/_multiprocessing/multiprocessing.h Modules/_pickle.c Modules/_sqlite/connection.c Modules/_sqlite/cursor.c Modules/_sqlite/microprotocols.c Modules/_sqlite/microprotocols.h Modules/_sqlite/module.c Modules/_sqlite/statement.c Modules/_sqlite/util.c Modules/_sqlite/util.h Modules/_sre.c Modules/_stringio.c Modules/_struct.c Modules/_testcapimodule.c Modules/atexitmodule.c Modules/bsddb.h Modules/cjkcodecs/multibytecodec.c Modules/config.c.in Modules/getpath.c Modules/main.c Modules/mmapmodule.c Modules/ossaudiodev.c Modules/parsermodule.c Modules/posixmodule.c Modules/python.c Modules/readline.c Modules/selectmodule.c Modules/signalmo dule.c Modules/tkappinit.c Modules/unicodedata.c Modules/unicodedata_db.h Modules/unicodename_db.h Modules/zipimport.c Modules/zlibmodule.c Objects/abstract.c Objects/bytearrayobject.c Objects/bytesobject.c Objects/dictobject.c Objects/floatobject.c Objects/frameobject.c Objects/listobject.c Objects/memoryobject.c Objects/moduleobject.c Objects/object.c Objects/obmalloc.c Objects/setobject.c Objects/stringlib/count.h Objects/stringlib/find.h Objects/tupleobject.c Objects/typeobject.c Objects/unicodectype.c Objects/unicodeobject.c Objects/unicodetype_db.h Objects/weakrefobject.c PC/VC6/_bsddb.dsp PC/VC6/pcbuild.dsw PC/VC6/readme.txt PC/VS7.1/_bsddb.vcproj PC/VS7.1/pcbuild.sln PC/VS7.1/pythoncore.vcproj PC/VS7.1/readme.txt PC/VS8.0/_bsddb.vcproj PC/VS8.0/_bsddb44.vcproj PC/VS8.0/_ctypes.vcproj PC/VS8.0/_sqlite3.vcproj PC/VS8.0/pcbuild.sln PC/VS8.0/pyproject.vsprops PC/VS8.0/sqlite3.vcproj PC/dllbase_nt.txt PC/winreg.c PCbuild/_bsddb.vcproj PCbuild/_bsddb44.vcproj PCbuild/pcbui ld.sln PCbuild/pyd.vsprops PCbuild/pyd_d.vsprops PCbuild/readme.txt PCbuild/vs9to8.py Parser/asdl_c.py Parser/parser.c Parser/tokenizer.c Parser/tokenizer.h Python/Python-ast.c Python/_warnings.c Python/ast.c Python/bltinmodule.c Python/ceval.c Python/codecs.c Python/compile.c Python/frozenmain.c Python/future.c Python/import.c Python/marshal.c Python/pymath.c Python/pystate.c Python/pythonrun.c Python/sysmodule.c Python/traceback.c README RELNOTES Tools/msi/merge.py Tools/msi/msi.py Tools/msi/uuids.py Tools/scripts/2to3 Tools/scripts/findnocoding.py Tools/scripts/reindent.py Tools/unicode/makeunicodedata.py configure configure.in pyconfig.h.in runtests.sh setup.py Is being held until the list moderator can review it for approval. The reason it is being held: Message body is too big: 5397147 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/24f580c81a9104680b1a0eb9ad3490d815845d5e From nnorwitz at gmail.com Sat Nov 15 07:22:30 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 15 Nov 2008 01:22:30 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081115062230.GA30023@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Sat Nov 15 09:10:04 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 15 Nov 2008 09:10:04 +0100 (CET) Subject: [Python-checkins] r67224 - python/trunk/Doc/library/locale.rst Message-ID: <20081115081004.EC9101E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 15 09:10:04 2008 New Revision: 67224 Log: #4324: fix getlocale() argument. Modified: python/trunk/Doc/library/locale.rst Modified: python/trunk/Doc/library/locale.rst ============================================================================== --- python/trunk/Doc/library/locale.rst (original) +++ python/trunk/Doc/library/locale.rst Sat Nov 15 09:10:04 2008 @@ -492,7 +492,7 @@ Example:: >>> import locale - >>> loc = locale.getlocale(locale.LC_ALL) # get current locale + >>> loc = locale.getlocale() # get current locale >>> locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name might vary with platform >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale From python-checkins at python.org Sat Nov 15 23:33:26 2008 From: python-checkins at python.org (brett.cannon) Date: Sat, 15 Nov 2008 23:33:26 +0100 (CET) Subject: [Python-checkins] r67225 - python/trunk/Doc/library/httplib.rst Message-ID: <20081115223326.858921E4002@bag.python.org> Author: brett.cannon Date: Sat Nov 15 23:33:25 2008 New Revision: 67225 Log: Clarify the docs for the 'strict' argument to httplib.HTTPConnection. Modified: python/trunk/Doc/library/httplib.rst Modified: python/trunk/Doc/library/httplib.rst ============================================================================== --- python/trunk/Doc/library/httplib.rst (original) +++ python/trunk/Doc/library/httplib.rst Sat Nov 15 23:33:25 2008 @@ -40,7 +40,8 @@ server. It should be instantiated passing it a host and optional port number. If no port number is passed, the port is extracted from the host string if it has the form ``host:port``, else the default HTTP port (80) is - used. When True, the optional parameter *strict* causes ``BadStatusLine`` to + used. When True, the optional parameter *strict* (which defaults to a false + value) causes ``BadStatusLine`` to 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 From python-checkins at python.org Sat Nov 15 23:40:44 2008 From: python-checkins at python.org (brett.cannon) Date: Sat, 15 Nov 2008 23:40:44 +0100 (CET) Subject: [Python-checkins] r67226 - in python/trunk: Lib/httplib.py Misc/NEWS Message-ID: <20081115224044.F37691E4002@bag.python.org> Author: brett.cannon Date: Sat Nov 15 23:40:44 2008 New Revision: 67226 Log: The docs for httplib.HTTPConnection.putheader() have claimed for quite a while that their could be an arbitrary number of values passed in. Turns out the code did not match that. The code now matches the docs. Modified: python/trunk/Lib/httplib.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/httplib.py ============================================================================== --- python/trunk/Lib/httplib.py (original) +++ python/trunk/Lib/httplib.py Sat Nov 15 23:40:44 2008 @@ -846,7 +846,7 @@ # For HTTP/1.0, the server will assume "not chunked" pass - def putheader(self, header, value): + def putheader(self, header, *values): """Send a request header line to the server. For example: h.putheader('Accept', 'text/html') @@ -854,7 +854,7 @@ if self.__state != _CS_REQ_STARTED: raise CannotSendHeader() - str = '%s: %s' % (header, value) + str = '%s: %s' % (header, '\r\n\t'.join(values)) self._output(str) def endheaders(self): @@ -989,6 +989,7 @@ # set up delegation to flesh out interface self.send = conn.send self.putrequest = conn.putrequest + self.putheader = conn.putheader self.endheaders = conn.endheaders self.set_debuglevel = conn.set_debuglevel @@ -1008,10 +1009,6 @@ "Provide a getfile, since the superclass' does not use this concept." return self.file - def putheader(self, header, *values): - "The superclass allows only one value argument." - self._conn.putheader(header, '\r\n\t'.join(values)) - def getreply(self): """Compat definition since superclass does not define it. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Nov 15 23:40:44 2008 @@ -38,6 +38,9 @@ Library ------- +- httplib.HTTPConnection.putheader() now accepts an arbitrary number of values + for any header, matching what the documentation has claimed for a while. + - Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. From buildbot at python.org Sun Nov 16 00:05:37 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 15 Nov 2008 23:05:37 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20081115230538.801471E4002@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/4283 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon 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 Nov 16 00:10:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 15 Nov 2008 23:10:12 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081115231012.E3D121E4043@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/316 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: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asynchat make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Sun Nov 16 07:22:34 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 16 Nov 2008 01:22:34 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081116062234.GA3519@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Sun Nov 16 09:00:18 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 16 Nov 2008 09:00:18 +0100 (CET) Subject: [Python-checkins] r67227 - python/trunk/configure.in Message-ID: <20081116080018.171BE1E4025@bag.python.org> Author: georg.brandl Date: Sun Nov 16 09:00:17 2008 New Revision: 67227 Log: #4316: fix configure.in markup problem. Modified: python/trunk/configure.in Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Sun Nov 16 09:00:17 2008 @@ -261,7 +261,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From python-checkins at python.org Sun Nov 16 09:01:08 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 16 Nov 2008 09:01:08 +0100 (CET) Subject: [Python-checkins] r67228 - python/branches/release25-maint/configure.in Message-ID: <20081116080108.F0BAC1E400C@bag.python.org> Author: georg.brandl Date: Sun Nov 16 09:01:08 2008 New Revision: 67228 Log: #4316: configure.in markup fix (backport from r67227). Modified: python/branches/release25-maint/configure.in Modified: python/branches/release25-maint/configure.in ============================================================================== --- python/branches/release25-maint/configure.in (original) +++ python/branches/release25-maint/configure.in Sun Nov 16 09:01:08 2008 @@ -211,7 +211,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From python-checkins at python.org Sun Nov 16 09:02:56 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 16 Nov 2008 09:02:56 +0100 (CET) Subject: [Python-checkins] r67229 - in python/branches/release26-maint: configure.in Message-ID: <20081116080256.C78CB1E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 16 09:02:56 2008 New Revision: 67229 Log: Merged revisions 67227 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67227 | georg.brandl | 2008-11-16 09:00:17 +0100 (Sun, 16 Nov 2008) | 2 lines #4316: fix configure.in markup problem. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/configure.in Modified: python/branches/release26-maint/configure.in ============================================================================== --- python/branches/release26-maint/configure.in (original) +++ python/branches/release26-maint/configure.in Sun Nov 16 09:02:56 2008 @@ -261,7 +261,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From buildbot at python.org Sun Nov 16 10:16:14 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 16 Nov 2008 09:16:14 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 2.5 Message-ID: <20081116091615.0587A1E4002@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%202.5/builds/8 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 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 python-checkins at python.org Sun Nov 16 10:59:12 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 16 Nov 2008 10:59:12 +0100 (CET) Subject: [Python-checkins] r67230 - in sandbox/trunk/tkinter-polo: src Message-ID: <20081116095912.928701E4002@bag.python.org> Author: guilherme.polo Date: Sun Nov 16 10:59:12 2008 New Revision: 67230 Log: Creating a branch to hold my assorted changes in tkinter Added: sandbox/trunk/tkinter-polo/ sandbox/trunk/tkinter-polo/src/ From python-checkins at python.org Sun Nov 16 11:09:44 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 16 Nov 2008 11:09:44 +0100 (CET) Subject: [Python-checkins] r67231 - in sandbox/trunk/tkinter-polo/src: Dialog.py FileDialog.py FixTk.py ScrolledText.py SimpleDialog.py Tkconstants.py Tkinter.py _tkinter.c tkColorChooser.py tkCommonDialog.py tkFileDialog.py tkFont.py tkMessageBox.py tkSimpleDialog.py Message-ID: <20081116100944.EB5181E4002@bag.python.org> Author: guilherme.polo Date: Sun Nov 16 11:09:44 2008 New Revision: 67231 Log: Initial copy Added: sandbox/trunk/tkinter-polo/src/Dialog.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/Dialog.py sandbox/trunk/tkinter-polo/src/FileDialog.py (props changed) - copied unchanged from r67226, /python/trunk/Lib/lib-tk/FileDialog.py sandbox/trunk/tkinter-polo/src/FixTk.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/FixTk.py sandbox/trunk/tkinter-polo/src/ScrolledText.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/ScrolledText.py sandbox/trunk/tkinter-polo/src/SimpleDialog.py (props changed) - copied unchanged from r67226, /python/trunk/Lib/lib-tk/SimpleDialog.py sandbox/trunk/tkinter-polo/src/Tkconstants.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/Tkconstants.py sandbox/trunk/tkinter-polo/src/Tkinter.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/Tkinter.py sandbox/trunk/tkinter-polo/src/_tkinter.c (props changed) - copied unchanged from r67226, /python/trunk/Modules/_tkinter.c sandbox/trunk/tkinter-polo/src/tkColorChooser.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/tkColorChooser.py sandbox/trunk/tkinter-polo/src/tkCommonDialog.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/tkCommonDialog.py sandbox/trunk/tkinter-polo/src/tkFileDialog.py (props changed) - copied unchanged from r67226, /python/trunk/Lib/lib-tk/tkFileDialog.py sandbox/trunk/tkinter-polo/src/tkFont.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/tkFont.py sandbox/trunk/tkinter-polo/src/tkMessageBox.py - copied unchanged from r67226, /python/trunk/Lib/lib-tk/tkMessageBox.py sandbox/trunk/tkinter-polo/src/tkSimpleDialog.py (props changed) - copied unchanged from r67226, /python/trunk/Lib/lib-tk/tkSimpleDialog.py From buildbot at python.org Sun Nov 16 12:58:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 16 Nov 2008 11:58:39 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 3.0 Message-ID: <20081116115840.2E98B1E4002@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/1745 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: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Unknown signal 32 sincerely, -The Buildbot From python-checkins at python.org Sun Nov 16 18:02:53 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 16 Nov 2008 18:02:53 +0100 (CET) Subject: [Python-checkins] r67233 - sandbox/trunk/tkinter-polo/src/_tkinter.c Message-ID: <20081116170253.B4CE91E4002@bag.python.org> Author: guilherme.polo Date: Sun Nov 16 18:02:53 2008 New Revision: 67233 Log: Let it compiled under python 2.5 Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c ============================================================================== --- sandbox/trunk/tkinter-polo/src/_tkinter.c (original) +++ sandbox/trunk/tkinter-polo/src/_tkinter.c Sun Nov 16 18:02:53 2008 @@ -47,6 +47,16 @@ #define PyBool_FromLong PyInt_FromLong #endif +/* Allow using this code in Python 2.5 */ +#ifndef PyVarObject_HEAD_INIT +#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, +#endif + +#ifndef Py_TYPE +#define Py_TYPE(ob) (((PyObject *)(ob))->ob_type) +#endif + + /* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately, making _tkinter correct for this API means to break earlier versions. USE_COMPAT_CONST allows to make _tkinter work with both 8.4 and From python-checkins at python.org Sun Nov 16 18:54:56 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 16 Nov 2008 18:54:56 +0100 (CET) Subject: [Python-checkins] r67234 - python/trunk/configure Message-ID: <20081116175456.3B8351E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 16 18:54:55 2008 New Revision: 67234 Log: run autoconf Modified: python/trunk/configure Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Sun Nov 16 18:54:55 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 66764 . +# From configure.in Revision: 67227 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.7. # @@ -2090,7 +2090,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6A-S) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From python-checkins at python.org Sun Nov 16 18:57:10 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 16 Nov 2008 18:57:10 +0100 (CET) Subject: [Python-checkins] r67235 - python/branches/release26-maint/configure Message-ID: <20081116175710.A2C001E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 16 18:57:10 2008 New Revision: 67235 Log: regenerate configure Modified: python/branches/release26-maint/configure Modified: python/branches/release26-maint/configure ============================================================================== --- python/branches/release26-maint/configure (original) +++ python/branches/release26-maint/configure Sun Nov 16 18:57:10 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 66295 . +# From configure.in Revision: 67229 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -2090,7 +2090,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6A-S) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From python-checkins at python.org Sun Nov 16 18:57:32 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 16 Nov 2008 18:57:32 +0100 (CET) Subject: [Python-checkins] r67236 - python/branches/release25-maint/configure Message-ID: <20081116175732.05D871E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 16 18:57:31 2008 New Revision: 67236 Log: regenerate configure Modified: python/branches/release25-maint/configure Modified: python/branches/release25-maint/configure ============================================================================== --- python/branches/release25-maint/configure (original) +++ python/branches/release25-maint/configure Sun Nov 16 18:57:31 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 66299 . +# From configure.in Revision: 67228 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.5. # @@ -2017,7 +2017,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6A-S) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From buildbot at python.org Sun Nov 16 19:23:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 16 Nov 2008 18:23:12 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20081116182313.25F5E1E4002@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/492 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_bsddb3 ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/bsddb/test/test_replication.py", line 134, in test01_basic_replication self.assertTrue(time.time() Author: guilherme.polo Date: Sun Nov 16 21:48:41 2008 New Revision: 67238 Log: Added something to compile _tkinter which will probably work only here (!) Added: sandbox/trunk/tkinter-polo/Makefile (contents, props changed) sandbox/trunk/tkinter-polo/setup.py (contents, props changed) Added: sandbox/trunk/tkinter-polo/Makefile ============================================================================== --- (empty file) +++ sandbox/trunk/tkinter-polo/Makefile Sun Nov 16 21:48:41 2008 @@ -0,0 +1,18 @@ +PYTHON=python +INSTALL_DIR=tkinter +TCLTK_VER=8.5 +TCL_BASE_DIR=/usr/share/tcltk +TK_BASE_DIR=$(TCL_BASE_DIR) +TCL_CONFIG_DIR=$(TCL_BASE_DIR)/tcl$(TCLTK_VER) +TK_CONFIG_DIR=$(TK_BASE_DIR)/tk$(TCLTK_VER) + +TCL_CONFIG=$(TCL_CONFIG_DIR)/tclConfig.sh +TK_CONFIG=$(TK_CONFIG_DIR)/tkConfig.sh + +build: + TCL_CONFIG=$(TCL_CONFIG) TK_CONFIG=$(TK_CONFIG) \ +$(PYTHON) setup.py install_lib --install-dir $(INSTALL_DIR) + +clean: + rm -rf build + rm -rf $(INSTALL_DIR) Added: sandbox/trunk/tkinter-polo/setup.py ============================================================================== --- (empty file) +++ sandbox/trunk/tkinter-polo/setup.py Sun Nov 16 21:48:41 2008 @@ -0,0 +1,57 @@ +""" +This builds _tkinter (in a hacky way to not require autotools). +""" +from distutils.core import setup, Extension +import os +import sys +import subprocess + +class MissingTclTkConfig(EnvironmentError): + pass + +def get_paths(path, prefix): + bash = subprocess.Popen(['bash'], stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + + bash.stdin.write('source %s\n' % path) + for name in ("%s_LIB_SPEC", "%s_INCLUDE_SPEC"): + bash.stdin.write('echo `eval echo $%s`\n' % (name % prefix)) + result = bash.communicate()[0].strip().split('\n') + + if not result[0]: + raise MissingTclTkConfig("'%s' did not contain a (correct) '%s'" % + (os.path.dirname(path), "%sConfig.sh" % prefix.lower())) + + libs = result[0].split() + yield libs[1][2:] + yield libs[0][2:] + yield result[1][2:] + +def get_tcltk_paths(): + tclconfig = os.environ.get('TCL_CONFIG') + tkconfig = os.environ.get('TK_CONFIG') + + if not all((tclconfig, tkconfig)): + raise MissingTclTkConfig("TCL_CONFIG and TK_CONFIG env vars must " + "exist and should point to tclConfig.sh and tkConfig.sh ") + + paths = zip(get_paths(tclconfig, 'TCL'), get_paths(tkconfig, 'TK')) + return dict(zip(('libraries', 'library_dirs', 'include_dirs'), paths)) + + +def main(args): + if not len(args) or args[0].startswith('-'): + tcltk_paths = {} + else: + tcltk_paths = get_tcltk_paths() + + setup(name="_tkinter", + package_dir={'': 'src'}, packages=[''], + ext_modules=[ + Extension("_tkinter", ["src/_tkinter.c"], + **tcltk_paths) + ] + ) + +if __name__ == "__main__": + main(sys.argv[1:]) From python-checkins at python.org Sun Nov 16 22:52:33 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 16 Nov 2008 22:52:33 +0100 (CET) Subject: [Python-checkins] r67239 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081116215233.4836B1E4002@bag.python.org> Author: guilherme.polo Date: Sun Nov 16 22:52:33 2008 New Revision: 67239 Log: Removed the example from the module's docstring; Renamed _test to example; Removed check for TclVersion >= 8.1 in example since _tkinter requires 8.2 at least; Removed a lambda usage in example that I disliked. Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Sun Nov 16 22:52:33 2008 @@ -16,18 +16,6 @@ Actions are bound to events by resources (e.g. keyword argument command) or with the method bind. - -Example (Hello, World): -import Tkinter -from Tkconstants import * -tk = Tkinter.Tk() -frame = Tkinter.Frame(tk, relief=RIDGE, borderwidth=2) -frame.pack(fill=BOTH,expand=1) -label = Tkinter.Label(frame, text="Hello, World") -label.pack(fill=X, expand=1) -button = Tkinter.Button(frame,text="Exit",command=tk.destroy) -button.pack(side=BOTTOM) -tk.mainloop() """ __version__ = "$Revision$" @@ -3742,32 +3730,34 @@ self['activebackground'] = self['bg'] ###################################################################### -# Test: +# Example: + +def example(): + + def update_btntext(): + test['text'] = "[%s]" % test['text'] -def _test(): root = Tk() text = "This is Tcl/Tk version %s" % TclVersion - if TclVersion >= 8.1: - try: - text = text + unicode("\nThis should be a cedilla: \347", - "iso-8859-1") - except NameError: - pass # no unicode support + try: + text = text + unicode("\nThis should be a cedilla: \347", "iso-8859-1") + except NameError: + # no unicode support + pass label = Label(root, text=text) label.pack() - test = Button(root, text="Click me!", - command=lambda root=root: root.test.configure( - text="[%s]" % root.test['text'])) + test = Button(root, text="Click me!", command=update_btntext) test.pack() - root.test = test quit = Button(root, text="QUIT", command=root.destroy) quit.pack() - # The following three commands are needed so the window pops - # up on top on Windows... + # The following three commands are needed so the window pops up + # on top on Windows. + # XXX I don't have this issue with tk8.4 neither 8.5 on Vista. root.iconify() root.update() root.deiconify() + root.mainloop() if __name__ == '__main__': - _test() + example() From python-checkins at python.org Mon Nov 17 01:14:11 2008 From: python-checkins at python.org (guilherme.polo) Date: Mon, 17 Nov 2008 01:14:11 +0100 (CET) Subject: [Python-checkins] r67240 - sandbox/trunk/tkinter-polo/src/Dialog.py Message-ID: <20081117001411.2E68A1E4017@bag.python.org> Author: guilherme.polo Date: Mon Nov 17 01:14:07 2008 New Revision: 67240 Log: Dropped usage of star import; No need to check for TkVersion <= 3.6 since _tkinter enforces the need for Tcl/Tk 8.2 at least; Cleaned up the Dialog class; Correctly converts the reply to an integer, checking for the possibility of receiving a tuple; Updated example to suggest the more appropriate use of the Dialog. Modified: sandbox/trunk/tkinter-polo/src/Dialog.py Modified: sandbox/trunk/tkinter-polo/src/Dialog.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Dialog.py (original) +++ sandbox/trunk/tkinter-polo/src/Dialog.py Mon Nov 17 01:14:07 2008 @@ -1,49 +1,63 @@ -# dialog.py -- Tkinter interface to the tk_dialog script. +""" +Tkinter interface to the command tk_dialog in tk. +""" -from Tkinter import * -from Tkinter import _cnfmerge +__all__ = ['Dialog', 'DIALOG_ICON'] -if TkVersion <= 3.6: - DIALOG_ICON = 'warning' -else: - DIALOG_ICON = 'questhead' +import Tkinter +DIALOG_ICON = 'questhead' + +class Dialog(Tkinter.Toplevel): + """ + Create modal dialog and wait for response. + """ + widgetname = 'tk_dialog' -class Dialog(Widget): def __init__(self, master=None, cnf={}, **kw): - cnf = _cnfmerge((cnf, kw)) - self.widgetName = '__dialog__' - Widget._setup(self, master, cnf) - self.num = self.tk.getint( - self.tk.call( - 'tk_dialog', self._w, - cnf['title'], cnf['text'], - cnf['bitmap'], cnf['default'], - *cnf['strings'])) - try: Widget.destroy(self) - except TclError: pass - def destroy(self): pass - -def _test(): - d = Dialog(None, {'title': 'File Modified', - 'text': - 'File "Python.h" has been modified' - ' since the last time it was saved.' - ' Do you want to save it before' - ' exiting the application.', - 'bitmap': DIALOG_ICON, - 'default': 0, - 'strings': ('Save File', - 'Discard Changes', - 'Return to Editor')}) - print d.num + """Construct a tk_dialog with the parent master and the parameters + in kw. + kw must contain the following keys: + title, text, bitmap, default, strings + """ + Tkinter.Toplevel.__init__(self, master) + kw.update(cnf) + args = tuple(kw[arg] for arg in ('title', 'text', 'bitmap', 'default')) + strings = kw['strings'] + + result = self.tk.call(self.widgetname, self._w, *(args + strings)) + if isinstance(result, tuple): + # We may receive a tuple with a single Tcl_Obj, so convert that to + # a string before continuing. + result = str(result[0]) + self.num = int(result) + + try: + self.destroy() + except Tkinter.TclError: + pass + + +def example(): + def test_dialog(): + d = Dialog( + title='File Modified', + text=("File 'Python.h' has been modified since the last time " + "it was saved. Do you want to save it before exiting " + "the application ?"), + bitmap=DIALOG_ICON, + strings=('Save File', 'Discard Changes', 'Return to Editor'), + default=0 + ) + print d.num + + from Tkinter import Button + test = Button(text='Test', command=test_dialog) + quit = Button(text='Quit', command=test.quit) + test.pack() + quit.pack() + test.mainloop() if __name__ == '__main__': - t = Button(None, {'text': 'Test', - 'command': _test, - Pack: {}}) - q = Button(None, {'text': 'Quit', - 'command': t.quit, - Pack: {}}) - t.mainloop() + example() From nnorwitz at gmail.com Mon Nov 17 07:22:33 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 17 Nov 2008 01:22:33 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081117062233.GA5802@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Mon Nov 17 22:39:05 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 17 Nov 2008 22:39:05 +0100 (CET) Subject: [Python-checkins] r67243 - python/trunk/Doc/tools/sphinxext/download.html Message-ID: <20081117213905.E38D81E4010@bag.python.org> Author: benjamin.peterson Date: Mon Nov 17 22:39:05 2008 New Revision: 67243 Log: a few fixes on the download page Modified: python/trunk/Doc/tools/sphinxext/download.html Modified: python/trunk/Doc/tools/sphinxext/download.html ============================================================================== --- python/trunk/Doc/tools/sphinxext/download.html (original) +++ python/trunk/Doc/tools/sphinxext/download.html Mon Nov 17 22:39:05 2008 @@ -14,7 +14,7 @@

To download an archive containing all the documents for this version of Python in one of various formats, follow one of links in this table. The numbers -in the table are the size of the download files in Kilobytes.

+in the table are the size of the download files in megabytes.

@@ -54,7 +54,7 @@

Problems

If you have comments or suggestions for the Python documentation, please send -email to docs at python.org.

+email to docs at python.org.

{% endif %} {% endblock %} From python-checkins at python.org Mon Nov 17 23:05:19 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 17 Nov 2008 23:05:19 +0100 (CET) Subject: [Python-checkins] r67245 - python/trunk/Doc/reference/datamodel.rst Message-ID: <20081117220519.7D7B81E400C@bag.python.org> Author: benjamin.peterson Date: Mon Nov 17 23:05:19 2008 New Revision: 67245 Log: improve __hash__ docs Modified: python/trunk/Doc/reference/datamodel.rst Modified: python/trunk/Doc/reference/datamodel.rst ============================================================================== --- python/trunk/Doc/reference/datamodel.rst (original) +++ python/trunk/Doc/reference/datamodel.rst Mon Nov 17 23:05:19 2008 @@ -1365,21 +1365,21 @@ object: dictionary builtin: hash - Called for the key object for dictionary operations, and by the built-in - function :func:`hash`. Should return an integer usable as a hash value - for dictionary operations. The only required property is that objects which - compare equal have the same hash value; it is advised to somehow mix together - (e.g., using exclusive or) the hash values for the components of the object that - also play a part in comparison of objects. + Called by built-in function :func:`hash` and for operations on members of + hashed collections including :class:`set`, :class:`frozenset`, and + :class:`dict`. :meth:`__hash__` should return an integer. The only required + property is that objects which compare equal have the same hash value; it is + advised to somehow mix together (e.g. using exclusive or) the hash values for + the components of the object that also play a part in comparison of objects. If a class does not define a :meth:`__cmp__` or :meth:`__eq__` method it should not define a :meth:`__hash__` operation either; if it defines :meth:`__cmp__` or :meth:`__eq__` but not :meth:`__hash__`, its instances - will not be usable as dictionary keys. If a class defines mutable objects + will not be usable in hashed collections. If a class defines mutable objects and implements a :meth:`__cmp__` or :meth:`__eq__` method, it should not - implement :meth:`__hash__`, since the dictionary implementation requires that - a key's hash value is immutable (if the object's hash value changes, it will - be in the wrong hash bucket). + implement :meth:`__hash__`, since hashable collection implementations require + that a object's hash value is immutable (if the object's hash value changes, + it will be in the wrong hash bucket). User-defined classes have :meth:`__cmp__` and :meth:`__hash__` methods by default; with them, all objects compare unequal (except with themselves) @@ -1389,13 +1389,13 @@ change the meaning of :meth:`__cmp__` or :meth:`__eq__` such that the hash value returned is no longer appropriate (e.g. by switching to a value-based concept of equality instead of the default identity based equality) can - explicitly flag themselves as being unhashable by setting - ``__hash__ = None`` in the class definition. Doing so means that not only - will instances of the class raise an appropriate :exc:`TypeError` when - a program attempts to retrieve their hash value, but they will also be - correctly identified as unhashable when checking - ``isinstance(obj, collections.Hashable)`` (unlike classes which define - their own :meth:`__hash__` to explicitly raise :exc:`TypeError`). + explicitly flag themselves as being unhashable by setting ``__hash__ = None`` + in the class definition. Doing so means that not only will instances of the + class raise an appropriate :exc:`TypeError` when a program attempts to + retrieve their hash value, but they will also be correctly identified as + unhashable when checking ``isinstance(obj, collections.Hashable)`` (unlike + classes which define their own :meth:`__hash__` to explicitly raise + :exc:`TypeError`). .. versionchanged:: 2.5 :meth:`__hash__` may now also return a long integer object; the 32-bit From python-checkins at python.org Mon Nov 17 23:39:09 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 17 Nov 2008 23:39:09 +0100 (CET) Subject: [Python-checkins] r67246 - in python/trunk: Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Message-ID: <20081117223909.BEB911E400C@bag.python.org> Author: benjamin.peterson Date: Mon Nov 17 23:39:09 2008 New Revision: 67246 Log: when __getattr__ is a descriptor, call it correctly; fixes #4230 patch from Ziga Seilnacht Modified: python/trunk/Lib/test/test_descr.py python/trunk/Misc/NEWS python/trunk/Objects/typeobject.c Modified: python/trunk/Lib/test/test_descr.py ============================================================================== --- python/trunk/Lib/test/test_descr.py (original) +++ python/trunk/Lib/test/test_descr.py Mon Nov 17 23:39:09 2008 @@ -4289,6 +4289,46 @@ c[1:2] = 3 self.assertEqual(c.value, 3) + def test_getattr_hooks(self): + # issue 4230 + + class Descriptor(object): + counter = 0 + def __get__(self, obj, objtype=None): + def getter(name): + self.counter += 1 + raise AttributeError(name) + return getter + + descr = Descriptor() + class A(object): + __getattribute__ = descr + class B(object): + __getattr__ = descr + class C(object): + __getattribute__ = descr + __getattr__ = descr + + self.assertRaises(AttributeError, getattr, A(), "attr") + self.assertEquals(descr.counter, 1) + self.assertRaises(AttributeError, getattr, B(), "attr") + self.assertEquals(descr.counter, 2) + self.assertRaises(AttributeError, getattr, C(), "attr") + self.assertEquals(descr.counter, 4) + + import gc + class EvilGetattribute(object): + # This used to segfault + def __getattr__(self, name): + raise AttributeError(name) + def __getattribute__(self, name): + del EvilGetattribute.__getattr__ + for i in range(5): + gc.collect() + raise AttributeError(name) + + self.assertRaises(AttributeError, getattr, EvilGetattribute(), "attr") + class DictProxyTests(unittest.TestCase): def setUp(self): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Nov 17 23:39:09 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. + - Issue #4048: The parser module now correctly validates relative imports. - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an Modified: python/trunk/Objects/typeobject.c ============================================================================== --- python/trunk/Objects/typeobject.c (original) +++ python/trunk/Objects/typeobject.c Mon Nov 17 23:39:09 2008 @@ -5391,6 +5391,24 @@ } static PyObject * +call_attribute(PyObject *self, PyObject *attr, PyObject *name) +{ + PyObject *res, *descr = NULL; + descrgetfunc f = Py_TYPE(attr)->tp_descr_get; + + if (f != NULL) { + descr = f(attr, self, (PyObject *)(Py_TYPE(self))); + if (descr == NULL) + return NULL; + else + attr = descr; + } + res = PyObject_CallFunctionObjArgs(attr, name, NULL); + Py_XDECREF(descr); + return res; +} + +static PyObject * slot_tp_getattr_hook(PyObject *self, PyObject *name) { PyTypeObject *tp = Py_TYPE(self); @@ -5409,24 +5427,39 @@ if (getattribute_str == NULL) return NULL; } + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when the attribute is present. So we use + _PyType_Lookup and create the method only when needed, with + call_attribute. */ getattr = _PyType_Lookup(tp, getattr_str); if (getattr == NULL) { /* No __getattr__ hook: use a simpler dispatcher */ tp->tp_getattro = slot_tp_getattro; return slot_tp_getattro(self, name); } + Py_INCREF(getattr); + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when self has the default __getattribute__ + method. So we use _PyType_Lookup and create the method only when + needed, with call_attribute. */ getattribute = _PyType_Lookup(tp, getattribute_str); if (getattribute == NULL || (Py_TYPE(getattribute) == &PyWrapperDescr_Type && ((PyWrapperDescrObject *)getattribute)->d_wrapped == (void *)PyObject_GenericGetAttr)) res = PyObject_GenericGetAttr(self, name); - else - res = PyObject_CallFunctionObjArgs(getattribute, self, name, NULL); + else { + Py_INCREF(getattribute); + res = call_attribute(self, getattribute, name); + Py_DECREF(getattribute); + } if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); - res = PyObject_CallFunctionObjArgs(getattr, self, name, NULL); + res = call_attribute(self, getattr, name); } + Py_DECREF(getattr); return res; } From python-checkins at python.org Mon Nov 17 23:44:31 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 17 Nov 2008 23:44:31 +0100 (CET) Subject: [Python-checkins] r67247 - in python/branches/release26-maint: Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Message-ID: <20081117224431.156301E400C@bag.python.org> Author: benjamin.peterson Date: Mon Nov 17 23:44:30 2008 New Revision: 67247 Log: Merged revisions 67246 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67246 | benjamin.peterson | 2008-11-17 16:39:09 -0600 (Mon, 17 Nov 2008) | 5 lines when __getattr__ is a descriptor, call it correctly; fixes #4230 patch from Ziga Seilnacht ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_descr.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Objects/typeobject.c Modified: python/branches/release26-maint/Lib/test/test_descr.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_descr.py (original) +++ python/branches/release26-maint/Lib/test/test_descr.py Mon Nov 17 23:44:30 2008 @@ -4289,6 +4289,46 @@ c[1:2] = 3 self.assertEqual(c.value, 3) + def test_getattr_hooks(self): + # issue 4230 + + class Descriptor(object): + counter = 0 + def __get__(self, obj, objtype=None): + def getter(name): + self.counter += 1 + raise AttributeError(name) + return getter + + descr = Descriptor() + class A(object): + __getattribute__ = descr + class B(object): + __getattr__ = descr + class C(object): + __getattribute__ = descr + __getattr__ = descr + + self.assertRaises(AttributeError, getattr, A(), "attr") + self.assertEquals(descr.counter, 1) + self.assertRaises(AttributeError, getattr, B(), "attr") + self.assertEquals(descr.counter, 2) + self.assertRaises(AttributeError, getattr, C(), "attr") + self.assertEquals(descr.counter, 4) + + import gc + class EvilGetattribute(object): + # This used to segfault + def __getattr__(self, name): + raise AttributeError(name) + def __getattribute__(self, name): + del EvilGetattribute.__getattr__ + for i in range(5): + gc.collect() + raise AttributeError(name) + + self.assertRaises(AttributeError, getattr, EvilGetattribute(), "attr") + class DictProxyTests(unittest.TestCase): def setUp(self): Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Mon Nov 17 23:44:30 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. + - Issue #4048: The parser module now correctly validates relative imports. - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an Modified: python/branches/release26-maint/Objects/typeobject.c ============================================================================== --- python/branches/release26-maint/Objects/typeobject.c (original) +++ python/branches/release26-maint/Objects/typeobject.c Mon Nov 17 23:44:30 2008 @@ -5391,6 +5391,24 @@ } static PyObject * +call_attribute(PyObject *self, PyObject *attr, PyObject *name) +{ + PyObject *res, *descr = NULL; + descrgetfunc f = Py_TYPE(attr)->tp_descr_get; + + if (f != NULL) { + descr = f(attr, self, (PyObject *)(Py_TYPE(self))); + if (descr == NULL) + return NULL; + else + attr = descr; + } + res = PyObject_CallFunctionObjArgs(attr, name, NULL); + Py_XDECREF(descr); + return res; +} + +static PyObject * slot_tp_getattr_hook(PyObject *self, PyObject *name) { PyTypeObject *tp = Py_TYPE(self); @@ -5409,24 +5427,39 @@ if (getattribute_str == NULL) return NULL; } + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when the attribute is present. So we use + _PyType_Lookup and create the method only when needed, with + call_attribute. */ getattr = _PyType_Lookup(tp, getattr_str); if (getattr == NULL) { /* No __getattr__ hook: use a simpler dispatcher */ tp->tp_getattro = slot_tp_getattro; return slot_tp_getattro(self, name); } + Py_INCREF(getattr); + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when self has the default __getattribute__ + method. So we use _PyType_Lookup and create the method only when + needed, with call_attribute. */ getattribute = _PyType_Lookup(tp, getattribute_str); if (getattribute == NULL || (Py_TYPE(getattribute) == &PyWrapperDescr_Type && ((PyWrapperDescrObject *)getattribute)->d_wrapped == (void *)PyObject_GenericGetAttr)) res = PyObject_GenericGetAttr(self, name); - else - res = PyObject_CallFunctionObjArgs(getattribute, self, name, NULL); + else { + Py_INCREF(getattribute); + res = call_attribute(self, getattribute, name); + Py_DECREF(getattribute); + } if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); - res = PyObject_CallFunctionObjArgs(getattr, self, name, NULL); + res = call_attribute(self, getattr, name); } + Py_DECREF(getattr); return res; } From python-checkins at python.org Tue Nov 18 00:27:03 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 18 Nov 2008 00:27:03 +0100 (CET) Subject: [Python-checkins] r67250 - in python/branches/release24-maint: Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Message-ID: <20081117232703.262C21E400C@bag.python.org> Author: benjamin.peterson Date: Tue Nov 18 00:27:02 2008 New Revision: 67250 Log: backport the security fix part of r67246 Modified: python/branches/release24-maint/Lib/test/test_descr.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Objects/typeobject.c Modified: python/branches/release24-maint/Lib/test/test_descr.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_descr.py (original) +++ python/branches/release24-maint/Lib/test/test_descr.py Tue Nov 18 00:27:02 2008 @@ -4087,6 +4087,24 @@ check(iexpr, c, N1) check(iexpr, c, N2) +def test_lost_getattr(): + # issue 4230 + import gc + class EvilGetattribute(object): + def __getattr__(self, name): + raise AttributeError(name) + def __getattribute__(self, name): + del EvilGetattribute.__getattr__ + for i in range(5): + gc.collect() + raise AttributeError(name) + + try: + # This used to segfault + EvilGetattribute().attr + except AttributeError: + pass + def test_main(): weakref_segfault() # Must be first, somehow wrapper_segfault() @@ -4183,6 +4201,7 @@ vicious_descriptor_nonsense() test_init() notimplemented() + test_lost_getattr() if verbose: print "All OK" Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Nov 18 00:27:02 2008 @@ -12,6 +12,9 @@ Core and builtins ----------------- +- Issue #4230: Fix a crash when a class has a custom __getattr__ and an + __getattribute__ method that deletes the __getattr__ attribute. + - Apply security patches from Apple. CVE-2008-2315. - Issue #2620: Overflow checking when allocating or reallocating memory Modified: python/branches/release24-maint/Objects/typeobject.c ============================================================================== --- python/branches/release24-maint/Objects/typeobject.c (original) +++ python/branches/release24-maint/Objects/typeobject.c Tue Nov 18 00:27:02 2008 @@ -4594,6 +4594,7 @@ tp->tp_getattro = slot_tp_getattro; return slot_tp_getattro(self, name); } + Py_INCREF(getattr); getattribute = _PyType_Lookup(tp, getattribute_str); if (getattribute == NULL || (getattribute->ob_type == &PyWrapperDescr_Type && @@ -4606,6 +4607,7 @@ PyErr_Clear(); res = PyObject_CallFunction(getattr, "OO", self, name); } + Py_DECREF(getattr); return res; } From python-checkins at python.org Tue Nov 18 00:35:25 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 18 Nov 2008 00:35:25 +0100 (CET) Subject: [Python-checkins] r67251 - in python/branches/release25-maint: Lib/test/test_descr.py Misc/NEWS Objects/typeobject.c Message-ID: <20081117233525.4C3911E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 18 00:35:24 2008 New Revision: 67251 Log: backport r67246 from the trunk Modified: python/branches/release25-maint/Lib/test/test_descr.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Objects/typeobject.c Modified: python/branches/release25-maint/Lib/test/test_descr.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_descr.py (original) +++ python/branches/release25-maint/Lib/test/test_descr.py Tue Nov 18 00:35:24 2008 @@ -1073,20 +1073,21 @@ (EditableScrollablePane, ScrollablePane, EditablePane, Pane, ScrollingMixin, EditingMixin, object)) +def raises(exc, expected, callable, *args): + try: + callable(*args) + except exc, msg: + if not str(msg).startswith(expected): + raise TestFailed, "Message %r, expected %r" % (str(msg), + expected) + else: + raise TestFailed, "Expected %s" % exc + mro_err_msg = """Cannot create a consistent method resolution order (MRO) for bases """ def mro_disagreement(): if verbose: print "Testing error messages for MRO disagreement..." - def raises(exc, expected, callable, *args): - try: - callable(*args) - except exc, msg: - if not str(msg).startswith(expected): - raise TestFailed, "Message %r, expected %r" % (str(msg), - expected) - else: - raise TestFailed, "Expected %s" % exc class A(object): pass class B(A): pass class C(object): pass @@ -4171,6 +4172,45 @@ vereq(t.__add__, (7,).__add__) vereq(hash(t.__add__), hash((7,).__add__)) +def test_getattr_hooks(): + # issue 4230 + class Descriptor(object): + counter = 0 + def __get__(self, obj, objtype=None): + def getter(name): + self.counter += 1 + raise AttributeError(name) + return getter + + descr = Descriptor() + class A(object): + __getattribute__ = descr + class B(object): + __getattr__ = descr + class C(object): + __getattribute__ = descr + __getattr__ = descr + + raises(AttributeError, "attr", getattr, A(), "attr") + vereq(descr.counter, 1) + raises(AttributeError, "attr", getattr, B(), "attr") + vereq(descr.counter, 2) + raises(AttributeError, "attr", getattr, C(), "attr") + vereq(descr.counter, 4) + + import gc + class EvilGetattribute(object): + # This used to segfault + def __getattr__(self, name): + raise AttributeError(name) + def __getattribute__(self, name): + del EvilGetattribute.__getattr__ + for i in range(5): + gc.collect() + raise AttributeError(name) + + raises(AttributeError, "attr", getattr, EvilGetattribute(), "attr") + def notimplemented(): # all binary methods should be able to return a NotImplemented if verbose: @@ -4352,6 +4392,7 @@ methodwrapper() notimplemented() test_assign_slice() + test_getattr_hooks() if verbose: print "All OK" Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Nov 18 00:35:24 2008 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. + - Issue #4048: The parser module now correctly validates relative imports. - Issue #4176: Fixed a crash when pickling an object which ``__reduce__`` Modified: python/branches/release25-maint/Objects/typeobject.c ============================================================================== --- python/branches/release25-maint/Objects/typeobject.c (original) +++ python/branches/release25-maint/Objects/typeobject.c Tue Nov 18 00:35:24 2008 @@ -4738,6 +4738,24 @@ } static PyObject * +call_attribute(PyObject *self, PyObject *attr, PyObject *name) +{ + PyObject *res, *descr = NULL; + descrgetfunc f = attr->ob_type->tp_descr_get; + + if (f != NULL) { + descr = f(attr, self, (PyObject *)(self->ob_type)); + if (descr == NULL) + return NULL; + else + attr = descr; + } + res = PyObject_CallFunctionObjArgs(attr, name, NULL); + Py_XDECREF(descr); + return res; +} + +static PyObject * slot_tp_getattr_hook(PyObject *self, PyObject *name) { PyTypeObject *tp = self->ob_type; @@ -4756,24 +4774,39 @@ if (getattribute_str == NULL) return NULL; } + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when the attribute is present. So we use + _PyType_Lookup and create the method only when needed, with + call_attribute. */ getattr = _PyType_Lookup(tp, getattr_str); if (getattr == NULL) { /* No __getattr__ hook: use a simpler dispatcher */ tp->tp_getattro = slot_tp_getattro; return slot_tp_getattro(self, name); } + Py_INCREF(getattr); + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when self has the default __getattribute__ + method. So we use _PyType_Lookup and create the method only when + needed, with call_attribute. */ getattribute = _PyType_Lookup(tp, getattribute_str); if (getattribute == NULL || (getattribute->ob_type == &PyWrapperDescr_Type && ((PyWrapperDescrObject *)getattribute)->d_wrapped == (void *)PyObject_GenericGetAttr)) res = PyObject_GenericGetAttr(self, name); - else - res = PyObject_CallFunctionObjArgs(getattribute, self, name, NULL); + else { + Py_INCREF(getattribute); + res = call_attribute(self, getattribute, name); + Py_DECREF(getattribute); + } if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); - res = PyObject_CallFunctionObjArgs(getattr, self, name, NULL); + res = call_attribute(self, getattr, name); } + Py_DECREF(getattr); return res; } From python-checkins at python.org Tue Nov 18 00:37:34 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 18 Nov 2008 00:37:34 +0100 (CET) Subject: [Python-checkins] r67252 - python/branches/release24-maint Message-ID: <20081117233734.82B561E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 18 00:37:34 2008 New Revision: 67252 Log: update svn:ignore here Modified: python/branches/release24-maint/ (props changed) From buildbot at python.org Tue Nov 18 00:50:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 17 Nov 2008 23:50:30 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 2.5 Message-ID: <20081117235030.C58701E402F@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/61 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Tue Nov 18 01:26:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 00:26:24 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081118002624.C8CC61E4010@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/2081 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_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 18 01:32:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 00:32:10 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081118003210.878531E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/410 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Tue Nov 18 04:24:49 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 04:24:49 +0100 (CET) Subject: [Python-checkins] r67254 - sandbox/trunk/tkinter-polo/src/FileDialog.py Message-ID: <20081118032449.0B5A21E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 04:24:48 2008 New Revision: 67254 Log: * Removed star import; * FileDialog is a subclass of Toplevel now; * Renamed class attribute 'title' to 'dlg_title' so it doesn't conflict with Tkinter.Wm.title * Making clear that the person should /try/ opening the file (if one wants to) instead of saying just to open it (FileDialog docstring); * Changed its layout a bit: the filter button is next to the filter entry now, added some spacing between widgets, changed scrollbar positions, added a panedwindow between the listboxes, the bottom buttons are placed on right; * Uses the tab order that one would naturally expect; * Renamed self.how to self.result (makes more sense to me); * Renamed FileDialog.quit to FileDialog.close, the former has been taken by Tkinter.Misc; * dirs_select_event and files_select_event use listbox curselection now, this eliminates the need to deal with bindtags and it also checks for no selection, so creating an empty FileDialog and clicking on it doesn't give some tracebacks; Modified: sandbox/trunk/tkinter-polo/src/FileDialog.py Modified: sandbox/trunk/tkinter-polo/src/FileDialog.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/FileDialog.py (original) +++ sandbox/trunk/tkinter-polo/src/FileDialog.py Tue Nov 18 04:24:48 2008 @@ -1,33 +1,30 @@ -"""File selection dialog classes. +"""File selection dialog classes.""" -Classes: - -- FileDialog -- LoadFileDialog -- SaveFileDialog - -""" - -from Tkinter import * -from Dialog import Dialog +__all__ = ['FileDialog', 'LoadFileDialog', 'SaveFileDialog'] import os import fnmatch +from Tkinter import Toplevel, Frame, PanedWindow +from Tkinter import Button, Entry, Listbox, Scrollbar +from Tkconstants import TOP, BOTTOM, X, Y, BOTH, RIGHT, LEFT, END, E +from Dialog import Dialog dialogstates = {} - -class FileDialog: - +class FileDialog(Toplevel): """Standard file selection dialog -- no checks on selected file. Usage: d = FileDialog(master) fname = d.go(dir_or_file, pattern, default, key) - if fname is None: ...canceled... - else: ...open file... + if fname is None: + # canceled + ... + else: + # try opening it + ... All arguments to go() are optional. @@ -38,76 +35,84 @@ the dialog keeps no memory of previous state. Note that memory is kept even when the dialog is canceled. (All this emulates the behavior of the Macintosh file selection dialogs.) - """ - title = "File Selection Dialog" + dlg_title = "File Selection Dialog" def __init__(self, master, title=None): - if title is None: title = self.title - self.master = master - self.directory = None + if title is None: + title = self.dlg_title - self.top = Toplevel(master) - self.top.title(title) - self.top.iconname(title) + Toplevel.__init__(self, master) + self.wm_title(title) + self.iconname(title) - self.botframe = Frame(self.top) - self.botframe.pack(side=BOTTOM, fill=X) - - self.selection = Entry(self.top) - self.selection.pack(side=BOTTOM, fill=X) - self.selection.bind('', self.ok_event) + self.directory = None - self.filter = Entry(self.top) - self.filter.pack(side=TOP, fill=X) - self.filter.bind('', self.filter_command) + filterframe = Frame(self) + self.filter = Entry(filterframe) + filter_button = Button(filterframe, text="Filter", + command=self.filter_command) + + # Middle frame, holds the listboxes + midframe = Frame(self) + paned = PanedWindow(midframe, orient='horizontal') + # Directory listbox + dirsframe = Frame(paned) + self.dirs = Listbox(dirsframe, exportselection=0) + dirsbar = Scrollbar(dirsframe, command=self.dirs.yview) + self.dirs['yscrollcommand'] = dirsbar.set + # Files listbox + filesframe = Frame(paned) + self.files = Listbox(filesframe, exportselection=False) + filesbar = Scrollbar(filesframe, command=self.files.yview) + self.files['yscrollcommand'] = filesbar.set + # Paned + paned.add(dirsframe) + paned.add(filesframe) - self.midframe = Frame(self.top) - self.midframe.pack(expand=YES, fill=BOTH) + self.selection = Entry(self) + self.selection.bind('', self.ok_event) - self.filesbar = Scrollbar(self.midframe) - self.filesbar.pack(side=RIGHT, fill=Y) - self.files = Listbox(self.midframe, exportselection=0, - yscrollcommand=(self.filesbar, 'set')) - self.files.pack(side=RIGHT, expand=YES, fill=BOTH) - btags = self.files.bindtags() - self.files.bindtags(btags[1:] + btags[:1]) - self.files.bind('', self.files_select_event) - self.files.bind('', self.files_double_event) - self.filesbar.config(command=(self.files, 'yview')) + # Bottom frame, holds dialog buttons + btframe = Frame(self) + ok_button = Button(btframe, text="OK", command=self.ok_command) + cancel_button = Button(btframe, text="Cancel", + command=self.cancel_command) - self.dirsbar = Scrollbar(self.midframe) - self.dirsbar.pack(side=LEFT, fill=Y) - self.dirs = Listbox(self.midframe, exportselection=0, - yscrollcommand=(self.dirsbar, 'set')) - self.dirs.pack(side=LEFT, expand=YES, fill=BOTH) - self.dirsbar.config(command=(self.dirs, 'yview')) - btags = self.dirs.bindtags() - self.dirs.bindtags(btags[1:] + btags[:1]) + # setup bindings + self.filter.bind('', self.filter_command) self.dirs.bind('', self.dirs_select_event) self.dirs.bind('', self.dirs_double_event) + self.files.bind('', self.files_select_event) + self.files.bind('', self.files_double_event) + self.wm_protocol('WM_DELETE_WINDOW', self.cancel_command) + # XXX Are the following okay for a general audience? + self.bind('', self.cancel_command) + self.bind('', self.cancel_command) - self.ok_button = Button(self.botframe, - text="OK", - command=self.ok_command) - self.ok_button.pack(side=LEFT) - self.filter_button = Button(self.botframe, - text="Filter", - command=self.filter_command) - self.filter_button.pack(side=LEFT, expand=YES) - self.cancel_button = Button(self.botframe, - text="Cancel", - command=self.cancel_command) - self.cancel_button.pack(side=RIGHT) + # pack widgets + spacing = {'padx': 6, 'pady': 6} - self.top.protocol('WM_DELETE_WINDOW', self.cancel_command) - # XXX Are the following okay for a general audience? - self.top.bind('', self.cancel_command) - self.top.bind('', self.cancel_command) + filterframe.pack(fill=X) + self.filter.pack(side=LEFT, fill=X, expand=True, **spacing) + filter_button.pack(side=RIGHT, **spacing) + + midframe.pack(expand=True, fill=BOTH, **spacing) + paned.pack(expand=True, fill=BOTH) + self.dirs.pack(side=LEFT, fill=BOTH, expand=True) + dirsbar.pack(side=LEFT, fill=Y) + self.files.pack(side=LEFT, fill=BOTH, expand=True) + filesbar.pack(side=LEFT, fill=Y) + + self.selection.pack(fill=X, **spacing) + + btframe.pack(side=BOTTOM, anchor=E) + cancel_button.pack(side=LEFT, **spacing) + ok_button.pack(side=LEFT, **spacing) def go(self, dir_or_file=os.curdir, pattern="*", default="", key=None): - if key and dialogstates.has_key(key): + if key and key in dialogstates: self.directory, pattern = dialogstates[key] else: dir_or_file = os.path.expanduser(dir_or_file) @@ -119,28 +124,35 @@ self.set_selection(default) self.filter_command() self.selection.focus_set() - self.top.wait_visibility() # window needs to be visible for the grab - self.top.grab_set() - self.how = None - self.master.mainloop() # Exited by self.quit(how) + + self.result = None + self.wait_visibility() # window needs to be visible for the grab + self.grab_set() + self.mainloop() + if key: directory, pattern = self.get_filter() - if self.how: - directory = os.path.dirname(self.how) + if self.result: + directory = os.path.dirname(self.result) dialogstates[key] = directory, pattern - self.top.destroy() - return self.how - def quit(self, how=None): - self.how = how - self.master.quit() # Exit mainloop() + self.destroy() + return self.result + + def close(self, result=None): + self.result = result + self.quit() def dirs_double_event(self, event): self.filter_command() def dirs_select_event(self, event): + sel = self.dirs.curselection() + if not sel: + return + dir, pat = self.get_filter() - subdir = self.dirs.get('active') + subdir = self.dirs.get(sel[0]) dir = os.path.normpath(os.path.join(self.directory, subdir)) self.set_filter(dir, pat) @@ -148,24 +160,32 @@ self.ok_command() def files_select_event(self, event): - file = self.files.get('active') - self.set_selection(file) + sel = self.files.curselection() + if not sel: + return + + self.set_selection(self.files.get(sel[0])) def ok_event(self, event): self.ok_command() def ok_command(self): - self.quit(self.get_selection()) + self.close(self.get_selection()) + + def cancel_command(self, event=None): + self.close() def filter_command(self, event=None): dir, pat = self.get_filter() try: names = os.listdir(dir) except os.error: - self.master.bell() + self.bell() return + self.directory = dir self.set_filter(dir, pat) + names.sort() subdirs = [os.pardir] matchingfiles = [] @@ -175,14 +195,18 @@ subdirs.append(name) elif fnmatch.fnmatch(name, pat): matchingfiles.append(name) + self.dirs.delete(0, END) for name in subdirs: self.dirs.insert(END, name) + self.files.delete(0, END) for name in matchingfiles: self.files.insert(END, name) + head, tail = os.path.split(self.get_selection()) - if tail == os.curdir: tail = '' + if tail == os.curdir: + tail = '' self.set_selection(tail) def get_filter(self): @@ -193,12 +217,8 @@ return os.path.split(filter) def get_selection(self): - file = self.selection.get() - file = os.path.expanduser(file) - return file - - def cancel_command(self, event=None): - self.quit() + sel = self.selection.get() + return os.path.expanduser(sel) def set_filter(self, dir, pat): if not os.path.isabs(dir): @@ -206,7 +226,7 @@ pwd = os.getcwd() except os.error: pwd = None - if pwd: + else: dir = os.path.join(pwd, dir) dir = os.path.normpath(dir) self.filter.delete(0, END) @@ -218,57 +238,65 @@ class LoadFileDialog(FileDialog): - """File selection dialog which checks that the file exists.""" - title = "Load File Selection Dialog" + dlg_title = "Load File Selection Dialog" def ok_command(self): - file = self.get_selection() - if not os.path.isfile(file): + sel = self.get_selection() + if not os.path.isfile(sel): self.master.bell() else: - self.quit(file) + self.close(sel) class SaveFileDialog(FileDialog): - """File selection dialog which checks that the file may be created.""" - title = "Save File Selection Dialog" + dlg_title = "Save File Selection Dialog" def ok_command(self): - file = self.get_selection() - if os.path.exists(file): - if os.path.isdir(file): - self.master.bell() + sel = self.get_selection() + + if os.path.exists(sel): + if os.path.isdir(sel): + # selection is not a file, keep the FileDialog running + self.bell() return - d = Dialog(self.top, + + dlg = Dialog(self, title="Overwrite Existing File Question", - text="Overwrite existing file %r?" % (file,), + text=("Overwrite existing file %r ?" % sel), bitmap='questhead', default=1, strings=("Yes", "Cancel")) - if d.num != 0: + + if dlg.num == 1: + # cancelled, keep the FileDialog running return + else: - head, tail = os.path.split(file) + head, tail = os.path.split(sel) if not os.path.isdir(head): - self.master.bell() + # selection is not a file, keep the FileDialog running + self.bell() return - self.quit(file) + + self.close(sel) -def test(): - """Simple test program.""" +def example(): + """Example program.""" + from Tkinter import Tk root = Tk() root.withdraw() + fd = LoadFileDialog(root) loadfile = fd.go(key="test") fd = SaveFileDialog(root) savefile = fd.go(key="test") - print loadfile, savefile + print loadfile, savefile -if __name__ == '__main__': - test() +if __name__ == "__main__": + example() From python-checkins at python.org Tue Nov 18 05:13:53 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 05:13:53 +0100 (CET) Subject: [Python-checkins] r67255 - sandbox/trunk/tkinter-polo/src/ScrolledText.py Message-ID: <20081118041353.3934E1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 05:13:52 2008 New Revision: 67255 Log: * Removed star import usage; * Cleaned it up a bit, by dropping support for cnf; * Added a minimal example Modified: sandbox/trunk/tkinter-polo/src/ScrolledText.py Modified: sandbox/trunk/tkinter-polo/src/ScrolledText.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/ScrolledText.py (original) +++ sandbox/trunk/tkinter-polo/src/ScrolledText.py Tue Nov 18 05:13:52 2008 @@ -1,43 +1,52 @@ -# A ScrolledText widget feels like a text widget but also has a -# vertical scroll bar on its right. (Later, options may be added to -# add a horizontal bar as well, to make the bars disappear -# automatically when not needed, to move them to the other side of the -# window, etc.) -# -# Configuration options are passed to the Text widget. -# A Frame widget is inserted between the master and the text, to hold -# the Scrollbar widget. -# Most methods calls are inherited from the Text widget; Pack methods -# are redirected to the Frame widget however. +"""A ScrolledText widget feels like a text widget but also has a +vertical scroll bar on its right. (Later, options may be added to +add a horizontal bar as well, to make the bars disappear +automatically when not needed, to move them to the other side of the +window, etc.) -from Tkinter import * -from Tkinter import _cnfmerge +Configuration options are passed to the Text widget. +A Frame widget is inserted between the master and the text, to hold +the Scrollbar widget. +Most methods calls are inherited from the Text widget; Pack, Grid and +Place methods are redirected to the Frame widget however. +""" + +__all__ = ['ScrolledText'] + +from Tkinter import Frame, Text, Scrollbar, Pack, Grid, Place +from Tkconstants import RIGHT, LEFT, Y, BOTH class ScrolledText(Text): - def __init__(self, master=None, cnf=None, **kw): - if cnf is None: - cnf = {} - if kw: - cnf = _cnfmerge((cnf, kw)) - fcnf = {} - for k in cnf.keys(): - if type(k) == ClassType or k == 'name': - fcnf[k] = cnf[k] - del cnf[k] - self.frame = Frame(master, **fcnf) - self.vbar = Scrollbar(self.frame, name='vbar') + def __init__(self, master=None, **kw): + self.frame = Frame(master) + self.vbar = Scrollbar(self.frame) self.vbar.pack(side=RIGHT, fill=Y) - cnf['name'] = 'text' - Text.__init__(self, self.frame, **cnf) - self.pack(side=LEFT, fill=BOTH, expand=1) - self['yscrollcommand'] = self.vbar.set + + kw.update({'yscrollcommand': self.vbar.set}) + Text.__init__(self, self.frame, **kw) + self.pack(side=LEFT, fill=BOTH, expand=True) self.vbar['command'] = self.yview # Copy geometry methods of self.frame -- hack! - methods = Pack.__dict__.keys() - methods = methods + Grid.__dict__.keys() - methods = methods + Place.__dict__.keys() + methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys() for m in methods: if m[0] != '_' and m != 'config' and m != 'configure': setattr(self, m, getattr(self.frame, m)) + + def __str__(self): + return str(self.frame) + + +def example(): + import __main__ + from Tkconstants import END + + stext = ScrolledText(bg='white', height=10) + stext.insert(END, __main__.__doc__) + stext.pack(fill=BOTH, side=LEFT, expand=True) + stext.focus_set() + stext.mainloop() + +if __name__ == "__main__": + example() From buildbot at python.org Tue Nov 18 06:57:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 05:57:48 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081118055750.39BA81E4002@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/757 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: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 18 07:13:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 06:13:36 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081118061337.4B4441E4002@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/677 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: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Tue Nov 18 07:23:21 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 18 Nov 2008 01:23:21 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081118062321.GA742@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From nnorwitz at gmail.com Tue Nov 18 11:14:37 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 18 Nov 2008 05:14:37 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081118101437.GA23592@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_cmd_line leaked [-50, 50, 0] references, sum=0 test_smtplib leaked [0, 0, -7] references, sum=-7 test_sys leaked [21, 0, 0] references, sum=21 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From python-checkins at python.org Tue Nov 18 13:00:39 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 13:00:39 +0100 (CET) Subject: [Python-checkins] r67257 - sandbox/trunk/tkinter-polo/src/SimpleDialog.py Message-ID: <20081118120039.D0BEB1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 13:00:38 2008 New Revision: 67257 Log: * Removed usage of star import; * SimpleDialog is subclass of Toplevel now; * Changed its layout a bit, added some spacing, buttons on the right; * Removed the _set_transient method: didn't see the need to do such geometry tricks; * Moved the example in the bottom to an example method Modified: sandbox/trunk/tkinter-polo/src/SimpleDialog.py Modified: sandbox/trunk/tkinter-polo/src/SimpleDialog.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/SimpleDialog.py (original) +++ sandbox/trunk/tkinter-polo/src/SimpleDialog.py Tue Nov 18 13:00:38 2008 @@ -1,112 +1,84 @@ """A simple but flexible modal dialog box.""" +__all__ = ['SimpleDialog'] -from Tkinter import * +from Tkinter import Toplevel, Label, Frame, Message, Button +from Tkconstants import BOTH, LEFT, RIGHT - -class SimpleDialog: - - def __init__(self, master, - text='', buttons=[], default=None, cancel=None, - title=None, class_=None): - if class_: - self.root = Toplevel(master, class_=class_) - else: - self.root = Toplevel(master) - if title: - self.root.title(title) - self.root.iconname(title) - self.message = Message(self.root, text=text, aspect=400) - self.message.pack(expand=1, fill=BOTH) - self.frame = Frame(self.root) - self.frame.pack() +class SimpleDialog(Toplevel): + def __init__(self, master=None, text='', buttons=None, default=None, + cancel=None, title=None, **kw): + Toplevel.__init__(self, master, **kw) + self.wm_title(title) + self.wm_iconname(title) + + spacing = {'padx': 6, 'pady': 6} + self.message = Message(self, text=text, aspect=400) + self.message.pack(expand=True, fill=BOTH, **spacing) + self.frame = Frame(self) + self.frame.pack(side=RIGHT) self.num = default self.cancel = cancel self.default = default - self.root.bind('', self.return_event) - for num in range(len(buttons)): - s = buttons[num] - b = Button(self.frame, text=s, - command=(lambda self=self, num=num: self.done(num))) - if num == default: - b.config(relief=RIDGE, borderwidth=8) - b.pack(side=LEFT, fill=BOTH, expand=1) - self.root.protocol('WM_DELETE_WINDOW', self.wm_delete_window) - self._set_transient(master) - - def _set_transient(self, master, relx=0.5, rely=0.3): - widget = self.root - widget.withdraw() # Remain invisible while we figure out the geometry - widget.transient(master) - widget.update_idletasks() # Actualize geometry information - if master.winfo_ismapped(): - m_width = master.winfo_width() - m_height = master.winfo_height() - m_x = master.winfo_rootx() - m_y = master.winfo_rooty() - else: - m_width = master.winfo_screenwidth() - m_height = master.winfo_screenheight() - m_x = m_y = 0 - w_width = widget.winfo_reqwidth() - w_height = widget.winfo_reqheight() - x = m_x + (m_width - w_width) * relx - y = m_y + (m_height - w_height) * rely - if x+w_width > master.winfo_screenwidth(): - x = master.winfo_screenwidth() - w_width - elif x < 0: - x = 0 - if y+w_height > master.winfo_screenheight(): - y = master.winfo_screenheight() - w_height - elif y < 0: - y = 0 - widget.geometry("+%d+%d" % (x, y)) - widget.deiconify() # Become visible at the desired location + self.bind('', self.return_event) + + buttons = buttons or () + for indx, text in enumerate(buttons): + b = Button(self.frame, text=text, + command=(lambda self=self, indx=indx: self.done(indx))) + b.pack(side=RIGHT, **spacing) + if indx == default: + b.config(default='active') + + self.wm_protocol('WM_DELETE_WINDOW', self.wm_delete_window) + self.wm_transient(master) def go(self): - self.root.wait_visibility() - self.root.grab_set() - self.root.mainloop() - self.root.destroy() + self.wait_visibility() + self.grab_set() + self.mainloop() + self.destroy() return self.num def return_event(self, event): if self.default is None: - self.root.bell() + self.bell() else: self.done(self.default) def wm_delete_window(self): if self.cancel is None: - self.root.bell() + self.bell() else: self.done(self.cancel) def done(self, num): self.num = num - self.root.quit() + self.quit() -if __name__ == '__main__': +def example(): + from Tkinter import Tk - def test(): - root = Tk() - def doit(root=root): - d = SimpleDialog(root, + def show_dlg(): + d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" - "Do you believe this?", - buttons=["Yes", "No", "Cancel"], + "Do you believe this ?", + buttons=("Yes", "No", "Cancel"), default=0, cancel=2, title="Test Dialog") - print d.go() - t = Button(root, text='Test', command=doit) - t.pack() - q = Button(root, text='Quit', command=t.quit) - q.pack() - t.mainloop() + print d.go() - test() + root = Tk() + t = Button(root, text='Test', command=show_dlg) + q = Button(root, text='Quit', command=t.quit) + t.pack() + q.pack() + root.mainloop() + +if __name__ == '__main__': + example() From python-checkins at python.org Tue Nov 18 13:13:28 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 13:13:28 +0100 (CET) Subject: [Python-checkins] r67258 - sandbox/trunk/tkinter-polo/src/FixTk.py Message-ID: <20081118121328.1110D1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 13:13:27 2008 New Revision: 67258 Log: * Moved some common code to a new function (find_path); * Removed has_key uses Modified: sandbox/trunk/tkinter-polo/src/FixTk.py Modified: sandbox/trunk/tkinter-polo/src/FixTk.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/FixTk.py (original) +++ sandbox/trunk/tkinter-polo/src/FixTk.py Tue Nov 18 13:13:27 2008 @@ -1,41 +1,41 @@ -import sys, os - # Delay import _tkinter until we have set TCL_LIBRARY, # so that Tcl_FindExecutable has a chance to locate its # encoding directory. - +# # Unfortunately, we cannot know the TCL_LIBRARY directory # if we don't know the tcl version, which we cannot find out # without import Tcl. Fortunately, Tcl will itself look in -# \..\tcl, so anything close to +# /../tcl, so anything close to # the real Tcl library will do. -prefix = os.path.join(sys.prefix,"tcl") +import os +import sys + +def find_path(prefix, basename, env_var): + for name in os.listdir(prefix): + if name.startswith(basename): + pkgdir = os.path.join(prefix, name) + if os.path.isdir(pkgdir): + os.environ[env_var] = pkgdir + +prefix = os.path.join(sys.prefix, "tcl") if not os.path.exists(prefix): # devdir/../tcltk/lib prefix = os.path.join(sys.prefix, os.path.pardir, "tcltk", "lib") prefix = os.path.abspath(prefix) # if this does not exist, no further search is needed if os.path.exists(prefix): - if not os.environ.has_key("TCL_LIBRARY"): - for name in os.listdir(prefix): - if name.startswith("tcl"): - tcldir = os.path.join(prefix,name) - if os.path.isdir(tcldir): - os.environ["TCL_LIBRARY"] = tcldir - # Compute TK_LIBRARY, knowing that it has the same version - # as Tcl + if not "TCL_LIBRARY" in os.environ: + find_path(prefix, 'tcl', 'TCL_LIBRARY') + + # Compute TK_LIBRARY, knowing that it has the same version as Tcl import _tkinter ver = str(_tkinter.TCL_VERSION) - if not os.environ.has_key("TK_LIBRARY"): - v = os.path.join(prefix, 'tk'+ver) + if not "TK_LIBRARY" in os.environ: + v = os.path.join(prefix, 'tk%s' % ver) if os.path.exists(os.path.join(v, "tclIndex")): os.environ['TK_LIBRARY'] = v - # We don't know the Tix version, so we must search the entire - # directory - if not os.environ.has_key("TIX_LIBRARY"): - for name in os.listdir(prefix): - if name.startswith("tix"): - tixdir = os.path.join(prefix,name) - if os.path.isdir(tixdir): - os.environ["TIX_LIBRARY"] = tixdir + + # We don't know the Tix version, so we must search the entire directory + if not "TIX_LIBRARY" in os.environ: + find_path(prefix, 'tix', 'TIX_LIBRARY') From python-checkins at python.org Tue Nov 18 13:20:46 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 13:20:46 +0100 (CET) Subject: [Python-checkins] r67259 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081118122046.E10521E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 13:20:46 2008 New Revision: 67259 Log: Added a function that returns a master to the caller, if possible. Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Tue Nov 18 13:20:46 2008 @@ -132,12 +132,25 @@ Call this function to inhibit that the first instance of Tk is used for windows without an explicit parent window. """ - global _support_default_root + global _support_default_root, _default_root _support_default_root = 0 - global _default_root _default_root = None del _default_root +def setup_master(master=None): + """If master is not None, itself is returned. Otherwise attempt + getting a new master or the default one and return it. + + If it is not allowed to use the default root and master is None, + RuntimeError is raised.""" + if master is None: + if _support_default_root: + master = _default_root or Tkinter.Tk() + else: + raise RuntimeError("No master specified and Tkinter is " + "configured to not support default root") + return master + def _tkerror(err): """Internal function.""" pass From python-checkins at python.org Tue Nov 18 13:30:29 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 13:30:29 +0100 (CET) Subject: [Python-checkins] r67260 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081118123029.13A581E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 13:30:28 2008 New Revision: 67260 Log: Applied setup_master where possible, now only setup_master and the Tk class has to deal with _default_root. Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Tue Nov 18 13:30:28 2008 @@ -177,8 +177,7 @@ then the existing value is retained. """ global _varnum - if not master: - master = _default_root + master = setup_master(master) self._master = master self._tk = master.tk if name: @@ -323,7 +322,7 @@ def mainloop(n=0): """Run the main loop of Tcl.""" - _default_root.tk.mainloop(n) + setup_master().tk.mainloop(n) getint = int @@ -331,7 +330,7 @@ def getboolean(s): """Convert true and false to integer values 1 and 0.""" - return _default_root.tk.getboolean(s) + return setup_master().tk.getboolean(s) # Methods defined on both toplevel and interior widgets class Misc: @@ -1892,12 +1891,7 @@ """Internal class.""" def _setup(self, master, cnf): """Internal function. Sets up information about children.""" - if _support_default_root: - global _default_root - if not master: - if not _default_root: - _default_root = Tk() - master = _default_root + master = setup_master(master) self.master = master self.tk = master.tk name = None @@ -3220,10 +3214,7 @@ _last_id = 0 def __init__(self, imgtype, name=None, cnf={}, master=None, **kw): self.name = None - if not master: - master = _default_root - if not master: - raise RuntimeError, 'Too early to create image' + master = setup_master(master) self.tk = master.tk if not name: Image._last_id += 1 @@ -3343,8 +3334,8 @@ Valid resource names: background, data, file, foreground, maskdata, maskfile.""" Image.__init__(self, 'bitmap', name, cnf, master, **kw) -def image_names(): return _default_root.tk.call('image', 'names') -def image_types(): return _default_root.tk.call('image', 'types') +def image_names(): return setup_master().tk.call('image', 'names') +def image_types(): return setup_master().tk.call('image', 'types') class Spinbox(Widget): From python-checkins at python.org Tue Nov 18 13:46:40 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 13:46:40 +0100 (CET) Subject: [Python-checkins] r67261 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081118124640.10B511E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 13:46:39 2008 New Revision: 67261 Log: Oops, this should have been Tk() only Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Tue Nov 18 13:46:39 2008 @@ -145,7 +145,7 @@ RuntimeError is raised.""" if master is None: if _support_default_root: - master = _default_root or Tkinter.Tk() + master = _default_root or Tk() else: raise RuntimeError("No master specified and Tkinter is " "configured to not support default root") From python-checkins at python.org Tue Nov 18 13:58:07 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 13:58:07 +0100 (CET) Subject: [Python-checkins] r67262 - sandbox/trunk/tkinter-polo/src/tkColorChooser.py Message-ID: <20081118125807.C77CB1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 13:58:07 2008 New Revision: 67262 Log: Fixes for correctly handling result Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/tkColorChooser.py (original) +++ sandbox/trunk/tkinter-polo/src/tkColorChooser.py Tue Nov 18 13:58:07 2008 @@ -34,19 +34,22 @@ try: # make sure initialcolor is a tk color string color = self.options["initialcolor"] - if type(color) == type(()): + if isinstance(color, tuple): # assume an RGB triplet self.options["initialcolor"] = "#%02x%02x%02x" % color except KeyError: pass def _fixresult(self, widget, result): + # result can be somethings: an empty tuple, an empty string or + # a Tcl_Obj, so this somewhat weird check handles that + if not result or not str(result): + return None, None # canceled + # to simplify application code, the color chooser returns # an RGB tuple together with the Tk color string - if not result: - return None, None # canceled r, g, b = widget.winfo_rgb(result) - return (r/256, g/256, b/256), result + return (r/256, g/256, b/256), str(result) # @@ -66,5 +69,4 @@ # test stuff if __name__ == "__main__": - print "color", askcolor() From python-checkins at python.org Tue Nov 18 14:56:00 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 14:56:00 +0100 (CET) Subject: [Python-checkins] r67263 - sandbox/trunk/tkinter-polo/src/_tkinter.c Message-ID: <20081118135600.5A43A1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 14:56:00 2008 New Revision: 67263 Log: Implement nb_nonzero for PyTclObjects Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c ============================================================================== --- sandbox/trunk/tkinter-polo/src/_tkinter.c (original) +++ sandbox/trunk/tkinter-polo/src/_tkinter.c Tue Nov 18 14:56:00 2008 @@ -844,6 +844,12 @@ return 0; } +static int +PyTclObject_nonzero(PyTclObject *self) +{ + return Tcl_GetCharLength(self->value) ? 1 : 0; +} + PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type"); static PyObject* @@ -868,6 +874,20 @@ {0} }; +static PyNumberMethods PyTclObject_as_number = { + 0, /* nb_add */ + 0, /* nb_subtract */ + 0, /* nb_muliply */ + 0, /* nb_divide */ + 0, /* nb_remainder */ + 0, /* nb_divmod */ + 0, /* nb_power */ + 0, /* nb_negative */ + 0, /* nb_positive */ + 0, /* nb_absolute */ + (inquiry)PyTclObject_nonzero /* nb_nonzero */ +}; + statichere PyTypeObject PyTclObject_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ @@ -881,7 +901,7 @@ 0, /*tp_setattr*/ (cmpfunc)PyTclObject_cmp, /*tp_compare*/ (reprfunc)PyTclObject_repr, /*tp_repr*/ - 0, /*tp_as_number*/ + &PyTclObject_as_number, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ From python-checkins at python.org Tue Nov 18 14:59:35 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 14:59:35 +0100 (CET) Subject: [Python-checkins] r67264 - sandbox/trunk/tkinter-polo/src/tkColorChooser.py Message-ID: <20081118135935.5D7711E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 14:59:35 2008 New Revision: 67264 Log: The weird check is no longer needed, Tcl_Obj has __nonzero__ now Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/tkColorChooser.py (original) +++ sandbox/trunk/tkinter-polo/src/tkColorChooser.py Tue Nov 18 14:59:35 2008 @@ -41,9 +41,7 @@ pass def _fixresult(self, widget, result): - # result can be somethings: an empty tuple, an empty string or - # a Tcl_Obj, so this somewhat weird check handles that - if not result or not str(result): + if not result: return None, None # canceled # to simplify application code, the color chooser returns From python-checkins at python.org Tue Nov 18 15:05:49 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 18 Nov 2008 15:05:49 +0100 (CET) Subject: [Python-checkins] r67265 - sandbox/trunk/tkinter-polo/src/tkColorChooser.py Message-ID: <20081118140549.401CC1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 18 15:05:49 2008 New Revision: 67265 Log: Some code relayout Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/tkColorChooser.py (original) +++ sandbox/trunk/tkinter-polo/src/tkColorChooser.py Tue Nov 18 15:05:49 2008 @@ -19,11 +19,10 @@ # - title: dialog title # -from tkCommonDialog import Dialog +__all__ = ['Chooser', 'askcolor'] +from tkCommonDialog import Dialog -# -# color chooser class class Chooser(Dialog): "Ask for a color" @@ -50,10 +49,7 @@ return (r/256, g/256, b/256), str(result) -# -# convenience stuff - -def askcolor(color = None, **options): +def askcolor(color=None, **options): "Ask for a color" if color: @@ -63,8 +59,6 @@ return Chooser(**options).show() -# -------------------------------------------------------------------- -# test stuff - if __name__ == "__main__": + # test print "color", askcolor() From nnorwitz at gmail.com Tue Nov 18 22:08:25 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 18 Nov 2008 16:08:25 -0500 Subject: [Python-checkins] Python Regression Test Failures basics (1) Message-ID: <20081118210825.GA6463@python.psfb.org> 327 tests OK. 1 test failed: test_smtplib 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 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 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_fileio 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_future5 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 [12826 refs] [12826 refs] [21355 refs] test_imageop 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_lib2to3 skipped -- No module named myfixes 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_multiprocessing test_multiprocessing skipped -- OSError raises on RLock creation, see issue 3111! 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 /tmp/python-test/local/lib/python2.7/os.py:759: DeprecationWarning: integer argument expected, got float bs += read(_urandomfd, n - len(bs)) 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 [14481 refs] [14481 refs] test_plistlib test_poll test_popen [12831 refs] [12831 refs] [12831 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 [17360 refs] test_pyexpat test_queue test_quopri [15351 refs] [15351 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 [12826 refs] [12826 refs] [12829 refs] [12826 refs] test_slice test_smtplib test test_smtplib produced unexpected output: ********************************************************************** error: uncaptured python exception, closing channel (:[Errno 9] Bad file descriptor [/tmp/python-test/local/lib/python2.7/asyncore.py|readwrite|101] [/tmp/python-test/local/lib/python2.7/asyncore.py|handle_write_event|427] [|getsockopt|1] [/tmp/python-test/local/lib/python2.7/socket.py|_dummy|165]) ********************************************************************** test_socket 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 [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [14726 refs] [13041 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] [12826 refs] . [12826 refs] [12826 refs] this bit of output is from a test of stdout in a different process ... [12826 refs] [12826 refs] [13041 refs] test_sunaudiodev test_sunaudiodev skipped -- No module named sunaudiodev test_sundry /tmp/python-test/local/lib/python2.7/test/test_sundry.py:67: DeprecationWarning: The posixfile module is deprecated; fcntl.lockf() provides better locking import posixfile test_symtable test_syntax test_sys [12826 refs] [12826 refs] [13055 refs] [12849 refs] test_tarfile test_tcl test_tcl skipped -- No module named _tkinter test_telnetlib test_tempfile [12829 refs] test_textwrap test_thread test_threaded_import test_threadedtempfile test_threading [16318 refs] [15967 refs] [15783 refs] [15783 refs] [15783 refs] [15783 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 327 tests OK. 1 test failed: test_smtplib 33 tests skipped: test_aepack test_al test_applesingle test_bsddb185 test_bsddb3 test_cd test_cl test_curses test_epoll test_gl test_imgfile test_ioctl test_kqueue test_lib2to3 test_linuxaudiodev test_macos test_macostools test_multiprocessing 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 4 skips unexpected on linux2: test_epoll test_multiprocessing test_lib2to3 test_ioctl [650680 refs] From python-checkins at python.org Tue Nov 18 23:19:37 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 18 Nov 2008 23:19:37 +0100 (CET) Subject: [Python-checkins] r67266 - in python/trunk: Lib/test/test_imageop.py Misc/NEWS Modules/imageop.c Message-ID: <20081118221937.69B6C1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 18 23:19:37 2008 New Revision: 67266 Log: #4317: Fix an Array Bounds Read in imageop.rgb2rgb8. Will backport to 2.4. Modified: python/trunk/Lib/test/test_imageop.py python/trunk/Misc/NEWS python/trunk/Modules/imageop.c Modified: python/trunk/Lib/test/test_imageop.py ============================================================================== --- python/trunk/Lib/test/test_imageop.py (original) +++ python/trunk/Lib/test/test_imageop.py Tue Nov 18 23:19:37 2008 @@ -15,6 +15,7 @@ _VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1) VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES AAAAA = "A" * 1024 +MAX_LEN = 2**20 class InputValidationTests(unittest.TestCase): @@ -26,7 +27,7 @@ strlen = abs(width * height) if size: strlen *= size - if strlen < 1024: + if strlen < MAX_LEN: data = "A" * strlen else: data = AAAAA Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Nov 18 23:19:37 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. + - Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. - Issue #4048: The parser module now correctly validates relative imports. Modified: python/trunk/Modules/imageop.c ============================================================================== --- python/trunk/Modules/imageop.c (original) +++ python/trunk/Modules/imageop.c Tue Nov 18 23:19:37 2008 @@ -590,7 +590,7 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( !check_multiply_size(len*4, x, "x", y, "y", 4) ) + if ( !check_multiply_size(len, x, "x", y, "y", 4) ) return 0; nlen = x*y; if ( !check_multiply(nlen, x, y) ) From python-checkins at python.org Tue Nov 18 23:27:00 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 18 Nov 2008 23:27:00 +0100 (CET) Subject: [Python-checkins] r67267 - in python/branches/release26-maint: Lib/test/test_imageop.py Misc/NEWS Modules/imageop.c Message-ID: <20081118222700.A83931E400C@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 18 23:27:00 2008 New Revision: 67267 Log: Merged revisions 67266 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67266 | amaury.forgeotdarc | 2008-11-18 23:19:37 +0100 (mar., 18 nov. 2008) | 4 lines #4317: Fix an Array Bounds Read in imageop.rgb2rgb8. Will backport to 2.4. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_imageop.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/imageop.c Modified: python/branches/release26-maint/Lib/test/test_imageop.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_imageop.py (original) +++ python/branches/release26-maint/Lib/test/test_imageop.py Tue Nov 18 23:27:00 2008 @@ -15,6 +15,7 @@ _VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1) VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES AAAAA = "A" * 1024 +MAX_LEN = 2**20 class InputValidationTests(unittest.TestCase): @@ -26,7 +27,7 @@ strlen = abs(width * height) if size: strlen *= size - if strlen < 1024: + if strlen < MAX_LEN: data = "A" * strlen else: data = AAAAA Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Tue Nov 18 23:27:00 2008 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. + - Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. - Issue #4048: The parser module now correctly validates relative imports. Modified: python/branches/release26-maint/Modules/imageop.c ============================================================================== --- python/branches/release26-maint/Modules/imageop.c (original) +++ python/branches/release26-maint/Modules/imageop.c Tue Nov 18 23:27:00 2008 @@ -590,7 +590,7 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( !check_multiply_size(len*4, x, "x", y, "y", 4) ) + if ( !check_multiply_size(len, x, "x", y, "y", 4) ) return 0; nlen = x*y; if ( !check_multiply(nlen, x, y) ) From python-checkins at python.org Tue Nov 18 23:35:49 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 18 Nov 2008 23:35:49 +0100 (CET) Subject: [Python-checkins] r67268 - in python/branches/release25-maint: Lib/test/test_imageop.py Misc/NEWS Modules/imageop.c Message-ID: <20081118223549.4978D1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 18 23:35:48 2008 New Revision: 67268 Log: #4317: Fix an Array Bounds Read in imageop.rgb2rgb8. Backport of r67266 Modified: python/branches/release25-maint/Lib/test/test_imageop.py python/branches/release25-maint/Misc/NEWS python/branches/release25-maint/Modules/imageop.c Modified: python/branches/release25-maint/Lib/test/test_imageop.py ============================================================================== --- python/branches/release25-maint/Lib/test/test_imageop.py (original) +++ python/branches/release25-maint/Lib/test/test_imageop.py Tue Nov 18 23:35:48 2008 @@ -19,6 +19,7 @@ _VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1) VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES AAAAA = "A" * 1024 +MAX_LEN = 2**20 class InputValidationTests(unittest.TestCase): @@ -30,7 +31,7 @@ strlen = abs(width * height) if size: strlen *= size - if strlen < 1024: + if strlen < MAX_LEN: data = "A" * strlen else: data = AAAAA Modified: python/branches/release25-maint/Misc/NEWS ============================================================================== --- python/branches/release25-maint/Misc/NEWS (original) +++ python/branches/release25-maint/Misc/NEWS Tue Nov 18 23:35:48 2008 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. + - Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. - Issue #4048: The parser module now correctly validates relative imports. Modified: python/branches/release25-maint/Modules/imageop.c ============================================================================== --- python/branches/release25-maint/Modules/imageop.c (original) +++ python/branches/release25-maint/Modules/imageop.c Tue Nov 18 23:35:48 2008 @@ -590,7 +590,7 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( !check_multiply_size(len*4, x, "x", y, "y", 4) ) + if ( !check_multiply_size(len, x, "x", y, "y", 4) ) return 0; nlen = x*y; if ( !check_multiply(nlen, x, y) ) From python-checkins at python.org Tue Nov 18 23:49:40 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 18 Nov 2008 23:49:40 +0100 (CET) Subject: [Python-checkins] r67270 - in python/branches/release24-maint: Lib/test/test_imageop.py Misc/NEWS Modules/imageop.c Message-ID: <20081118224940.9B9741E4002@bag.python.org> Author: amaury.forgeotdarc Date: Tue Nov 18 23:49:39 2008 New Revision: 67270 Log: #4317: Fix an Array Bounds Read in imageop.rgb2rgb8. Backport of r67266 Modified: python/branches/release24-maint/Lib/test/test_imageop.py python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Modules/imageop.c Modified: python/branches/release24-maint/Lib/test/test_imageop.py ============================================================================== --- python/branches/release24-maint/Lib/test/test_imageop.py (original) +++ python/branches/release24-maint/Lib/test/test_imageop.py Tue Nov 18 23:49:39 2008 @@ -13,6 +13,7 @@ _VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1) VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES AAAAA = "A" * 1024 +MAX_LEN = 2**20 class InputValidationTests(unittest.TestCase): @@ -24,7 +25,7 @@ strlen = abs(width * height) if size: strlen *= size - if strlen < 1024: + if strlen < MAX_LEN: data = "A" * strlen else: data = AAAAA Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Tue Nov 18 23:49:39 2008 @@ -12,6 +12,8 @@ Core and builtins ----------------- +- Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. + - Issue #4230: Fix a crash when a class has a custom __getattr__ and an __getattribute__ method that deletes the __getattr__ attribute. Modified: python/branches/release24-maint/Modules/imageop.c ============================================================================== --- python/branches/release24-maint/Modules/imageop.c (original) +++ python/branches/release24-maint/Modules/imageop.c Tue Nov 18 23:49:39 2008 @@ -590,7 +590,7 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( !check_multiply_size(len*4, x, "x", y, "y", 4) ) + if ( !check_multiply_size(len, x, "x", y, "y", 4) ) return 0; nlen = x*y; if ( !check_multiply(nlen, x, y) ) From python-checkins at python.org Wed Nov 19 00:15:10 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 19 Nov 2008 00:15:10 +0100 (CET) Subject: [Python-checkins] r67272 - sandbox/trunk/tkinter-polo/src/tkCommonDialog.py Message-ID: <20081118231510.AF8F11E4002@bag.python.org> Author: guilherme.polo Date: Wed Nov 19 00:15:09 2008 New Revision: 67272 Log: * Checking for Tk < 4.2 is not needed anymore; * Dialog subclasses object now; * Some code relayout Modified: sandbox/trunk/tkinter-polo/src/tkCommonDialog.py Modified: sandbox/trunk/tkinter-polo/src/tkCommonDialog.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/tkCommonDialog.py (original) +++ sandbox/trunk/tkinter-polo/src/tkCommonDialog.py Wed Nov 19 00:15:09 2008 @@ -8,19 +8,14 @@ # written by Fredrik Lundh, May 1997 # -from Tkinter import * +from Tkinter import Frame -class Dialog: +class Dialog(object): command = None def __init__(self, master=None, **options): - - # FIXME: should this be placed on the module level instead? - if TkVersion < 4.2: - raise TclError, "this module requires Tk 4.2 or newer" - - self.master = master + self.master = master self.options = options if not master and options.get('parent'): self.master = options['parent'] @@ -32,10 +27,8 @@ return result # hook def show(self, **options): - # update instance options - for k, v in options.items(): - self.options[k] = v + self.options.update(options) self._fixoptions() @@ -44,13 +37,10 @@ w = Frame(self.master) try: - s = w.tk.call(self.command, *w._options(self.options)) - s = self._fixresult(w, s) finally: - try: # get rid of the widget w.destroy() From python-checkins at python.org Wed Nov 19 00:26:24 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 19 Nov 2008 00:26:24 +0100 (CET) Subject: [Python-checkins] r67273 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081118232624.72CE51E4002@bag.python.org> Author: guilherme.polo Date: Wed Nov 19 00:26:24 2008 New Revision: 67273 Log: Keep every line below 80 columns Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Wed Nov 19 00:26:24 2008 @@ -84,11 +84,16 @@ Instances of this type are generated if one of the following events occurs: - KeyPress, KeyRelease - for keyboard events - ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events - Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, - Colormap, Gravity, Reparent, Property, Destroy, Activate, - Deactivate - for window events. + Keyboard events: + KeyPress, KeyRelease + + Mouse events: + ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel + + Window events: + Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, + Colormap, Gravity, Reparent, Property, Destroy, Activate, + Deactivate - for window events. If a callback function for one of these events is registered using bind, bind_all, bind_class, or tag_bind, the callback is @@ -96,30 +101,29 @@ following attributes (in braces are the event types for which the attribute is valid): - serial - serial number of event - num - mouse button pressed (ButtonPress, ButtonRelease) - focus - whether the window has the focus (Enter, Leave) - height - height of the exposed window (Configure, Expose) - width - width of the exposed window (Configure, Expose) - keycode - keycode of the pressed key (KeyPress, KeyRelease) - state - state of the event as a number (ButtonPress, ButtonRelease, - Enter, KeyPress, KeyRelease, - Leave, Motion) - state - state as a string (Visibility) - time - when the event occurred - x - x-position of the mouse - y - y-position of the mouse - x_root - x-position of the mouse on the screen - (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) - y_root - y-position of the mouse on the screen - (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) - char - pressed character (KeyPress, KeyRelease) - send_event - see X/Windows documentation - keysym - keysym of the event as a string (KeyPress, KeyRelease) - keysym_num - keysym of the event as a number (KeyPress, KeyRelease) - type - type of the event as a number - widget - widget in which the event occurred - delta - delta of wheel movement (MouseWheel) + serial - serial number of event + num - mouse button pressed (ButtonPress, ButtonRelease) + focus - whether the window has the focus (Enter, Leave) + height - height of the exposed window (Configure, Expose) + width - width of the exposed window (Configure, Expose) + keycode - keycode of the pressed key (KeyPress, KeyRelease) + state - state of the event as a number (ButtonPress, ButtonRelease, + Enter, KeyPress, KeyRelease, Leave, Motion) + state - state as a string (Visibility) + time - when the event occurred + x - x-position of the mouse + y - y-position of the mouse + x_root - x-position of the mouse on the screen + (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) + y_root - y-position of the mouse on the screen + (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) + char - pressed character (KeyPress, KeyRelease) + send_event - see X/Windows documentation + keysym - keysym of the event as a string (KeyPress, KeyRelease) + keysym_num - keysym of the event as a number (KeyPress, KeyRelease) + type - type of the event as a number + widget - widget in which the event occurred + delta - delta of wheel movement (MouseWheel) """ pass @@ -218,7 +222,8 @@ """Delete the trace callback for a variable. MODE is one of "r", "w", "u" for read, write, undefine. - CBNAME is the name of the callback returned from trace_variable or trace. + CBNAME is the name of the callback returned from trace_variable or + trace. """ self._tk.call("trace", "vdelete", self._name, mode, cbname) self._master.deletecommand(cbname) @@ -370,7 +375,8 @@ return self.tk.getboolean(self.tk.call( 'set', 'tk_strictMotif', boolean)) def tk_bisque(self): - """Change the color scheme to light brown as used in Tk 3.6 and before.""" + """Change the color scheme to light brown as used in Tk 3.6 and + before.""" self.tk.call('tk_bisque') def tk_setPalette(self, *args, **kw): """Set a new color scheme for all widget elements. @@ -419,7 +425,8 @@ getint = int getdouble = float def getboolean(self, s): - """Return a boolean value for Tcl boolean values true and false given as parameter.""" + """Return a boolean value for Tcl boolean values true and false given + as parameter.""" return self.tk.getboolean(s) def focus_set(self): """Direct input focus to this widget. @@ -475,7 +482,8 @@ if not name: return None return self._nametowidget(name) def tk_focusPrev(self): - """Return previous widget in the focus order. See tk_focusNext for details.""" + """Return previous widget in the focus order. See tk_focusNext for + details.""" name = self.tk.call('tk_focusPrev', self._w) if not name: return None return self._nametowidget(name) @@ -658,7 +666,8 @@ if not name: return None return self._nametowidget(name) def send(self, interp, cmd, *args): - """Send Tcl command CMD to different interpreter INTERP to be executed.""" + """Send Tcl command CMD to different interpreter INTERP to be + executed.""" return self.tk.call(('send', interp, cmd) + args) def lower(self, belowThis=None): """Lower this widget in the stacking order.""" @@ -723,7 +732,8 @@ return getdouble(self.tk.call( 'winfo', 'fpixels', self._w, number)) def winfo_geometry(self): - """Return geometry string for this widget in the form "widthxheight+X+Y".""" + """Return geometry string for this widget in the form + "widthxheight+X+Y".""" return self.tk.call('winfo', 'geometry', self._w) def winfo_height(self): """Return height of this widget.""" @@ -764,7 +774,8 @@ return getint( self.tk.call('winfo', 'pointerx', self._w)) def winfo_pointerxy(self): - """Return a tuple of x and y coordinates of the pointer on the root window.""" + """Return a tuple of x and y coordinates of the pointer on the root + window.""" return self._getints( self.tk.call('winfo', 'pointerxy', self._w)) def winfo_pointery(self): @@ -808,8 +819,8 @@ return getint( self.tk.call('winfo', 'screendepth', self._w)) def winfo_screenheight(self): - """Return the number of pixels of the height of the screen of this widget - in pixel.""" + """Return the number of pixels of the height of the screen of this + widget in pixel.""" return getint( self.tk.call('winfo', 'screenheight', self._w)) def winfo_screenmmheight(self): @@ -841,7 +852,8 @@ return self._nametowidget(self.tk.call( 'winfo', 'toplevel', self._w)) def winfo_viewable(self): - """Return true if the widget and all its higher ancestors are mapped.""" + """Return true if the widget and all its higher ancestors are + mapped.""" return getint( self.tk.call('winfo', 'viewable', self._w)) def winfo_visual(self): @@ -907,7 +919,8 @@ return getint( self.tk.call('winfo', 'y', self._w)) def update(self): - """Enter event loop until all pending events have been processed by Tcl.""" + """Enter event loop until all pending events have been processed by + Tcl.""" self.tk.call('update') def update_idletasks(self): """Enter event loop until all idle callbacks have been called. This @@ -976,8 +989,8 @@ be called additionally to the other bound function or whether it will replace the previous function. - Bind will return an identifier to allow deletion of the bound function with - unbind without memory leak. + Bind will return an identifier to allow deletion of the bound function + with unbind without memory leak. If FUNC or SEQUENCE is omitted the bound function or list of bound events are returned.""" @@ -993,7 +1006,8 @@ """Bind to all widgets at an event SEQUENCE a call to function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether - it will replace the previous function. See bind for the return value.""" + it will replace the previous function. See bind for the return + value.""" return self._bind(('bind', 'all'), sequence, func, add, 0) def unbind_all(self, sequence): """Unbind for all widgets for event SEQUENCE all functions.""" @@ -1118,7 +1132,8 @@ getint = int def getint_event(s): - """Tk changed behavior in 8.4.2, returning "??" rather more often.""" + """Tk changed behavior in 8.4.2, returning "??" rather more + often.""" try: return int(s) except ValueError: @@ -1421,8 +1436,8 @@ minNumer=None, minDenom=None, maxNumer=None, maxDenom=None): """Instruct the window manager to set the aspect ratio (width/height) - of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple - of the actual values if no argument is given.""" + of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. + Return a tuple of the actual values if no argument is given.""" return self._getints( self.tk.call('wm', 'aspect', self._w, minNumer, minDenom, @@ -1458,8 +1473,8 @@ client = wm_client def wm_colormapwindows(self, *wlist): """Store list of window names (WLIST) into WM_COLORMAPWINDOWS property - of this widget. This list contains windows whose colormaps differ from their - parents. Return current list of widgets if WLIST is empty.""" + of this widget. This list contains windows whose colormaps differ from + their parents. Return current list of widgets if WLIST is empty.""" if len(wlist) > 1: wlist = (wlist,) # Tk needs a list of windows here args = ('wm', 'colormapwindows', self._w) + wlist @@ -1517,7 +1532,8 @@ (example: root.iconbitmap(default='myicon.ico') ). See Tk documentation for more information.""" if default: - return self.tk.call('wm', 'iconbitmap', self._w, '-default', default) + return self.tk.call('wm', 'iconbitmap', self._w, '-default', + default) else: return self.tk.call('wm', 'iconbitmap', self._w, bitmap) iconbitmap = wm_iconbitmap @@ -1542,8 +1558,8 @@ 'wm', 'iconposition', self._w, x, y)) iconposition = wm_iconposition def wm_iconwindow(self, pathName=None): - """Set widget PATHNAME to be displayed instead of icon. Return the current - value if None is given.""" + """Set widget PATHNAME to be displayed instead of icon. Return the + current value if None is given.""" return self.tk.call('wm', 'iconwindow', self._w, pathName) iconwindow = wm_iconwindow def wm_maxsize(self, width=None, height=None): @@ -1569,8 +1585,8 @@ overrideredirect = wm_overrideredirect def wm_positionfrom(self, who=None): """Instruct the window manager that the position of this widget shall - be defined by the user if WHO is "user", and by its own policy if WHO is - "program".""" + be defined by the user if WHO is "user", and by its own policy if WHO + is "program".""" return self.tk.call('wm', 'positionfrom', self._w, who) positionfrom = wm_positionfrom def wm_protocol(self, name=None, func=None): @@ -1591,8 +1607,8 @@ resizable = wm_resizable def wm_sizefrom(self, who=None): """Instruct the window manager that the size of this widget shall - be defined by the user if WHO is "user", and by its own policy if WHO is - "program".""" + be defined by the user if WHO is "user", and by its own policy if WHO + is "program".""" return self.tk.call('wm', 'sizefrom', self._w, who) sizefrom = wm_sizefrom def wm_state(self, newstate=None): @@ -1622,11 +1638,11 @@ _w = '.' def __init__(self, screenName=None, baseName=None, className='Tk', useTk=1, sync=0, use=None): - """Return a new Toplevel widget on screen SCREENNAME. A new Tcl interpreter will - be created. BASENAME will be used for the identification of the profile file (see - readprofile). - It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME - is the name of the widget class.""" + """Return a new Toplevel widget on screen SCREENNAME. A new Tcl + interpreter will be created. BASENAME will be used for the + identification of the profile file (see readprofile). + It is constructed from sys.argv[0] without extensions if None is + given. CLASSNAME is the name of the widget class.""" self.master = None self.children = {} self._tkloaded = 0 @@ -1640,7 +1656,8 @@ if ext not in ('.py', '.pyc', '.pyo'): baseName = baseName + ext interactive = 0 - self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) + self.tk = _tkinter.create(screenName, baseName, className, + interactive, wantobjects, useTk, sync, use) if useTk: self._loadtk() self.readprofile(baseName, className) @@ -1690,8 +1707,8 @@ _default_root = None def readprofile(self, baseName, className): """Internal function. It reads BASENAME.tcl and CLASSNAME.tcl into - the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py if - such a file exists in the home directory.""" + the Tcl Interpreter and calls execfile on BASENAME.py and CLASSNAME.py + if such a file exists in the home directory.""" import os if os.environ.has_key('HOME'): home = os.environ['HOME'] else: home = os.curdir @@ -2106,7 +2123,8 @@ if funcid: self.deletecommand(funcid) def tag_bind(self, tagOrId, sequence=None, func=None, add=None): - """Bind to all items with TAGORID at event SEQUENCE a call to function FUNC. + """Bind to all items with TAGORID at event SEQUENCE a call to function + FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will @@ -2168,8 +2186,8 @@ """Create window with coordinates x1,y1,x2,y2.""" return self._create('window', args, kw) def dchars(self, *args): - """Delete characters of text items identified by tag or id in ARGS (possibly - several times) from FIRST to LAST character (including).""" + """Delete characters of text items identified by tag or id in ARGS + (possibly several times) from FIRST to LAST character (including).""" self.tk.call((self._w, 'dchars') + args) def delete(self, *args): """Delete items identified by all tag or ids contained in ARGS.""" @@ -2275,7 +2293,8 @@ scan_mark.""" self.tk.call(self._w, 'scan', 'dragto', x, y, gain) def select_adjust(self, tagOrId, index): - """Adjust the end of the selection near the cursor of an item TAGORID to index.""" + """Adjust the end of the selection near the cursor of an item TAGORID + to index.""" self.tk.call(self._w, 'select', 'adjust', tagOrId, index) def select_clear(self): """Clear the selection if it is in this widget.""" @@ -2302,7 +2321,8 @@ total width of the canvas is off-screen to the left.""" self.tk.call(self._w, 'xview', 'moveto', fraction) def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" + """Shift the x-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" self.tk.call(self._w, 'xview', 'scroll', number, what) def yview(self, *args): """Query and change vertical position of the view.""" @@ -2314,7 +2334,8 @@ total height of the canvas is off-screen to the top.""" self.tk.call(self._w, 'yview', 'moveto', fraction) def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" + """Shift the y-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" self.tk.call(self._w, 'yview', 'scroll', number, what) class Checkbutton(Widget): @@ -2417,17 +2438,20 @@ total width of the entry is off-screen to the left.""" self.tk.call(self._w, 'xview', 'moveto', fraction) def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" + """Shift the x-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" self.tk.call(self._w, 'xview', 'scroll', number, what) class Frame(Widget): - """Frame widget which may contain other widgets and can have a 3D border.""" + """Frame widget which may contain other widgets and can have a 3D + border.""" def __init__(self, master=None, cnf={}, **kw): """Construct a frame widget with the parent MASTER. Valid resource names: background, bd, bg, borderwidth, class, colormap, container, cursor, height, highlightbackground, - highlightcolor, highlightthickness, relief, takefocus, visual, width.""" + highlightcolor, highlightthickness, relief, takefocus, visual, + width.""" cnf = _cnfmerge((cnf, kw)) extra = () if cnf.has_key('class_'): @@ -2549,7 +2573,8 @@ total width of the entry is off-screen to the left.""" self.tk.call(self._w, 'xview', 'moveto', fraction) def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" + """Shift the x-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" self.tk.call(self._w, 'xview', 'scroll', number, what) def yview(self, *what): """Query and change vertical position of the view.""" @@ -2561,7 +2586,8 @@ total width of the entry is off-screen to the top.""" self.tk.call(self._w, 'yview', 'moveto', fraction) def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" + """Shift the y-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" self.tk.call(self._w, 'yview', 'scroll', number, what) def itemcget(self, index, option): """Return the resource value for an ITEM and an OPTION.""" @@ -2579,7 +2605,8 @@ itemconfig = itemconfigure class Menu(Widget): - """Menu widget which allows to display menu bars, pull-down menus and pop-up menus.""" + """Menu widget which allows to display menu bars, pull-down menus and + pop-up menus.""" def __init__(self, master=None, cnf={}, **kw): """Construct menu widget with the parent MASTER. @@ -2695,7 +2722,8 @@ """Unmap a menu.""" self.tk.call(self._w, 'unpost') def yposition(self, index): - """Return the y-position of the topmost pixel of the menu item at INDEX.""" + """Return the y-position of the topmost pixel of the menu item at + INDEX.""" return getint(self.tk.call( self._w, 'yposition', index)) @@ -2705,12 +2733,14 @@ Widget.__init__(self, master, 'menubutton', cnf, kw) class Message(Widget): - """Message widget to display multiline text. Obsolete since Label does it too.""" + """Message widget to display multiline text. Obsolete since Label does it + too.""" def __init__(self, master=None, cnf={}, **kw): Widget.__init__(self, master, 'message', cnf, kw) class Radiobutton(Widget): - """Radiobutton widget which shows only one of several buttons in on-state.""" + """Radiobutton widget which shows only one of several buttons in + on-state.""" def __init__(self, master=None, cnf={}, **kw): """Construct a radiobutton widget with the parent MASTER. @@ -2854,8 +2884,8 @@ return self.tk.getboolean(self.tk.call( self._w, 'compare', index1, op, index2)) def debug(self, boolean=None): - """Turn on the internal consistency checks of the B-Tree inside the text - widget according to BOOLEAN.""" + """Turn on the internal consistency checks of the B-Tree inside the + text widget according to BOOLEAN.""" return self.tk.getboolean(self.tk.call( self._w, 'debug', boolean)) def delete(self, index1, index2=None): @@ -2992,7 +3022,8 @@ return str(self.tk.call(self._w, 'index', index)) def insert(self, index, chars, *args): """Insert CHARS before the characters at INDEX. An additional - tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.""" + tag can be given in ARGS. Additional CHARS and tags can follow in + ARGS.""" self.tk.call((self._w, 'insert', index, chars) + args) def mark_gravity(self, markName, direction=None): """Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT). @@ -3027,7 +3058,8 @@ forwards=None, backwards=None, exact=None, regexp=None, nocase=None, count=None, elide=None): """Search PATTERN beginning from INDEX until STOPINDEX. - Return the index of the first character of a match or an empty string.""" + Return the index of the first character of a match or an empty + string.""" args = [self._w, 'search'] if forwards: args.append('-forwards') if backwards: args.append('-backwards') @@ -3056,7 +3088,8 @@ if funcid: self.deletecommand(funcid) def tag_bind(self, tagName, sequence, func, add=None): - """Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC. + """Bind to all characters with TAGNAME at event SEQUENCE a call to + function FUNC. An additional boolean parameter ADD specifies whether FUNC will be called additionally to the other bound function or whether it will @@ -3218,7 +3251,7 @@ self.tk = master.tk if not name: Image._last_id += 1 - name = "pyimage%r" % (Image._last_id,) # tk itself would use image + name = "pyimage%r" % Image._last_id # tk itself would use image # The following is needed for systems where id(x) # can return a negative number, such as Linux/m68k: if name[0] == '-': name = '_' + name[1:] @@ -3331,7 +3364,8 @@ def __init__(self, name=None, cnf={}, master=None, **kw): """Create a bitmap with NAME. - Valid resource names: background, data, file, foreground, maskdata, maskfile.""" + Valid resource names: background, data, file, foreground, maskdata, + maskfile.""" Image.__init__(self, 'bitmap', name, cnf, master, **kw) def image_names(): return setup_master().tk.call('image', 'names') From buildbot at python.org Wed Nov 19 00:29:14 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 23:29:14 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081118232914.364221E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/413 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed Nov 19 00:33:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 23:33:36 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 2.5 Message-ID: <20081118233336.594A01E400C@bag.python.org> The Buildbot has detected a new failure of i386 Ubuntu 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/i386%20Ubuntu%202.5/builds/11 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 00:37:18 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 19 Nov 2008 00:37:18 +0100 (CET) Subject: [Python-checkins] r67274 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081118233718.DFC4B1E4002@bag.python.org> Author: guilherme.polo Date: Wed Nov 19 00:37:18 2008 New Revision: 67274 Log: Removed most of type() calls Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Wed Nov 19 00:37:18 2008 @@ -46,14 +46,14 @@ except AttributeError: _tkinter.deletefilehandler = None -def _flatten(tuple): +def _flatten(nested): """Internal function.""" res = () - for item in tuple: - if type(item) in (TupleType, ListType): + for item in nested: + if isinstance(item, (tuple, list)): res = res + _flatten(item) elif item is not None: - res = res + (item,) + res = res + (item, ) return res try: _flatten = _tkinter._flatten @@ -61,9 +61,9 @@ def _cnfmerge(cnfs): """Internal function.""" - if type(cnfs) is DictionaryType: + if isinstance(cnfs, dict): return cnfs - elif type(cnfs) in (NoneType, StringType): + elif isinstance(cnfs, (NoneType, str)): return cnfs else: cnf = {} @@ -873,7 +873,7 @@ data = self.tk.split( self.tk.call('winfo', 'visualsavailable', self._w, includeids and 'includeids' or None)) - if type(data) is StringType: + if isinstance(data, str): data = [self.tk.split(data)] return map(self.__winfo_parseitem, data) def __winfo_parseitem(self, t): @@ -941,7 +941,7 @@ self.tk.call('bindtags', self._w, tagList) def _bind(self, what, sequence, func, add, needcleanup=1): """Internal function.""" - if type(func) is StringType: + if isinstance(func, str): self.tk.call(what + (sequence, func)) elif func: funcid = self._register(func, self._substitute, @@ -1201,7 +1201,7 @@ self.tk.call(_flatten((self._w, cmd)))): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf - if type(cnf) is StringType: + if isinstance(cnf, str): x = self.tk.split( self.tk.call(_flatten((self._w, cmd, '-'+cnf)))) return (x[0][1:],) + x[1:] @@ -1284,7 +1284,7 @@ bbox = grid_bbox def _grid_configure(self, command, index, cnf, kw): """Internal function.""" - if type(cnf) is StringType and not kw: + if isinstance(cnf, str) and not kw: if cnf[-1:] == '_': cnf = cnf[:-1] if cnf[:1] != '-': @@ -1937,7 +1937,7 @@ self._tclCommands = [] classes = [] for k in cnf.keys(): - if type(k) is ClassType: + if type(k) is ClassType: # XXX classes.append((k, cnf[k])) del cnf[k] self.tk.call( @@ -2151,13 +2151,12 @@ """Internal function.""" args = _flatten(args) cnf = args[-1] - if type(cnf) in (DictionaryType, TupleType): + if isinstance(cnf, (dict, tuple)): args = args[:-1] else: cnf = {} return getint(self.tk.call( - self._w, 'create', itemType, - *(args + self._options(cnf, kw)))) + self._w, 'create', itemType, *(args + self._options(cnf, kw)))) def create_arc(self, *args, **kw): """Create arc shaped region with coordinates x1,y1,x2,y2.""" return self._create('arc', args, kw) @@ -2645,8 +2644,7 @@ self.tk.call(self._w, 'activate', index) def add(self, itemType, cnf={}, **kw): """Internal function.""" - self.tk.call((self._w, 'add', itemType) + - self._options(cnf, kw)) + self.tk.call((self._w, 'add', itemType) + self._options(cnf, kw)) def add_cascade(self, cnf={}, **kw): """Add hierarchical menu item.""" self.add('cascade', cnf or kw) @@ -3734,7 +3732,7 @@ 'paneconfigure', tagOrId)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf - if type(cnf) == StringType and not kw: + if isinstance(cnf, str) and not kw: x = self.tk.split(self.tk.call( self._w, 'paneconfigure', tagOrId, '-'+cnf)) return (x[0][1:],) + x[1:] From python-checkins at python.org Wed Nov 19 00:38:30 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 19 Nov 2008 00:38:30 +0100 (CET) Subject: [Python-checkins] r67275 - sandbox/trunk/tkinter-polo/src/tkColorChooser.py Message-ID: <20081118233830.62DC61E4002@bag.python.org> Author: guilherme.polo Date: Wed Nov 19 00:38:30 2008 New Revision: 67275 Log: Removed copying options Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py Modified: sandbox/trunk/tkinter-polo/src/tkColorChooser.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/tkColorChooser.py (original) +++ sandbox/trunk/tkinter-polo/src/tkColorChooser.py Wed Nov 19 00:38:30 2008 @@ -53,7 +53,6 @@ "Ask for a color" if color: - options = options.copy() options["initialcolor"] = color return Chooser(**options).show() From buildbot at python.org Wed Nov 19 00:43:56 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 18 Nov 2008 23:43:56 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081118234356.573DD1E4002@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/1274 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 test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 00:53:20 2008 From: python-checkins at python.org (guilherme.polo) Date: Wed, 19 Nov 2008 00:53:20 +0100 (CET) Subject: [Python-checkins] r67276 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081118235320.76D9B1E4002@bag.python.org> Author: guilherme.polo Date: Wed Nov 19 00:53:19 2008 New Revision: 67276 Log: Removed some dead code Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Wed Nov 19 00:53:19 2008 @@ -391,9 +391,6 @@ disabledForeground, insertBackground, troughColor.""" self.tk.call(('tk_setPalette',) + _flatten(args) + _flatten(kw.items())) - def tk_menuBar(self, *args): - """Do not use. Needed in Tk 3.6 and earlier.""" - pass # obsolete since Tk 4.0 def wait_variable(self, name='PY_VAR'): """Wait until the variable is modified. @@ -676,9 +673,6 @@ """Raise this widget in the stacking order.""" self.tk.call('raise', self._w, aboveThis) lift = tkraise - def colormodel(self, value=None): - """Useless. Not implemented in Tk.""" - return self.tk.call('tk', 'colormodel', self._w, value) def winfo_atom(self, name, displayof=0): """Return integer which represents atom NAME.""" args = ('winfo', 'atom') + self._displayof(displayof) + (name,) @@ -1185,7 +1179,6 @@ return (e,) def _report_exception(self): """Internal function.""" - import sys exc, val, tb = sys.exc_type, sys.exc_value, sys.exc_traceback root = self._root() root.report_callback_exception(exc, val, tb) @@ -1650,7 +1643,7 @@ # ensure that self.tk is always _something_. self.tk = None if baseName is None: - import sys, os + import os baseName = os.path.basename(sys.argv[0]) baseName, ext = os.path.splitext(baseName) if ext not in ('.py', '.pyc', '.pyo'): @@ -2013,21 +2006,6 @@ """ Widget.__init__(self, master, 'button', cnf, kw) - def tkButtonEnter(self, *dummy): - self.tk.call('tkButtonEnter', self._w) - - def tkButtonLeave(self, *dummy): - self.tk.call('tkButtonLeave', self._w) - - def tkButtonDown(self, *dummy): - self.tk.call('tkButtonDown', self._w) - - def tkButtonUp(self, *dummy): - self.tk.call('tkButtonUp', self._w) - - def tkButtonInvoke(self, *dummy): - self.tk.call('tkButtonInvoke', self._w) - def flash(self): """Flash the button. @@ -2050,24 +2028,6 @@ """ return self.tk.call(self._w, 'invoke') -# Indices: -# XXX I don't like these -- take them away -def AtEnd(): - return 'end' -def AtInsert(*args): - s = 'insert' - for a in args: - if a: s = s + (' ' + a) - return s -def AtSelFirst(): - return 'sel.first' -def AtSelLast(): - return 'sel.last' -def At(x, y=None): - if y is None: - return '@%r' % (x,) - else: - return '@%r,%r' % (x, y) class Canvas(Widget): """Canvas widget to display graphical elements like lines or text.""" @@ -2614,28 +2574,6 @@ disabledforeground, fg, font, foreground, postcommand, relief, selectcolor, takefocus, tearoff, tearoffcommand, title, type.""" Widget.__init__(self, master, 'menu', cnf, kw) - def tk_bindForTraversal(self): - pass # obsolete since Tk 4.0 - def tk_mbPost(self): - self.tk.call('tk_mbPost', self._w) - def tk_mbUnpost(self): - self.tk.call('tk_mbUnpost') - def tk_traverseToMenu(self, char): - self.tk.call('tk_traverseToMenu', self._w, char) - def tk_traverseWithinMenu(self, char): - self.tk.call('tk_traverseWithinMenu', self._w, char) - def tk_getMenuButtons(self): - return self.tk.call('tk_getMenuButtons', self._w) - def tk_nextMenu(self, count): - self.tk.call('tk_nextMenu', count) - def tk_nextMenuEntry(self, count): - self.tk.call('tk_nextMenuEntry', count) - def tk_invokeMenu(self): - self.tk.call('tk_invokeMenu', self._w) - def tk_firstMenu(self): - self.tk.call('tk_firstMenu', self._w) - def tk_mbButtonDown(self): - self.tk.call('tk_mbButtonDown', self._w) def tk_popup(self, x, y, entry=""): """Post the menu at position X,Y with entry ENTRY.""" self.tk.call('tk_popup', self._w, x, y, entry) @@ -2868,14 +2806,6 @@ box of the visible part of the character at the index in ARGS.""" return self._getints( self.tk.call((self._w, 'bbox') + args)) or None - def tk_textSelectTo(self, index): - self.tk.call('tk_textSelectTo', self._w, index) - def tk_textBackspace(self): - self.tk.call('tk_textBackspace', self._w) - def tk_textIndexCloser(self, a, b, c): - self.tk.call('tk_textIndexCloser', self._w, a, b, c) - def tk_textResetAnchor(self, index): - self.tk.call('tk_textResetAnchor', self._w, index) def compare(self, index1, op, index2): """Return whether between index INDEX1 and index INDEX2 the relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.""" From python-checkins at python.org Wed Nov 19 04:35:41 2008 From: python-checkins at python.org (skip.montanaro) Date: Wed, 19 Nov 2008 04:35:41 +0100 (CET) Subject: [Python-checkins] r67277 - python/trunk/Lib/doctest.py Message-ID: <20081119033541.5AC311E4002@bag.python.org> Author: skip.montanaro Date: Wed Nov 19 04:35:41 2008 New Revision: 67277 Log: patch from issue 1108 Modified: python/trunk/Lib/doctest.py Modified: python/trunk/Lib/doctest.py ============================================================================== --- python/trunk/Lib/doctest.py (original) +++ python/trunk/Lib/doctest.py Wed Nov 19 04:35:41 2008 @@ -854,12 +854,12 @@ """ if module is None: return True + elif inspect.getmodule(object) is not None: + return module is inspect.getmodule(object) elif inspect.isfunction(object): return module.__dict__ is object.func_globals elif inspect.isclass(object): return module.__name__ == object.__module__ - elif inspect.getmodule(object) is not None: - return module is inspect.getmodule(object) elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property): From buildbot at python.org Wed Nov 19 05:25:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 04:25:42 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081119042542.F390C1E4002@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/311 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: skip.montanaro BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From nnorwitz at gmail.com Wed Nov 19 07:22:54 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 19 Nov 2008 01:22:54 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081119062254.GA20951@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.94 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.114 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. ! Undefined control sequence. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ? ! Emergency stop. \MakeFramed l.144 \begin{Verbatim}[commandchars=@\[\]] ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Wed Nov 19 08:59:09 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 19 Nov 2008 08:59:09 +0100 (CET) Subject: [Python-checkins] r67278 - python/trunk/Doc/conf.py Message-ID: <20081119075909.9D7581E4002@bag.python.org> Author: georg.brandl Date: Wed Nov 19 08:59:09 2008 New Revision: 67278 Log: Try to fix problems with verbatim. Modified: python/trunk/Doc/conf.py Modified: python/trunk/Doc/conf.py ============================================================================== --- python/trunk/Doc/conf.py (original) +++ python/trunk/Doc/conf.py Wed Nov 19 08:59:09 2008 @@ -138,6 +138,8 @@ \strong{Python Software Foundation}\\ Email: \email{docs at python.org} } +\let\Verbatim=\OriginalVerbatim +\let\endVerbatim=\endOriginalVerbatim ''' # Documents to append as an appendix to all manuals. From buildbot at python.org Wed Nov 19 10:07:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 09:07:51 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 2.5 Message-ID: <20081119090752.049241E4002@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/11 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: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 10:09:41 2008 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 19 Nov 2008 10:09:41 +0100 (CET) Subject: [Python-checkins] r67279 - in python/trunk: Lib/lib-tk/turtle.py Misc/NEWS Message-ID: <20081119090941.59B261E4002@bag.python.org> Author: martin.v.loewis Date: Wed Nov 19 10:09:41 2008 New Revision: 67279 Log: Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__ Modified: python/trunk/Lib/lib-tk/turtle.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/lib-tk/turtle.py ============================================================================== --- python/trunk/Lib/lib-tk/turtle.py (original) +++ python/trunk/Lib/lib-tk/turtle.py Wed Nov 19 10:09:41 2008 @@ -359,7 +359,7 @@ 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._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" @@ -379,7 +379,7 @@ 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) + self._rootwindow.bind('', self.onResize) def reset(self, canvwidth=None, canvheight=None, bg = None): """Ajust canvas and scrollbars according to given canvas size.""" Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Nov 19 10:09:41 2008 @@ -42,6 +42,8 @@ Library ------- +- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. + - httplib.HTTPConnection.putheader() now accepts an arbitrary number of values for any header, matching what the documentation has claimed for a while. From python-checkins at python.org Wed Nov 19 10:11:49 2008 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 19 Nov 2008 10:11:49 +0100 (CET) Subject: [Python-checkins] r67280 - in python/branches/release26-maint: Lib/lib-tk/turtle.py Misc/NEWS Message-ID: <20081119091149.AB30E1E4002@bag.python.org> Author: martin.v.loewis Date: Wed Nov 19 10:11:49 2008 New Revision: 67280 Log: Merged revisions 67279 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67279 | martin.v.loewis | 2008-11-19 10:09:41 +0100 (Mi, 19 Nov 2008) | 2 lines Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__ ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/lib-tk/turtle.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/lib-tk/turtle.py ============================================================================== --- python/branches/release26-maint/Lib/lib-tk/turtle.py (original) +++ python/branches/release26-maint/Lib/lib-tk/turtle.py Wed Nov 19 10:11:49 2008 @@ -359,7 +359,7 @@ 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._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" @@ -379,7 +379,7 @@ 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) + self._rootwindow.bind('', self.onResize) def reset(self, canvwidth=None, canvheight=None, bg = None): """Ajust canvas and scrollbars according to given canvas size.""" Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Wed Nov 19 10:11:49 2008 @@ -42,6 +42,8 @@ Library ------- +- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. + - Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. From buildbot at python.org Wed Nov 19 11:04:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 10:04:05 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081119100405.ACCCE1E4002@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/1066 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 12:34:07 2008 From: python-checkins at python.org (georg.brandl) Date: Wed, 19 Nov 2008 12:34:07 +0100 (CET) Subject: [Python-checkins] r67282 - in python/branches/release26-maint: Doc/conf.py Message-ID: <20081119113407.46F6C1E4002@bag.python.org> Author: georg.brandl Date: Wed Nov 19 12:34:07 2008 New Revision: 67282 Log: Merged revisions 67278 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67278 | georg.brandl | 2008-11-19 08:59:09 +0100 (Wed, 19 Nov 2008) | 2 lines Try to fix problems with verbatim. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/conf.py Modified: python/branches/release26-maint/Doc/conf.py ============================================================================== --- python/branches/release26-maint/Doc/conf.py (original) +++ python/branches/release26-maint/Doc/conf.py Wed Nov 19 12:34:07 2008 @@ -138,6 +138,8 @@ \strong{Python Software Foundation}\\ Email: \email{docs at python.org} } +\let\Verbatim=\OriginalVerbatim +\let\endVerbatim=\endOriginalVerbatim ''' # Documents to append as an appendix to all manuals. From buildbot at python.org Wed Nov 19 13:21:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 12:21:35 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081119122135.DB2171E4002@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/680 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_subprocess ====================================================================== ERROR: test_no_leaking (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_subprocess.py", line 423, in test_no_leaking data = p.communicate(b"lime")[0] File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 671, in communicate return self._communicate(input) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/subprocess.py", line 1171, in _communicate bytes_written = os.write(self.stdin.fileno(), chunk) OSError: [Errno 32] Broken pipe make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 14:51:45 2008 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 19 Nov 2008 14:51:45 +0100 (CET) Subject: [Python-checkins] r67283 - in python/trunk: Misc/NEWS Tools/msi/msi.py Message-ID: <20081119135145.5EF461E4002@bag.python.org> Author: martin.v.loewis Date: Wed Nov 19 14:51:44 2008 New Revision: 67283 Log: Issue #4289: Remove Cancel button from AdvancedDlg. Modified: python/trunk/Misc/NEWS python/trunk/Tools/msi/msi.py Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Nov 19 14:51:44 2008 @@ -66,6 +66,8 @@ Build ----- +- Issue #4289: Remove Cancel button from AdvancedDlg. + - Issue #1656675: Register a drop handler for .py* files on Windows. - Issue #4120: Exclude manifest from extension modules in VS2008. Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Wed Nov 19 14:51:44 2008 @@ -716,18 +716,15 @@ ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, - "CompilePyc", "Next", "Cancel") + "CompilePyc", "Ok", "Ok") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, - "COMPILEALL", "Compile .py files to byte code after installation", "Next") + "COMPILEALL", "Compile .py files to byte code after installation", "Ok") - c = advanced.next("Finish", "Cancel") + c = advanced.cancel("Ok", "CompilePyc", name="Ok") # Button just has location of cancel button. c.event("EndDialog", "Return") - c = advanced.cancel("Cancel", "CompilePyc") - c.event("SpawnDialog", "CancelDlg") - ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, From python-checkins at python.org Wed Nov 19 14:54:01 2008 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 19 Nov 2008 14:54:01 +0100 (CET) Subject: [Python-checkins] r67284 - in python/branches/release26-maint: Misc/NEWS Tools/msi/msi.py Message-ID: <20081119135401.C07311E400C@bag.python.org> Author: martin.v.loewis Date: Wed Nov 19 14:54:01 2008 New Revision: 67284 Log: Merged revisions 67283 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67283 | martin.v.loewis | 2008-11-19 14:51:44 +0100 (Mi, 19 Nov 2008) | 1 line Issue #4289: Remove Cancel button from AdvancedDlg. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Tools/msi/msi.py Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Wed Nov 19 14:54:01 2008 @@ -63,6 +63,8 @@ Build ----- +- Issue #4289: Remove Cancel button from AdvancedDlg. + - Issue #1656675: Register a drop handler for .py* files on Windows. - Issue #4120: Exclude manifest from extension modules in VS2008. Modified: python/branches/release26-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release26-maint/Tools/msi/msi.py (original) +++ python/branches/release26-maint/Tools/msi/msi.py Wed Nov 19 14:54:01 2008 @@ -715,18 +715,15 @@ ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, - "CompilePyc", "Next", "Cancel") + "CompilePyc", "Ok", "Ok") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, - "COMPILEALL", "Compile .py files to byte code after installation", "Next") + "COMPILEALL", "Compile .py files to byte code after installation", "Ok") - c = advanced.next("Finish", "Cancel") + c = advanced.cancel("Ok", "CompilePyc", name="Ok") # Button just has location of cancel button. c.event("EndDialog", "Return") - c = advanced.cancel("Cancel", "CompilePyc") - c.event("SpawnDialog", "CancelDlg") - ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, From buildbot at python.org Wed Nov 19 15:58:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 14:58:46 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI trunk Message-ID: <20081119145846.6FE471E4002@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%20trunk/builds/61 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi 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 Wed Nov 19 19:26:12 2008 From: python-checkins at python.org (josiah.carlson) Date: Wed, 19 Nov 2008 19:26:12 +0100 (CET) Subject: [Python-checkins] r67287 - python/trunk/Lib/asyncore.py Message-ID: <20081119182612.BC1DE1E404E@bag.python.org> Author: josiah.carlson Date: Wed Nov 19 19:26:12 2008 New Revision: 67287 Log: Fix for issue 4332 in trunk. Modified: python/trunk/Lib/asyncore.py Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Wed Nov 19 19:26:12 2008 @@ -615,6 +615,6 @@ fcntl.fcntl(fd, fcntl.F_SETFL, flags) def set_file(self, fd): - self._fileno = fd self.socket = file_wrapper(fd) + self._fileno = self.socket.fileno() self.add_channel() From python-checkins at python.org Wed Nov 19 19:32:46 2008 From: python-checkins at python.org (josiah.carlson) Date: Wed, 19 Nov 2008 19:32:46 +0100 (CET) Subject: [Python-checkins] r67288 - python/branches/release26-maint/Lib/asyncore.py Message-ID: <20081119183246.2EF391E402D@bag.python.org> Author: josiah.carlson Date: Wed Nov 19 19:32:45 2008 New Revision: 67288 Log: This fixes issue 4332 in 2.6 maintenance. Modified: python/branches/release26-maint/Lib/asyncore.py Modified: python/branches/release26-maint/Lib/asyncore.py ============================================================================== --- python/branches/release26-maint/Lib/asyncore.py (original) +++ python/branches/release26-maint/Lib/asyncore.py Wed Nov 19 19:32:45 2008 @@ -615,6 +615,6 @@ fcntl.fcntl(fd, fcntl.F_SETFL, flags) def set_file(self, fd): - self._fileno = fd self.socket = file_wrapper(fd) + self._fileno = self.socket.fileno() self.add_channel() From buildbot at python.org Wed Nov 19 19:39:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 18:39:52 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081119183952.9D8001E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/416 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Wed Nov 19 20:04:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 19:04:10 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux 3.0 Message-ID: <20081119190410.DFE171E400C@bag.python.org> The Buildbot has detected a new failure of ARM Linux 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%203.0/builds/59 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-arm Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: josiah.carlson BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Wed Nov 19 20:29:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 19:29:38 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081119192938.CD9851E400C@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/1068 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: josiah.carlson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 21:29:39 2008 From: python-checkins at python.org (brett.cannon) Date: Wed, 19 Nov 2008 21:29:39 +0100 (CET) Subject: [Python-checkins] r67289 - in python/trunk/Lib/lib2to3/tests/data/fixers: myfixes Message-ID: <20081119202939.DB1611E400C@bag.python.org> Author: brett.cannon Date: Wed Nov 19 21:29:39 2008 New Revision: 67289 Log: Ignore .pyc and .pyo files. Modified: python/trunk/Lib/lib2to3/tests/data/fixers/ (props changed) python/trunk/Lib/lib2to3/tests/data/fixers/myfixes/ (props changed) From buildbot at python.org Wed Nov 19 21:38:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 20:38:50 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20081119203851.1C34A1E4002@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/391 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: brett.cannon BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 22:49:09 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 19 Nov 2008 22:49:09 +0100 (CET) Subject: [Python-checkins] r67291 - in python/trunk: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c Message-ID: <20081119214909.C1A451E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 19 22:49:09 2008 New Revision: 67291 Log: make sure that bytearray methods return a new bytearray even if there is no change Fixes #4348 Reviewed by Brett Modified: python/trunk/Lib/test/test_bytes.py python/trunk/Misc/NEWS python/trunk/Objects/bytearrayobject.c Modified: python/trunk/Lib/test/test_bytes.py ============================================================================== --- python/trunk/Lib/test/test_bytes.py (original) +++ python/trunk/Lib/test/test_bytes.py Wed Nov 19 22:49:09 2008 @@ -721,6 +721,16 @@ b.insert(0, Indexable(ord('A'))) self.assertEqual(b, b'A') + def test_copied(self): + # Issue 4348. Make sure that operations that don't mutate the array + # copy the bytes. + b = bytearray(b'abc') + #self.assertFalse(b is b.replace(b'abc', b'cde', 0)) + + t = bytearray([i for i in range(256)]) + x = bytearray(b'') + self.assertFalse(x is x.translate(t)) + def test_partition_bytearray_doesnt_share_nullstring(self): a, b, c = bytearray(b"x").partition(b"y") self.assertEqual(b, b"") Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Nov 19 22:49:09 2008 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4348: Some bytearray methods returned that didn't cause any change to + the bytearray, returned the same bytearray instead of a copy. + - Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. - Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. Modified: python/trunk/Objects/bytearrayobject.c ============================================================================== --- python/trunk/Objects/bytearrayobject.c (original) +++ python/trunk/Objects/bytearrayobject.c Wed Nov 19 22:49:09 2008 @@ -1423,7 +1423,7 @@ { register char *input, *output; register const char *table; - register Py_ssize_t i, c, changed = 0; + register Py_ssize_t i, c; PyObject *input_obj = (PyObject*)self; const char *output_start; Py_ssize_t inlen; @@ -1469,14 +1469,8 @@ /* 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; + *output++ = table[c]; } - if (changed || !PyByteArray_CheckExact(input_obj)) - goto done; - Py_DECREF(result); - Py_INCREF(input_obj); - result = input_obj; goto done; } @@ -1491,13 +1485,6 @@ if (trans_table[c] != -1) if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) continue; - changed = 1; - } - if (!changed && PyByteArray_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - result = input_obj; - goto done; } /* Fix the size of the resulting string */ if (inlen > 0) @@ -1526,15 +1513,10 @@ !memcmp(target+offset+1, pattern+1, length-2) ) -/* Bytes ops must return a string. */ -/* If the object is subclass of bytes, create a copy */ +/* Bytes ops must return a string, create a copy */ Py_LOCAL(PyByteArrayObject *) return_self(PyByteArrayObject *self) { - if (PyByteArray_CheckExact(self)) { - Py_INCREF(self); - return (PyByteArrayObject *)self; - } return (PyByteArrayObject *)PyByteArray_FromStringAndSize( PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self)); From buildbot at python.org Wed Nov 19 23:03:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 19 Nov 2008 22:03:19 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 3.0 Message-ID: <20081119220319.C044C1E4002@bag.python.org> The Buildbot has detected a new failure of OS X x86 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%203.0/builds/494 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,hirokazu.yamamoto,josiah.carlson,martin.v.loewis,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== FAIL: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.0.noller-osx86/build/Lib/test/test_cmd_line.py", line 143, in test_run_code 0) AssertionError: 1 != 0 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Nov 19 23:05:53 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 19 Nov 2008 23:05:53 +0100 (CET) Subject: [Python-checkins] r67293 - in python/branches/release26-maint: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c Message-ID: <20081119220553.7D45B1E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 19 23:05:53 2008 New Revision: 67293 Log: Merged revisions 67291 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67291 | benjamin.peterson | 2008-11-19 15:49:09 -0600 (Wed, 19 Nov 2008) | 5 lines make sure that bytearray methods return a new bytearray even if there is no change Fixes #4348 Reviewed by Brett ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_bytes.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Objects/bytearrayobject.c Modified: python/branches/release26-maint/Lib/test/test_bytes.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_bytes.py (original) +++ python/branches/release26-maint/Lib/test/test_bytes.py Wed Nov 19 23:05:53 2008 @@ -721,6 +721,16 @@ b.insert(0, Indexable(ord('A'))) self.assertEqual(b, b'A') + def test_copied(self): + # Issue 4348. Make sure that operations that don't mutate the array + # copy the bytes. + b = bytearray(b'abc') + #self.assertFalse(b is b.replace(b'abc', b'cde', 0)) + + t = bytearray([i for i in range(256)]) + x = bytearray(b'') + self.assertFalse(x is x.translate(t)) + def test_partition_bytearray_doesnt_share_nullstring(self): a, b, c = bytearray(b"x").partition(b"y") self.assertEqual(b, b"") Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Wed Nov 19 23:05:53 2008 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4348: Some bytearray methods returned that didn't cause any change to + the bytearray, returned the same bytearray instead of a copy. + - Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. - Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. Modified: python/branches/release26-maint/Objects/bytearrayobject.c ============================================================================== --- python/branches/release26-maint/Objects/bytearrayobject.c (original) +++ python/branches/release26-maint/Objects/bytearrayobject.c Wed Nov 19 23:05:53 2008 @@ -1423,7 +1423,7 @@ { register char *input, *output; register const char *table; - register Py_ssize_t i, c, changed = 0; + register Py_ssize_t i, c; PyObject *input_obj = (PyObject*)self; const char *output_start; Py_ssize_t inlen; @@ -1469,14 +1469,8 @@ /* 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; + *output++ = table[c]; } - if (changed || !PyByteArray_CheckExact(input_obj)) - goto done; - Py_DECREF(result); - Py_INCREF(input_obj); - result = input_obj; goto done; } @@ -1491,13 +1485,6 @@ if (trans_table[c] != -1) if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) continue; - changed = 1; - } - if (!changed && PyByteArray_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - result = input_obj; - goto done; } /* Fix the size of the resulting string */ if (inlen > 0) @@ -1526,15 +1513,10 @@ !memcmp(target+offset+1, pattern+1, length-2) ) -/* Bytes ops must return a string. */ -/* If the object is subclass of bytes, create a copy */ +/* Bytes ops must return a string, create a copy */ Py_LOCAL(PyByteArrayObject *) return_self(PyByteArrayObject *self) { - if (PyByteArray_CheckExact(self)) { - Py_INCREF(self); - return (PyByteArrayObject *)self; - } return (PyByteArrayObject *)PyByteArray_FromStringAndSize( PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self)); From buildbot at python.org Thu Nov 20 01:43:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 00:43:50 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081120004350.DDA781E4024@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/764 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_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Nov 20 05:05:13 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 20 Nov 2008 05:05:13 +0100 (CET) Subject: [Python-checkins] r67295 - in python/trunk/Doc/library: pdb.rst sys.rst Message-ID: <20081120040513.14A851E4002@bag.python.org> Author: benjamin.peterson Date: Thu Nov 20 05:05:12 2008 New Revision: 67295 Log: move useful sys.settrace information to the function's documentation from the debugger Modified: python/trunk/Doc/library/pdb.rst python/trunk/Doc/library/sys.rst Modified: python/trunk/Doc/library/pdb.rst ============================================================================== --- python/trunk/Doc/library/pdb.rst (original) +++ python/trunk/Doc/library/pdb.rst Thu Nov 20 05:05:12 2008 @@ -351,68 +351,3 @@ q(uit) Quit from the debugger. The program being executed is aborted. - - -.. _debugger-hooks: - -How It Works -============ - -Some changes were made to the interpreter: - -* ``sys.settrace(func)`` sets the global trace function - -* there can also a local trace function (see later) - -Trace functions have three arguments: *frame*, *event*, and *arg*. *frame* is -the current stack frame. *event* is a string: ``'call'``, ``'line'``, -``'return'``, ``'exception'``, ``'c_call'``, ``'c_return'``, or -``'c_exception'``. *arg* depends on the event type. - -The global trace function is invoked (with *event* set to ``'call'``) whenever a -new local scope is entered; it should return a reference to the local trace -function to be used that scope, or ``None`` if the scope shouldn't be traced. - -The local trace function should return a reference to itself (or to another -function for further tracing in that scope), or ``None`` to turn off tracing in -that scope. - -Instance methods are accepted (and very useful!) as trace functions. - -The events have the following meaning: - -``'call'`` - A function is called (or some other code block entered). The global trace - function is called; *arg* is ``None``; the return value specifies the local - trace function. - -``'line'`` - The interpreter is about to execute a new line of code (sometimes multiple line - events on one line exist). The local trace function is called; *arg* is - ``None``; the return value specifies the new local trace function. - -``'return'`` - A function (or other code block) is about to return. The local trace function - is called; *arg* is the value that will be returned. The trace function's - return value is ignored. - -``'exception'`` - An exception has occurred. The local trace function is called; *arg* is a - triple ``(exception, value, traceback)``; the return value specifies the new - local trace function. - -``'c_call'`` - A C function is about to be called. This may be an extension function or a - builtin. *arg* is the C function object. - -``'c_return'`` - A C function has returned. *arg* is ``None``. - -``'c_exception'`` - A C function has thrown an exception. *arg* is ``None``. - -Note that as an exception is propagated down the chain of callers, an -``'exception'`` event is generated at each level. - -For more information on code and frame objects, refer to :ref:`types`. - Modified: python/trunk/Doc/library/sys.rst ============================================================================== --- python/trunk/Doc/library/sys.rst (original) +++ python/trunk/Doc/library/sys.rst Thu Nov 20 05:05:12 2008 @@ -717,6 +717,56 @@ debugger to support multiple threads, it must be registered using :func:`settrace` for each thread being debugged. + Trace functions should have three arguments: *frame*, *event*, and + *arg*. *frame* is the current stack frame. *event* is a string: ``'call'``, + ``'line'``, ``'return'``, ``'exception'``, ``'c_call'``, ``'c_return'``, or + ``'c_exception'``. *arg* depends on the event type. + + The trace function is invoked (with *event* set to ``'call'``) whenever a new + local scope is entered; it should return a reference to a local trace + function to be used that scope, or ``None`` if the scope shouldn't be traced. + + The local trace function should return a reference to itself (or to another + function for further tracing in that scope), or ``None`` to turn off tracing + in that scope. + + The events have the following meaning: + + ``'call'`` + A function is called (or some other code block entered). The + global trace function is called; *arg* is ``None``; the return value + specifies the local trace function. + + ``'line'`` + The interpreter is about to execute a new line of code (sometimes multiple + line events on one line exist). The local trace function is called; *arg* + is ``None``; the return value specifies the new local trace function. + + ``'return'`` + A function (or other code block) is about to return. The local trace + function is called; *arg* is the value that will be returned. The trace + function's return value is ignored. + + ``'exception'`` + An exception has occurred. The local trace function is called; *arg* is a + tuple ``(exception, value, traceback)``; the return value specifies the + new local trace function. + + ``'c_call'`` + A C function is about to be called. This may be an extension function or + a builtin. *arg* is the C function object. + + ``'c_return'`` + A C function has returned. *arg* is ``None``. + + ``'c_exception'`` + A C function has thrown an exception. *arg* is ``None``. + + Note that as an exception is propagated down the chain of callers, an + ``'exception'`` event is generated at each level. + + For more information on code and frame objects, refer to :ref:`types`. + .. note:: The :func:`settrace` function is intended only for implementing debuggers, From nnorwitz at gmail.com Thu Nov 20 07:23:16 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 20 Nov 2008 01:23:16 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081120062316.GA24112@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) Underfull \hbox (badness 10000) in paragraph at lines 158--159 [3] [4] [5] [6] [7] [8] (/usr/share/texmf/tex/latex/psnfss/ts1ptm.fd) [9] [10] Chapter 2. [11] [12] [13] [14] Chapter 3. [15] [16] Chapter 4. [17] Overfull \hbox (14.2714pt too wide) in paragraph at lines 1304--1304 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 1304--1305 [][] [18] [19] [20] [21] [22] Chapter 5. [23] [24] [25] [26] [27] Underfull \hbox (badness 5359) in paragraph at lines 2168--2177 /ptmr8t/Return a Python ob-ject from the data stream in a /pcrr8t/FILE* /ptmr8t /opened for read-ing. Un-like [28] Underfull \hbox (badness 10000) in paragraph at lines 2257--2260 [] Underfull \hbox (badness 10000) in paragraph at lines 2275--2278 [] Overfull \hbox (79.5372pt too wide) in paragraph at lines 2280--2283 [] Underfull \hbox (badness 10000) in paragraph at lines 2311--2314 [] [29] [30] [31] Underfull \hbox (badness 6125) in paragraph at lines 2560--2562 []/ptmr8t/The call to [][]/pcrr8t/PyArg_UnpackTuple[][] /ptmr8t/in this ex-am-p le is en-tirely equiv-a-lent to this call to [32] [33] [34] [35] [36] Chapter 6. [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 7. Underfull \hbox (badness 10000) in paragraph at lines 3827--3828 [49] [50] [51] [52] [53] [54] [55] Overfull \hbox (14.2714pt too wide) in paragraph at lines 4686--4686 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 4686--4687 [][] [56] [57] [58] [59] Underfull \hbox (badness 8113) in paragraph at lines 5050--5053 /ptmr8t/Shortcut for /pcrr8t/PyUnicode_FromEncodedObject(obj, NULL, "strict") / ptmr8t/which is used [60] [61] [62] [63] [64] [65] [66] Underfull \hbox (badness 10000) in paragraph at lines 5649--5654 /ptmr8t/This con-stant may be passed as the /ptmri8t/size /ptmr8t/pa-ram-e-ter to [][]/pcrr8t/PyBuffer_FromObject[][] /ptmr8t/or [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] Overfull \hbox (44.0pt too wide) in paragraph at lines 6572--6573 [] [77] [78] [79] [80] Underfull \hbox (badness 10000) in paragraph at lines 6954--6956 /ptmr8t/Return true if /ptmri8t/ob /ptmr8t/is of type /pcrr8t/PyDateTime_DateTi meType /ptmr8t/or a sub-type of [81] Underfull \hbox (badness 5548) in paragraph at lines 7113--7125 [][]/pcrr8t/PyObject_CallMethod[][]/ptmr8t/, [][]/pcrr8t/PyObject_RichCompareBo ol[][]/ptmr8t/, [][]/pcrr8t/PyObject_Hash[][]/ptmr8t/, [][]/pcrr8t/PyObject_Rep r[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7113--7125 /ptmr8t/to-col (in-clud-ing [][]/pcrr8t/PyNumber_And[][]/ptmr8t/, [][]/pcrr8t/P yNumber_Subtract[][]/ptmr8t/, [][]/pcrr8t/PyNumber_Or[][]/ptmr8t/, [][]/pcrr8t/ PyNumber_Xor[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7113--7125 [][]/pcrr8t/PyNumber_InPlaceAnd[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceSubtra ct[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceOr[][]/ptmr8t/, and [82] [83] [84] Chapter 8. [85] [86] Underfull \hbox (badness 10000) in paragraph at lines 7514--7518 []/pcrr8t/'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam' []/pt mr8t/The re- [87] [88] [89] [90] Underfull \hbox (badness 10000) in paragraph at lines 7815--7818 /ptmr8t/This macro ex-pands to /pcrr8t/PyEval_RestoreThread(_save);/ptmr8t/: it is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 7822--7825 /ptmr8t/This macro ex-pands to /pcrr8t/_save = PyEval_SaveThread();/ptmr8t/: it is equiv-a-lent to [91] [92] [93] [94] Chapter 9. [95] [96] [97] [98] Chapter 10. Underfull \hbox (badness 10000) in paragraph at lines 8399--8399 Underfull \hbox (badness 10000) in paragraph at lines 8402--8402 [99] [100] [101] [102] [103] [104] [105] Underfull \hbox (badness 10000) in paragraph at lines 9002--9012 []/ptmr8t/The print func-tion is called with the same sig-na-ture as [][]/pcrr8 t/PyObject_Print[][]/ptmr8t/: /pcrr8t/int [106] [107] Underfull \hbox (badness 10000) in paragraph at lines 9250--9261 /ptmr8t/the fields /pcrr8t/nb_inplace_add/ptmr8t/, /pcrr8t/nb_inplace_subtract/ ptmr8t/, /pcrr8t/nb_inplace_multiply/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9250--9261 /pcrr8t/nb_inplace_divide/ptmr8t/, /pcrr8t/nb_inplace_remainder/ptmr8t/, /pcrr8 t/nb_inplace_power/ptmr8t/, Underfull \hbox (badness 5637) in paragraph at lines 9297--9303 /ptmr8t/If this bit is set, the type ob-ject has sev-eral new fields de-fined s tart-ing in Python [108] Underfull \hbox (badness 6300) in paragraph at lines 9348--9354 /ptmr8t/This is a bit-mask of all the bits that per-tain to the ex-is-tence of cer-tain fields in Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 /ptmr8t/the type ob-ject and its ex-ten-sion struc-tures. Cur-rently, it in-clu des the fol-low-ing Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 /ptmr8t/bits: [][]/pcrr8t/Py_TPFLAGS_HAVE_GETCHARBUFFER[][]/ptmr8t/, [][]/pcrr8 t/Py_TPFLAGS_HAVE_SEQUENCE_IN[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 [][]/pcrr8t/Py_TPFLAGS_HAVE_INPLACEOPS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE _RICHCOMPARE[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 [][]/pcrr8t/Py_TPFLAGS_HAVE_WEAKREFS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE_I TER[][]/ptmr8t/, and [109] Underfull \hbox (badness 10000) in paragraph at lines 9472--9474 /ptmr8t/An op-tional pointer to the rich com-par-i-son func-tion, whose sig-na- ture is /pcrr8t/PyObject [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] Appendix A. [121] [122] [123] [124] [125] [126] Appendix B. ! Package inputenc Error: Unicode char \u8:^^c3^^ba not set up for use with LaT eX. See the inputenc package documentation for explanation. Type H for immediate help. ... l.11005 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ? ! Emergency stop. ... l.11005 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From ncoghlan at gmail.com Thu Nov 20 11:51:39 2008 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 20 Nov 2008 20:51:39 +1000 Subject: [Python-checkins] r67291 - in python/trunk: Lib/test/test_bytes.py Misc/NEWS Objects/bytearrayobject.c In-Reply-To: <20081119214909.C1A451E4002@bag.python.org> References: <20081119214909.C1A451E4002@bag.python.org> Message-ID: <4925413B.2090902@gmail.com> benjamin.peterson wrote: > Author: benjamin.peterson > Date: Wed Nov 19 22:49:09 2008 > New Revision: 67291 > > Log: > make sure that bytearray methods return a new bytearray even if there is no change > > Fixes #4348 > Reviewed by Brett > > > Modified: > python/trunk/Lib/test/test_bytes.py > python/trunk/Misc/NEWS > python/trunk/Objects/bytearrayobject.c > > Modified: python/trunk/Lib/test/test_bytes.py > ============================================================================== > --- python/trunk/Lib/test/test_bytes.py (original) > +++ python/trunk/Lib/test/test_bytes.py Wed Nov 19 22:49:09 2008 > @@ -721,6 +721,16 @@ > b.insert(0, Indexable(ord('A'))) > self.assertEqual(b, b'A') > > + def test_copied(self): > + # Issue 4348. Make sure that operations that don't mutate the array > + # copy the bytes. > + b = bytearray(b'abc') > + #self.assertFalse(b is b.replace(b'abc', b'cde', 0)) > + > + t = bytearray([i for i in range(256)]) > + x = bytearray(b'') > + self.assertFalse(x is x.translate(t)) Why is the first test disabled? Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From python-checkins at python.org Thu Nov 20 16:47:45 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 20 Nov 2008 16:47:45 +0100 (CET) Subject: [Python-checkins] r67296 - sandbox/trunk/tkinter-polo/src/_tkinter.c Message-ID: <20081120154745.7E7E21E4011@bag.python.org> Author: guilherme.polo Date: Thu Nov 20 16:47:45 2008 New Revision: 67296 Log: * Removed module methods that would check for a tcl_lock, now they are only accessible after creating a tcl interpreter with _tkinter.create; Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c ============================================================================== --- sandbox/trunk/tkinter-polo/src/_tkinter.c (original) +++ sandbox/trunk/tkinter-polo/src/_tkinter.c Thu Nov 20 16:47:45 2008 @@ -2723,7 +2723,7 @@ return Py_None; } - + /**** Tkapp Method List ****/ static PyMethodDef Tkapp_methods[] = @@ -2769,7 +2769,6 @@ }; - /**** Tkapp Type Methods ****/ static void @@ -2904,11 +2903,11 @@ context.maxsize = PySequence_Size(item); if (context.maxsize <= 0) return PyTuple_New(0); - + context.tuple = PyTuple_New(context.maxsize); if (!context.tuple) return NULL; - + context.size = 0; if (!_flatten1(&context, item,0)) @@ -2990,19 +2989,13 @@ { {"_flatten", Tkinter_Flatten, METH_VARARGS}, {"create", Tkinter_Create, METH_VARARGS}, -#ifdef HAVE_CREATEFILEHANDLER - {"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS}, - {"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS}, -#endif - {"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS}, - {"mainloop", Tkapp_MainLoop, METH_VARARGS}, {"dooneevent", Tkapp_DoOneEvent, METH_VARARGS}, {"quit", Tkapp_Quit, METH_VARARGS}, {"setbusywaitinterval",Tkinter_setbusywaitinterval, METH_VARARGS, setbusywaitinterval_doc}, {"getbusywaitinterval",(PyCFunction)Tkinter_getbusywaitinterval, METH_NOARGS, getbusywaitinterval_doc}, - {NULL, NULL} + {NULL, NULL} }; #ifdef WAIT_FOR_STDIN From python-checkins at python.org Thu Nov 20 17:07:29 2008 From: python-checkins at python.org (guilherme.polo) Date: Thu, 20 Nov 2008 17:07:29 +0100 (CET) Subject: [Python-checkins] r67297 - sandbox/trunk/tkinter-polo/src/_tkinter.c Message-ID: <20081120160729.2401B1E4002@bag.python.org> Author: guilherme.polo Date: Thu Nov 20 17:07:28 2008 New Revision: 67297 Log: Check for exception in _flatten Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c ============================================================================== --- sandbox/trunk/tkinter-polo/src/_tkinter.c (original) +++ sandbox/trunk/tkinter-polo/src/_tkinter.c Thu Nov 20 17:07:28 2008 @@ -2901,7 +2901,9 @@ return NULL; context.maxsize = PySequence_Size(item); - if (context.maxsize <= 0) + if (context.maxsize == -1) + return NULL; + else if (context.maxsize == 0) return PyTuple_New(0); context.tuple = PyTuple_New(context.maxsize); From buildbot at python.org Thu Nov 20 18:00:20 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 17:00:20 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian 3.0 Message-ID: <20081120170021.219DA1E402E@bag.python.org> The Buildbot has detected a new failure of MIPS Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%20Debian%203.0/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-mips Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,hirokazu.yamamoto,josiah.carlson,martin.v.loewis,raymond.hettinger BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 18:07:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 17:07:26 +0000 Subject: [Python-checkins] buildbot failure in MIPS Debian trunk Message-ID: <20081120170726.B60151E4002@bag.python.org> The Buildbot has detected a new failure of MIPS Debian trunk. Full details are available at: http://www.python.org/dev/buildbot/all/MIPS%20Debian%20trunk/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-mips Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,brett.cannon,georg.brandl,josiah.carlson,martin.v.loewis,skip.montanaro BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 21:25:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 20:25:11 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081120202512.3A9231E4002@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/1282 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: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 21:28:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 20:28:26 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081120202826.436021E4002@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/507 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: barry.warsaw 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 Thu Nov 20 21:43:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 20:43:05 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081120204305.9B5E01E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/422 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: barry.warsaw BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 21:51:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 20:51:30 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081120205130.A23DD1E4002@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/580 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: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_poplib.py", line 143, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 412, in handle_read_event self.handle_read() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asynchat.py", line 130, in handle_read self.handle_error() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asynchat.py", line 128, in handle_read data = self.recv (self.ac_in_buffer_size) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 361, in recv data = self.socket.recv(buffer_size) socket.error: [Errno 11] Resource temporarily unavailable Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_poplib.py", line 143, in handle_accept conn, addr = self.accept() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 338, in accept conn, addr = self.socket.accept() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/socket.py", line 120, in accept fd, addr = self._accept() socket.error: [Errno 9] Bad file descriptor Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/asyncore.py", line 129, in poll r, w, e = select.select(r, w, e, timeout) select.error: (9, 'Bad file descriptor') sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 22:10:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 21:10:10 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20081120211010.B7F721E4002@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/1701 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: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1492, in write if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_socket.py", line 126, in clientRun Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1492, in write self.clientSetUp() File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_socket.py", line 774, in clientSetUp self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1492, in write self.cli_file = self.serv_conn.makefile('wb') File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1039, in write self.buffer.write(b) Unhandled exception in thread started by File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/io.py", line 1039, in write sincerely, -The Buildbot From python-checkins at python.org Thu Nov 20 22:25:31 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 20 Nov 2008 22:25:31 +0100 (CET) Subject: [Python-checkins] r67301 - python/trunk/Doc/library/sys.rst Message-ID: <20081120212531.666A81E4002@bag.python.org> Author: benjamin.peterson Date: Thu Nov 20 22:25:31 2008 New Revision: 67301 Log: fix indentation and a sphinx warning Modified: python/trunk/Doc/library/sys.rst Modified: python/trunk/Doc/library/sys.rst ============================================================================== --- python/trunk/Doc/library/sys.rst (original) +++ python/trunk/Doc/library/sys.rst Thu Nov 20 22:25:31 2008 @@ -712,8 +712,7 @@ single: debugger Set the system's trace function, which allows you to implement a Python - source code debugger in Python. See section :ref:`debugger-hooks` in the - chapter on the Python debugger. The function is thread-specific; for a + source code debugger in Python. The function is thread-specific; for a debugger to support multiple threads, it must be registered using :func:`settrace` for each thread being debugged. @@ -762,10 +761,10 @@ ``'c_exception'`` A C function has thrown an exception. *arg* is ``None``. - Note that as an exception is propagated down the chain of callers, an - ``'exception'`` event is generated at each level. + Note that as an exception is propagated down the chain of callers, an + ``'exception'`` event is generated at each level. - For more information on code and frame objects, refer to :ref:`types`. + For more information on code and frame objects, refer to :ref:`types`. .. note:: From buildbot at python.org Thu Nov 20 22:29:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 21:29:38 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian 3.0 Message-ID: <20081120212938.8E1F41E4002@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%203.0/builds/1804 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 558, in process_request_thread self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 146, in poll write(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 85, in write obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 81, in write obj.handle_write_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 431, in handle_write_event self.handle_write() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asynchat.py", line 194, in handle_write self.initiate_send() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asynchat.py", line 266, in initiate_send del self.producer_fifo[0] IndexError: deque index out of range Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_ssl.py", line 983, in testSocketServer raise support.TestFailed(msg) test.support.TestFailed: Traceback (most recent call last): Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1039, in write if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 126, in clientRun self.clientSetUp() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 774, in clientSetUp self.cli_file = self.serv_conn.makefile('wb') File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/socket.py", line 163, in makefile Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1039, in write if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 126, in clientRun self.clientSetUp() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 774, in clientSetUp if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 126, in clientRun self.clientSetUp() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 774, in clientSetUp if len(self._write_buf) > self.buffer_size:self.cli_file = self.serv_conn.makefile('wb') Unhandled exception in thread started by Traceback (most recent call last): self.clientSetUp() File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/io.py", line 1039, in write File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_socket.py", line 126, in clientRun Traceback (most recent call last): sincerely, -The Buildbot From python-checkins at python.org Thu Nov 20 22:44:23 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 20 Nov 2008 22:44:23 +0100 (CET) Subject: [Python-checkins] r67302 - python/trunk/Lib/test/test_bytes.py Message-ID: <20081120214423.745361E4047@bag.python.org> Author: benjamin.peterson Date: Thu Nov 20 22:44:23 2008 New Revision: 67302 Log: oops! didn't mean to disable that test Modified: python/trunk/Lib/test/test_bytes.py Modified: python/trunk/Lib/test/test_bytes.py ============================================================================== --- python/trunk/Lib/test/test_bytes.py (original) +++ python/trunk/Lib/test/test_bytes.py Thu Nov 20 22:44:23 2008 @@ -725,7 +725,7 @@ # Issue 4348. Make sure that operations that don't mutate the array # copy the bytes. b = bytearray(b'abc') - #self.assertFalse(b is b.replace(b'abc', b'cde', 0)) + self.assertFalse(b is b.replace(b'abc', b'cde', 0)) t = bytearray([i for i in range(256)]) x = bytearray(b'') From buildbot at python.org Thu Nov 20 23:04:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 22:04:36 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20081120220436.E19781E4002@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/393 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 BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Nov 20 23:06:22 2008 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 20 Nov 2008 23:06:22 +0100 (CET) Subject: [Python-checkins] r67303 - in python/trunk/Lib: io.py test/test_io.py Message-ID: <20081120220622.BB8A51E4002@bag.python.org> Author: benjamin.peterson Date: Thu Nov 20 23:06:22 2008 New Revision: 67303 Log: backport r67300 Modified: python/trunk/Lib/io.py python/trunk/Lib/test/test_io.py Modified: python/trunk/Lib/io.py ============================================================================== --- python/trunk/Lib/io.py (original) +++ python/trunk/Lib/io.py Thu Nov 20 23:06:22 2008 @@ -238,8 +238,6 @@ raise ValueError("invalid buffering size") if buffering == 0: if binary: - raw._name = file - raw._mode = mode return raw raise ValueError("can't have unbuffered text I/O") if updating: @@ -251,11 +249,8 @@ else: raise ValueError("unknown mode: %r" % mode) if binary: - buffer.name = file - buffer.mode = mode return buffer text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering) - text.name = file text.mode = mode return text @@ -622,6 +617,10 @@ # that _fileio._FileIO inherits from io.RawIOBase (which would be hard # to do since _fileio.c is written in C). + def __init__(self, name, mode="r", closefd=True): + _fileio._FileIO.__init__(self, name, mode, closefd) + self._name = name + def close(self): _fileio._FileIO.close(self) RawIOBase.close(self) @@ -630,10 +629,6 @@ def name(self): return self._name - @property - def mode(self): - return self._mode - class BufferedIOBase(IOBase): @@ -767,6 +762,14 @@ def closed(self): return self.raw.closed + @property + def name(self): + return self.raw.name + + @property + def mode(self): + return self.raw.mode + ### Lower-level APIs ### def fileno(self): @@ -1473,6 +1476,10 @@ def closed(self): return self.buffer.closed + @property + def name(self): + return self.buffer.name + def fileno(self): return self.buffer.fileno() Modified: python/trunk/Lib/test/test_io.py ============================================================================== --- python/trunk/Lib/test/test_io.py (original) +++ python/trunk/Lib/test/test_io.py Thu Nov 20 23:06:22 2008 @@ -1225,6 +1225,9 @@ class MiscIOTest(unittest.TestCase): + def tearDown(self): + test_support.unlink(test_support.TESTFN) + def testImport__all__(self): for name in io.__all__: obj = getattr(io, name, None) @@ -1237,6 +1240,34 @@ self.assert_(issubclass(obj, io.IOBase)) + def test_attributes(self): + f = io.open(test_support.TESTFN, "wb", buffering=0) + self.assertEquals(f.mode, "w") + f.close() + + f = io.open(test_support.TESTFN, "U") + self.assertEquals(f.name, test_support.TESTFN) + self.assertEquals(f.buffer.name, test_support.TESTFN) + self.assertEquals(f.buffer.raw.name, test_support.TESTFN) + self.assertEquals(f.mode, "U") + self.assertEquals(f.buffer.mode, "r") + self.assertEquals(f.buffer.raw.mode, "r") + f.close() + + f = io.open(test_support.TESTFN, "w+") + self.assertEquals(f.mode, "w+") + self.assertEquals(f.buffer.mode, "r+") # Does it really matter? + self.assertEquals(f.buffer.raw.mode, "r+") + + g = io.open(f.fileno(), "wb", closefd=False) + self.assertEquals(g.mode, "w") + self.assertEquals(g.raw.mode, "w") + self.assertEquals(g.name, f.fileno()) + self.assertEquals(g.raw.name, f.fileno()) + f.close() + g.close() + + def test_main(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, BufferedReaderTest, BufferedWriterTest, From buildbot at python.org Thu Nov 20 23:13:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 22:13:12 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20081120221312.D78181E4002@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/501 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_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 23:18:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 22:18:06 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081120221807.13A971E4002@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/767 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: barry.warsaw BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_ssl.py", line 970, in testSocketServer f = urllib.request.urlopen(url) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1090, in https_open return self.do_open(http.client.HTTPSConnection, req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_ssl.py", line 983, in testSocketServer raise support.TestFailed(msg) test.support.TestFailed: Traceback (most recent call last): Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_ssl.py", line 970, in testSocketServer f = urllib.request.urlopen(url) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1090, in https_open return self.do_open(http.client.HTTPSConnection, req) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/io.py", line 1492, in write if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_socket.py", line 126, in clientRun self.clientSetUp() File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_socket.py", line 774, in clientSetUp Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/io.py", line 1492, in write self.buffer.write(b) Traceback (most recent call last): sincerely, -The Buildbot From nnorwitz at gmail.com Thu Nov 20 23:25:14 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 20 Nov 2008 17:25:14 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081120222513.GA1183@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_cmd_line leaked [25, 0, 0] references, sum=25 test_smtplib leaked [-88, -4, 92] references, sum=0 test_sys leaked [21, 0, 0] references, sum=21 test_threadedtempfile leaked [0, 0, 93] references, sum=93 test_threadsignals leaked [0, -8, 0] references, sum=-8 test_urllib2_localnet leaked [3, 3, 3] references, sum=9 From buildbot at python.org Thu Nov 20 23:29:40 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 22:29:40 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081120222940.3388C1E4002@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/327 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: sincerely, -The Buildbot From buildbot at python.org Thu Nov 20 23:36:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 22:36:36 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081120223636.E917E1E4002@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/1071 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 00:06:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 23:06:58 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081120230658.6252E1E4002@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/2090 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: Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/threading.py", line 522, in __bootstrap_inner self.run() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/bsddb/test/test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30994, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 00:08:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 23:08:42 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081120230843.196461E4002@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/318 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 test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 00:09:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 23:09:23 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081120230924.2659B1E4002@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/687 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: barry.warsaw 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/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 143, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 143, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 143, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 133, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_poplib.py", line 143, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 558, in process_request_thread self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ssl.py", line 970, in testSocketServer f = urllib.request.urlopen(url) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1090, in https_open return self.do_open(http.client.HTTPSConnection, req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ssl.py", line 983, in testSocketServer raise support.TestFailed(msg) test.support.TestFailed: Traceback (most recent call last): Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ssl.py", line 970, in testSocketServer f = urllib.request.urlopen(url) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1090, in https_open return self.do_open(http.client.HTTPSConnection, req) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 146, in poll write(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 85, in write obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 81, in write obj.handle_write_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 431, in handle_write_event self.handle_write() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asynchat.py", line 194, in handle_write self.initiate_send() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asynchat.py", line 266, in initiate_send del self.producer_fifo[0] IndexError: deque index out of range Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 216, in handle_accept self.handler = self.handler(conn) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 51, in __init__ self.push('220 welcome') File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 79, in push asynchat.async_chat.push(self, data.encode('ascii') + b'\r\n') File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asynchat.py", line 206, in push self.initiate_send() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asynchat.py", line 266, in initiate_send del self.producer_fifo[0] IndexError: deque index out of range Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 146, in poll write(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 85, in write obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 81, in write obj.handle_write_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 431, in handle_write_event self.handle_write() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asynchat.py", line 194, in handle_write self.initiate_send() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asynchat.py", line 266, in initiate_send del self.producer_fifo[0] IndexError: deque index out of range Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/threading.py", line 507, in _bootstrap_inner self.run() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 203, in loop poll_fun(timeout, map) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 140, in poll read(obj) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 77, in read obj.handle_error() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 73, in read obj.handle_read_event() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/asyncore.py", line 407, in handle_read_event self.handle_accept() File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_ftplib.py", line 215, in handle_accept conn, addr = self.accept() TypeError: 'NoneType' object is not iterable Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/io.py", line 1492, in write if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_socket.py", line 126, in clientRun Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/io.py", line 1492, in write self.clientSetUp() Traceback (most recent call last): Traceback (most recent call last): self.buffer.write(b) File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/io.py", line 1492, in write if len(self._write_buf) > self.buffer_size: sincerely, -The Buildbot From python-checkins at python.org Fri Nov 21 00:34:31 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 21 Nov 2008 00:34:31 +0100 (CET) Subject: [Python-checkins] r67307 - in python/trunk: Doc/library/io.rst Lib/test/test_io.py Misc/NEWS Modules/_fileio.c Message-ID: <20081120233431.D2AFB1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Fri Nov 21 00:34:31 2008 New Revision: 67307 Log: Fixed issue #4233. Changed semantic of _fileio.FileIO's close() method on file objects with closefd=False. The file descriptor is still kept open but the file object behaves like a closed file. The FileIO object also got a new readonly attribute closefd. Approved by Barry Backport of r67106 from the py3k branch Modified: python/trunk/Doc/library/io.rst python/trunk/Lib/test/test_io.py python/trunk/Misc/NEWS python/trunk/Modules/_fileio.c Modified: python/trunk/Doc/library/io.rst ============================================================================== --- python/trunk/Doc/library/io.rst (original) +++ python/trunk/Doc/library/io.rst Fri Nov 21 00:34:31 2008 @@ -214,8 +214,10 @@ .. method:: close() - Flush and close this stream. This method has no effect if the file is - already closed. + Flush and close this stream. This method has no effect if the file is + already closed. Once the file is closed, any operation on the file + (e.g. reading or writing) will raise an :exc:`IOError`. The internal + file descriptor isn't closed if *closefd* was False. .. attribute:: closed Modified: python/trunk/Lib/test/test_io.py ============================================================================== --- python/trunk/Lib/test/test_io.py (original) +++ python/trunk/Lib/test/test_io.py Fri Nov 21 00:34:31 2008 @@ -272,6 +272,30 @@ self.assertRaises(ValueError, io.open, test_support.TESTFN, 'w', closefd=False) + def testReadClosed(self): + with io.open(test_support.TESTFN, "w") as f: + f.write("egg\n") + with io.open(test_support.TESTFN, "r") as f: + file = io.open(f.fileno(), "r", closefd=False) + self.assertEqual(file.read(), "egg\n") + file.seek(0) + file.close() + self.assertRaises(ValueError, file.read) + + def test_no_closefd_with_filename(self): + # can't use closefd in combination with a file name + self.assertRaises(ValueError, + io.open, test_support.TESTFN, "r", closefd=False) + + def test_closefd_attr(self): + with io.open(test_support.TESTFN, "wb") as f: + f.write(b"egg\n") + with io.open(test_support.TESTFN, "r") as f: + self.assertEqual(f.buffer.raw.closefd, True) + file = io.open(f.fileno(), "r", closefd=False) + self.assertEqual(file.buffer.raw.closefd, False) + + class MemorySeekTestMixin: def testInit(self): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Nov 21 00:34:31 2008 @@ -12,6 +12,11 @@ Core and Builtins ----------------- +- Issue #4233: Changed semantic of ``_fileio.FileIO``'s ``close()`` + method on file objects with closefd=False. The file descriptor is still + kept open but the file object behaves like a closed file. The ``FileIO`` + object also got a new readonly attribute ``closefd``. + - Issue #4348: Some bytearray methods returned that didn't cause any change to the bytearray, returned the same bytearray instead of a copy. Modified: python/trunk/Modules/_fileio.c ============================================================================== --- python/trunk/Modules/_fileio.c (original) +++ python/trunk/Modules/_fileio.c Fri Nov 21 00:34:31 2008 @@ -61,10 +61,7 @@ fileio_close(PyFileIOObject *self) { if (!self->closefd) { - if (PyErr_WarnEx(PyExc_RuntimeWarning, - "Trying to close unclosable fd!", 3) < 0) { - return NULL; - } + self->fd = -1; Py_RETURN_NONE; } errno = internal_close(self); @@ -821,6 +818,12 @@ } static PyObject * +get_closefd(PyFileIOObject *self, void *closure) +{ + return PyBool_FromLong((long)(self->closefd)); +} + +static PyObject * get_mode(PyFileIOObject *self, void *closure) { return PyString_FromString(mode_string(self)); @@ -828,6 +831,8 @@ static PyGetSetDef fileio_getsetlist[] = { {"closed", (getter)get_closed, NULL, "True if the file is closed"}, + {"closefd", (getter)get_closefd, NULL, + "True if the file descriptor will be closed"}, {"mode", (getter)get_mode, NULL, "String giving the file mode"}, {0}, }; From buildbot at python.org Fri Nov 21 00:46:44 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 20 Nov 2008 23:46:44 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 3.0 Message-ID: <20081120234644.EADF31E4002@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/425 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 test Excerpt from the test logfile: 1 test failed: test_gzip ====================================================================== FAIL: test_mode (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\3.0.nelson-windows\build\lib\test\test_gzip.py", line 153, in test_mode self.assertEqual(f.myfileobj.mode, 'rb') AssertionError: 'r' != 'rb' sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 01:31:04 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 00:31:04 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081121003104.23EFB1E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/424 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 01:37:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 00:37:15 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081121003716.09E3E1E4002@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/585 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_dbm_dumb ====================================================================== ERROR: test_dumbdbm_creation (test.test_dbm_dumb.DumbDBMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 41, in test_dumbdbm_creation f.close() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 228, in close self._commit() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 116, in _commit f.write("%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/io.py", line 1491, in write b = encoder.encode(s) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128) ====================================================================== ERROR: test_dumbdbm_keys (test.test_dbm_dumb.DumbDBMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 88, in test_dumbdbm_keys self.init_db() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 154, in init_db f.close() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 228, in close self._commit() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 116, in _commit f.write("%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/io.py", line 1491, in write b = encoder.encode(s) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128) ====================================================================== ERROR: test_dumbdbm_modification (test.test_dbm_dumb.DumbDBMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 75, in test_dumbdbm_modification self.init_db() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 154, in init_db f.close() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 228, in close self._commit() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 116, in _commit f.write("%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/io.py", line 1491, in write b = encoder.encode(s) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128) ====================================================================== ERROR: test_dumbdbm_read (test.test_dbm_dumb.DumbDBMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 82, in test_dumbdbm_read self.init_db() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 154, in init_db f.close() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 228, in close self._commit() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 116, in _commit f.write("%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/io.py", line 1491, in write b = encoder.encode(s) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128) ====================================================================== ERROR: test_str_read (test.test_dbm_dumb.DumbDBMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 110, in test_str_read self.init_db() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 154, in init_db f.close() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 228, in close self._commit() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 116, in _commit f.write("%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/io.py", line 1491, in write b = encoder.encode(s) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128) ====================================================================== ERROR: test_str_write_contains (test.test_dbm_dumb.DumbDBMTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 115, in test_str_write_contains self.init_db() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_dumb.py", line 154, in init_db f.close() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 228, in close self._commit() File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/dbm/dumb.py", line 116, in _commit f.write("%r, %r\n" % (key.decode('Latin-1'), pos_and_siz_pair)) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/io.py", line 1491, in write b = encoder.encode(s) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode characters in position 1-2: ordinal not in range(128) make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 01:46:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 00:46:48 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20081121004648.385E61E4010@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/719 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: amaury.forgeotdarc,barry.warsaw,benjamin.peterson,hirokazu.yamamoto,josiah.carlson,martin.v.loewis,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 307, in process_request self.finish_request(request, client_address) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 320, in finish_request self.RequestHandlerClass(request, client_address, self) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 613, in __init__ self.setup() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socketserver.py", line 651, in setup self.rfile = self.connection.makefile('rb', self.rbufsize) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile buffer.name = self.fileno() AttributeError: can't set attribute Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_ssl.py", line 970, in testSocketServer f = urllib.request.urlopen(url) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1090, in https_open return self.do_open(http.client.HTTPSConnection, req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_ssl.py", line 983, in testSocketServer raise support.TestFailed(msg) test.support.TestFailed: Traceback (most recent call last): Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_ssl.py", line 970, in testSocketServer f = urllib.request.urlopen(url) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 122, in urlopen return _opener.open(url, data, timeout) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 359, in open response = self._open(req, data) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 377, in _open '_open', req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 337, in _call_chain result = func(*args) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1090, in https_open return self.do_open(http.client.HTTPSConnection, req) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/urllib/request.py", line 1071, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write Unhandled exception in thread started by Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1492, in write if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_socket.py", line 126, in clientRun self.clientSetUp() File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_socket.py", line 774, in clientSetUp self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.buffer.write(b) File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py", line 1039, in write self.cli_file = self.serv_conn.makefile('wb') File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/socket.py", line 163, in makefile if len(self._write_buf) > self.buffer_size: File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_socket.py", line 126, in clientRun buffer.name = self.fileno() AttributeError: can't set attribute sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 01:58:57 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 00:58:57 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 3.0 Message-ID: <20081121005857.ECA7F1E400C@bag.python.org> The Buildbot has detected a new failure of AMD64 W2k8 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%203.0/builds/948 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_gzip ====================================================================== FAIL: test_mode (test.test_gzip.TestGzip) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\3.0.nelson-win64\build\lib\test\test_gzip.py", line 153, in test_mode self.assertEqual(f.myfileobj.mode, 'rb') AssertionError: 'r' != 'rb' sincerely, -The Buildbot From buildbot at python.org Fri Nov 21 02:02:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 01:02:16 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081121010216.4DD491E400C@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/820 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: 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 Fri Nov 21 02:22:30 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 21 Nov 2008 02:22:30 +0100 (CET) Subject: [Python-checkins] r67313 - python/tags/r30rc3 Message-ID: <20081121012230.531011E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 21 02:22:30 2008 New Revision: 67313 Log: Tagging 3.0rc3. Added: python/tags/r30rc3/ - copied from r67312, /python/branches/py3k/ From buildbot at python.org Fri Nov 21 05:28:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 04:28:06 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.0 Message-ID: <20081121042807.0475C1E400C@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/1283 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: amaury.forgeotdarc,barry.warsaw,benjamin.peterson,brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_urllib2_localnet test_urllibnet ====================================================================== FAIL: test_bad_address (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_urllib2_localnet.py", line 452, in test_bad_address "http://www.python.invalid./") AssertionError: IOError not raised by urlopen ====================================================================== FAIL: test_bad_address (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_urllibnet.py", line 142, in test_bad_address "http://www.python.invalid./") AssertionError: IOError not raised by urlopen sincerely, -The Buildbot From nnorwitz at gmail.com Fri Nov 21 07:23:24 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 21 Nov 2008 01:23:24 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081121062324.GA31564@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... make[1]: *** [build] Killed make[1]: Leaving directory `/home/neal/python/r26/Doc' make: *** [dist] Error 2 From python-checkins at python.org Fri Nov 21 16:04:17 2008 From: python-checkins at python.org (barry.warsaw) Date: Fri, 21 Nov 2008 16:04:17 +0100 (CET) Subject: [Python-checkins] r67315 - peps/trunk/pep-0361.txt Message-ID: <20081121150417.1862D1E4002@bag.python.org> Author: barry.warsaw Date: Fri Nov 21 16:04:16 2008 New Revision: 67315 Log: 3.0rc3 Modified: peps/trunk/pep-0361.txt Modified: peps/trunk/pep-0361.txt ============================================================================== --- peps/trunk/pep-0361.txt (original) +++ peps/trunk/pep-0361.txt Fri Nov 21 16:04:16 2008 @@ -62,7 +62,7 @@ Sep 17 2008: Python 2.6rc2 and 3.0rc1 released Oct 01 2008: Python 2.6 final released Nov 06 2008: Python 3.0rc2 released - Nov 19 2008: Python 3.0rc3 planned (if needed) + Nov 21 2008: Python 3.0rc3 released Dec 03 2008: Python 3.0 final planned See the public `Google calendar`_ From python-checkins at python.org Fri Nov 21 23:05:48 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 21 Nov 2008 23:05:48 +0100 (CET) Subject: [Python-checkins] r67318 - in python/trunk: Lib/uuid.py Misc/NEWS Message-ID: <20081121220548.61E821E4011@bag.python.org> Author: amaury.forgeotdarc Date: Fri Nov 21 23:05:48 2008 New Revision: 67318 Log: #4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present. Will backport to 2.6 Modified: python/trunk/Lib/uuid.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/uuid.py ============================================================================== --- python/trunk/Lib/uuid.py (original) +++ python/trunk/Lib/uuid.py Fri Nov 21 23:05:48 2008 @@ -479,8 +479,8 @@ # When the system provides a version-1 UUID generator, use it (but don't # use UuidCreate here because its UUIDs don't conform to RFC 4122). - _buffer = ctypes.create_string_buffer(16) if _uuid_generate_time and node is clock_seq is None: + _buffer = ctypes.create_string_buffer(16) _uuid_generate_time(_buffer) return UUID(bytes=_buffer.raw) @@ -516,8 +516,8 @@ """Generate a random UUID.""" # When the system provides a version-4 UUID generator, use it. - _buffer = ctypes.create_string_buffer(16) if _uuid_generate_random: + _buffer = ctypes.create_string_buffer(16) _uuid_generate_random(_buffer) return UUID(bytes=_buffer.raw) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Nov 21 23:05:48 2008 @@ -50,6 +50,9 @@ Library ------- +- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if + the ctypes module is not present. + - Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. - httplib.HTTPConnection.putheader() now accepts an arbitrary number of values From python-checkins at python.org Fri Nov 21 23:08:14 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Fri, 21 Nov 2008 23:08:14 +0100 (CET) Subject: [Python-checkins] r67319 - in python/branches/release26-maint: Lib/uuid.py Misc/NEWS Message-ID: <20081121220814.769E31E400C@bag.python.org> Author: amaury.forgeotdarc Date: Fri Nov 21 23:08:14 2008 New Revision: 67319 Log: Merged revisions 67318 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67318 | amaury.forgeotdarc | 2008-11-21 23:05:48 +0100 (ven., 21 nov. 2008) | 4 lines #4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present. Will backport to 2.6 ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/uuid.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/uuid.py ============================================================================== --- python/branches/release26-maint/Lib/uuid.py (original) +++ python/branches/release26-maint/Lib/uuid.py Fri Nov 21 23:08:14 2008 @@ -479,8 +479,8 @@ # When the system provides a version-1 UUID generator, use it (but don't # use UuidCreate here because its UUIDs don't conform to RFC 4122). - _buffer = ctypes.create_string_buffer(16) if _uuid_generate_time and node is clock_seq is None: + _buffer = ctypes.create_string_buffer(16) _uuid_generate_time(_buffer) return UUID(bytes=_buffer.raw) @@ -516,8 +516,8 @@ """Generate a random UUID.""" # When the system provides a version-4 UUID generator, use it. - _buffer = ctypes.create_string_buffer(16) if _uuid_generate_random: + _buffer = ctypes.create_string_buffer(16) _uuid_generate_random(_buffer) return UUID(bytes=_buffer.raw) Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Fri Nov 21 23:08:14 2008 @@ -45,6 +45,9 @@ Library ------- +- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if + the ctypes module is not present. + - Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. - Issue #3774: Fixed an error when create a Tkinter menu item without command From nnorwitz at gmail.com Fri Nov 21 23:16:19 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Fri, 21 Nov 2008 17:16:19 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081121221619.GA6186@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From python-checkins at python.org Fri Nov 21 23:27:24 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 21 Nov 2008 23:27:24 +0100 (CET) Subject: [Python-checkins] r67320 - in python/trunk: Lib/test/test_unicodedata.py Misc/NEWS Python/ast.c Message-ID: <20081121222724.954041E4002@bag.python.org> Author: benjamin.peterson Date: Fri Nov 21 23:27:24 2008 New Revision: 67320 Log: don't segfault when \N escapes are used and unicodedata fails to load Fixes #4367 Modified: python/trunk/Lib/test/test_unicodedata.py python/trunk/Misc/NEWS python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_unicodedata.py ============================================================================== --- python/trunk/Lib/test/test_unicodedata.py (original) +++ python/trunk/Lib/test/test_unicodedata.py Fri Nov 21 23:27:24 2008 @@ -4,9 +4,13 @@ (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. -"""#" -import unittest, test.test_support +""" + +import sys +import unittest import hashlib +import subprocess +import test.test_support encoding = 'utf-8' @@ -196,6 +200,25 @@ class UnicodeMiscTest(UnicodeDatabaseTest): + def test_failed_import_during_compiling(self): + # Issue 4367 + # Decoding \N escapes requires the unicodedata module. If it can't be + # imported, we shouldn't segfault. + + # This program should raise a SyntaxError in the eval. + code = "import sys;" \ + "sys.modules['unicodedata'] = None;" \ + """eval("u'\N{SOFT HYPHEN}'")""" + args = [sys.executable, "-c", code] + # We use a subprocess because the unicodedata module may already have + # been loaded in this process. + popen = subprocess.Popen(args, stderr=subprocess.PIPE) + popen.wait() + self.assertEqual(popen.returncode, 1) + error = "SyntaxError: (unicode error) \N escapes not supported " \ + "(can't load unicodedata module)" + self.assertTrue(error in popen.stderr.read()) + def test_decimal_numeric_consistent(self): # Test that decimal and numeric are consistent, # i.e. if a character has a decimal value, Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Nov 21 23:27:24 2008 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4367: Python would segfault during compiling when the unicodedata + module couldn't be imported and \N escapes were present. + - Issue #4233: Changed semantic of ``_fileio.FileIO``'s ``close()`` method on file objects with closefd=False. The file descriptor is still kept open but the file object behaves like a closed file. The ``FileIO`` Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Fri Nov 21 23:27:24 2008 @@ -1294,13 +1294,14 @@ if (PyErr_ExceptionMatches(PyExc_UnicodeError)){ PyObject *type, *value, *tback, *errstr; PyErr_Fetch(&type, &value, &tback); - errstr = ((PyUnicodeErrorObject *)value)->reason; + errstr = PyObject_Str(value); if (errstr) { char *s = ""; char buf[128]; s = PyString_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); + Py_DECREF(errstr); } else { ast_error(n, "(unicode error) unknown error"); } From python-checkins at python.org Fri Nov 21 23:52:22 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 21 Nov 2008 23:52:22 +0100 (CET) Subject: [Python-checkins] r67321 - in python/branches/release26-maint: Lib/test/test_unicodedata.py Misc/NEWS Python/ast.c Message-ID: <20081121225222.151D71E4002@bag.python.org> Author: benjamin.peterson Date: Fri Nov 21 23:52:21 2008 New Revision: 67321 Log: Merged revisions 67320 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67320 | benjamin.peterson | 2008-11-21 16:27:24 -0600 (Fri, 21 Nov 2008) | 4 lines don't segfault when \N escapes are used and unicodedata fails to load Fixes #4367 ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_unicodedata.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Python/ast.c Modified: python/branches/release26-maint/Lib/test/test_unicodedata.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_unicodedata.py (original) +++ python/branches/release26-maint/Lib/test/test_unicodedata.py Fri Nov 21 23:52:21 2008 @@ -4,9 +4,13 @@ (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. -"""#" -import unittest, test.test_support +""" + +import sys +import unittest import hashlib +import subprocess +import test.test_support encoding = 'utf-8' @@ -196,6 +200,25 @@ class UnicodeMiscTest(UnicodeDatabaseTest): + def test_failed_import_during_compiling(self): + # Issue 4367 + # Decoding \N escapes requires the unicodedata module. If it can't be + # imported, we shouldn't segfault. + + # This program should raise a SyntaxError in the eval. + code = "import sys;" \ + "sys.modules['unicodedata'] = None;" \ + """eval("u'\N{SOFT HYPHEN}'")""" + args = [sys.executable, "-c", code] + # We use a subprocess because the unicodedata module may already have + # been loaded in this process. + popen = subprocess.Popen(args, stderr=subprocess.PIPE) + popen.wait() + self.assertEqual(popen.returncode, 1) + error = "SyntaxError: (unicode error) \N escapes not supported " \ + "(can't load unicodedata module)" + self.assertTrue(error in popen.stderr.read()) + def test_decimal_numeric_consistent(self): # Test that decimal and numeric are consistent, # i.e. if a character has a decimal value, Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Fri Nov 21 23:52:21 2008 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4367: Python would segfault during compiling when the unicodedata + module couldn't be imported and \N escapes were present. + - Issue #4348: Some bytearray methods returned that didn't cause any change to the bytearray, returned the same bytearray instead of a copy. Modified: python/branches/release26-maint/Python/ast.c ============================================================================== --- python/branches/release26-maint/Python/ast.c (original) +++ python/branches/release26-maint/Python/ast.c Fri Nov 21 23:52:21 2008 @@ -1287,13 +1287,14 @@ if (PyErr_ExceptionMatches(PyExc_UnicodeError)){ PyObject *type, *value, *tback, *errstr; PyErr_Fetch(&type, &value, &tback); - errstr = ((PyUnicodeErrorObject *)value)->reason; + errstr = PyObject_Str(value); if (errstr) { char *s = ""; char buf[128]; s = PyString_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); + Py_DECREF(errstr); } else { ast_error(n, "(unicode error) unknown error"); } From buildbot at python.org Sat Nov 22 00:06:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 23:06:01 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20081121230602.22F291E4021@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/4298 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: 1 test failed: test_pickletools make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 00:21:45 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 23:21:45 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081121232145.3E62D1E4002@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/331 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: sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 00:29:08 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 21 Nov 2008 23:29:08 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081121232908.DA6CE1E4002@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/321 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 test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 01:05:04 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 00:05:04 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081122000505.4EEA31E4011@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/822 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: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Nov 22 02:59:15 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 22 Nov 2008 02:59:15 +0100 (CET) Subject: [Python-checkins] r67326 - in python/trunk: Lib/test/test_fileio.py Lib/test/test_io.py Misc/NEWS Modules/_fileio.c Message-ID: <20081122015915.E36251E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 22 02:59:15 2008 New Revision: 67326 Log: backport r67325: make FileIO.mode always contain 'b' Modified: python/trunk/Lib/test/test_fileio.py python/trunk/Lib/test/test_io.py python/trunk/Misc/NEWS python/trunk/Modules/_fileio.c Modified: python/trunk/Lib/test/test_fileio.py ============================================================================== --- python/trunk/Lib/test/test_fileio.py (original) +++ python/trunk/Lib/test/test_fileio.py Sat Nov 22 02:59:15 2008 @@ -50,7 +50,7 @@ # verify expected attributes exist f = self.f - self.assertEquals(f.mode, "w") + self.assertEquals(f.mode, "wb") self.assertEquals(f.closed, False) # verify the attributes are readonly @@ -160,7 +160,7 @@ def testModeStrings(self): # check invalid mode strings - for mode in ("", "aU", "wU+", "rb", "rt"): + for mode in ("", "aU", "wU+", "rw", "rt"): try: f = _fileio._FileIO(TESTFN, mode) except ValueError: Modified: python/trunk/Lib/test/test_io.py ============================================================================== --- python/trunk/Lib/test/test_io.py (original) +++ python/trunk/Lib/test/test_io.py Sat Nov 22 02:59:15 2008 @@ -1266,7 +1266,7 @@ def test_attributes(self): f = io.open(test_support.TESTFN, "wb", buffering=0) - self.assertEquals(f.mode, "w") + self.assertEquals(f.mode, "wb") f.close() f = io.open(test_support.TESTFN, "U") @@ -1274,18 +1274,18 @@ self.assertEquals(f.buffer.name, test_support.TESTFN) self.assertEquals(f.buffer.raw.name, test_support.TESTFN) self.assertEquals(f.mode, "U") - self.assertEquals(f.buffer.mode, "r") - self.assertEquals(f.buffer.raw.mode, "r") + self.assertEquals(f.buffer.mode, "rb") + self.assertEquals(f.buffer.raw.mode, "rb") f.close() f = io.open(test_support.TESTFN, "w+") self.assertEquals(f.mode, "w+") - self.assertEquals(f.buffer.mode, "r+") # Does it really matter? - self.assertEquals(f.buffer.raw.mode, "r+") + self.assertEquals(f.buffer.mode, "rb+") # Does it really matter? + self.assertEquals(f.buffer.raw.mode, "rb+") g = io.open(f.fileno(), "wb", closefd=False) - self.assertEquals(g.mode, "w") - self.assertEquals(g.raw.mode, "w") + self.assertEquals(g.mode, "wb") + self.assertEquals(g.raw.mode, "wb") self.assertEquals(g.name, f.fileno()) self.assertEquals(g.raw.name, f.fileno()) f.close() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Nov 22 02:59:15 2008 @@ -56,6 +56,8 @@ - Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if the ctypes module is not present. +- FileIO's mode attribute now always includes ``"b"``. + - Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. - httplib.HTTPConnection.putheader() now accepts an arbitrary number of values Modified: python/trunk/Modules/_fileio.c ============================================================================== --- python/trunk/Modules/_fileio.c (original) +++ python/trunk/Modules/_fileio.c Sat Nov 22 02:59:15 2008 @@ -208,6 +208,8 @@ flags |= O_CREAT; append = 1; break; + case 'b': + break; case '+': if (plus) goto bad_mode; @@ -682,12 +684,12 @@ { if (self->readable) { if (self->writable) - return "r+"; + return "rb+"; else - return "r"; + return "rb"; } else - return "w"; + return "wb"; } static PyObject * From buildbot at python.org Sat Nov 22 03:50:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 02:50:49 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081122025049.8FDE51E4002@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/1076 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 04:25:11 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 03:25:11 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081122032511.6B3891E4002@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/2094 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: Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/threading.py", line 522, in __bootstrap_inner self.run() File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/bsddb/test/test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/pybot/buildarea/trunk.klose-debian-ppc/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30994, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_bsddb3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Nov 22 09:34:15 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 22 Nov 2008 09:34:15 +0100 (CET) Subject: [Python-checkins] r67330 - python/trunk/Doc/library/multiprocessing.rst Message-ID: <20081122083415.1EFCD1E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 22 09:34:14 2008 New Revision: 67330 Log: #4364: fix attribute name on ctypes object. 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 Nov 22 09:34:14 2008 @@ -874,7 +874,7 @@ Note that *lock* is a keyword only argument. - Note that an array of :data:`ctypes.c_char` has *value* and *rawvalue* + Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes which allow one to use it to store and retrieve strings. @@ -923,7 +923,7 @@ :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`` + Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` attributes which allow one to use it to store and retrieve strings -- see documentation for :mod:`ctypes`. From buildbot at python.org Sat Nov 22 09:40:10 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 08:40:10 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081122084010.53D111E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/432 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi 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 Sat Nov 22 09:45:34 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 22 Nov 2008 09:45:34 +0100 (CET) Subject: [Python-checkins] r67332 - python/trunk/Lib/multiprocessing/pool.py Message-ID: <20081122084534.2000E1E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 22 09:45:33 2008 New Revision: 67332 Log: Fix typo. Modified: python/trunk/Lib/multiprocessing/pool.py Modified: python/trunk/Lib/multiprocessing/pool.py ============================================================================== --- python/trunk/Lib/multiprocessing/pool.py (original) +++ python/trunk/Lib/multiprocessing/pool.py Sat Nov 22 09:45:33 2008 @@ -149,7 +149,7 @@ def imap(self, func, iterable, chunksize=1): ''' - Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` + Equivalent of `itertools.imap()` -- can be MUCH slower than `Pool.map()` ''' assert self._state == RUN if chunksize == 1: From buildbot at python.org Sat Nov 22 09:53:38 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 08:53:38 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081122085338.360B81E4002@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/1295 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_doctest make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 10:17:00 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 09:17:00 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20081122091700.7EFD21E4002@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/507 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: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-ubuntu-i386/build/Lib/bsddb/test/test_replication.py", line 134, in test01_basic_replication self.assertTrue(time.time() More important issues: ---------------------- Less important issues: ---------------------- From buildbot at python.org Sat Nov 22 10:35:13 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 09:35:13 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081122093513.70C081E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/434 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 10:35:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 09:35:30 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081122093530.3A7991E4002@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/323 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From nnorwitz at gmail.com Sat Nov 22 10:01:14 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:14 -0500 Subject: [Python-checkins] Python Regression Test Failures all () Message-ID: <20081122090114.GA22198@python.psfb.org> From nnorwitz at gmail.com Sat Nov 22 10:01:40 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:40 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081122090140.GA22345@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28421@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 10:01:40 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:40 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081122090140.GA22351@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28442@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 10:01:14 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:14 -0500 Subject: [Python-checkins] Python Regression Test Failures all () Message-ID: <20081122090114.GA22204@python.psfb.org> From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28435@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 10:01:39 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:39 -0500 Subject: [Python-checkins] Python Regression Test Failures all () Message-ID: <20081122090139.GA22223@python.psfb.org> From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28452@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 10:01:42 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:42 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081122090142.GA22555@python.psfb.org> svn update tools/sphinx At revision 67335. svn update tools/docutils svn: Working copy 'tools/docutils' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28462@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 10:01:40 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:40 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081122090139.GA22319@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From buildbot at python.org Sat Nov 22 10:46:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 09:46:02 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081122094602.EEDD41E401F@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/333 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: sincerely, -The Buildbot From nnorwitz at gmail.com Sat Nov 22 10:01:14 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:14 -0500 Subject: [Python-checkins] Python Regression Test Failures all () Message-ID: <20081122090114.GA22210@python.psfb.org> From nnorwitz at gmail.com Sat Nov 22 10:01:40 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:40 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081122090140.GA22384@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28413@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28457@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28447@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28426@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28431@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20081122062443.GA28408@python.psfb.org> More important issues: ---------------------- test_pydoc leaked [-21, 0, 0] references, sum=-21 Less important issues: ---------------------- test_asynchat leaked [117, -117, 0] references, sum=0 test_cmd_line leaked [25, 0, -50] references, sum=-25 test_file leaked [0, 0, 69] references, sum=69 test_smtplib leaked [88, -97, 9] references, sum=0 test_sys leaked [21, 0, -21] references, sum=0 test_urllib2_localnet leaked [3, 3, 285] references, sum=291 test_xmlrpc leaked [2, -6, 2] references, sum=-2 From nnorwitz at gmail.com Sat Nov 22 10:01:40 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 04:01:40 -0500 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20081122090140.GA22340@python.psfb.org> svn update tools/sphinx svn: Working copy 'tools/sphinx' locked svn: run 'svn cleanup' to remove locks (type 'svn help cleanup' for details) make: *** [update] Error 1 From nnorwitz at gmail.com Sat Nov 22 07:24:43 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sat, 22 Nov 2008 01:24:43 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081122062443.GA28419@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... make[1]: *** [build] Killed make[1]: Leaving directory `/home/neal/python/r26/Doc' make: *** [dist] Error 2 From python-checkins at python.org Sat Nov 22 11:08:51 2008 From: python-checkins at python.org (georg.brandl) Date: Sat, 22 Nov 2008 11:08:51 +0100 (CET) Subject: [Python-checkins] r67336 - python/trunk/Doc/howto/unicode.rst Message-ID: <20081122100851.257D01E4002@bag.python.org> Author: georg.brandl Date: Sat Nov 22 11:08:50 2008 New Revision: 67336 Log: Fix error about "-*-" being mandatory in coding cookies. Modified: python/trunk/Doc/howto/unicode.rst Modified: python/trunk/Doc/howto/unicode.rst ============================================================================== --- python/trunk/Doc/howto/unicode.rst (original) +++ python/trunk/Doc/howto/unicode.rst Sat Nov 22 11:08:50 2008 @@ -410,9 +410,9 @@ The syntax is inspired by Emacs's notation for specifying variables local to a file. Emacs supports many different variables, but Python only supports -'coding'. The ``-*-`` symbols indicate that the comment is special; within -them, you must supply the name ``coding`` and the name of your chosen encoding, -separated by ``':'``. +'coding'. The ``-*-`` symbols indicate to Emacs that the comment is special; +they have no significance to Python but are a convention. Python looks for +``coding: name`` or ``coding=name`` in the comment. If you don't include such a comment, the default encoding used will be ASCII. Versions of Python before 2.4 were Euro-centric and assumed Latin-1 as a default From buildbot at python.org Sat Nov 22 11:33:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 10:33:32 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081122103332.749CD1E4002@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/1298 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_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Nov 22 12:20:44 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 11:20:44 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: <20081122112044.C8FC61E4028@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/4300 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: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/fork_wait.py", line 29, in f self.alive[id] = os.getpid() AttributeError: 'NoneType' object has no attribute 'getpid' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/fork_wait.py", line 29, in f self.alive[id] = os.getpid() AttributeError: 'NoneType' object has no attribute 'getpid' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/fork_wait.py", line 29, in f self.alive[id] = os.getpid() AttributeError: 'NoneType' object has no attribute 'getpid' Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/fork_wait.py", line 29, in f self.alive[id] = os.getpid() AttributeError: 'NoneType' object has no attribute 'getpid' 1 test failed: test_wait4 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Nov 22 16:10:34 2008 From: python-checkins at python.org (guilherme.polo) Date: Sat, 22 Nov 2008 16:10:34 +0100 (CET) Subject: [Python-checkins] r67339 - sandbox/trunk/tkinter-polo/src/Tkinter.py Message-ID: <20081122151034.EBEEE1E4002@bag.python.org> Author: guilherme.polo Date: Sat Nov 22 16:10:34 2008 New Revision: 67339 Log: Added classes XScroll and YScroll for widgets that support scrolling Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Sat Nov 22 16:10:34 2008 @@ -1422,6 +1422,46 @@ self.widget._report_exception() +class XScroll(object): + """Methods supported by widgets that support x scrolling.""" + + def xview(self, *args): + """Query and change horizontal position of the view.""" + result = self.tk.call(self._w, 'xview', *args) + if not args: + return self._getdoubles(result) + + def xview_moveto(self, fraction): + """Adjusts the view in the window so that FRACTION of the + total width of the canvas is off-screen to the left.""" + self.tk.call(self._w, 'xview', 'moveto', fraction) + + def xview_scroll(self, number, what): + """Shift the x-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" + self.tk.call(self._w, 'xview', 'scroll', number, what) + + +class YScroll(object): + """Methods supported by widgets that support y scrolling.""" + + def yview(self, *args): + """Query and change vertical position of the view.""" + result = self.tk.call(self._w, 'yview', *args) + if not args: + return self._getdoubles(result) + + def yview_moveto(self, fraction): + """Adjusts the view in the window so that FRACTION of the + total height of the canvas is off-screen to the top.""" + self.tk.call(self._w, 'yview', 'moveto', fraction) + + def yview_scroll(self, number, what): + """Shift the y-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" + self.tk.call(self._w, 'yview', 'scroll', number, what) + + class Wm: """Provides functions for the communication with the window manager.""" @@ -2029,7 +2069,7 @@ return self.tk.call(self._w, 'invoke') -class Canvas(Widget): +class Canvas(Widget, XScroll, YScroll): """Canvas widget to display graphical elements like lines or text.""" def __init__(self, master=None, cnf={}, **kw): """Construct a canvas widget with the parent MASTER. @@ -2270,32 +2310,6 @@ def type(self, tagOrId): """Return the type of the item TAGORID.""" return self.tk.call(self._w, 'type', tagOrId) or None - def xview(self, *args): - """Query and change horizontal position of the view.""" - if not args: - return self._getdoubles(self.tk.call(self._w, 'xview')) - self.tk.call((self._w, 'xview') + args) - def xview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total width of the canvas is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" - or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) - def yview(self, *args): - """Query and change vertical position of the view.""" - if not args: - return self._getdoubles(self.tk.call(self._w, 'yview')) - self.tk.call((self._w, 'yview') + args) - def yview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total height of the canvas is off-screen to the top.""" - self.tk.call(self._w, 'yview', 'moveto', fraction) - def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured in "units" - or "pages" (WHAT).""" - self.tk.call(self._w, 'yview', 'scroll', number, what) class Checkbutton(Widget): """Checkbutton widget which is either in on- or off-state.""" @@ -2326,7 +2340,7 @@ """Toggle the button.""" self.tk.call(self._w, 'toggle') -class Entry(Widget): +class Entry(Widget, XScroll): """Entry widget which allows to display simple text.""" def __init__(self, master=None, cnf={}, **kw): """Construct an entry widget with the parent MASTER. @@ -2389,17 +2403,6 @@ """Set the variable end of a selection to INDEX.""" self.tk.call(self._w, 'selection', 'to', index) select_to = selection_to - def xview(self, index): - """Query and change horizontal position of the view.""" - self.tk.call(self._w, 'xview', index) - def xview_moveto(self, fraction): - """Adjust the view in the window so that FRACTION of the - total width of the entry is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" - or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) class Frame(Widget): """Frame widget which may contain other widgets and can have a 3D @@ -2443,7 +2446,7 @@ """ Widget.__init__(self, master, 'label', cnf, kw) -class Listbox(Widget): +class Listbox(Widget, XScroll, YScroll): """Listbox widget which can display a list of strings.""" def __init__(self, master=None, cnf={}, **kw): """Construct a listbox widget with the parent MASTER. @@ -2522,32 +2525,6 @@ def size(self): """Return the number of elements in the listbox.""" return getint(self.tk.call(self._w, 'size')) - def xview(self, *what): - """Query and change horizontal position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'xview')) - self.tk.call((self._w, 'xview') + what) - def xview_moveto(self, fraction): - """Adjust the view in the window so that FRACTION of the - total width of the entry is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured in "units" - or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) - def yview(self, *what): - """Query and change vertical position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'yview')) - self.tk.call((self._w, 'yview') + what) - def yview_moveto(self, fraction): - """Adjust the view in the window so that FRACTION of the - total width of the entry is off-screen to the top.""" - self.tk.call(self._w, 'yview', 'moveto', fraction) - def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured in "units" - or "pages" (WHAT).""" - self.tk.call(self._w, 'yview', 'scroll', number, what) def itemcget(self, index, option): """Return the resource value for an ITEM and an OPTION.""" return self.tk.call( @@ -2775,7 +2752,7 @@ -class Text(Widget): +class Text(Widget, XScroll, YScroll): """Text widget which can display text in various forms.""" def __init__(self, master=None, cnf={}, **kw): """Construct a text widget with the parent MASTER. @@ -3091,32 +3068,6 @@ """Return all names of embedded windows in this widget.""" return self.tk.splitlist( self.tk.call(self._w, 'window', 'names')) - def xview(self, *what): - """Query and change horizontal position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'xview')) - self.tk.call((self._w, 'xview') + what) - def xview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total width of the canvas is off-screen to the left.""" - self.tk.call(self._w, 'xview', 'moveto', fraction) - def xview_scroll(self, number, what): - """Shift the x-view according to NUMBER which is measured - in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'xview', 'scroll', number, what) - def yview(self, *what): - """Query and change vertical position of the view.""" - if not what: - return self._getdoubles(self.tk.call(self._w, 'yview')) - self.tk.call((self._w, 'yview') + what) - def yview_moveto(self, fraction): - """Adjusts the view in the window so that FRACTION of the - total height of the canvas is off-screen to the top.""" - self.tk.call(self._w, 'yview', 'moveto', fraction) - def yview_scroll(self, number, what): - """Shift the y-view according to NUMBER which is measured - in "units" or "pages" (WHAT).""" - self.tk.call(self._w, 'yview', 'scroll', number, what) def yview_pickplace(self, *what): """Obsolete function, use see.""" self.tk.call((self._w, 'yview', '-pickplace') + what) @@ -3300,7 +3251,7 @@ def image_types(): return setup_master().tk.call('image', 'types') -class Spinbox(Widget): +class Spinbox(Widget, XScroll): """spinbox widget.""" def __init__(self, master=None, cnf={}, **kw): """Construct a spinbox widget with the parent MASTER. From buildbot at python.org Sat Nov 22 19:53:55 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 18:53:55 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081122185356.661B51E4002@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/1300 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_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Nov 22 20:39:39 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 22 Nov 2008 20:39:39 +0100 (CET) Subject: [Python-checkins] r67342 - in python/trunk: PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/pythoncore.vcproj PC/os2vacpp/makefile PC/os2vacpp/makefile.omk PCbuild/pythoncore.vcproj Message-ID: <20081122193939.2BA921E401C@bag.python.org> Author: amaury.forgeotdarc Date: Sat Nov 22 20:39:38 2008 New Revision: 67342 Log: yuvconvert.c is a part of the "sv" module, an old IRIX thing and certainly not useful for any Windows build. Modified: python/trunk/PC/VC6/pythoncore.dsp python/trunk/PC/VS7.1/pythoncore.vcproj python/trunk/PC/VS8.0/pythoncore.vcproj python/trunk/PC/os2vacpp/makefile python/trunk/PC/os2vacpp/makefile.omk python/trunk/PCbuild/pythoncore.vcproj Modified: python/trunk/PC/VC6/pythoncore.dsp ============================================================================== --- python/trunk/PC/VC6/pythoncore.dsp (original) +++ python/trunk/PC/VC6/pythoncore.dsp Sat Nov 22 20:39:38 2008 @@ -747,10 +747,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\yuvconvert.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\zipimport.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 Sat Nov 22 20:39:38 2008 @@ -821,9 +821,6 @@ RelativePath="..\..\Modules\xxsubtype.c"> - - Modified: python/trunk/PC/VS8.0/pythoncore.vcproj ============================================================================== --- python/trunk/PC/VS8.0/pythoncore.vcproj (original) +++ python/trunk/PC/VS8.0/pythoncore.vcproj Sat Nov 22 20:39:38 2008 @@ -1171,14 +1171,6 @@ > - - - - Modified: python/trunk/PC/os2vacpp/makefile ============================================================================== --- python/trunk/PC/os2vacpp/makefile (original) +++ python/trunk/PC/os2vacpp/makefile Sat Nov 22 20:39:38 2008 @@ -203,8 +203,7 @@ $(PATHOBJ)\StropModule.obj \ $(PATHOBJ)\StructModule.obj \ $(PATHOBJ)\TimeModule.obj \ - $(PATHOBJ)\ThreadModule.obj \ - $(PATHOBJ)\YUVConvert.obj + $(PATHOBJ)\ThreadModule.obj # Standalone Parser Generator Program (Shares Some of Python's Modules) PGEN = \ @@ -1113,8 +1112,7 @@ $(PY_INCLUDE)\pyerrors.h $(PY_INCLUDE)\pyfpe.h $(PY_INCLUDE)\pystate.h \ $(PY_INCLUDE)\python.h $(PY_INCLUDE)\pythonrun.h $(PY_INCLUDE)\rangeobject.h \ $(PY_INCLUDE)\sliceobject.h $(PY_INCLUDE)\stringobject.h \ - $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h \ - $(PY_MODULES)\yuv.h + $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h syslogmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \ $(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \ @@ -1198,8 +1196,6 @@ $(PY_INCLUDE)\sliceobject.h $(PY_INCLUDE)\stringobject.h \ $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h -yuvconvert.obj: $(PY_MODULES)\yuv.h - zlibmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h $(PY_INCLUDE)\classobject.h \ $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h pyconfig.h \ $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h $(PY_INCLUDE)\floatobject.h \ Modified: python/trunk/PC/os2vacpp/makefile.omk ============================================================================== --- python/trunk/PC/os2vacpp/makefile.omk (original) +++ python/trunk/PC/os2vacpp/makefile.omk Sat Nov 22 20:39:38 2008 @@ -164,8 +164,7 @@ StropModule.obj \ StructModule.obj \ TimeModule.obj \ - ThreadModule.obj \ - YUVConvert.obj + ThreadModule.obj # Omitted Modules (and Description/Reason): # @@ -803,8 +802,7 @@ intrcheck.h listobject.h longobject.h methodobject.h modsupport.h \ moduleobject.h mymalloc.h myproto.h object.h objimpl.h pydebug.h \ pyerrors.h pyfpe.h pystate.h python.h pythonrun.h rangeobject.h \ - sliceobject.h stringobject.h sysmodule.h traceback.h tupleobject.h \ - yuv.h + sliceobject.h stringobject.h sysmodule.h traceback.h tupleobject.h syslogmodule.obj: abstract.h ceval.h classobject.h cobject.h \ complexobject.h pyconfig.h dictobject.h fileobject.h floatobject.h \ @@ -854,8 +852,6 @@ pythonrun.h rangeobject.h sliceobject.h stringobject.h sysmodule.h \ traceback.h tupleobject.h -yuvconvert.obj: yuv.h - zlibmodule.obj: abstract.h ceval.h classobject.h cobject.h complexobject.h \ pyconfig.h dictobject.h fileobject.h floatobject.h funcobject.h \ import.h intobject.h intrcheck.h listobject.h longobject.h \ Modified: python/trunk/PCbuild/pythoncore.vcproj ============================================================================== --- python/trunk/PCbuild/pythoncore.vcproj (original) +++ python/trunk/PCbuild/pythoncore.vcproj Sat Nov 22 20:39:38 2008 @@ -1171,14 +1171,6 @@ > - - - - From python-checkins at python.org Sat Nov 22 21:01:18 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 22 Nov 2008 21:01:18 +0100 (CET) Subject: [Python-checkins] r67343 - in python/trunk: Misc/NEWS Python/pythonrun.c Message-ID: <20081122200118.4224F1E4002@bag.python.org> Author: amaury.forgeotdarc Date: Sat Nov 22 21:01:18 2008 New Revision: 67343 Log: #3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from stack overflow. But doing this, it always crashes when the stack is nearly full. Reviewed by Martin von Loewis. Will backport to 2.6. Modified: python/trunk/Misc/NEWS python/trunk/Python/pythonrun.c Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Nov 22 21:01:18 2008 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #3996: On Windows, the PyOS_CheckStack function would cause the + interpreter to abort ("Fatal Python error: Could not reset the stack!") + instead of throwing a MemoryError. + - Issue #4367: Python would segfault during compiling when the unicodedata module couldn't be imported and \N escapes were present. Modified: python/trunk/Python/pythonrun.c ============================================================================== --- python/trunk/Python/pythonrun.c (original) +++ python/trunk/Python/pythonrun.c Sat Nov 22 21:01:18 2008 @@ -1755,7 +1755,7 @@ EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { int errcode = _resetstkoflw(); - if (errcode) + if (errcode == 0) { Py_FatalError("Could not reset the stack!"); } From python-checkins at python.org Sat Nov 22 21:06:52 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 22 Nov 2008 21:06:52 +0100 (CET) Subject: [Python-checkins] r67344 - in python/branches/release26-maint: Misc/NEWS Python/pythonrun.c Message-ID: <20081122200652.4D6801E4002@bag.python.org> Author: amaury.forgeotdarc Date: Sat Nov 22 21:06:51 2008 New Revision: 67344 Log: Merged revisions 67343 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67343 | amaury.forgeotdarc | 2008-11-22 21:01:18 +0100 (sam., 22 nov. 2008) | 5 lines #3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from stack overflow. But doing this, it always crashes when the stack is nearly full. Reviewed by Martin von Loewis. Will backport to 2.6. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Python/pythonrun.c Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Sat Nov 22 21:06:51 2008 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #3996: On Windows, the PyOS_CheckStack function would cause the + interpreter to abort ("Fatal Python error: Could not reset the stack!") + instead of throwing a MemoryError. + - Issue #4367: Python would segfault during compiling when the unicodedata module couldn't be imported and \N escapes were present. Modified: python/branches/release26-maint/Python/pythonrun.c ============================================================================== --- python/branches/release26-maint/Python/pythonrun.c (original) +++ python/branches/release26-maint/Python/pythonrun.c Sat Nov 22 21:06:51 2008 @@ -1755,7 +1755,7 @@ EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { int errcode = _resetstkoflw(); - if (errcode) + if (errcode == 0) { Py_FatalError("Could not reset the stack!"); } From buildbot at python.org Sat Nov 22 21:30:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 22 Nov 2008 20:30:30 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081122203031.17D7B1E4035@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/1078 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,georg.brandl 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 "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Unknown error') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() 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/4302 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From contact at nstnetwork.com Sun Nov 23 01:56:04 2008 From: contact at nstnetwork.com (contact at nstnetwork.com) Date: Sun, 23 Nov 2008 08:56:04 +0800 Subject: [Python-checkins] Sell Cisco Systems equipment items Message-ID: <20081123010610.9FAD71A8369@Linux-Mail.com> Hello, We are professional development, manufacture and marketing of optical transceivers,cards,cables. We have the following item for sale today. If you have interested in some items,please tell me. CWDB-SFP-1G-1510nm-32dB CWDB-SFP-1G-1570nm-32dB CWDM-SFP-1470nm-1.25G-80km CWDM-SFP-1490nm-1.25G-80km CWDM-SFP-1G-1570nm-38db CWDM-SFP-2.5G-1530nm-34db CWDM-SFP-2.5G-1550nm-34db DWDM-SFP-1550.92nm DWDM-SFP-1552.52nm Thanks Helen.Zhou Newstar networking technology www.nstnetwork.com Email/MSN: helen at nstnetwork.com AOL helenxuezhou From python-checkins at python.org Sun Nov 23 03:09:41 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 23 Nov 2008 03:09:41 +0100 (CET) Subject: [Python-checkins] r67348 - python/trunk/Lib/optparse.py Message-ID: <20081123020941.787521E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 23 03:09:41 2008 New Revision: 67348 Log: raise a better error Modified: python/trunk/Lib/optparse.py Modified: python/trunk/Lib/optparse.py ============================================================================== --- python/trunk/Lib/optparse.py (original) +++ python/trunk/Lib/optparse.py Sun Nov 23 03:09:41 2008 @@ -799,7 +799,7 @@ parser.print_version() parser.exit() else: - raise RuntimeError, "unknown action %r" % self.action + raise ValueError("unknown action %r" % self.action) return 1 From buildbot at python.org Sun Nov 23 04:00:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 23 Nov 2008 03:00:42 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081123030042.DEB7F1E4002@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/1080 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Sun Nov 23 04:04:09 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 23 Nov 2008 03:04:09 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081123030409.86BFA1E4002@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/336 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: sincerely, -The Buildbot From nnorwitz at gmail.com Sun Nov 23 07:29:00 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Sun, 23 Nov 2008 01:29:00 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081123062900.GA29955@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) Underfull \hbox (badness 10000) in paragraph at lines 158--159 [3] [4] [5] [6] [7] [8] (/usr/share/texmf/tex/latex/psnfss/ts1ptm.fd) [9] [10] Chapter 2. [11] [12] [13] [14] Chapter 3. [15] [16] Chapter 4. [17] Overfull \hbox (14.2714pt too wide) in paragraph at lines 1304--1304 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 1304--1305 [][] [18] [19] [20] [21] [22] Chapter 5. [23] [24] [25] [26] [27] Underfull \hbox (badness 5359) in paragraph at lines 2168--2177 /ptmr8t/Return a Python ob-ject from the data stream in a /pcrr8t/FILE* /ptmr8t /opened for read-ing. Un-like [28] Underfull \hbox (badness 10000) in paragraph at lines 2257--2260 [] Underfull \hbox (badness 10000) in paragraph at lines 2275--2278 [] Overfull \hbox (79.5372pt too wide) in paragraph at lines 2280--2283 [] Underfull \hbox (badness 10000) in paragraph at lines 2311--2314 [] [29] [30] [31] Underfull \hbox (badness 6125) in paragraph at lines 2560--2562 []/ptmr8t/The call to [][]/pcrr8t/PyArg_UnpackTuple[][] /ptmr8t/in this ex-am-p le is en-tirely equiv-a-lent to this call to [32] [33] [34] [35] [36] Chapter 6. [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 7. Underfull \hbox (badness 10000) in paragraph at lines 3827--3828 [49] [50] [51] [52] [53] [54] [55] Overfull \hbox (14.2714pt too wide) in paragraph at lines 4686--4686 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 4686--4687 [][] [56] [57] [58] [59] Underfull \hbox (badness 8113) in paragraph at lines 5050--5053 /ptmr8t/Shortcut for /pcrr8t/PyUnicode_FromEncodedObject(obj, NULL, "strict") / ptmr8t/which is used [60] [61] [62] [63] [64] [65] [66] Underfull \hbox (badness 10000) in paragraph at lines 5649--5654 /ptmr8t/This con-stant may be passed as the /ptmri8t/size /ptmr8t/pa-ram-e-ter to [][]/pcrr8t/PyBuffer_FromObject[][] /ptmr8t/or [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] Overfull \hbox (44.0pt too wide) in paragraph at lines 6572--6573 [] [77] [78] [79] [80] Underfull \hbox (badness 10000) in paragraph at lines 6954--6956 /ptmr8t/Return true if /ptmri8t/ob /ptmr8t/is of type /pcrr8t/PyDateTime_DateTi meType /ptmr8t/or a sub-type of [81] Underfull \hbox (badness 5548) in paragraph at lines 7113--7125 [][]/pcrr8t/PyObject_CallMethod[][]/ptmr8t/, [][]/pcrr8t/PyObject_RichCompareBo ol[][]/ptmr8t/, [][]/pcrr8t/PyObject_Hash[][]/ptmr8t/, [][]/pcrr8t/PyObject_Rep r[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7113--7125 /ptmr8t/to-col (in-clud-ing [][]/pcrr8t/PyNumber_And[][]/ptmr8t/, [][]/pcrr8t/P yNumber_Subtract[][]/ptmr8t/, [][]/pcrr8t/PyNumber_Or[][]/ptmr8t/, [][]/pcrr8t/ PyNumber_Xor[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7113--7125 [][]/pcrr8t/PyNumber_InPlaceAnd[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceSubtra ct[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceOr[][]/ptmr8t/, and [82] [83] [84] Chapter 8. [85] [86] Underfull \hbox (badness 10000) in paragraph at lines 7514--7518 []/pcrr8t/'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam' []/pt mr8t/The re- [87] [88] [89] [90] Underfull \hbox (badness 10000) in paragraph at lines 7815--7818 /ptmr8t/This macro ex-pands to /pcrr8t/PyEval_RestoreThread(_save);/ptmr8t/: it is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 7822--7825 /ptmr8t/This macro ex-pands to /pcrr8t/_save = PyEval_SaveThread();/ptmr8t/: it is equiv-a-lent to [91] [92] [93] [94] Chapter 9. [95] [96] [97] [98] Chapter 10. Underfull \hbox (badness 10000) in paragraph at lines 8399--8399 Underfull \hbox (badness 10000) in paragraph at lines 8402--8402 [99] [100] [101] [102] [103] [104] [105] Underfull \hbox (badness 10000) in paragraph at lines 9002--9012 []/ptmr8t/The print func-tion is called with the same sig-na-ture as [][]/pcrr8 t/PyObject_Print[][]/ptmr8t/: /pcrr8t/int [106] [107] Underfull \hbox (badness 10000) in paragraph at lines 9250--9261 /ptmr8t/the fields /pcrr8t/nb_inplace_add/ptmr8t/, /pcrr8t/nb_inplace_subtract/ ptmr8t/, /pcrr8t/nb_inplace_multiply/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9250--9261 /pcrr8t/nb_inplace_divide/ptmr8t/, /pcrr8t/nb_inplace_remainder/ptmr8t/, /pcrr8 t/nb_inplace_power/ptmr8t/, Underfull \hbox (badness 5637) in paragraph at lines 9297--9303 /ptmr8t/If this bit is set, the type ob-ject has sev-eral new fields de-fined s tart-ing in Python [108] Underfull \hbox (badness 6300) in paragraph at lines 9348--9354 /ptmr8t/This is a bit-mask of all the bits that per-tain to the ex-is-tence of cer-tain fields in Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 /ptmr8t/the type ob-ject and its ex-ten-sion struc-tures. Cur-rently, it in-clu des the fol-low-ing Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 /ptmr8t/bits: [][]/pcrr8t/Py_TPFLAGS_HAVE_GETCHARBUFFER[][]/ptmr8t/, [][]/pcrr8 t/Py_TPFLAGS_HAVE_SEQUENCE_IN[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 [][]/pcrr8t/Py_TPFLAGS_HAVE_INPLACEOPS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE _RICHCOMPARE[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9348--9354 [][]/pcrr8t/Py_TPFLAGS_HAVE_WEAKREFS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE_I TER[][]/ptmr8t/, and [109] Underfull \hbox (badness 10000) in paragraph at lines 9472--9474 /ptmr8t/An op-tional pointer to the rich com-par-i-son func-tion, whose sig-na- ture is /pcrr8t/PyObject [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] Appendix A. [121] [122] [123] [124] [125] [126] Appendix B. ! Package inputenc Error: Unicode char \u8:^^c3^^ba not set up for use with LaT eX. See the inputenc package documentation for explanation. Type H for immediate help. ... l.11005 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ? ! Emergency stop. ... l.11005 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Sun Nov 23 14:37:04 2008 From: python-checkins at python.org (matthias.klose) Date: Sun, 23 Nov 2008 14:37:04 +0100 (CET) Subject: [Python-checkins] r67349 - python/trunk/Modules/Setup.dist Message-ID: <20081123133704.209B81E4002@bag.python.org> Author: matthias.klose Date: Sun Nov 23 14:37:03 2008 New Revision: 67349 Log: - Modules/Setup.dist: Mention _functools in section "Modules that should always be present (non UNIX dependent)" Modified: python/trunk/Modules/Setup.dist Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Sun Nov 23 14:37:03 2008 @@ -179,6 +179,7 @@ #_collections _collectionsmodule.c # Container types #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations +#_functools functoolsmodule.c # Tools for working with functions and callable objects #unicodedata unicodedata.c # static Unicode character database From python-checkins at python.org Sun Nov 23 14:42:56 2008 From: python-checkins at python.org (matthias.klose) Date: Sun, 23 Nov 2008 14:42:56 +0100 (CET) Subject: [Python-checkins] r67351 - python/branches/release26-maint/Modules/Setup.dist Message-ID: <20081123134256.9D59C1E4002@bag.python.org> Author: matthias.klose Date: Sun Nov 23 14:42:55 2008 New Revision: 67351 Log: Merge 67349 from the trunk: - Modules/Setup.dist: Mention _functools in section "Modules that should always be present (non UNIX dependent)" Modified: python/branches/release26-maint/Modules/Setup.dist Modified: python/branches/release26-maint/Modules/Setup.dist ============================================================================== --- python/branches/release26-maint/Modules/Setup.dist (original) +++ python/branches/release26-maint/Modules/Setup.dist Sun Nov 23 14:42:55 2008 @@ -179,6 +179,7 @@ #_collections _collectionsmodule.c # Container types #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations +#_functools functoolsmodule.c # Tools for working with functions and callable objects #unicodedata unicodedata.c # static Unicode character database From python-checkins at python.org Sun Nov 23 14:53:05 2008 From: python-checkins at python.org (matthias.klose) Date: Sun, 23 Nov 2008 14:53:05 +0100 (CET) Subject: [Python-checkins] r67352 - python/branches/release26-maint/Modules/Setup.dist Message-ID: <20081123135305.D03591E4002@bag.python.org> Author: matthias.klose Date: Sun Nov 23 14:53:03 2008 New Revision: 67352 Log: - Fix typo in last checkin Modified: python/branches/release26-maint/Modules/Setup.dist Modified: python/branches/release26-maint/Modules/Setup.dist ============================================================================== --- python/branches/release26-maint/Modules/Setup.dist (original) +++ python/branches/release26-maint/Modules/Setup.dist Sun Nov 23 14:53:03 2008 @@ -179,7 +179,7 @@ #_collections _collectionsmodule.c # Container types #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations -#_functools functoolsmodule.c # Tools for working with functions and callable objects +#_functools _functoolsmodule.c # Tools for working with functions and callable objects #unicodedata unicodedata.c # static Unicode character database From python-checkins at python.org Sun Nov 23 14:54:42 2008 From: python-checkins at python.org (matthias.klose) Date: Sun, 23 Nov 2008 14:54:42 +0100 (CET) Subject: [Python-checkins] r67353 - python/trunk/Modules/Setup.dist Message-ID: <20081123135442.5A5781E4002@bag.python.org> Author: matthias.klose Date: Sun Nov 23 14:54:42 2008 New Revision: 67353 Log: - Fix typo in last checkin Modified: python/trunk/Modules/Setup.dist Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Sun Nov 23 14:54:42 2008 @@ -179,7 +179,7 @@ #_collections _collectionsmodule.c # Container types #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations -#_functools functoolsmodule.c # Tools for working with functions and callable objects +#_functools _functoolsmodule.c # Tools for working with functions and callable objects #unicodedata unicodedata.c # static Unicode character database From buildbot at python.org Sun Nov 23 15:21:58 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 23 Nov 2008 14:21:58 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081123142159.8D2621E4002@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/2099 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: matthias.klose 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 Sun Nov 23 16:14:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 23 Nov 2008 15:14:53 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081123151453.EE9B91E4002@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/328 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From python-checkins at python.org Sun Nov 23 20:17:25 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 23 Nov 2008 20:17:25 +0100 (CET) Subject: [Python-checkins] r67355 - python/trunk/Doc/library/collections.rst Message-ID: <20081123191725.B9B671E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 23 20:17:25 2008 New Revision: 67355 Log: #4392: fix parameter name. 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 Sun Nov 23 20:17:25 2008 @@ -487,16 +487,16 @@ self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index. -.. function:: namedtuple(typename, fieldnames, [verbose]) +.. function:: namedtuple(typename, field_names, [verbose]) Returns a new tuple subclass named *typename*. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as well as being indexable and iterable. Instances of the subclass also have a - helpful docstring (with typename and fieldnames) and a helpful :meth:`__repr__` + helpful docstring (with typename and field_names) and a helpful :meth:`__repr__` method which lists the tuple contents in a ``name=value`` format. - The *fieldnames* are a single string with each fieldname separated by whitespace - and/or commas, for example ``'x y'`` or ``'x, y'``. Alternatively, *fieldnames* + The *field_names* are a single string with each fieldname separated by whitespace + and/or commas, for example ``'x y'`` or ``'x, y'``. Alternatively, *field_names* can be a sequence of strings such as ``['x', 'y']``. Any valid Python identifier may be used for a fieldname except for names From python-checkins at python.org Sun Nov 23 22:04:36 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 23 Nov 2008 22:04:36 +0100 (CET) Subject: [Python-checkins] r67356 - peps/trunk/pep-0000.txt Message-ID: <20081123210436.20E351E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 23 22:04:35 2008 New Revision: 67356 Log: Move DVCS PEP to better location. Hey, nice symmetry between the two VCS PEP numbers :) Modified: peps/trunk/pep-0000.txt Modified: peps/trunk/pep-0000.txt ============================================================================== --- peps/trunk/pep-0000.txt (original) +++ peps/trunk/pep-0000.txt Sun Nov 23 22:04:35 2008 @@ -39,6 +39,7 @@ P 11 Removing support for little used platforms von Loewis P 12 Sample reStructuredText PEP Template Goodger, Warsaw P 347 Migrating the Python CVS to Subversion von L?wis + P 374 Migrating from svn to a distributed VCS Cannon P 3000 Python 3000 GvR P 3001 Reviewing and improving stdlib modules Brandl P 3002 Procedure for Backwards-Incompatible Changes Bethard @@ -100,7 +101,6 @@ S 368 Standard image protocol and class Mastrodomenico S 369 Post import hooks Heimes S 372 Adding an ordered dictionary to collections Ronacher - P 374 Migrating from svn to a distributed VCS Cannon S 3135 New Super Spealman, Delaney Finished PEPs (done, implemented in Subversion) From python-checkins at python.org Sun Nov 23 22:35:48 2008 From: python-checkins at python.org (guilherme.polo) Date: Sun, 23 Nov 2008 22:35:48 +0100 (CET) Subject: [Python-checkins] r67357 - in sandbox/trunk/tkinter-polo/src: Tkinter.py _tkinter.c Message-ID: <20081123213548.66DE31E4017@bag.python.org> Author: guilherme.polo Date: Sun Nov 23 22:35:48 2008 New Revision: 67357 Log: * Documented _flatten in _tkinter.c; * Removed _flatten implementation from Tkinter since _tkinter must be available in order to Tkinter work; * Removed check for _tkinter._cnfmerge which always fails given current _tkinter * Removed the methods image_name and image_types from Misc, they are already present in Tkinter.py global namespace Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py sandbox/trunk/tkinter-polo/src/_tkinter.c Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py ============================================================================== --- sandbox/trunk/tkinter-polo/src/Tkinter.py (original) +++ sandbox/trunk/tkinter-polo/src/Tkinter.py Sun Nov 23 22:35:48 2008 @@ -46,18 +46,7 @@ except AttributeError: _tkinter.deletefilehandler = None -def _flatten(nested): - """Internal function.""" - res = () - for item in nested: - if isinstance(item, (tuple, list)): - res = res + _flatten(item) - elif item is not None: - res = res + (item, ) - return res - -try: _flatten = _tkinter._flatten -except AttributeError: pass +_flatten = _tkinter._flatten def _cnfmerge(cnfs): """Internal function.""" @@ -76,8 +65,6 @@ cnf[k] = v return cnf -try: _cnfmerge = _tkinter._cnfmerge -except AttributeError: pass class Event: """Container for the properties of an event. @@ -1391,16 +1378,6 @@ return self.tk.splitlist( self.tk.call('event', 'info', virtual)) - # Image related commands - - def image_names(self): - """Return a list of all existing image names.""" - return self.tk.call('image', 'names') - - def image_types(self): - """Return a list of all available image types (e.g. phote bitmap).""" - return self.tk.call('image', 'types') - class CallWrapper: """Internal class. Stores function to call when some user Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c ============================================================================== --- sandbox/trunk/tkinter-polo/src/_tkinter.c (original) +++ sandbox/trunk/tkinter-polo/src/_tkinter.c Sun Nov 23 22:35:48 2008 @@ -2921,6 +2921,10 @@ return context.tuple; } +PyDoc_STRVAR(_flatten_doc, "_flatten(nested) -> flattened tuple\n\n" +"Flatten a nest of tuples and lists."); + + static PyObject * Tkinter_Create(PyObject *self, PyObject *args) { @@ -2989,7 +2993,7 @@ static PyMethodDef moduleMethods[] = { - {"_flatten", Tkinter_Flatten, METH_VARARGS}, + {"_flatten", Tkinter_Flatten, METH_VARARGS, _flatten_doc}, {"create", Tkinter_Create, METH_VARARGS}, {"dooneevent", Tkapp_DoOneEvent, METH_VARARGS}, {"quit", Tkapp_Quit, METH_VARARGS}, From python-checkins at python.org Sun Nov 23 22:40:35 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 23 Nov 2008 22:40:35 +0100 (CET) Subject: [Python-checkins] r67358 - tracker/instances/python-dev/detectors/cia.py Message-ID: <20081123214035.6B50E1E4002@bag.python.org> Author: martin.v.loewis Date: Sun Nov 23 22:40:35 2008 New Revision: 67358 Log: Add notice to change the CIA parameters when recycling detector. Modified: tracker/instances/python-dev/detectors/cia.py Modified: tracker/instances/python-dev/detectors/cia.py ============================================================================== --- tracker/instances/python-dev/detectors/cia.py (original) +++ tracker/instances/python-dev/detectors/cia.py Sun Nov 23 22:40:35 2008 @@ -4,6 +4,7 @@ server = "http://CIA.vc" +# CHANGE THESE WHEN INTEGRATION THIS INTO YOUR TRACKER!!!! parameters = { 'name':'Roundup Reactor for CIA', 'revision': "$Revision$"[11:-2], From python-checkins at python.org Sun Nov 23 22:57:30 2008 From: python-checkins at python.org (georg.brandl) Date: Sun, 23 Nov 2008 22:57:30 +0100 (CET) Subject: [Python-checkins] r67359 - python/trunk/Doc/library/ctypes.rst Message-ID: <20081123215730.944051E4002@bag.python.org> Author: georg.brandl Date: Sun Nov 23 22:57:30 2008 New Revision: 67359 Log: #4399: fix typo. 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 Sun Nov 23 22:57:30 2008 @@ -1370,7 +1370,7 @@ All these classes can be instantiated by calling them with at least one argument, the pathname of the shared library. If you have an existing handle to -an already loaded shard library, it can be passed as the ``handle`` named +an already loaded shared library, it can be passed as the ``handle`` named parameter, otherwise the underlying platforms ``dlopen`` or :meth:`LoadLibrary` function is used to load the library into the process, and to get a handle to it. From g.brandl at gmx.net Sun Nov 23 23:10:06 2008 From: g.brandl at gmx.net (Georg Brandl) Date: Sun, 23 Nov 2008 23:10:06 +0100 Subject: [Python-checkins] r67358 - tracker/instances/python-dev/detectors/cia.py In-Reply-To: <20081123214035.6B50E1E4002@bag.python.org> References: <20081123214035.6B50E1E4002@bag.python.org> Message-ID: martin.v.loewis schrieb: > Author: martin.v.loewis > Date: Sun Nov 23 22:40:35 2008 > New Revision: 67358 > > Log: > Add notice to change the CIA parameters when recycling detector. > > > Modified: > tracker/instances/python-dev/detectors/cia.py > > Modified: tracker/instances/python-dev/detectors/cia.py > ============================================================================== > --- tracker/instances/python-dev/detectors/cia.py (original) > +++ tracker/instances/python-dev/detectors/cia.py Sun Nov 23 22:40:35 2008 > @@ -4,6 +4,7 @@ > > server = "http://CIA.vc" > > +# CHANGE THESE WHEN INTEGRATION THIS INTO YOUR TRACKER!!!! ITYM "INTEGRATING". 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 Nov 23 23:39:41 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 23 Nov 2008 23:39:41 +0100 (CET) Subject: [Python-checkins] r67360 - tracker/instances/python-dev/detectors/cia.py Message-ID: <20081123223941.A2EE81E4002@bag.python.org> Author: martin.v.loewis Date: Sun Nov 23 23:39:41 2008 New Revision: 67360 Log: Fix typo. Modified: tracker/instances/python-dev/detectors/cia.py Modified: tracker/instances/python-dev/detectors/cia.py ============================================================================== --- tracker/instances/python-dev/detectors/cia.py (original) +++ tracker/instances/python-dev/detectors/cia.py Sun Nov 23 23:39:41 2008 @@ -4,7 +4,7 @@ server = "http://CIA.vc" -# CHANGE THESE WHEN INTEGRATION THIS INTO YOUR TRACKER!!!! +# CHANGE THESE WHEN INTEGRATING THIS INTO YOUR TRACKER!!!! parameters = { 'name':'Roundup Reactor for CIA', 'revision': "$Revision$"[11:-2], From python-checkins at python.org Mon Nov 24 01:41:43 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 24 Nov 2008 01:41:43 +0100 (CET) Subject: [Python-checkins] r67362 - python/trunk/Doc/c-api/arg.rst Message-ID: <20081124004143.E68001E4002@bag.python.org> Author: gregory.p.smith Date: Mon Nov 24 01:41:43 2008 New Revision: 67362 Log: Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple. Modified: python/trunk/Doc/c-api/arg.rst Modified: python/trunk/Doc/c-api/arg.rst ============================================================================== --- python/trunk/Doc/c-api/arg.rst (original) +++ python/trunk/Doc/c-api/arg.rst Mon Nov 24 01:41:43 2008 @@ -32,7 +32,7 @@ converted to C strings using the default encoding. If this conversion fails, a :exc:`UnicodeError` is raised. -``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int] +``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :ctype:`Py_ssize_t`, see below)] This variant on ``s`` stores into two C variables, the first one a pointer to a character string, the second one its length. In this case the Python string may contain embedded null bytes. Unicode objects pass back a pointer to the default @@ -40,6 +40,11 @@ other read-buffer compatible objects pass back a reference to the raw internal data representation. + Starting with Python 2.5 the type of the length argument can be + controlled by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before + including :file:`Python.h`. If the macro is defined, length is a + :ctype:`Py_ssize_t` rather than an int. + ``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer \*] Similar to ``s#``, this code fills a Py_buffer structure provided by the caller. The buffer gets locked, so that the caller can subsequently use the buffer even From python-checkins at python.org Mon Nov 24 01:42:44 2008 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 24 Nov 2008 01:42:44 +0100 (CET) Subject: [Python-checkins] r67363 - python/branches/release26-maint/Doc/c-api/arg.rst Message-ID: <20081124004244.E15A01E4002@bag.python.org> Author: gregory.p.smith Date: Mon Nov 24 01:42:44 2008 New Revision: 67363 Log: merge in r67362 documentation update to document PY_SSIZE_T_CLEAN Modified: python/branches/release26-maint/Doc/c-api/arg.rst Modified: python/branches/release26-maint/Doc/c-api/arg.rst ============================================================================== --- python/branches/release26-maint/Doc/c-api/arg.rst (original) +++ python/branches/release26-maint/Doc/c-api/arg.rst Mon Nov 24 01:42:44 2008 @@ -32,7 +32,7 @@ converted to C strings using the default encoding. If this conversion fails, a :exc:`UnicodeError` is raised. -``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int] +``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :ctype:`Py_ssize_t`, see below)] This variant on ``s`` stores into two C variables, the first one a pointer to a character string, the second one its length. In this case the Python string may contain embedded null bytes. Unicode objects pass back a pointer to the default @@ -40,6 +40,11 @@ other read-buffer compatible objects pass back a reference to the raw internal data representation. + Starting with Python 2.5 the type of the length argument can be + controlled by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before + including :file:`Python.h`. If the macro is defined, length is a + :ctype:`Py_ssize_t` rather than an int. + ``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer \*] Similar to ``s#``, this code fills a Py_buffer structure provided by the caller. The buffer gets locked, so that the caller can subsequently use the buffer even From python-checkins at python.org Mon Nov 24 02:16:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 24 Nov 2008 02:16:29 +0100 (CET) Subject: [Python-checkins] r67364 - python/trunk/Doc/library/bdb.rst Message-ID: <20081124011629.849721E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 24 02:16:29 2008 New Revision: 67364 Log: replace reference to debugger-hooks Modified: python/trunk/Doc/library/bdb.rst Modified: python/trunk/Doc/library/bdb.rst ============================================================================== --- python/trunk/Doc/library/bdb.rst (original) +++ python/trunk/Doc/library/bdb.rst Mon Nov 24 02:16:29 2008 @@ -107,8 +107,9 @@ The *arg* parameter depends on the previous event. - For more information on trace functions, see :ref:`debugger-hooks`. For - more information on code and frame objects, refer to :ref:`types`. + See the documentation for :func:`sys.settrace` for more information on the + trace function. For more information on code and frame objects, refer to + :ref:`types`. .. method:: dispatch_line(frame) From python-checkins at python.org Mon Nov 24 05:09:03 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 24 Nov 2008 05:09:03 +0100 (CET) Subject: [Python-checkins] r67365 - in python/trunk: Lib/test/test_parser.py Misc/NEWS Modules/parsermodule.c Message-ID: <20081124040903.648BA1E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 24 05:09:03 2008 New Revision: 67365 Log: #4396 make the parser module correctly validate the with syntax Modified: python/trunk/Lib/test/test_parser.py python/trunk/Misc/NEWS python/trunk/Modules/parsermodule.c Modified: python/trunk/Lib/test/test_parser.py ============================================================================== --- python/trunk/Lib/test/test_parser.py (original) +++ python/trunk/Lib/test/test_parser.py Mon Nov 24 05:09:03 2008 @@ -196,6 +196,10 @@ def test_assert(self): self.check_suite("assert alo < ahi and blo < bhi\n") + def test_with(self): + self.check_suite("with open('x'): pass\n") + self.check_suite("with open('x') as f: pass\n") + def test_position(self): # An absolutely minimal test of position information. Better # tests would be a big project. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Nov 24 05:09:03 2008 @@ -106,6 +106,11 @@ - Issue #4122: On Windows, fix a compilation error when using the Py_UNICODE_ISSPACE macro in an extension module. +Extension Modules +----------------- + +- Issue #4396: The parser module now correctly validates the with statement. + What's New in Python 2.6 final ============================== Modified: python/trunk/Modules/parsermodule.c ============================================================================== --- python/trunk/Modules/parsermodule.c (original) +++ python/trunk/Modules/parsermodule.c Mon Nov 24 05:09:03 2008 @@ -1559,7 +1559,7 @@ /* compound_stmt: - * if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef | decorated + * if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated */ static int validate_compound_stmt(node *tree) @@ -1577,6 +1577,7 @@ || (ntype == while_stmt) || (ntype == for_stmt) || (ntype == try_stmt) + || (ntype == with_stmt) || (ntype == funcdef) || (ntype == classdef) || (ntype == decorated)) @@ -2617,6 +2618,38 @@ return ok; } +/* with_var +with_var: 'as' expr + */ +static int +validate_with_var(node *tree) +{ + int nch = NCH(tree); + int ok = (validate_ntype(tree, with_var) + && (nch == 2) + && validate_name(CHILD(tree, 0), "as") + && validate_expr(CHILD(tree, 1))); + return ok; +} + +/* with_stmt + * 0 1 2 -2 -1 +with_stmt: 'with' test [ with_var ] ':' suite + */ +static int +validate_with_stmt(node *tree) +{ + int nch = NCH(tree); + int ok = (validate_ntype(tree, with_stmt) + && ((nch == 4) || (nch == 5)) + && validate_name(CHILD(tree, 0), "with") + && validate_test(CHILD(tree, 1)) + && (nch == 4 || validate_with_var(CHILD(tree, 2))) + && validate_colon(RCHILD(tree, -2)) + && validate_suite(RCHILD(tree, -1))); + return ok; +} + /* funcdef: * * -5 -4 -3 -2 -1 @@ -2993,6 +3026,9 @@ case funcdef: res = validate_funcdef(tree); break; + case with_stmt: + res = validate_with_stmt(tree); + break; case classdef: res = validate_class(tree); break; From python-checkins at python.org Mon Nov 24 05:19:50 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 24 Nov 2008 05:19:50 +0100 (CET) Subject: [Python-checkins] r67366 - in python/branches/release26-maint: Lib/test/test_parser.py Misc/NEWS Modules/parsermodule.c Message-ID: <20081124041950.C15C61E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 24 05:19:49 2008 New Revision: 67366 Log: Merged revisions 67365 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67365 | benjamin.peterson | 2008-11-23 22:09:03 -0600 (Sun, 23 Nov 2008) | 1 line #4396 make the parser module correctly validate the with syntax ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_parser.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/parsermodule.c Modified: python/branches/release26-maint/Lib/test/test_parser.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_parser.py (original) +++ python/branches/release26-maint/Lib/test/test_parser.py Mon Nov 24 05:19:49 2008 @@ -196,6 +196,10 @@ def test_assert(self): self.check_suite("assert alo < ahi and blo < bhi\n") + def test_with(self): + self.check_suite("with open('x'): pass\n") + self.check_suite("with open('x') as f: pass\n") + def test_position(self): # An absolutely minimal test of position information. Better # tests would be a big project. Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Mon Nov 24 05:19:49 2008 @@ -96,6 +96,11 @@ - Issue #4122: On Windows, fix a compilation error when using the Py_UNICODE_ISSPACE macro in an extension module. +Extension Modules +----------------- + +- Issue #4396: The parser module now correctly validates the with statement. + What's New in Python 2.6 final ============================== Modified: python/branches/release26-maint/Modules/parsermodule.c ============================================================================== --- python/branches/release26-maint/Modules/parsermodule.c (original) +++ python/branches/release26-maint/Modules/parsermodule.c Mon Nov 24 05:19:49 2008 @@ -1559,7 +1559,7 @@ /* compound_stmt: - * if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef | decorated + * if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated */ static int validate_compound_stmt(node *tree) @@ -1577,6 +1577,7 @@ || (ntype == while_stmt) || (ntype == for_stmt) || (ntype == try_stmt) + || (ntype == with_stmt) || (ntype == funcdef) || (ntype == classdef) || (ntype == decorated)) @@ -2617,6 +2618,38 @@ return ok; } +/* with_var +with_var: 'as' expr + */ +static int +validate_with_var(node *tree) +{ + int nch = NCH(tree); + int ok = (validate_ntype(tree, with_var) + && (nch == 2) + && validate_name(CHILD(tree, 0), "as") + && validate_expr(CHILD(tree, 1))); + return ok; +} + +/* with_stmt + * 0 1 2 -2 -1 +with_stmt: 'with' test [ with_var ] ':' suite + */ +static int +validate_with_stmt(node *tree) +{ + int nch = NCH(tree); + int ok = (validate_ntype(tree, with_stmt) + && ((nch == 4) || (nch == 5)) + && validate_name(CHILD(tree, 0), "with") + && validate_test(CHILD(tree, 1)) + && (nch == 4 || validate_with_var(CHILD(tree, 2))) + && validate_colon(RCHILD(tree, -2)) + && validate_suite(RCHILD(tree, -1))); + return ok; +} + /* funcdef: * * -5 -4 -3 -2 -1 @@ -2993,6 +3026,9 @@ case funcdef: res = validate_funcdef(tree); break; + case with_stmt: + res = validate_with_stmt(tree); + break; case classdef: res = validate_class(tree); break; From buildbot at python.org Mon Nov 24 07:09:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 24 Nov 2008 06:09:36 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081124060936.399C21E4002@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/831 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: benjamin.peterson,georg.brandl,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Mon Nov 24 07:29:05 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 24 Nov 2008 01:29:05 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081124062905.GA21539@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 1 source files that are out of date updating environment: 0 added, 0 changed, 0 removed preparing documents... done writing output... c-api/arg c-api/utilities contents build succeeded. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) Underfull \hbox (badness 10000) in paragraph at lines 158--159 [3] [4] [5] [6] [7] [8] (/usr/share/texmf/tex/latex/psnfss/ts1ptm.fd) [9] [10] Chapter 2. [11] [12] [13] [14] Chapter 3. [15] [16] Chapter 4. [17] Overfull \hbox (14.2714pt too wide) in paragraph at lines 1304--1304 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 1304--1305 [][] [18] [19] [20] [21] [22] Chapter 5. [23] [24] [25] [26] [27] Underfull \hbox (badness 5359) in paragraph at lines 2168--2177 /ptmr8t/Return a Python ob-ject from the data stream in a /pcrr8t/FILE* /ptmr8t /opened for read-ing. Un-like Overfull \hbox (0.98854pt too wide) in paragraph at lines 2219--2225 [] [28] Underfull \hbox (badness 10000) in paragraph at lines 2262--2265 [] Underfull \hbox (badness 10000) in paragraph at lines 2280--2283 [] Overfull \hbox (79.5372pt too wide) in paragraph at lines 2285--2288 [] Underfull \hbox (badness 10000) in paragraph at lines 2316--2319 [] [29] [30] [31] Underfull \hbox (badness 6125) in paragraph at lines 2565--2567 []/ptmr8t/The call to [][]/pcrr8t/PyArg_UnpackTuple[][] /ptmr8t/in this ex-am-p le is en-tirely equiv-a-lent to this call to [32] [33] [34] [35] [36] Chapter 6. [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 7. Underfull \hbox (badness 10000) in paragraph at lines 3832--3833 [49] [50] [51] [52] [53] [54] [55] Overfull \hbox (14.2714pt too wide) in paragraph at lines 4691--4691 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 4691--4692 [][] [56] [57] [58] [59] Underfull \hbox (badness 8113) in paragraph at lines 5055--5058 /ptmr8t/Shortcut for /pcrr8t/PyUnicode_FromEncodedObject(obj, NULL, "strict") / ptmr8t/which is used [60] [61] [62] [63] [64] [65] [66] Underfull \hbox (badness 10000) in paragraph at lines 5654--5659 /ptmr8t/This con-stant may be passed as the /ptmri8t/size /ptmr8t/pa-ram-e-ter to [][]/pcrr8t/PyBuffer_FromObject[][] /ptmr8t/or [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] Overfull \hbox (44.0pt too wide) in paragraph at lines 6577--6578 [] [77] [78] [79] [80] Underfull \hbox (badness 10000) in paragraph at lines 6959--6961 /ptmr8t/Return true if /ptmri8t/ob /ptmr8t/is of type /pcrr8t/PyDateTime_DateTi meType /ptmr8t/or a sub-type of [81] Underfull \hbox (badness 5548) in paragraph at lines 7118--7130 [][]/pcrr8t/PyObject_CallMethod[][]/ptmr8t/, [][]/pcrr8t/PyObject_RichCompareBo ol[][]/ptmr8t/, [][]/pcrr8t/PyObject_Hash[][]/ptmr8t/, [][]/pcrr8t/PyObject_Rep r[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 /ptmr8t/to-col (in-clud-ing [][]/pcrr8t/PyNumber_And[][]/ptmr8t/, [][]/pcrr8t/P yNumber_Subtract[][]/ptmr8t/, [][]/pcrr8t/PyNumber_Or[][]/ptmr8t/, [][]/pcrr8t/ PyNumber_Xor[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 [][]/pcrr8t/PyNumber_InPlaceAnd[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceSubtra ct[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceOr[][]/ptmr8t/, and [82] [83] [84] Chapter 8. [85] [86] Underfull \hbox (badness 10000) in paragraph at lines 7519--7523 []/pcrr8t/'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam' []/pt mr8t/The re- [87] [88] [89] [90] Underfull \hbox (badness 10000) in paragraph at lines 7820--7823 /ptmr8t/This macro ex-pands to /pcrr8t/PyEval_RestoreThread(_save);/ptmr8t/: it is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 7827--7830 /ptmr8t/This macro ex-pands to /pcrr8t/_save = PyEval_SaveThread();/ptmr8t/: it is equiv-a-lent to [91] [92] [93] [94] Chapter 9. [95] [96] [97] [98] Chapter 10. Underfull \hbox (badness 10000) in paragraph at lines 8404--8404 Underfull \hbox (badness 10000) in paragraph at lines 8407--8407 [99] [100] [101] [102] [103] [104] [105] Underfull \hbox (badness 10000) in paragraph at lines 9007--9017 []/ptmr8t/The print func-tion is called with the same sig-na-ture as [][]/pcrr8 t/PyObject_Print[][]/ptmr8t/: /pcrr8t/int [106] [107] Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /ptmr8t/the fields /pcrr8t/nb_inplace_add/ptmr8t/, /pcrr8t/nb_inplace_subtract/ ptmr8t/, /pcrr8t/nb_inplace_multiply/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /pcrr8t/nb_inplace_divide/ptmr8t/, /pcrr8t/nb_inplace_remainder/ptmr8t/, /pcrr8 t/nb_inplace_power/ptmr8t/, Underfull \hbox (badness 5637) in paragraph at lines 9302--9308 /ptmr8t/If this bit is set, the type ob-ject has sev-eral new fields de-fined s tart-ing in Python [108] Underfull \hbox (badness 6300) in paragraph at lines 9353--9359 /ptmr8t/This is a bit-mask of all the bits that per-tain to the ex-is-tence of cer-tain fields in Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/the type ob-ject and its ex-ten-sion struc-tures. Cur-rently, it in-clu des the fol-low-ing Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/bits: [][]/pcrr8t/Py_TPFLAGS_HAVE_GETCHARBUFFER[][]/ptmr8t/, [][]/pcrr8 t/Py_TPFLAGS_HAVE_SEQUENCE_IN[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_INPLACEOPS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE _RICHCOMPARE[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_WEAKREFS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE_I TER[][]/ptmr8t/, and [109] Underfull \hbox (badness 10000) in paragraph at lines 9477--9479 /ptmr8t/An op-tional pointer to the rich com-par-i-son func-tion, whose sig-na- ture is /pcrr8t/PyObject [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] Appendix A. [121] [122] [123] [124] [125] [126] Appendix B. ! Package inputenc Error: Unicode char \u8:^^c3^^ba not set up for use with LaT eX. See the inputenc package documentation for explanation. Type H for immediate help. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ? ! Emergency stop. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Mon Nov 24 17:16:08 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 24 Nov 2008 17:16:08 +0100 (CET) Subject: [Python-checkins] r67367 - python/trunk/Doc/library/collections.rst Message-ID: <20081124161608.7E20B1E4053@bag.python.org> Author: georg.brandl Date: Mon Nov 24 17:16:07 2008 New Revision: 67367 Log: Fix typo. 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 Mon Nov 24 17:16:07 2008 @@ -60,7 +60,7 @@ :class:`Iterable`, and ``__len__`` ``index``, and ``count`` :class:`Container` -:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and +:class:`MutableSequence` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, ``insert``, ``remove``, and ``__iadd__`` and ``__len__`` From python-checkins at python.org Mon Nov 24 20:56:47 2008 From: python-checkins at python.org (georg.brandl) Date: Mon, 24 Nov 2008 20:56:47 +0100 (CET) Subject: [Python-checkins] r67368 - python/trunk/Doc/library/os.rst Message-ID: <20081124195647.A08751E4002@bag.python.org> Author: georg.brandl Date: Mon Nov 24 20:56:47 2008 New Revision: 67368 Log: #4404: make clear what "path" is. Modified: python/trunk/Doc/library/os.rst Modified: python/trunk/Doc/library/os.rst ============================================================================== --- python/trunk/Doc/library/os.rst (original) +++ python/trunk/Doc/library/os.rst Mon Nov 24 20:56:47 2008 @@ -933,10 +933,10 @@ .. function:: listdir(path) - Return a list containing the names of the entries in the directory. The list is - in arbitrary order. It does not include the special entries ``'.'`` and - ``'..'`` even if they are present in the directory. Availability: - Unix, Windows. + Return a list containing the names of the entries in the directory given by + *path*. The list is in arbitrary order. It does not include the special + entries ``'.'`` and ``'..'`` even if they are present in the + directory. Availability: Unix, Windows. .. versionchanged:: 2.3 On Windows NT/2k/XP and Unix, if *path* is a Unicode object, the result will be From buildbot at python.org Mon Nov 24 22:37:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 24 Nov 2008 21:37:36 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081124213736.795751E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/442 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon,gregory.p.smith BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Mon Nov 24 23:00:29 2008 From: python-checkins at python.org (jeremy.hylton) Date: Mon, 24 Nov 2008 23:00:29 +0100 (CET) Subject: [Python-checkins] r67370 - python/trunk/Lib/test/test_xmlrpc.py Message-ID: <20081124220029.788C61E4002@bag.python.org> Author: jeremy.hylton Date: Mon Nov 24 23:00:29 2008 New Revision: 67370 Log: Add unittests that verify documented behavior of public methods in Transport class. These methods can be overridden. The tests verify that the overridden methods are called, and that changes to the connection have a visible effect on the request. Modified: python/trunk/Lib/test/test_xmlrpc.py Modified: python/trunk/Lib/test/test_xmlrpc.py ============================================================================== --- python/trunk/Lib/test/test_xmlrpc.py (original) +++ python/trunk/Lib/test/test_xmlrpc.py Mon Nov 24 23:00:29 2008 @@ -9,6 +9,7 @@ import mimetools import httplib import socket +import StringIO import os from test import test_support @@ -639,9 +640,93 @@ os.remove("xmldata.txt") os.remove(test_support.TESTFN) +class FakeSocket: + + def __init__(self): + self.data = StringIO.StringIO() + + def send(self, buf): + self.data.write(buf) + return len(buf) + + def sendall(self, buf): + self.data.write(buf) + + def getvalue(self): + return self.data.getvalue() + + def makefile(self, x, y): + raise RuntimeError + +class FakeTransport(xmlrpclib.Transport): + """A Transport instance that records instead of sending a request. + + This class replaces the actual socket used by httplib with a + FakeSocket object that records the request. It doesn't provide a + response. + """ + + def make_connection(self, host): + conn = xmlrpclib.Transport.make_connection(self, host) + conn._conn.sock = self.fake_socket = FakeSocket() + return conn + +class TransportSubclassTestCase(unittest.TestCase): + + def issue_request(self, transport_class): + """Return an HTTP request made via transport_class.""" + transport = transport_class() + proxy = xmlrpclib.ServerProxy("http://example.com/", + transport=transport) + try: + proxy.pow(6, 8) + except RuntimeError: + return transport.fake_socket.getvalue() + return None + + def test_custom_user_agent(self): + class TestTransport(FakeTransport): + + def send_user_agent(self, conn): + xmlrpclib.Transport.send_user_agent(self, conn) + conn.putheader("X-Test", "test_custom_user_agent") + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_custom_user_agent\r\n" in req) + + def test_send_host(self): + class TestTransport(FakeTransport): + + def send_host(self, conn, host): + xmlrpclib.Transport.send_host(self, conn, host) + conn.putheader("X-Test", "test_send_host") + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_send_host\r\n" in req) + + def test_send_request(self): + class TestTransport(FakeTransport): + + def send_request(self, conn, url, body): + xmlrpclib.Transport.send_request(self, conn, url, body) + conn.putheader("X-Test", "test_send_request") + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_send_request\r\n" in req) + + def test_send_content(self): + class TestTransport(FakeTransport): + + def send_content(self, conn, body): + conn.putheader("X-Test", "test_send_content") + xmlrpclib.Transport.send_content(self, conn, body) + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_send_content\r\n" in req) + def test_main(): xmlrpc_tests = [XMLRPCTestCase, HelperTestCase, DateTimeTestCase, - BinaryTestCase, FaultTestCase] + BinaryTestCase, FaultTestCase, TransportSubclassTestCase] # The test cases against a SimpleXMLRPCServer raise a socket error # 10035 (WSAEWOULDBLOCK) in the server thread handle_request call when From python-checkins at python.org Mon Nov 24 23:02:00 2008 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 24 Nov 2008 23:02:00 +0100 (CET) Subject: [Python-checkins] r67371 - in sandbox/trunk/2to3/lib2to3: fixes/fix_metaclass.py tests/test_fixers.py Message-ID: <20081124220200.C14F21E4002@bag.python.org> Author: benjamin.peterson Date: Mon Nov 24 23:02:00 2008 New Revision: 67371 Log: don't blow up in the metaclass fixer when assignments in the class statement aren't simple Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py Mon Nov 24 23:02:00 2008 @@ -110,8 +110,11 @@ if simple_node.type == syms.simple_stmt and simple_node.children: expr_node = simple_node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + # Check if the expr_node is a simple assignment. + left_node = expr_node.children[0] + if isinstance(left_node, Leaf) and \ + left_node.value == '__metaclass__': + # We found a assignment to __metaclass__. fixup_simple_stmt(node, i, simple_node) remove_trailing_newline(simple_node) yield (node, i, simple_node) 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 Nov 24 23:02:00 2008 @@ -3769,6 +3769,17 @@ """ self.check(b, a) + b = """ + class X: + __metaclass__ = Meta + save.py = 23 + """ + a = """ + class X(metaclass=Meta): + save.py = 23 + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): From buildbot at python.org Mon Nov 24 23:44:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Mon, 24 Nov 2008 22:44:34 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081124224434.3B9341E4002@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/2102 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: georg.brandl,jeremy.hylton 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 Tue Nov 25 04:31:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 03:31:36 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081125033137.2E8551E4002@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/1306 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: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 04:41:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 03:41:05 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 3.0 Message-ID: <20081125034105.492FF1E4002@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/1783 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Unknown signal 32 sincerely, -The Buildbot From python-checkins at python.org Tue Nov 25 04:43:15 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 04:43:15 +0100 (CET) Subject: [Python-checkins] r67373 - python/trunk/Python/ast.c Message-ID: <20081125034315.0CD4F1E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 04:43:14 2008 New Revision: 67373 Log: always check the return value of NEW_IDENTIFIER Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Tue Nov 25 04:43:14 2008 @@ -47,7 +47,8 @@ static identifier new_identifier(const char* n, PyArena *arena) { PyObject* id = PyString_InternFromString(n); - PyArena_AddPyObject(arena, id); + if (id != NULL) + PyArena_AddPyObject(arena, id); return id; } @@ -604,6 +605,7 @@ */ REQ(n, fplist); for (i = 0; i < len; i++) { + PyObject *arg_id; const node *fpdef_node = CHILD(n, 2*i); const node *child; expr_ty arg; @@ -612,9 +614,12 @@ child = CHILD(fpdef_node, 0); if (TYPE(child) == NAME) { if (!forbidden_check(c, n, STR(child))) - return NULL; - arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), - child->n_col_offset, c->c_arena); + return NULL; + arg_id = NEW_IDENTIFIER(child); + if (!arg_id) + return NULL; + arg = Name(arg_id, Store, LINENO(child), child->n_col_offset, + c->c_arena); } else { assert(TYPE(fpdef_node) == fpdef); @@ -724,11 +729,14 @@ } } if (TYPE(CHILD(ch, 0)) == NAME) { + PyObject *id; expr_ty name; 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, + id = NEW_IDENTIFIER(CHILD(ch, 0)); + if (!id) + goto error; + name = Name(id, Param, LINENO(ch), ch->n_col_offset, c->c_arena); if (!name) goto error; @@ -741,12 +749,16 @@ if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; vararg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!vararg) + goto error; i += 3; break; case DOUBLESTAR: if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!kwarg) + goto error; i += 3; break; default: @@ -1282,11 +1294,14 @@ node *ch = CHILD(n, 0); switch (TYPE(ch)) { - case NAME: + case NAME: { /* All names start in Load context, but may later be changed. */ - return Name(NEW_IDENTIFIER(ch), Load, LINENO(n), n->n_col_offset, - c->c_arena); + PyObject *name = NEW_IDENTIFIER(ch); + if (!name) + return NULL; + return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena); + } case STRING: { PyObject *str = parsestrplus(c, n); if (!str) { @@ -1544,7 +1559,10 @@ return ast_for_call(c, CHILD(n, 1), left_expr); } else if (TYPE(CHILD(n, 0)) == DOT ) { - return Attribute(left_expr, NEW_IDENTIFIER(CHILD(n, 1)), Load, + PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1)); + if (!attr_id) + return NULL; + return Attribute(left_expr, attr_id, Load, LINENO(n), n->n_col_offset, c->c_arena); } else { @@ -2318,7 +2336,7 @@ dotted_as_name: dotted_name ['as' NAME] dotted_name: NAME ('.' NAME)* */ - PyObject *str; + PyObject *str, *name; loop: switch (TYPE(n)) { @@ -2326,8 +2344,13 @@ str = NULL; if (NCH(n) == 3) { str = NEW_IDENTIFIER(CHILD(n, 2)); + if (!str) + return NULL; } - return alias(NEW_IDENTIFIER(CHILD(n, 0)), str, c->c_arena); + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, str, c->c_arena); case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); @@ -2339,12 +2362,18 @@ return NULL; assert(!a->asname); a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + if (!a->asname) + return NULL; return a; } break; case dotted_name: - if (NCH(n) == 1) - return alias(NEW_IDENTIFIER(CHILD(n, 0)), NULL, c->c_arena); + if (NCH(n) == 1) { + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, NULL, c->c_arena); + } else { /* Create a string of the form "a.b.c" */ int i; @@ -3023,6 +3052,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) { /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */ + PyObject *classname; asdl_seq *bases, *s; REQ(n, classdef); @@ -3034,16 +3064,22 @@ s = ast_for_suite(c, CHILD(n, 3)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), + n->n_col_offset, c->c_arena); } /* check for empty base list */ if (TYPE(CHILD(n,3)) == RPAR) { s = ast_for_suite(c, CHILD(n,5)); if (!s) - return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); + return NULL; + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), + n->n_col_offset, c->c_arena); } /* else handle the base class list */ @@ -3054,7 +3090,10 @@ s = ast_for_suite(c, CHILD(n, 6)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, s, decorator_seq, + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, bases, s, decorator_seq, LINENO(n), n->n_col_offset, c->c_arena); } From python-checkins at python.org Tue Nov 25 05:00:37 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 05:00:37 +0100 (CET) Subject: [Python-checkins] r67374 - in python/branches/release26-maint: Python/ast.c Message-ID: <20081125040037.C4DC01E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 05:00:37 2008 New Revision: 67374 Log: Merged revisions 67373 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67373 | benjamin.peterson | 2008-11-24 21:43:14 -0600 (Mon, 24 Nov 2008) | 2 lines always check the return value of NEW_IDENTIFIER ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Python/ast.c Modified: python/branches/release26-maint/Python/ast.c ============================================================================== --- python/branches/release26-maint/Python/ast.c (original) +++ python/branches/release26-maint/Python/ast.c Tue Nov 25 05:00:37 2008 @@ -47,7 +47,8 @@ static identifier new_identifier(const char* n, PyArena *arena) { PyObject* id = PyString_InternFromString(n); - PyArena_AddPyObject(arena, id); + if (id != NULL) + PyArena_AddPyObject(arena, id); return id; } @@ -597,6 +598,7 @@ */ REQ(n, fplist); for (i = 0; i < len; i++) { + PyObject *arg_id; const node *fpdef_node = CHILD(n, 2*i); const node *child; expr_ty arg; @@ -605,9 +607,12 @@ child = CHILD(fpdef_node, 0); if (TYPE(child) == NAME) { if (!forbidden_check(c, n, STR(child))) - return NULL; - arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), - child->n_col_offset, c->c_arena); + return NULL; + arg_id = NEW_IDENTIFIER(child); + if (!arg_id) + return NULL; + arg = Name(arg_id, Store, LINENO(child), child->n_col_offset, + c->c_arena); } else { assert(TYPE(fpdef_node) == fpdef); @@ -717,11 +722,14 @@ } } if (TYPE(CHILD(ch, 0)) == NAME) { + PyObject *id; expr_ty name; 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, + id = NEW_IDENTIFIER(CHILD(ch, 0)); + if (!id) + goto error; + name = Name(id, Param, LINENO(ch), ch->n_col_offset, c->c_arena); if (!name) goto error; @@ -734,12 +742,16 @@ if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; vararg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!vararg) + goto error; i += 3; break; case DOUBLESTAR: if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!kwarg) + goto error; i += 3; break; default: @@ -1275,11 +1287,14 @@ node *ch = CHILD(n, 0); switch (TYPE(ch)) { - case NAME: + case NAME: { /* All names start in Load context, but may later be changed. */ - return Name(NEW_IDENTIFIER(ch), Load, LINENO(n), n->n_col_offset, - c->c_arena); + PyObject *name = NEW_IDENTIFIER(ch); + if (!name) + return NULL; + return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena); + } case STRING: { PyObject *str = parsestrplus(c, n); if (!str) { @@ -1537,7 +1552,10 @@ return ast_for_call(c, CHILD(n, 1), left_expr); } else if (TYPE(CHILD(n, 0)) == DOT ) { - return Attribute(left_expr, NEW_IDENTIFIER(CHILD(n, 1)), Load, + PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1)); + if (!attr_id) + return NULL; + return Attribute(left_expr, attr_id, Load, LINENO(n), n->n_col_offset, c->c_arena); } else { @@ -2311,7 +2329,7 @@ dotted_as_name: dotted_name ['as' NAME] dotted_name: NAME ('.' NAME)* */ - PyObject *str; + PyObject *str, *name; loop: switch (TYPE(n)) { @@ -2319,8 +2337,13 @@ str = NULL; if (NCH(n) == 3) { str = NEW_IDENTIFIER(CHILD(n, 2)); + if (!str) + return NULL; } - return alias(NEW_IDENTIFIER(CHILD(n, 0)), str, c->c_arena); + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, str, c->c_arena); case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); @@ -2332,12 +2355,18 @@ return NULL; assert(!a->asname); a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + if (!a->asname) + return NULL; return a; } break; case dotted_name: - if (NCH(n) == 1) - return alias(NEW_IDENTIFIER(CHILD(n, 0)), NULL, c->c_arena); + if (NCH(n) == 1) { + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, NULL, c->c_arena); + } else { /* Create a string of the form "a.b.c" */ int i; @@ -3016,6 +3045,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) { /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */ + PyObject *classname; asdl_seq *bases, *s; REQ(n, classdef); @@ -3027,16 +3057,22 @@ s = ast_for_suite(c, CHILD(n, 3)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), + n->n_col_offset, c->c_arena); } /* check for empty base list */ if (TYPE(CHILD(n,3)) == RPAR) { s = ast_for_suite(c, CHILD(n,5)); if (!s) - return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); + return NULL; + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), + n->n_col_offset, c->c_arena); } /* else handle the base class list */ @@ -3047,7 +3083,10 @@ s = ast_for_suite(c, CHILD(n, 6)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, s, decorator_seq, + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, bases, s, decorator_seq, LINENO(n), n->n_col_offset, c->c_arena); } From python-checkins at python.org Tue Nov 25 05:07:46 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 05:07:46 +0100 (CET) Subject: [Python-checkins] r67376 - in python/trunk/Lib/lib2to3: fixes/fix_import.py fixes/fix_metaclass.py tests/test_fixers.py Message-ID: <20081125040746.0DBA81E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 05:07:45 2008 New Revision: 67376 Log: Merged revisions 67183,67191,67371 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r67183 | benjamin.peterson | 2008-11-10 21:51:33 -0600 (Mon, 10 Nov 2008) | 1 line handle 'import x as y' in fix_imports; this still needs more work... ........ r67191 | benjamin.peterson | 2008-11-11 17:24:51 -0600 (Tue, 11 Nov 2008) | 1 line super() is good ........ r67371 | benjamin.peterson | 2008-11-24 16:02:00 -0600 (Mon, 24 Nov 2008) | 1 line don't blow up in the metaclass fixer when assignments in the class statement aren't simple ........ Modified: python/trunk/Lib/lib2to3/ (props changed) python/trunk/Lib/lib2to3/fixes/fix_import.py python/trunk/Lib/lib2to3/fixes/fix_metaclass.py python/trunk/Lib/lib2to3/tests/test_fixers.py 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 Tue Nov 25 05:07:45 2008 @@ -13,7 +13,7 @@ # Local imports from .. import fixer_base from os.path import dirname, join, exists, pathsep -from ..fixer_util import FromImport +from ..fixer_util import FromImport, syms class FixImport(fixer_base.BaseFix): @@ -26,11 +26,14 @@ def transform(self, node, results): imp = results['imp'] - if unicode(imp).startswith('.'): + mod_name = unicode(imp.children[0] if imp.type == syms.dotted_as_name \ + else imp) + + if mod_name.startswith('.'): # Already a new-style import return - if not probably_a_local_import(unicode(imp), self.filename): + if not probably_a_local_import(mod_name, self.filename): # I guess this is a global import -- skip it! return Modified: python/trunk/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_metaclass.py Tue Nov 25 05:07:45 2008 @@ -110,8 +110,11 @@ if simple_node.type == syms.simple_stmt and simple_node.children: expr_node = simple_node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + # Check if the expr_node is a simple assignment. + left_node = expr_node.children[0] + if isinstance(left_node, Leaf) and \ + left_node.value == '__metaclass__': + # We found a assignment to __metaclass__. fixup_simple_stmt(node, i, simple_node) remove_trailing_newline(simple_node) yield (node, i, simple_node) 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 Tue Nov 25 05:07:45 2008 @@ -2622,7 +2622,7 @@ def check(self, b, a): self.unchanged("from future_builtins import map; " + b, a) - FixerTestCase.check(self, b, a) + super(Test_map, self).check(b, a) def test_prefix_preservation(self): b = """x = map( f, 'abc' )""" @@ -2729,7 +2729,7 @@ def check(self, b, a): self.unchanged("from future_builtins import zip; " + b, a) - FixerTestCase.check(self, b, a) + super(Test_zip, self).check(b, a) def test_zip_basic(self): b = """x = zip(a, b, c)""" @@ -3274,7 +3274,7 @@ fixer = "import" def setUp(self): - FixerTestCase.setUp(self) + super(Test_import, self).setUp() # Need to replace fix_import's exists method # so we can check that it's doing the right thing self.files_checked = [] @@ -3293,9 +3293,9 @@ def check_both(self, b, a): self.always_exists = True - FixerTestCase.check(self, b, a) + super(Test_import, self).check(b, a) self.always_exists = False - FixerTestCase.unchanged(self, b) + super(Test_import, self).unchanged(b) def test_files_checked(self): def p(path): @@ -3372,6 +3372,11 @@ a = "from . import foo, bar" self.check_both(b, a) + def test_import_as(self): + b = "import foo as x" + a = "from . import foo as x" + self.check_both(b, a) + def test_dotted_import(self): b = "import foo.bar" a = "from . import foo.bar" @@ -3766,6 +3771,17 @@ """ self.check(b, a) + b = """ + class X: + __metaclass__ = Meta + save.py = 23 + """ + a = """ + class X(metaclass=Meta): + save.py = 23 + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): From buildbot at python.org Tue Nov 25 05:25:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 04:25:06 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 3.0 Message-ID: <20081125042506.34D3C1E4017@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/446 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: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 05:25:49 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 04:25:49 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20081125042549.A79FE1E401E@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/1604 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 failed slave lost sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 05:37:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 04:37:16 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081125043717.0EE891E4002@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/1085 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson 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 "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Unknown error') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() The Buildbot has detected a new failure of AMD64 W2k8 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/AMD64%20W2k8%203.0/builds/968 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed compile sincerely, -The Buildbot From nnorwitz at gmail.com Tue Nov 25 07:28:11 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 25 Nov 2008 01:28:11 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081125062811.GA3627@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) Underfull \hbox (badness 10000) in paragraph at lines 158--159 [3] [4] [5] [6] [7] [8] (/usr/share/texmf/tex/latex/psnfss/ts1ptm.fd) [9] [10] Chapter 2. [11] [12] [13] [14] Chapter 3. [15] [16] Chapter 4. [17] Overfull \hbox (14.2714pt too wide) in paragraph at lines 1304--1304 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 1304--1305 [][] [18] [19] [20] [21] [22] Chapter 5. [23] [24] [25] [26] [27] Underfull \hbox (badness 5359) in paragraph at lines 2168--2177 /ptmr8t/Return a Python ob-ject from the data stream in a /pcrr8t/FILE* /ptmr8t /opened for read-ing. Un-like Overfull \hbox (0.98854pt too wide) in paragraph at lines 2219--2225 [] [28] Underfull \hbox (badness 10000) in paragraph at lines 2262--2265 [] Underfull \hbox (badness 10000) in paragraph at lines 2280--2283 [] Overfull \hbox (79.5372pt too wide) in paragraph at lines 2285--2288 [] Underfull \hbox (badness 10000) in paragraph at lines 2316--2319 [] [29] [30] [31] Underfull \hbox (badness 6125) in paragraph at lines 2565--2567 []/ptmr8t/The call to [][]/pcrr8t/PyArg_UnpackTuple[][] /ptmr8t/in this ex-am-p le is en-tirely equiv-a-lent to this call to [32] [33] [34] [35] [36] Chapter 6. [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 7. Underfull \hbox (badness 10000) in paragraph at lines 3832--3833 [49] [50] [51] [52] [53] [54] [55] Overfull \hbox (14.2714pt too wide) in paragraph at lines 4691--4691 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 4691--4692 [][] [56] [57] [58] [59] Underfull \hbox (badness 8113) in paragraph at lines 5055--5058 /ptmr8t/Shortcut for /pcrr8t/PyUnicode_FromEncodedObject(obj, NULL, "strict") / ptmr8t/which is used [60] [61] [62] [63] [64] [65] [66] Underfull \hbox (badness 10000) in paragraph at lines 5654--5659 /ptmr8t/This con-stant may be passed as the /ptmri8t/size /ptmr8t/pa-ram-e-ter to [][]/pcrr8t/PyBuffer_FromObject[][] /ptmr8t/or [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] Overfull \hbox (44.0pt too wide) in paragraph at lines 6577--6578 [] [77] [78] [79] [80] Underfull \hbox (badness 10000) in paragraph at lines 6959--6961 /ptmr8t/Return true if /ptmri8t/ob /ptmr8t/is of type /pcrr8t/PyDateTime_DateTi meType /ptmr8t/or a sub-type of [81] Underfull \hbox (badness 5548) in paragraph at lines 7118--7130 [][]/pcrr8t/PyObject_CallMethod[][]/ptmr8t/, [][]/pcrr8t/PyObject_RichCompareBo ol[][]/ptmr8t/, [][]/pcrr8t/PyObject_Hash[][]/ptmr8t/, [][]/pcrr8t/PyObject_Rep r[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 /ptmr8t/to-col (in-clud-ing [][]/pcrr8t/PyNumber_And[][]/ptmr8t/, [][]/pcrr8t/P yNumber_Subtract[][]/ptmr8t/, [][]/pcrr8t/PyNumber_Or[][]/ptmr8t/, [][]/pcrr8t/ PyNumber_Xor[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 [][]/pcrr8t/PyNumber_InPlaceAnd[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceSubtra ct[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceOr[][]/ptmr8t/, and [82] [83] [84] Chapter 8. [85] [86] Underfull \hbox (badness 10000) in paragraph at lines 7519--7523 []/pcrr8t/'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam' []/pt mr8t/The re- [87] [88] [89] [90] Underfull \hbox (badness 10000) in paragraph at lines 7820--7823 /ptmr8t/This macro ex-pands to /pcrr8t/PyEval_RestoreThread(_save);/ptmr8t/: it is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 7827--7830 /ptmr8t/This macro ex-pands to /pcrr8t/_save = PyEval_SaveThread();/ptmr8t/: it is equiv-a-lent to [91] [92] [93] [94] Chapter 9. [95] [96] [97] [98] Chapter 10. Underfull \hbox (badness 10000) in paragraph at lines 8404--8404 Underfull \hbox (badness 10000) in paragraph at lines 8407--8407 [99] [100] [101] [102] [103] [104] [105] Underfull \hbox (badness 10000) in paragraph at lines 9007--9017 []/ptmr8t/The print func-tion is called with the same sig-na-ture as [][]/pcrr8 t/PyObject_Print[][]/ptmr8t/: /pcrr8t/int [106] [107] Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /ptmr8t/the fields /pcrr8t/nb_inplace_add/ptmr8t/, /pcrr8t/nb_inplace_subtract/ ptmr8t/, /pcrr8t/nb_inplace_multiply/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /pcrr8t/nb_inplace_divide/ptmr8t/, /pcrr8t/nb_inplace_remainder/ptmr8t/, /pcrr8 t/nb_inplace_power/ptmr8t/, Underfull \hbox (badness 5637) in paragraph at lines 9302--9308 /ptmr8t/If this bit is set, the type ob-ject has sev-eral new fields de-fined s tart-ing in Python [108] Underfull \hbox (badness 6300) in paragraph at lines 9353--9359 /ptmr8t/This is a bit-mask of all the bits that per-tain to the ex-is-tence of cer-tain fields in Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/the type ob-ject and its ex-ten-sion struc-tures. Cur-rently, it in-clu des the fol-low-ing Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/bits: [][]/pcrr8t/Py_TPFLAGS_HAVE_GETCHARBUFFER[][]/ptmr8t/, [][]/pcrr8 t/Py_TPFLAGS_HAVE_SEQUENCE_IN[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_INPLACEOPS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE _RICHCOMPARE[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_WEAKREFS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE_I TER[][]/ptmr8t/, and [109] Underfull \hbox (badness 10000) in paragraph at lines 9477--9479 /ptmr8t/An op-tional pointer to the rich com-par-i-son func-tion, whose sig-na- ture is /pcrr8t/PyObject [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] Appendix A. [121] [122] [123] [124] [125] [126] Appendix B. ! Package inputenc Error: Unicode char \u8:^^c3^^ba not set up for use with LaT eX. See the inputenc package documentation for explanation. Type H for immediate help. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ? ! Emergency stop. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From buildbot at python.org Tue Nov 25 07:30:05 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 06:30:05 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081125063006.210181E4002@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/531 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: sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 10:40:52 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 09:40:52 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081125094052.8DB2C1E4002@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/834 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: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 14:03:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 13:03:19 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD 3.0 Message-ID: <20081125130319.B0C251E4002@bag.python.org> The Buildbot has detected a new failure of x86 OpenBSD 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20OpenBSD%203.0/builds/446 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: cortesi Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: thomas.heller BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Tue Nov 25 16:32:34 2008 From: python-checkins at python.org (guilherme.polo) Date: Tue, 25 Nov 2008 16:32:34 +0100 (CET) Subject: [Python-checkins] r67379 - sandbox/trunk/tkinter-polo/Makefile Message-ID: <20081125153234.4671C1E4002@bag.python.org> Author: guilherme.polo Date: Tue Nov 25 16:32:33 2008 New Revision: 67379 Log: Making more clear what one should change, also removed TCLTK_VER variable so this may end up making more sense in custom builds Modified: sandbox/trunk/tkinter-polo/Makefile Modified: sandbox/trunk/tkinter-polo/Makefile ============================================================================== --- sandbox/trunk/tkinter-polo/Makefile (original) +++ sandbox/trunk/tkinter-polo/Makefile Tue Nov 25 16:32:33 2008 @@ -1,15 +1,16 @@ PYTHON=python INSTALL_DIR=tkinter -TCLTK_VER=8.5 + +# You are likely to change the following four variables TCL_BASE_DIR=/usr/share/tcltk TK_BASE_DIR=$(TCL_BASE_DIR) -TCL_CONFIG_DIR=$(TCL_BASE_DIR)/tcl$(TCLTK_VER) -TK_CONFIG_DIR=$(TK_BASE_DIR)/tk$(TCLTK_VER) +TCL_CONFIG_DIR=$(TCL_BASE_DIR)/tcl8.5 +TK_CONFIG_DIR=$(TK_BASE_DIR)/tk8.5 TCL_CONFIG=$(TCL_CONFIG_DIR)/tclConfig.sh TK_CONFIG=$(TK_CONFIG_DIR)/tkConfig.sh -build: +build: src/_tkinter.c TCL_CONFIG=$(TCL_CONFIG) TK_CONFIG=$(TK_CONFIG) \ $(PYTHON) setup.py install_lib --install-dir $(INSTALL_DIR) From buildbot at python.org Tue Nov 25 17:30:51 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 16:30:51 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20081125163051.E9DEF1E4018@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/96 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: thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea-armeabi/3.0.klose-linux-armeabi/build/Lib/multiprocessing/managers.py", line 188, in handle_request result = func(c, *args, **kwds) File "/home/pybot/buildarea-armeabi/3.0.klose-linux-armeabi/build/Lib/multiprocessing/managers.py", line 306, in debug_info keys.sort() TypeError: unorderable types: str() < int() sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 20:34:46 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 19:34:46 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081125193447.018531E400C@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/607 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-ubuntu-i386 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 20:42:59 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 19:42:59 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081125194300.203BA1E4002@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/1310 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 20:50:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 19:50:16 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable 3.0 Message-ID: <20081125195016.C526B1E4002@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/1725 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_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ppc/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 20:53:42 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 19:53:42 +0000 Subject: [Python-checkins] buildbot failure in PPC64 Debian 3.0 Message-ID: <20081125195342.D56771E4002@bag.python.org> The Buildbot has detected a new failure of PPC64 Debian 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/PPC64%20Debian%203.0/builds/1828 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ppc64 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_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea64/3.0.klose-debian-ppc64/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 20:58:24 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 19:58:24 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.0 Message-ID: <20081125195824.6D9461E4002@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/741 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_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 21:43:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 20:43:36 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081125204336.4C7281E4002@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/707 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: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea-sid/3.0.klose-debian-sparc/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Nov 25 21:44:39 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 20:44:39 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081125204439.C44C21E4002@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/790 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: brett.cannon BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_dbm_gnu ====================================================================== FAIL: test_key_methods (test.test_dbm_gnu.TestGdbm) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-sparc/build/Lib/test/test_dbm_gnu.py", line 25, in test_key_methods self.assertEqual(key_set, set([b'a', b'12345678910'])) AssertionError: {b'a', b'bytes', b'12345678910'} != {b'a', b'12345678910'} make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Nov 25 23:13:31 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 23:13:31 +0100 (CET) Subject: [Python-checkins] r67384 - in sandbox/trunk/2to3/lib2to3: refactor.py tests/test_fixers.py Message-ID: <20081125221331.CA4BE1E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 23:13:31 2008 New Revision: 67384 Log: don't duplicate calls to start_tree() RefactoringTool.pre_order values now holds a list of the fixers while pre_order_mapping holds the dict. Modified: sandbox/trunk/2to3/lib2to3/refactor.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/refactor.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/refactor.py (original) +++ sandbox/trunk/2to3/lib2to3/refactor.py Tue Nov 25 23:13:31 2008 @@ -123,8 +123,8 @@ logger=self.logger) self.pre_order, self.post_order = self.get_fixers() - self.pre_order = get_headnode_dict(self.pre_order) - self.post_order = get_headnode_dict(self.post_order) + self.pre_order_mapping = get_headnode_dict(self.pre_order) + self.post_order_mapping = get_headnode_dict(self.post_order) self.files = [] # List of files that were or should be modified @@ -290,13 +290,12 @@ # Two calls to chain are required because pre_order.values() # will be a list of lists of fixers: # [[, ], []] - all_fixers = chain(chain(*self.pre_order.values()),\ - chain(*self.post_order.values())) + all_fixers = chain(self.pre_order, self.post_order) for fixer in all_fixers: fixer.start_tree(tree, name) - self.traverse_by(self.pre_order, tree.pre_order()) - self.traverse_by(self.post_order, tree.post_order()) + self.traverse_by(self.pre_order_mapping, tree.pre_order()) + self.traverse_by(self.post_order_mapping, tree.post_order()) for fixer in all_fixers: fixer.finish_tree(tree, name) 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 Tue Nov 25 23:13:31 2008 @@ -30,10 +30,9 @@ self.fixer_log = [] self.filename = "" - for order in (self.refactor.pre_order.values(),\ - self.refactor.post_order.values()): - for fixer in chain(*order): - fixer.log = self.fixer_log + for fixer in chain(self.refactor.pre_order, + self.refactor.post_order): + fixer.log = self.fixer_log def _check(self, before, after): before = support.reformat(before) From buildbot at python.org Tue Nov 25 23:42:48 2008 From: buildbot at python.org (buildbot at python.org) Date: Tue, 25 Nov 2008 22:42:48 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081125224248.B60151E4002@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/1313 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_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Nov 25 23:44:52 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 23:44:52 +0100 (CET) Subject: [Python-checkins] r67386 - in sandbox/trunk/2to3/lib2to3: fixes/fix_imports.py tests/test_fixers.py Message-ID: <20081125224452.4A29D1E4040@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 23:44:52 2008 New Revision: 67386 Log: #4423 fix_imports was still replacing usage of a module if attributes were being used Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Tue Nov 25 23:44:52 2008 @@ -63,6 +63,8 @@ def build_pattern(mapping=MAPPING): mod_list = ' | '.join(["module='" + key + "'" for key in mapping.keys()]) mod_name_list = ' | '.join(["module_name='" + key + "'" for key in mapping.keys()]) + mod_attribute_list = ' | '.join(["mod_with_attribute='" + key + "'" + for key in mapping.keys()]) yield """import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) @@ -76,8 +78,8 @@ # Find usages of module members in code e.g. urllib.foo(bar) yield """power< (%s) trailer<'.' any > any* > - """ % mod_name_list - yield """bare_name=%s""" % alternates(mapping.keys()) + """ % mod_attribute_list + yield "bare_name=(%s)" % alternates(mapping.keys()) class FixImports(fixer_base.BaseFix): PATTERN = "|".join(build_pattern()) @@ -103,6 +105,7 @@ import_mod = results.get("module") mod_name = results.get("module_name") bare_name = results.get("bare_name") + mod_with_attribute = results.get("mod_with_attribute") if import_mod or mod_name: new_name = self.mapping[(import_mod or mod_name).value] @@ -112,6 +115,11 @@ import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) elif mod_name: mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) + elif mod_with_attribute: + new_name = self.replace.get(mod_with_attribute.value) + if new_name: + mod_with_attribute.replace(Name(new_name, + prefix=mod_with_attribute.get_prefix())) elif bare_name: bare_name = bare_name[0] new_name = self.replace.get(bare_name.value) 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 Tue Nov 25 23:44:52 2008 @@ -1485,6 +1485,22 @@ """ % (new, new) self.check(b, a) + b = """ + from %s import x + %s = 23 + """ % (old, old) + a = """ + from %s import x + %s = 23 + """ % (new, old) + self.check(b, a) + + s = """ + def f(): + %s.method() + """ % (old,) + self.unchanged(s) + class Test_imports2(Test_imports): fixer = "imports2" From python-checkins at python.org Tue Nov 25 23:47:54 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 23:47:54 +0100 (CET) Subject: [Python-checkins] r67387 - sandbox/trunk/2to3/lib2to3/tests/test_refactor.py Message-ID: <20081125224754.C1FF91E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 23:47:54 2008 New Revision: 67387 Log: fix broken test Modified: sandbox/trunk/2to3/lib2to3/tests/test_refactor.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_refactor.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_refactor.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_refactor.py Tue Nov 25 23:47:54 2008 @@ -161,7 +161,7 @@ self.assertEqual(len(rt.post_order), 0) rt = self.rt(explicit=["myfixes.fix_explicit"]) - for fix in rt.post_order[None]: + for fix in rt.post_order: if isinstance(fix, FixExplicit): break else: From python-checkins at python.org Tue Nov 25 23:49:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 25 Nov 2008 23:49:29 +0100 (CET) Subject: [Python-checkins] r67388 - python/branches/release25-maint/Python/ast.c Message-ID: <20081125224929.14ABB1E4002@bag.python.org> Author: benjamin.peterson Date: Tue Nov 25 23:49:28 2008 New Revision: 67388 Log: backport r67373: checking for errors from NEW_IDENTIFIER Modified: python/branches/release25-maint/Python/ast.c Modified: python/branches/release25-maint/Python/ast.c ============================================================================== --- python/branches/release25-maint/Python/ast.c (original) +++ python/branches/release25-maint/Python/ast.c Tue Nov 25 23:49:28 2008 @@ -49,7 +49,8 @@ static identifier new_identifier(const char* n, PyArena *arena) { PyObject* id = PyString_InternFromString(n); - PyArena_AddPyObject(arena, id); + if (id != NULL) + PyArena_AddPyObject(arena, id); return id; } @@ -574,6 +575,7 @@ */ REQ(n, fplist); for (i = 0; i < len; i++) { + PyObject *arg_id; const node *fpdef_node = CHILD(n, 2*i); const node *child; expr_ty arg; @@ -581,13 +583,16 @@ /* 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; - } - arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), - child->n_col_offset, c->c_arena); - } + if (!strcmp(STR(child), "None")) { + ast_error(child, "assignment to None"); + return NULL; + } + arg_id = NEW_IDENTIFIER(child); + if (!arg_id) + return NULL; + arg = Name(arg_id, Store, LINENO(child), child->n_col_offset, + c->c_arena); + } else { assert(TYPE(fpdef_node) == fpdef); /* fpdef_node[0] is not a name, so it must be a '(', get CHILD[1] */ @@ -693,13 +698,16 @@ } } if (TYPE(CHILD(ch, 0)) == NAME) { + PyObject *id; expr_ty name; if (!strcmp(STR(CHILD(ch, 0)), "None")) { ast_error(CHILD(ch, 0), "assignment to None"); goto error; } - name = Name(NEW_IDENTIFIER(CHILD(ch, 0)), - Param, LINENO(ch), ch->n_col_offset, + id = NEW_IDENTIFIER(CHILD(ch, 0)); + if (!id) + goto error; + name = Name(id, Param, LINENO(ch), ch->n_col_offset, c->c_arena); if (!name) goto error; @@ -714,6 +722,8 @@ goto error; } vararg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!vararg) + goto error; i += 3; break; case DOUBLESTAR: @@ -722,6 +732,8 @@ goto error; } kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!kwarg) + goto error; i += 3; break; default: @@ -1235,10 +1247,14 @@ node *ch = CHILD(n, 0); switch (TYPE(ch)) { - case NAME: - /* All names start in Load context, but may later be - changed. */ - return Name(NEW_IDENTIFIER(ch), Load, LINENO(n), n->n_col_offset, c->c_arena); + case NAME: { + /* All names start in Load context, but may later be + changed. */ + PyObject *id = NEW_IDENTIFIER(ch); + if (!id) + return NULL; + return Name(id, Load, LINENO(n), n->n_col_offset, c->c_arena); + } case STRING: { PyObject *str = parsestrplus(c, n); if (!str) @@ -1472,7 +1488,10 @@ return ast_for_call(c, CHILD(n, 1), left_expr); } else if (TYPE(CHILD(n, 0)) == DOT ) { - return Attribute(left_expr, NEW_IDENTIFIER(CHILD(n, 1)), Load, + PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1)); + if (!attr_id) + return NULL; + return Attribute(left_expr, attr_id, Load, LINENO(n), n->n_col_offset, c->c_arena); } else { @@ -2226,7 +2245,7 @@ dotted_as_name: dotted_name ['as' NAME] dotted_name: NAME ('.' NAME)* */ - PyObject *str; + PyObject *str, *name; loop: switch (TYPE(n)) { @@ -2238,8 +2257,13 @@ return NULL; } str = NEW_IDENTIFIER(CHILD(n, 2)); + if (!str) + return NULL; } - return alias(NEW_IDENTIFIER(CHILD(n, 0)), str, c->c_arena); + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, str, c->c_arena); case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); @@ -2255,12 +2279,18 @@ } assert(!a->asname); a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + if (!a->asname) + return NULL; return a; } break; case dotted_name: - if (NCH(n) == 1) - return alias(NEW_IDENTIFIER(CHILD(n, 0)), NULL, c->c_arena); + if (NCH(n) == 1) { + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, NULL, c->c_arena); + } else { /* Create a string of the form "a.b.c" */ int i; @@ -2938,6 +2968,7 @@ ast_for_classdef(struct compiling *c, const node *n) { /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */ + PyObject *classname; asdl_seq *bases, *s; REQ(n, classdef); @@ -2951,15 +2982,21 @@ s = ast_for_suite(c, CHILD(n, 3)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, LINENO(n), + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, LINENO(n), n->n_col_offset, c->c_arena); } /* check for empty base list */ if (TYPE(CHILD(n,3)) == RPAR) { - s = ast_for_suite(c, CHILD(n,5)); - if (!s) - return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, LINENO(n), + s = ast_for_suite(c, CHILD(n, 5)); + if (!s) + return NULL; + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, LINENO(n), n->n_col_offset, c->c_arena); } @@ -2971,7 +3008,10 @@ s = ast_for_suite(c, CHILD(n, 6)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, s, LINENO(n), + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, bases, s, LINENO(n), n->n_col_offset, c->c_arena); } From python-checkins at python.org Wed Nov 26 00:13:18 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 00:13:18 +0100 (CET) Subject: [Python-checkins] r67389 - in sandbox/trunk/2to3/lib2to3: fixer_util.py fixes/fix_dict.py fixes/fix_except.py fixes/fix_imports.py fixes/fix_next.py fixes/fix_numliterals.py fixes/fix_renames.py fixes/fix_urllib.py pgen2/parse.py Message-ID: <20081125231318.439B41E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 00:13:17 2008 New Revision: 67389 Log: remove compatibility code; we only cater to 2.5+ Modified: sandbox/trunk/2to3/lib2to3/fixer_util.py sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py sandbox/trunk/2to3/lib2to3/fixes/fix_except.py sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/fixes/fix_next.py sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py sandbox/trunk/2to3/lib2to3/pgen2/parse.py Modified: sandbox/trunk/2to3/lib2to3/fixer_util.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixer_util.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_util.py Wed Nov 26 00:13:17 2008 @@ -153,30 +153,6 @@ 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 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 Wed Nov 26 00:13:17 2008 @@ -28,7 +28,7 @@ from .. import patcomp from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot from .. import fixer_util 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 Wed Nov 26 00:13:17 2008 @@ -25,7 +25,7 @@ from .. import pytree from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list def find_excepts(nodes): for i, n in enumerate(nodes): 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 Wed Nov 26 00:13:17 2008 @@ -3,7 +3,7 @@ # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {'StringIO': 'io', 'cStringIO': 'io', 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 Wed Nov 26 00:13:17 2008 @@ -9,7 +9,7 @@ from ..pgen2 import token from ..pygram import python_symbols as syms from .. import fixer_base -from ..fixer_util import Name, Call, find_binding, any +from ..fixer_util import Name, Call, find_binding bind_warning = "Calls to builtin next() possibly shadowed by global binding" 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 Wed Nov 26 00:13:17 2008 @@ -6,7 +6,7 @@ # Local imports from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Number, set +from ..fixer_util import Number class FixNumliterals(fixer_base.BaseFix): 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 Wed Nov 26 00:13:17 2008 @@ -8,7 +8,7 @@ # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {"sys": {"maxint" : "maxsize"}, } Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py Wed Nov 26 00:13:17 2008 @@ -7,7 +7,7 @@ # Local imports from .fix_imports import alternates, FixImports from .. import fixer_base -from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain, any, set +from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain MAPPING = {'urllib': [ ('urllib.request', Modified: sandbox/trunk/2to3/lib2to3/pgen2/parse.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/pgen2/parse.py (original) +++ sandbox/trunk/2to3/lib2to3/pgen2/parse.py Wed Nov 26 00:13:17 2008 @@ -10,12 +10,6 @@ """ -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - # Local imports from . import token From python-checkins at python.org Wed Nov 26 05:03:37 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 05:03:37 +0100 (CET) Subject: [Python-checkins] r67390 - in sandbox/trunk/2to3/lib2to3: fixes/fix_imports.py tests/test_fixers.py Message-ID: <20081126040337.2B6E91E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 05:03:36 2008 New Revision: 67390 Log: fix #3994; the usage of changed imports was fixed in nested cases Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Wed Nov 26 05:03:36 2008 @@ -92,7 +92,8 @@ match = super(FixImports, self).match results = match(node) if results: - if any([match(obj) for obj in attr_chain(node, "parent")]): + if "mod_with_attribute" not in results and \ + any([match(obj) for obj in attr_chain(node, "parent")]): return False return results return False 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 Wed Nov 26 05:03:36 2008 @@ -1501,6 +1501,18 @@ """ % (old,) self.unchanged(s) + # test nested usage + b = """ + import %s + %s.bar(%s.foo) + """ % (old, old, old) + a = """ + import %s + %s.bar(%s.foo) + """ % (new, new, new) + self.check(b, a) + + class Test_imports2(Test_imports): fixer = "imports2" From nnorwitz at gmail.com Wed Nov 26 07:22:32 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Wed, 26 Nov 2008 01:22:32 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081126062232.GA22410@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) Underfull \hbox (badness 10000) in paragraph at lines 158--159 [3] [4] [5] [6] [7] [8] (/usr/share/texmf/tex/latex/psnfss/ts1ptm.fd) [9] [10] Chapter 2. [11] [12] [13] [14] Chapter 3. [15] [16] Chapter 4. [17] Overfull \hbox (14.2714pt too wide) in paragraph at lines 1304--1304 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 1304--1305 [][] [18] [19] [20] [21] [22] Chapter 5. [23] [24] [25] [26] [27] Underfull \hbox (badness 5359) in paragraph at lines 2168--2177 /ptmr8t/Return a Python ob-ject from the data stream in a /pcrr8t/FILE* /ptmr8t /opened for read-ing. Un-like Overfull \hbox (0.98854pt too wide) in paragraph at lines 2219--2225 [] [28] Underfull \hbox (badness 10000) in paragraph at lines 2262--2265 [] Underfull \hbox (badness 10000) in paragraph at lines 2280--2283 [] Overfull \hbox (79.5372pt too wide) in paragraph at lines 2285--2288 [] Underfull \hbox (badness 10000) in paragraph at lines 2316--2319 [] [29] [30] [31] Underfull \hbox (badness 6125) in paragraph at lines 2565--2567 []/ptmr8t/The call to [][]/pcrr8t/PyArg_UnpackTuple[][] /ptmr8t/in this ex-am-p le is en-tirely equiv-a-lent to this call to [32] [33] [34] [35] [36] Chapter 6. [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 7. Underfull \hbox (badness 10000) in paragraph at lines 3832--3833 [49] [50] [51] [52] [53] [54] [55] Overfull \hbox (14.2714pt too wide) in paragraph at lines 4691--4691 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 4691--4692 [][] [56] [57] [58] [59] Underfull \hbox (badness 8113) in paragraph at lines 5055--5058 /ptmr8t/Shortcut for /pcrr8t/PyUnicode_FromEncodedObject(obj, NULL, "strict") / ptmr8t/which is used [60] [61] [62] [63] [64] [65] [66] Underfull \hbox (badness 10000) in paragraph at lines 5654--5659 /ptmr8t/This con-stant may be passed as the /ptmri8t/size /ptmr8t/pa-ram-e-ter to [][]/pcrr8t/PyBuffer_FromObject[][] /ptmr8t/or [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] Overfull \hbox (44.0pt too wide) in paragraph at lines 6577--6578 [] [77] [78] [79] [80] Underfull \hbox (badness 10000) in paragraph at lines 6959--6961 /ptmr8t/Return true if /ptmri8t/ob /ptmr8t/is of type /pcrr8t/PyDateTime_DateTi meType /ptmr8t/or a sub-type of [81] Underfull \hbox (badness 5548) in paragraph at lines 7118--7130 [][]/pcrr8t/PyObject_CallMethod[][]/ptmr8t/, [][]/pcrr8t/PyObject_RichCompareBo ol[][]/ptmr8t/, [][]/pcrr8t/PyObject_Hash[][]/ptmr8t/, [][]/pcrr8t/PyObject_Rep r[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 /ptmr8t/to-col (in-clud-ing [][]/pcrr8t/PyNumber_And[][]/ptmr8t/, [][]/pcrr8t/P yNumber_Subtract[][]/ptmr8t/, [][]/pcrr8t/PyNumber_Or[][]/ptmr8t/, [][]/pcrr8t/ PyNumber_Xor[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 [][]/pcrr8t/PyNumber_InPlaceAnd[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceSubtra ct[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceOr[][]/ptmr8t/, and [82] [83] [84] Chapter 8. [85] [86] Underfull \hbox (badness 10000) in paragraph at lines 7519--7523 []/pcrr8t/'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam' []/pt mr8t/The re- [87] [88] [89] [90] Underfull \hbox (badness 10000) in paragraph at lines 7820--7823 /ptmr8t/This macro ex-pands to /pcrr8t/PyEval_RestoreThread(_save);/ptmr8t/: it is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 7827--7830 /ptmr8t/This macro ex-pands to /pcrr8t/_save = PyEval_SaveThread();/ptmr8t/: it is equiv-a-lent to [91] [92] [93] [94] Chapter 9. [95] [96] [97] [98] Chapter 10. Underfull \hbox (badness 10000) in paragraph at lines 8404--8404 Underfull \hbox (badness 10000) in paragraph at lines 8407--8407 [99] [100] [101] [102] [103] [104] [105] Underfull \hbox (badness 10000) in paragraph at lines 9007--9017 []/ptmr8t/The print func-tion is called with the same sig-na-ture as [][]/pcrr8 t/PyObject_Print[][]/ptmr8t/: /pcrr8t/int [106] [107] Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /ptmr8t/the fields /pcrr8t/nb_inplace_add/ptmr8t/, /pcrr8t/nb_inplace_subtract/ ptmr8t/, /pcrr8t/nb_inplace_multiply/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /pcrr8t/nb_inplace_divide/ptmr8t/, /pcrr8t/nb_inplace_remainder/ptmr8t/, /pcrr8 t/nb_inplace_power/ptmr8t/, Underfull \hbox (badness 5637) in paragraph at lines 9302--9308 /ptmr8t/If this bit is set, the type ob-ject has sev-eral new fields de-fined s tart-ing in Python [108] Underfull \hbox (badness 6300) in paragraph at lines 9353--9359 /ptmr8t/This is a bit-mask of all the bits that per-tain to the ex-is-tence of cer-tain fields in Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/the type ob-ject and its ex-ten-sion struc-tures. Cur-rently, it in-clu des the fol-low-ing Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/bits: [][]/pcrr8t/Py_TPFLAGS_HAVE_GETCHARBUFFER[][]/ptmr8t/, [][]/pcrr8 t/Py_TPFLAGS_HAVE_SEQUENCE_IN[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_INPLACEOPS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE _RICHCOMPARE[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_WEAKREFS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE_I TER[][]/ptmr8t/, and [109] Underfull \hbox (badness 10000) in paragraph at lines 9477--9479 /ptmr8t/An op-tional pointer to the rich com-par-i-son func-tion, whose sig-na- ture is /pcrr8t/PyObject [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] Appendix A. [121] [122] [123] [124] [125] [126] Appendix B. ! Package inputenc Error: Unicode char \u8:^^c3^^ba not set up for use with LaT eX. See the inputenc package documentation for explanation. Type H for immediate help. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ? ! Emergency stop. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Wed Nov 26 18:11:41 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 18:11:41 +0100 (CET) Subject: [Python-checkins] r67392 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Message-ID: <20081126171141.42A4E1E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 18:11:40 2008 New Revision: 67392 Log: simpilfy and comment fix_imports Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py 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 Wed Nov 26 18:11:40 2008 @@ -1,5 +1,5 @@ """Fix incompatible imports and module references.""" -# Author: Collin Winter +# Authors: Collin Winter, Nick Edds # Local imports from .. import fixer_base @@ -61,38 +61,43 @@ def build_pattern(mapping=MAPPING): - mod_list = ' | '.join(["module='" + key + "'" for key in mapping.keys()]) - mod_name_list = ' | '.join(["module_name='" + key + "'" for key in mapping.keys()]) - mod_attribute_list = ' | '.join(["mod_with_attribute='" + key + "'" - for key in mapping.keys()]) - yield """import_name< 'import' ((%s) + mod_list = ' | '.join(["module_name='%s'" % key for key in mapping]) + bare_names = alternates(mapping.keys()) + + yield """name_import=import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > - """ % mod_name_list + """ % mod_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > - """ % mod_name_list - # Find usages of module members in code e.g. urllib.foo(bar) - yield """power< (%s) - trailer<'.' any > any* > - """ % mod_attribute_list - yield "bare_name=(%s)" % alternates(mapping.keys()) + """ % mod_list + + # Find usages of module members in code e.g. thread.foo(bar) + # We differentiate between "bare_with_attr" and "bare_name" for the benfit + # of the match() override in FixImports. + yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names + yield "bare_name=(%s)" % bare_names + class FixImports(fixer_base.BaseFix): + PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal + # This is overridden in fix_imports2. mapping = MAPPING - # Don't match the node if it's within another match + # Don't match the node if it's within another match. def match(self, node): match = super(FixImports, self).match results = match(node) if results: - if "mod_with_attribute" not in results and \ + # Module usage could be in the trailier of an attribute lookup, so + # we might have nested matches when "bare_with_attr" is present. + if "bare_with_attr" not in results and \ any([match(obj) for obj in attr_chain(node, "parent")]): return False return results @@ -103,25 +108,17 @@ self.replace = {} def transform(self, node, results): - import_mod = results.get("module") - mod_name = results.get("module_name") - bare_name = results.get("bare_name") - mod_with_attribute = results.get("mod_with_attribute") - - if import_mod or mod_name: - new_name = self.mapping[(import_mod or mod_name).value] - + import_mod = results.get("module_name") if import_mod: - self.replace[import_mod.value] = new_name + new_name = self.mapping[(import_mod or mod_name).value] + if "name_import" in results: + # If it's not a "from x import x, y" or "import x as y" import, + # marked its usage to be replaced. + self.replace[import_mod.value] = new_name import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) - elif mod_name: - mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) - elif mod_with_attribute: - new_name = self.replace.get(mod_with_attribute.value) - if new_name: - mod_with_attribute.replace(Name(new_name, - prefix=mod_with_attribute.get_prefix())) - elif bare_name: + else: + # Replace usage of the module. + bare_name = results.get("bare_with_attr") or results.get("bare_name") bare_name = bare_name[0] new_name = self.replace.get(bare_name.value) if new_name: From python-checkins at python.org Wed Nov 26 18:32:49 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 26 Nov 2008 18:32:49 +0100 (CET) Subject: [Python-checkins] r67396 - python/trunk/Modules/Setup.dist Message-ID: <20081126173249.87BF41E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 26 18:32:49 2008 New Revision: 67396 Log: - Modules/Setup.dist: Mention _elementtree and _pickle. Modified: python/trunk/Modules/Setup.dist Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Wed Nov 26 18:32:49 2008 @@ -180,6 +180,8 @@ #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations #_functools _functoolsmodule.c # Tools for working with functions and callable objects +#_elementtreee _elementtree.c # elementtree accelerator +#_pickle _pickle.c # pickle accelerator #unicodedata unicodedata.c # static Unicode character database From python-checkins at python.org Wed Nov 26 18:39:09 2008 From: python-checkins at python.org (matthias.klose) Date: Wed, 26 Nov 2008 18:39:09 +0100 (CET) Subject: [Python-checkins] r67397 - python/branches/release26-maint/Modules/Setup.dist Message-ID: <20081126173909.CB9E01E4002@bag.python.org> Author: matthias.klose Date: Wed Nov 26 18:39:09 2008 New Revision: 67397 Log: - Merge rev 67396, Modules/Setup.dist: Mention _elementtree and _pickle. Modified: python/branches/release26-maint/Modules/Setup.dist Modified: python/branches/release26-maint/Modules/Setup.dist ============================================================================== --- python/branches/release26-maint/Modules/Setup.dist (original) +++ python/branches/release26-maint/Modules/Setup.dist Wed Nov 26 18:39:09 2008 @@ -180,6 +180,8 @@ #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations #_functools _functoolsmodule.c # Tools for working with functions and callable objects +#_elementtreee _elementtree.c # elementtree accelerator +#_pickle _pickle.c # pickle accelerator #unicodedata unicodedata.c # static Unicode character database From python-checkins at python.org Wed Nov 26 18:39:17 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 18:39:17 +0100 (CET) Subject: [Python-checkins] r67398 - python/trunk/Doc/library/sqlite3.rst Message-ID: <20081126173917.EA8D11E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 18:39:17 2008 New Revision: 67398 Log: fix typo in sqlite3 docs Modified: python/trunk/Doc/library/sqlite3.rst Modified: python/trunk/Doc/library/sqlite3.rst ============================================================================== --- python/trunk/Doc/library/sqlite3.rst (original) +++ python/trunk/Doc/library/sqlite3.rst Wed Nov 26 18:39:17 2008 @@ -223,8 +223,8 @@ .. attribute:: Connection.isolation_level - Get or set the current isolation level. :const:`None` for autocommit mode or one of - "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section + Get or set the current isolation level. :const:`None` for autocommit mode or + one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section :ref:`sqlite3-controlling-transactions` for a more detailed explanation. From python-checkins at python.org Wed Nov 26 18:47:03 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 18:47:03 +0100 (CET) Subject: [Python-checkins] r67399 - sandbox/trunk/2to3/lib2to3/fixer_base.py Message-ID: <20081126174703.7A3781E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 18:47:03 2008 New Revision: 67399 Log: remove more compatibility code Modified: sandbox/trunk/2to3/lib2to3/fixer_base.py Modified: sandbox/trunk/2to3/lib2to3/fixer_base.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixer_base.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_base.py Wed Nov 26 18:47:03 2008 @@ -7,12 +7,6 @@ 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 python-checkins at python.org Wed Nov 26 19:07:41 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 19:07:41 +0100 (CET) Subject: [Python-checkins] r67400 - in sandbox/trunk/2to3/lib2to3/tests: data data/fixers data/fixers/myfixes Message-ID: <20081126180741.D40D31E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 19:07:41 2008 New Revision: 67400 Log: set svn:ignore Modified: sandbox/trunk/2to3/lib2to3/tests/ (props changed) sandbox/trunk/2to3/lib2to3/tests/data/ (props changed) sandbox/trunk/2to3/lib2to3/tests/data/fixers/ (props changed) sandbox/trunk/2to3/lib2to3/tests/data/fixers/myfixes/ (props changed) From buildbot at python.org Wed Nov 26 19:30:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 26 Nov 2008 18:30:25 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081126183025.7B06A1E4002@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/333 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Wed Nov 26 19:44:01 2008 From: buildbot at python.org (buildbot at python.org) Date: Wed, 26 Nov 2008 18:44:01 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081126184401.BB67F1E4002@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/614 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_doctest make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Nov 26 20:11:11 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 20:11:11 +0100 (CET) Subject: [Python-checkins] r67403 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20081126191111.7888A1E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 20:11:11 2008 New Revision: 67403 Log: wrap import Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Wed Nov 26 20:11:11 2008 @@ -15,10 +15,7 @@ from operator import itemgetter # Local imports -from .. import pygram -from .. import pytree -from .. import refactor -from .. import fixer_util +from lib2to3 import pygram, pytree, refactor, fixer_util class FixerTestCase(support.TestCase): From python-checkins at python.org Wed Nov 26 20:29:50 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 20:29:50 +0100 (CET) Subject: [Python-checkins] r67404 - in sandbox/trunk/2to3/lib2to3/fixes: fix_imports.py fix_imports2.py fix_urllib.py Message-ID: <20081126192950.0C0BA1E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 20:29:49 2008 New Revision: 67404 Log: build the fix_imports pattern in compile_pattern, so MAPPING can be changed and reflected in the pattern Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py 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 Wed Nov 26 20:29:49 2008 @@ -84,12 +84,20 @@ class FixImports(fixer_base.BaseFix): - PATTERN = "|".join(build_pattern()) order = "pre" # Pre-order tree traversal # This is overridden in fix_imports2. mapping = MAPPING + def build_pattern(self): + return "|".join(build_pattern(self.mapping)) + + def compile_pattern(self): + # We override this, so MAPPING can be pragmatically altered and the + # changes will be reflected in PATTERN. + self.PATTERN = self.build_pattern() + super(FixImports, self).compile_pattern() + # Don't match the node if it's within another match. def match(self, node): match = super(FixImports, self).match Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py Wed Nov 26 20:29:49 2008 @@ -10,7 +10,6 @@ class FixImports2(fix_imports.FixImports): - PATTERN = "|".join((fix_imports.build_pattern(MAPPING))) order = "post" Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py Wed Nov 26 20:29:49 2008 @@ -65,7 +65,9 @@ class FixUrllib(FixImports): - PATTERN = "|".join(build_pattern()) + + def build_pattern(self): + return "|".join(build_pattern()) def transform_import(self, node, results): """Transform for the basic import case. Replaces the old From python-checkins at python.org Wed Nov 26 21:01:24 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 21:01:24 +0100 (CET) Subject: [Python-checkins] r67405 - sandbox/trunk/2to3/lib2to3/pytree.py Message-ID: <20081126200124.365BD1E4002@bag.python.org> Author: benjamin.peterson Date: Wed Nov 26 21:01:24 2008 New Revision: 67405 Log: stop ugly messages about runtime errors being ignored Modified: sandbox/trunk/2to3/lib2to3/pytree.py Modified: sandbox/trunk/2to3/lib2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/pytree.py Wed Nov 26 21:01:24 2008 @@ -11,6 +11,9 @@ __author__ = "Guido van Rossum " +import sys +from StringIO import StringIO + HUGE = 0x7FFFFFFF # maximum repeat count, default max @@ -655,6 +658,11 @@ elif self.name == "bare_name": yield self._bare_name_matches(nodes) else: + # The reason for this is that hitting the recursion limit usually + # results in some ugly messages about how RuntimeErrors are being + # ignored. + save_stderr = sys.stderr + sys.stderr = StringIO() try: for count, r in self._recursive_matches(nodes, 0): if self.name: @@ -667,6 +675,8 @@ if self.name: r[self.name] = nodes[:count] yield count, r + finally: + sys.stderr = save_stderr def _iterative_matches(self, nodes): """Helper to iteratively yield the matches.""" From python-checkins at python.org Wed Nov 26 21:02:53 2008 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 26 Nov 2008 21:02:53 +0100 (CET) Subject: [Python-checkins] r67405 - svn:log Message-ID: <20081126200253.59A4F1E4002@bag.python.org> Author: benjamin.peterson Revision: 67405 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1 +1 @@ -stop ugly messages about runtime errors being ignored \ No newline at end of file +stop ugly messages about runtime errors being from printed \ No newline at end of file From mal at egenix.com Wed Nov 26 23:02:16 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed, 26 Nov 2008 23:02:16 +0100 Subject: [Python-checkins] r67397 - python/branches/release26-maint/Modules/Setup.dist In-Reply-To: <20081126173909.CB9E01E4002@bag.python.org> References: <20081126173909.CB9E01E4002@bag.python.org> Message-ID: <492DC768.7010300@egenix.com> On 2008-11-26 18:39, matthias.klose wrote: > Author: matthias.klose > Date: Wed Nov 26 18:39:09 2008 > New Revision: 67397 > > Log: > - Merge rev 67396, Modules/Setup.dist: Mention _elementtree and _pickle. > > > Modified: > python/branches/release26-maint/Modules/Setup.dist > > Modified: python/branches/release26-maint/Modules/Setup.dist > ============================================================================== > --- python/branches/release26-maint/Modules/Setup.dist (original) > +++ python/branches/release26-maint/Modules/Setup.dist Wed Nov 26 18:39:09 2008 > @@ -180,6 +180,8 @@ > #itertools itertoolsmodule.c # Functions creating iterators for efficient looping > #strop stropmodule.c # String manipulations > #_functools _functoolsmodule.c # Tools for working with functions and callable objects > +#_elementtreee _elementtree.c # elementtree accelerator > +#_pickle _pickle.c # pickle accelerator Shouldn't that be cPickle ? _pickle is only available in Python 3.0. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Nov 26 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ 2008-11-12: Released mxODBC.Connect 0.9.3 http://python.egenix.com/ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From nnorwitz at gmail.com Thu Nov 27 07:22:32 2008 From: nnorwitz at gmail.com (Neal Norwitz) Date: Thu, 27 Nov 2008 01:22:32 -0500 Subject: [Python-checkins] Python Regression Test Failures doc dist (1) Message-ID: <20081127062232.GA8240@python.psfb.org> rm -rf dist mkdir -p dist # archive the HTML make html make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/html build/doctrees python tools/sphinx-build.py -b html -d build/doctrees -D latex_paper_size= . build/html Sphinx v0.5 (hg), building html loading pickled environment... done building [html]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished. The HTML pages are in build/html. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/html dist/python-docs-html tar -C dist -cf dist/python-docs-html.tar python-docs-html bzip2 -9 -k dist/python-docs-html.tar (cd dist; zip -q -r -9 python-docs-html.zip python-docs-html) rm -r dist/python-docs-html rm dist/python-docs-html.tar # archive the text build make text make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/text build/doctrees python tools/sphinx-build.py -b text -d build/doctrees -D latex_paper_size= . build/text Sphinx v0.5 (hg), building text loading pickled environment... done building [text]: targets for 0 source files that are out of date updating environment: 0 added, 0 changed, 0 removed no targets are out of date. Build finished; the text files are in build/text. make[1]: Leaving directory `/home/neal/python/r26/Doc' cp -pPR build/text dist/python-docs-text tar -C dist -cf dist/python-docs-text.tar python-docs-text bzip2 -9 -k dist/python-docs-text.tar (cd dist; zip -q -r -9 python-docs-text.zip python-docs-text) rm -r dist/python-docs-text rm dist/python-docs-text.tar # archive the A4 latex rm -r build/latex make latex PAPER=a4 make[1]: Entering directory `/home/neal/python/r26/Doc' mkdir -p build/latex build/doctrees python tools/sphinx-build.py -b latex -d build/doctrees -D latex_paper_size=a4 . build/latex Sphinx v0.5 (hg), building latex loading pickled environment... done building [latex]: all documents updating environment: 0 added, 0 changed, 0 removed processing c-api.tex... c-api/index c-api/intro c-api/veryhigh c-api/refcounting c-api/exceptions c-api/utilities c-api/sys c-api/import c-api/marshal c-api/arg c-api/conversion c-api/reflection c-api/abstract c-api/object c-api/number c-api/sequence c-api/mapping c-api/iter c-api/objbuffer c-api/concrete c-api/type c-api/none c-api/int c-api/bool c-api/long c-api/float c-api/complex c-api/bytearray c-api/string c-api/unicode c-api/buffer c-api/tuple c-api/list c-api/dict c-api/class c-api/function c-api/method c-api/file c-api/module c-api/iterator c-api/descriptor c-api/slice c-api/weakref c-api/cobject c-api/cell c-api/gen c-api/datetime c-api/set c-api/init c-api/memory c-api/objimpl c-api/allocation c-api/structures c-api/typeobj c-api/gcsupport resolving references... writing... done processing distutils.tex... distutils/index distutils/introduction distutils/setupscript distutils/configfile distutils/sourcedist distutils/builtdist distutils/packageindex distutils/uploading distutils/examples distutils/extending distutils/commandref distutils/apiref resolving references... writing... done processing documenting.tex... documenting/index documenting/intro documenting/style documenting/rest documenting/markup documenting/fromlatex documenting/sphinx resolving references... writing... done processing extending.tex... extending/index extending/extending extending/newtypes extending/building extending/windows extending/embedding resolving references... writing... done processing install.tex... install/index resolving references... writing... done processing library.tex... library/index library/intro library/functions library/constants library/objects library/stdtypes library/exceptions library/strings library/string library/re library/struct library/difflib library/stringio library/textwrap library/codecs library/unicodedata library/stringprep library/fpformat library/datatypes library/datetime library/calendar library/collections library/heapq library/bisect library/array library/sets library/sched library/mutex library/queue library/weakref library/userdict library/types library/new library/copy library/pprint library/repr library/numeric library/numbers library/math library/cmath library/decimal library/fractions library/random library/itertools library/functools library/operator library/filesys library/os.path library/fileinput library/stat library/statvfs library/filecmp library/tempfile library/glob library/fnmatch library/linecache library/shutil library/dircache library/macpath library/persistence library/pickle library/copy_reg library/shelve library/marshal library/anydbm library/whichdb library/dbm library/gdbm library/dbhash library/bsddb library/dumbdbm library/sqlite3 library/archiving library/zlib library/gzip library/bz2 library/zipfile library/tarfile library/fileformats library/csv library/configparser library/robotparser library/netrc library/xdrlib library/plistlib library/crypto library/hashlib library/hmac library/md5 library/sha library/allos library/os library/io library/time library/optparse library/getopt library/logging library/getpass library/curses library/curses.ascii library/curses.panel library/platform library/errno library/ctypes library/someos library/select library/threading library/thread library/dummy_threading library/dummy_thread library/multiprocessing library/mmap library/readline library/rlcompleter library/ipc library/subprocess library/socket library/ssl library/signal library/popen2 library/asyncore library/asynchat library/netdata library/email library/email.message library/email.parser library/email.generator library/email.mime library/email.header library/email.charset library/email.encoders library/email.errors library/email.util library/email.iterators library/email-examples library/json library/mailcap library/mailbox library/mhlib library/mimetools library/mimetypes library/mimewriter library/mimify library/multifile library/rfc822 library/base64 library/binhex library/binascii library/quopri library/uu library/markup library/htmlparser library/sgmllib library/htmllib library/pyexpat library/xml.dom library/xml.dom.minidom library/xml.dom.pulldom library/xml.sax library/xml.sax.handler library/xml.sax.utils library/xml.sax.reader library/xml.etree.elementtree library/internet library/webbrowser library/cgi library/cgitb library/wsgiref library/urllib library/urllib2 library/httplib library/ftplib library/poplib library/imaplib library/nntplib library/smtplib library/smtpd library/telnetlib library/uuid library/urlparse library/socketserver library/basehttpserver library/simplehttpserver library/cgihttpserver library/cookielib library/cookie library/xmlrpclib library/simplexmlrpcserver library/docxmlrpcserver library/mm library/audioop library/imageop library/aifc library/sunau library/wave library/chunk library/colorsys library/imghdr library/sndhdr library/ossaudiodev library/i18n library/gettext library/locale library/frameworks library/cmd library/shlex library/tk library/tkinter library/tix library/scrolledtext library/turtle library/idle library/othergui library/development library/pydoc library/doctest library/unittest library/2to3 library/test library/debug library/bdb library/pdb library/profile library/hotshot library/timeit library/trace library/python library/sys library/__builtin__ library/future_builtins library/__main__ library/warnings library/contextlib library/abc library/atexit library/traceback library/__future__ library/gc library/inspect library/site library/user library/fpectl library/custominterp library/code library/codeop library/restricted library/rexec library/bastion library/modules library/imp library/imputil library/zipimport library/pkgutil library/modulefinder library/runpy library/language library/parser library/ast library/symtable library/symbol library/token library/keyword library/tokenize library/tabnanny library/pyclbr library/py_compile library/compileall library/dis library/pickletools library/distutils library/compiler library/misc library/formatter library/windows library/msilib library/msvcrt library/_winreg library/winsound library/unix library/posix library/pwd library/spwd library/grp library/crypt library/dl library/termios library/tty library/pty library/fcntl library/pipes library/posixfile library/resource library/nis library/syslog library/commands library/mac library/ic library/macos library/macostools library/easydialogs library/framework library/autogil library/carbon library/colorpicker library/macosa library/gensuitemodule library/aetools library/aepack library/aetypes library/miniaeframe library/sgi library/al library/cd library/fl library/fm library/gl library/imgfile library/jpeg library/sun library/sunaudio library/undoc resolving references... writing... done processing reference.tex... reference/index reference/introduction reference/lexical_analysis reference/datamodel reference/executionmodel reference/expressions reference/simple_stmts reference/compound_stmts reference/toplevel_components reference/grammar resolving references... writing... done processing tutorial.tex... tutorial/index tutorial/appetite tutorial/interpreter tutorial/introduction tutorial/controlflow tutorial/datastructures tutorial/modules tutorial/inputoutput tutorial/errors tutorial/classes tutorial/stdlib tutorial/stdlib2 tutorial/whatnow tutorial/interactive tutorial/floatingpoint resolving references... writing... done processing using.tex... using/index using/cmdline using/unix using/windows using/mac resolving references... writing... done processing whatsnew.tex... whatsnew/2.6 resolving references... writing... done processing howto-doanddont.tex... howto/doanddont resolving references... writing... done processing howto-advocacy.tex... howto/advocacy resolving references... writing... done processing howto-functional.tex... howto/functional resolving references... writing... done processing howto-regex.tex... howto/regex resolving references... writing... done processing howto-sockets.tex... howto/sockets resolving references... writing... done processing howto-urllib2.tex... howto/urllib2 resolving references... writing... done processing howto-webservers.tex... howto/webservers resolving references... writing... done processing howto-curses.tex... howto/curses resolving references... writing... done processing howto-cporting.tex... howto/cporting resolving references... writing... done processing howto-unicode.tex... howto/unicode resolving references... writing... done copying TeX support files... done build succeeded. Build finished; the LaTeX files are in build/latex. Run `make all-pdf' or `make all-ps' in that directory to run these through (pdf)latex. make[1]: Leaving directory `/home/neal/python/r26/Doc' (cd build/latex; make clean && make all-pdf && make FMT=pdf zip bz2) make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' rm -f *.pdf *.dvi *.ps rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make[1]: Entering directory `/home/neal/python/r26/Doc/build/latex' pdflatex 'c-api.tex' This is pdfTeX, Version 3.14159-1.10b (Web2C 7.4.5) (./c-api.tex{/usr/share/texmf/pdftex/config/pdftex.cfg} LaTeX2e <2001/06/01> Babel and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (./manual.cls Document Class: manual 2008/10/18 Document class (Sphinx manual) (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo))) (/usr/share/texmf/tex/latex/base/inputenc.sty (/usr/share/texmf/tex/latex/base/utf8.def)) (/usr/share/texmf/tex/latex/base/fontenc.sty (/usr/share/texmf/tex/latex/base/t1enc.def)) (/usr/share/texmf/tex/generic/babel/babel.sty (/usr/share/texmf/tex/generic/babel/english.ldf (/usr/share/texmf/tex/generic/babel/babel.def))) (/usr/share/texmf/tex/latex/psnfss/times.sty) (./fncychap.sty) (./sphinx.sty (/usr/share/texmf/tex/latex/base/textcomp.sty (/usr/share/texmf/tex/latex/base/ts1enc.def)) (/usr/share/texmf/tex/latex/fancyhdr/fancyhdr.sty) (/usr/share/texmf/tex/latex/misc/fancybox.sty Style option: `fancybox' v1.3 <2000/09/19> (tvz) ) (/usr/share/texmf/tex/latex/titlesec/titlesec.sty) (./tabulary.sty (/usr/share/texmf/tex/latex/tools/array.sty)) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texmf/tex/latex/amsmath/amstext.sty (/usr/share/texmf/tex/latex/amsmath/amsgen.sty)) (/usr/share/texmf/tex/latex/amsmath/amsbsy.sty) (/usr/share/texmf/tex/latex/amsmath/amsopn.sty)) (/usr/share/texmf/tex/latex/base/makeidx.sty) (/usr/share/texmf/tex/latex/misc/framed.sty) (/usr/share/texmf/tex/latex/graphics/color.sty (/usr/share/texmf/tex/latex/config/color.cfg) (/usr/share/texmf/tex/latex/graphics/pdftex.def)) (/usr/share/texmf/tex/latex/fancyvrb/fancyvrb.sty Style option: `fancyvrb' v2.7, with DG/SPQR fixes <2000/03/21> (tvz) (/usr/share/texmf/tex/latex/graphics/keyval.sty)) (/usr/share/texmf/tex/latex/graphics/graphicx.sty (/usr/share/texmf/tex/latex/graphics/graphics.sty (/usr/share/texmf/tex/latex/graphics/trig.sty) (/usr/share/texmf/tex/latex/config/graphics.cfg))) (/usr/share/texmf/pdftex/plain/misc/pdfcolor.tex)) (/usr/share/texmf/tex/latex/hyperref/hyperref.sty (/usr/share/texmf/tex/latex/hyperref/pd1enc.def) (/usr/share/texmf/tex/latex/config/hyperref.cfg) Implicit mode ON; LaTeX internals redefined (/usr/share/texmf/tex/latex/html/url.sty)) *hyperref using default driver hpdftex* (/usr/share/texmf/tex/latex/hyperref/hpdftex.def (/usr/share/texmf/tex/latex/psnfss/pifont.sty (/usr/share/texmf/tex/latex/psnfss/upzd.fd) (/usr/share/texmf/tex/latex/psnfss/upsy.fd))) Writing index file c-api.idx No file c-api.aux. (/usr/share/texmf/tex/latex/base/ts1cmr.fd) (/usr/share/texmf/tex/latex/psnfss/t1ptm.fd) (/usr/share/texmf/tex/context/base/supp-pdf.tex (/usr/share/texmf/tex/context/base/supp-mis.tex loading : Context Support Macros / Missing ) loading : Context Support Macros / PDF ) (/usr/share/texmf/tex/latex/hyperref/nameref.sty) (/usr/share/texmf/tex/latex/psnfss/t1phv.fd) [1{/usr/share/texmf/dvips/config/p dftex.map}] [2] Adding blank page after the table of contents. ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.96 \tableofcontents [2] ! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [1] ! pdfTeX warning (ext4): destination with the same identifier (name{page.2}) ha s been already used, duplicate ignored \penalty l.116 \hypertarget{api-intro}{}\chapter {Introduction} [2] Chapter 1. (/usr/share/texmf/tex/latex/psnfss/t1pcr.fd) Underfull \hbox (badness 10000) in paragraph at lines 158--159 [3] [4] [5] [6] [7] [8] (/usr/share/texmf/tex/latex/psnfss/ts1ptm.fd) [9] [10] Chapter 2. [11] [12] [13] [14] Chapter 3. [15] [16] Chapter 4. [17] Overfull \hbox (14.2714pt too wide) in paragraph at lines 1304--1304 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 1304--1305 [][] [18] [19] [20] [21] [22] Chapter 5. [23] [24] [25] [26] [27] Underfull \hbox (badness 5359) in paragraph at lines 2168--2177 /ptmr8t/Return a Python ob-ject from the data stream in a /pcrr8t/FILE* /ptmr8t /opened for read-ing. Un-like Overfull \hbox (0.98854pt too wide) in paragraph at lines 2219--2225 [] [28] Underfull \hbox (badness 10000) in paragraph at lines 2262--2265 [] Underfull \hbox (badness 10000) in paragraph at lines 2280--2283 [] Overfull \hbox (79.5372pt too wide) in paragraph at lines 2285--2288 [] Underfull \hbox (badness 10000) in paragraph at lines 2316--2319 [] [29] [30] [31] Underfull \hbox (badness 6125) in paragraph at lines 2565--2567 []/ptmr8t/The call to [][]/pcrr8t/PyArg_UnpackTuple[][] /ptmr8t/in this ex-am-p le is en-tirely equiv-a-lent to this call to [32] [33] [34] [35] [36] Chapter 6. [37] [38] [39] [40] [41] [42] [43] [44] [45] [46] [47] [48] Chapter 7. Underfull \hbox (badness 10000) in paragraph at lines 3832--3833 [49] [50] [51] [52] [53] [54] [55] Overfull \hbox (14.2714pt too wide) in paragraph at lines 4691--4691 []/ptmr8t/Py_ssize_t| Overfull \hbox (24.99997pt too wide) in paragraph at lines 4691--4692 [][] [56] [57] [58] [59] Underfull \hbox (badness 8113) in paragraph at lines 5055--5058 /ptmr8t/Shortcut for /pcrr8t/PyUnicode_FromEncodedObject(obj, NULL, "strict") / ptmr8t/which is used [60] [61] [62] [63] [64] [65] [66] Underfull \hbox (badness 10000) in paragraph at lines 5654--5659 /ptmr8t/This con-stant may be passed as the /ptmri8t/size /ptmr8t/pa-ram-e-ter to [][]/pcrr8t/PyBuffer_FromObject[][] /ptmr8t/or [67] [68] [69] [70] [71] [72] [73] [74] [75] [76] Overfull \hbox (44.0pt too wide) in paragraph at lines 6577--6578 [] [77] [78] [79] [80] Underfull \hbox (badness 10000) in paragraph at lines 6959--6961 /ptmr8t/Return true if /ptmri8t/ob /ptmr8t/is of type /pcrr8t/PyDateTime_DateTi meType /ptmr8t/or a sub-type of [81] Underfull \hbox (badness 5548) in paragraph at lines 7118--7130 [][]/pcrr8t/PyObject_CallMethod[][]/ptmr8t/, [][]/pcrr8t/PyObject_RichCompareBo ol[][]/ptmr8t/, [][]/pcrr8t/PyObject_Hash[][]/ptmr8t/, [][]/pcrr8t/PyObject_Rep r[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 /ptmr8t/to-col (in-clud-ing [][]/pcrr8t/PyNumber_And[][]/ptmr8t/, [][]/pcrr8t/P yNumber_Subtract[][]/ptmr8t/, [][]/pcrr8t/PyNumber_Or[][]/ptmr8t/, [][]/pcrr8t/ PyNumber_Xor[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 7118--7130 [][]/pcrr8t/PyNumber_InPlaceAnd[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceSubtra ct[][]/ptmr8t/, [][]/pcrr8t/PyNumber_InPlaceOr[][]/ptmr8t/, and [82] [83] [84] Chapter 8. [85] [86] Underfull \hbox (badness 10000) in paragraph at lines 7519--7523 []/pcrr8t/'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam' []/pt mr8t/The re- [87] [88] [89] [90] Underfull \hbox (badness 10000) in paragraph at lines 7820--7823 /ptmr8t/This macro ex-pands to /pcrr8t/PyEval_RestoreThread(_save);/ptmr8t/: it is equiv-a-lent to Underfull \hbox (badness 10000) in paragraph at lines 7827--7830 /ptmr8t/This macro ex-pands to /pcrr8t/_save = PyEval_SaveThread();/ptmr8t/: it is equiv-a-lent to [91] [92] [93] [94] Chapter 9. [95] [96] [97] [98] Chapter 10. Underfull \hbox (badness 10000) in paragraph at lines 8404--8404 Underfull \hbox (badness 10000) in paragraph at lines 8407--8407 [99] [100] [101] [102] [103] [104] [105] Underfull \hbox (badness 10000) in paragraph at lines 9007--9017 []/ptmr8t/The print func-tion is called with the same sig-na-ture as [][]/pcrr8 t/PyObject_Print[][]/ptmr8t/: /pcrr8t/int [106] [107] Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /ptmr8t/the fields /pcrr8t/nb_inplace_add/ptmr8t/, /pcrr8t/nb_inplace_subtract/ ptmr8t/, /pcrr8t/nb_inplace_multiply/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9255--9266 /pcrr8t/nb_inplace_divide/ptmr8t/, /pcrr8t/nb_inplace_remainder/ptmr8t/, /pcrr8 t/nb_inplace_power/ptmr8t/, Underfull \hbox (badness 5637) in paragraph at lines 9302--9308 /ptmr8t/If this bit is set, the type ob-ject has sev-eral new fields de-fined s tart-ing in Python [108] Underfull \hbox (badness 6300) in paragraph at lines 9353--9359 /ptmr8t/This is a bit-mask of all the bits that per-tain to the ex-is-tence of cer-tain fields in Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/the type ob-ject and its ex-ten-sion struc-tures. Cur-rently, it in-clu des the fol-low-ing Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 /ptmr8t/bits: [][]/pcrr8t/Py_TPFLAGS_HAVE_GETCHARBUFFER[][]/ptmr8t/, [][]/pcrr8 t/Py_TPFLAGS_HAVE_SEQUENCE_IN[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_INPLACEOPS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE _RICHCOMPARE[][]/ptmr8t/, Underfull \hbox (badness 10000) in paragraph at lines 9353--9359 [][]/pcrr8t/Py_TPFLAGS_HAVE_WEAKREFS[][]/ptmr8t/, [][]/pcrr8t/Py_TPFLAGS_HAVE_I TER[][]/ptmr8t/, and [109] Underfull \hbox (badness 10000) in paragraph at lines 9477--9479 /ptmr8t/An op-tional pointer to the rich com-par-i-son func-tion, whose sig-na- ture is /pcrr8t/PyObject [110] [111] [112] [113] [114] [115] [116] [117] [118] [119] [120] Appendix A. [121] [122] [123] [124] [125] [126] Appendix B. ! Package inputenc Error: Unicode char \u8:^^c3^^ba not set up for use with LaT eX. See the inputenc package documentation for explanation. Type H for immediate help. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ? ! Emergency stop. ... l.11010 ...r Andrich, Heidi Annexstad, Jes^^c3^^ba s Cea Avi^^c3^^b3n, Daniel... ! ==> Fatal error occurred, the output PDF file is not finished! Transcript written on c-api.log. make[1]: *** [c-api.pdf] Error 1 make[1]: Leaving directory `/home/neal/python/r26/Doc/build/latex' make: *** [dist] Error 2 From python-checkins at python.org Thu Nov 27 08:45:25 2008 From: python-checkins at python.org (matthias.klose) Date: Thu, 27 Nov 2008 08:45:25 +0100 (CET) Subject: [Python-checkins] r67407 - python/trunk/Modules/Setup.dist Message-ID: <20081127074525.D8B1E1E4002@bag.python.org> Author: matthias.klose Date: Thu Nov 27 08:45:25 2008 New Revision: 67407 Log: - Modules/Setup.dist: Update pyexpat Modified: python/trunk/Modules/Setup.dist Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Thu Nov 27 08:45:25 2008 @@ -180,7 +180,7 @@ #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations #_functools _functoolsmodule.c # Tools for working with functions and callable objects -#_elementtreee _elementtree.c # elementtree accelerator +#_elementtree _elementtree.c # elementtree accelerator #_pickle _pickle.c # pickle accelerator #unicodedata unicodedata.c # static Unicode character database @@ -471,8 +471,7 @@ # # More information on Expat can be found at www.libexpat.org. # -#EXPAT_DIR=/usr/local/src/expat-1.95.2 -#pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat +#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI # Hye-Shik Chang's CJKCodecs From python-checkins at python.org Thu Nov 27 08:47:39 2008 From: python-checkins at python.org (matthias.klose) Date: Thu, 27 Nov 2008 08:47:39 +0100 (CET) Subject: [Python-checkins] r67408 - python/branches/release26-maint/Modules/Setup.dist Message-ID: <20081127074739.7FD521E4002@bag.python.org> Author: matthias.klose Date: Thu Nov 27 08:47:39 2008 New Revision: 67408 Log: - Modules/Setup.dist: Update pyexpat Modified: python/branches/release26-maint/Modules/Setup.dist Modified: python/branches/release26-maint/Modules/Setup.dist ============================================================================== --- python/branches/release26-maint/Modules/Setup.dist (original) +++ python/branches/release26-maint/Modules/Setup.dist Thu Nov 27 08:47:39 2008 @@ -180,7 +180,7 @@ #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations #_functools _functoolsmodule.c # Tools for working with functions and callable objects -#_elementtreee _elementtree.c # elementtree accelerator +#_elementtree _elementtree.c # elementtree accelerator #_pickle _pickle.c # pickle accelerator #unicodedata unicodedata.c # static Unicode character database @@ -471,8 +471,7 @@ # # More information on Expat can be found at www.libexpat.org. # -#EXPAT_DIR=/usr/local/src/expat-1.95.2 -#pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat +#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI # Hye-Shik Chang's CJKCodecs From buildbot at python.org Thu Nov 27 09:06:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 08:06:30 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 3.0 Message-ID: <20081127080631.1CCFE1E4002@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/457 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: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_threadedtempfile sincerely, -The Buildbot From buildbot at python.org Thu Nov 27 09:07:54 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 08:07:54 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081127080754.AAFEE1E4002@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/1319 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: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 27 09:14:33 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 08:14:33 +0000 Subject: [Python-checkins] buildbot failure in x86 OpenBSD trunk Message-ID: <20081127081433.B55A91E4002@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/410 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,matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Thu Nov 27 09:33:18 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 08:33:18 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081127083318.4D4271E4002@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/344 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,matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 522, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ftplib.py", line 203, in run asyncore.loop(timeout=0.1, count=1) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 204, in loop poll_fun(timeout, map) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 141, in poll read(obj) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 78, in read obj.handle_error() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 74, in read obj.handle_read_event() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 413, in handle_read_event self.handle_read() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ssl.py", line 408, in handle_read self.send(data.lower()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 519, in send self.initiate_send() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 506, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 349, in send result = self.socket.send(data) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/socket.py", line 165, in _dummy raise error(EBADF, 'Bad file descriptor') error: [Errno 9] Bad file descriptor 2 tests failed: test_ftplib test_socket ====================================================================== ERROR: testShutdown (test.test_socket.BasicTCPTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socket.py", line 120, in _tearDown self.fail(msg) AssertionError: [Errno 57] Socket is not connected make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 27 10:06:17 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 09:06:17 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081127090617.83B6B1E4002@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/713 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 failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Nov 27 11:14:23 2008 From: python-checkins at python.org (matthias.klose) Date: Thu, 27 Nov 2008 11:14:23 +0100 (CET) Subject: [Python-checkins] r67411 - python/trunk/Modules/Setup.dist Message-ID: <20081127101423.282ED1E4002@bag.python.org> Author: matthias.klose Date: Thu Nov 27 11:14:22 2008 New Revision: 67411 Log: - Modules/Setup.dist: Update _elementtree, add _bisect, datetime Modified: python/trunk/Modules/Setup.dist Modified: python/trunk/Modules/Setup.dist ============================================================================== --- python/trunk/Modules/Setup.dist (original) +++ python/trunk/Modules/Setup.dist Thu Nov 27 11:14:22 2008 @@ -180,8 +180,10 @@ #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations #_functools _functoolsmodule.c # Tools for working with functions and callable objects -#_elementtree _elementtree.c # elementtree accelerator +#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator #_pickle _pickle.c # pickle accelerator +#datetime datetimemodule.c # date/time type +#_bisect _bisectmodule.c # Bisection algorithms #unicodedata unicodedata.c # static Unicode character database From python-checkins at python.org Thu Nov 27 11:15:13 2008 From: python-checkins at python.org (matthias.klose) Date: Thu, 27 Nov 2008 11:15:13 +0100 (CET) Subject: [Python-checkins] r67412 - python/branches/release26-maint/Modules/Setup.dist Message-ID: <20081127101513.22B271E4002@bag.python.org> Author: matthias.klose Date: Thu Nov 27 11:15:12 2008 New Revision: 67412 Log: - Modules/Setup.dist: Update _elementtree, add _bisect, datetime Modified: python/branches/release26-maint/Modules/Setup.dist Modified: python/branches/release26-maint/Modules/Setup.dist ============================================================================== --- python/branches/release26-maint/Modules/Setup.dist (original) +++ python/branches/release26-maint/Modules/Setup.dist Thu Nov 27 11:15:12 2008 @@ -180,8 +180,10 @@ #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations #_functools _functoolsmodule.c # Tools for working with functions and callable objects -#_elementtree _elementtree.c # elementtree accelerator +#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator #_pickle _pickle.c # pickle accelerator +#datetime datetimemodule.c # date/time type +#_bisect _bisectmodule.c # Bisection algorithms #unicodedata unicodedata.c # static Unicode character database From buildbot at python.org Thu Nov 27 12:05:53 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 11:05:53 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081127110553.325D71E400C@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/335 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Thu Nov 27 12:19:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 11:19:02 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081127111903.9A0B71E4002@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/797 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: 1 test failed: test_timeout make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Nov 27 14:10:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Thu, 27 Nov 2008 13:10:30 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian trunk Message-ID: <20081127131030.D5AA81E4002@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/837 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: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_subprocess make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Nov 27 20:06:38 2008 From: python-checkins at python.org (georg.brandl) Date: Thu, 27 Nov 2008 20:06:38 +0100 (CET) Subject: [Python-checkins] r67413 - python/branches/release26-maint/Doc/conf.py Message-ID: <20081127190638.01FE61E400C@bag.python.org> Author: georg.brandl Date: Thu Nov 27 20:06:37 2008 New Revision: 67413 Log: Try using utf8x input encoding. Modified: python/branches/release26-maint/Doc/conf.py Modified: python/branches/release26-maint/Doc/conf.py ============================================================================== --- python/branches/release26-maint/Doc/conf.py (original) +++ python/branches/release26-maint/Doc/conf.py Thu Nov 27 20:06:37 2008 @@ -145,6 +145,8 @@ # Documents to append as an appendix to all manuals. latex_appendices = ['glossary', 'about', 'license', 'copyright'] +latex_elements = {'inputenc': '\\usepackage[utf8x]{inputenc}'} + # Options for the coverage checker # -------------------------------- From python-checkins at python.org Fri Nov 28 12:02:32 2008 From: python-checkins at python.org (christian.heimes) Date: Fri, 28 Nov 2008 12:02:32 +0100 (CET) Subject: [Python-checkins] r67414 - in python/trunk: Lib/distutils/msvc9compiler.py Misc/NEWS Message-ID: <20081128110232.C7BEC1E4002@bag.python.org> Author: christian.heimes Date: Fri Nov 28 12:02:32 2008 New Revision: 67414 Log: Fixed issue ##3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception Modified: python/trunk/Lib/distutils/msvc9compiler.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/msvc9compiler.py ============================================================================== --- python/trunk/Lib/distutils/msvc9compiler.py (original) +++ python/trunk/Lib/distutils/msvc9compiler.py Fri Nov 28 12:02:32 2008 @@ -316,7 +316,7 @@ self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS - self.__path = [] + self.__paths = [] # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.__arch = None # deprecated name Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Nov 28 12:02:32 2008 @@ -57,6 +57,9 @@ Library ------- +- Issue #3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an + exception. + - Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if the ctypes module is not present. From python-checkins at python.org Fri Nov 28 12:03:48 2008 From: python-checkins at python.org (christian.heimes) Date: Fri, 28 Nov 2008 12:03:48 +0100 (CET) Subject: [Python-checkins] r67415 - in python/branches/release26-maint: Lib/distutils/msvc9compiler.py Misc/NEWS Message-ID: <20081128110348.562E31E4002@bag.python.org> Author: christian.heimes Date: Fri Nov 28 12:03:48 2008 New Revision: 67415 Log: Merged revisions 67414 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67414 | christian.heimes | 2008-11-28 12:02:32 +0100 (Fri, 28 Nov 2008) | 1 line Fixed issue ##3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/distutils/msvc9compiler.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/distutils/msvc9compiler.py ============================================================================== --- python/branches/release26-maint/Lib/distutils/msvc9compiler.py (original) +++ python/branches/release26-maint/Lib/distutils/msvc9compiler.py Fri Nov 28 12:03:48 2008 @@ -316,7 +316,7 @@ self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS - self.__path = [] + self.__paths = [] # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.__arch = None # deprecated name Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Fri Nov 28 12:03:48 2008 @@ -52,6 +52,9 @@ Library ------- +- Issue #3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an + exception. + - Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if the ctypes module is not present. From buildbot at python.org Fri Nov 28 12:55:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 11:55:43 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081128115543.C09D31E4002@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/1090 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: christian.heimes BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From buildbot at python.org Fri Nov 28 12:58:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 11:58:02 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI trunk Message-ID: <20081128115803.0EEC11E4002@bag.python.org> The Buildbot has detected a new failure of ARM Linux EABI trunk. Full details are available at: http://www.python.org/dev/buildbot/all/ARM%20Linux%20EABI%20trunk/builds/79 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-linux-armeabi Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: christian.heimes BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Fri Nov 28 19:22:54 2008 From: python-checkins at python.org (jesse.noller) Date: Fri, 28 Nov 2008 19:22:54 +0100 (CET) Subject: [Python-checkins] r67419 - in python/trunk/Doc: includes/mp_distributing.py library/multiprocessing.rst Message-ID: <20081128182254.6C2911E4002@bag.python.org> Author: jesse.noller Date: Fri Nov 28 19:22:54 2008 New Revision: 67419 Log: mp docs - fix issues 4012,3518,4193 Modified: python/trunk/Doc/includes/mp_distributing.py python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/includes/mp_distributing.py ============================================================================== --- python/trunk/Doc/includes/mp_distributing.py (original) +++ python/trunk/Doc/includes/mp_distributing.py Fri Nov 28 19:22:54 2008 @@ -37,7 +37,6 @@ _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) Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Fri Nov 28 19:22:54 2008 @@ -26,6 +26,29 @@ import it will result in an :exc:`ImportError`. See :issue:`3770` for additional information. +.. note:: + + Functionality within this package requires that the ``__main__`` method be + importable by the children. This is covered in :ref:`multiprocessing-programming` + however it is worth pointing out here. This means that some examples, such + as the :class:`multiprocessing.Pool` examples will not work in the + interactive interpreter. For example:: + + >>> from multiprocessing import Pool + >>> p = Pool(5) + >>> def f(x): + ... return x*x + ... + >>> p.map(f, [1,2,3]) + Process PoolWorker-1: + Process PoolWorker-2: + Traceback (most recent call last): + Traceback (most recent call last): + AttributeError: 'module' object has no attribute 'f' + AttributeError: 'module' object has no attribute 'f' + AttributeError: 'module' object has no attribute 'f' + + The :class:`Process` class ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -34,17 +57,36 @@ follows the API of :class:`threading.Thread`. A trivial example of a multiprocess program is :: - from multiprocessing import Process + from multiprocessing import Process - def f(name): - print 'hello', name + def f(name): + print 'hello', name - if __name__ == '__main__': - p = Process(target=f, args=('bob',)) - p.start() - p.join() + if __name__ == '__main__': + p = Process(target=f, args=('bob',)) + p.start() + p.join() -Here the function ``f`` is run in a child process. +To show the individual process IDs involved, here is an expanded example:: + + from multiprocessing import Process + import os + + def info(title): + print title + print 'module name:', __name__ + print 'parent process:', os.getppid() + print 'process id:', os.getpid() + + def f(name): + info('function f') + print 'hello', name + + if __name__ == '__main__': + info('main line') + p = Process(target=f, args=('bob',)) + p.start() + p.join() For an explanation of why (on Windows) the ``if __name__ == '__main__'`` part is necessary, see :ref:`multiprocessing-programming`. @@ -234,7 +276,7 @@ if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes - result = pool.applyAsync(f, [10]) # evaluate "f(10)" asynchronously + result = pool.apply_async(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]" @@ -307,7 +349,7 @@ semantics. Multiple processes may be given the same name. The initial name is set by the constructor. - .. method:: is_alive() + .. method:: is_alive Return whether the process is alive. @@ -816,6 +858,9 @@ 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 that on OS/X ``sem_timedwait`` is unsupported, so timeout arguments + for these will be ignored. .. note:: @@ -1089,6 +1134,27 @@ 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:: get_server() + + Returns a :class:`Server` object which represents the actual server under + the control of the Manager. The :class:`Server` object supports the + :meth:`serve_forever` method:: + + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address=('', 50000), authkey='abc')) + >>> server = m.get_server() + >>> s.serve_forever() + + :class:`Server` additionally have an :attr:`address` attribute. + + .. method:: connect() + + Connect a local manager object to a remote manager process:: + + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address='127.0.0.1', authkey='abc)) + >>> m.connect() + .. method:: shutdown() Stop the process used by the manager. This is only available if @@ -1267,19 +1333,20 @@ >>> queue = Queue.Queue() >>> class QueueManager(BaseManager): pass ... - >>> QueueManager.register('getQueue', callable=lambda:queue) + >>> QueueManager.register('get_queue', callable=lambda:queue) >>> m = QueueManager(address=('', 50000), authkey='abracadabra') - >>> m.serveForever() + >>> s = m.get_server() + >>> s.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() + >>> QueueManager.register('get_queue') + >>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra') + >>> m.connect() + >>> queue = m.get_queue() >>> queue.put('hello') Another client can also use it:: @@ -1293,6 +1360,27 @@ >>> queue.get() 'hello' +Local processes can also access that queue, using the code from above on the +client to access it remotely:: + + >>> from multiprocessing import Process, Queue + >>> from multiprocessing.managers import BaseManager + >>> class Worker(Process): + ... def __init__(self, q): + ... self.q = q + ... super(Worker, self).__init__() + ... def run(self): + ... self.q.put('local hello') + ... + >>> queue = Queue() + >>> w = Worker(queue) + >>> w.start() + >>> class QueueManager(BaseManager): pass + ... + >>> QueueManager.register('get_queue', callable=lambda: queue) + >>> m = QueueManager(address=('', 50000), authkey='abracadabra') + >>> s = m.get_server() + >>> s.serve_forever() Proxy Objects ~~~~~~~~~~~~~ @@ -1507,7 +1595,7 @@ The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool.map_async`. - .. method:: get([timeout) + .. method:: get([timeout]) Return the result when it arrives. If *timeout* is not ``None`` and the result does not arrive within *timeout* seconds then @@ -1537,7 +1625,7 @@ if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes - result = pool.applyAsync(f, (10,)) # evaluate "f(10)" asynchronously + result = pool.apply_async(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]" @@ -1548,7 +1636,7 @@ print it.next(timeout=1) # prints "4" unless your computer is *very* slow import time - result = pool.applyAsync(time.sleep, (10,)) + result = pool.apply_async(time.sleep, (10,)) print result.get(timeout=1) # raises TimeoutError From python-checkins at python.org Fri Nov 28 19:37:07 2008 From: python-checkins at python.org (jesse.noller) Date: Fri, 28 Nov 2008 19:37:07 +0100 (CET) Subject: [Python-checkins] r67420 - in python/branches/release26-maint: Doc/includes/mp_distributing.py Doc/library/multiprocessing.rst Message-ID: <20081128183707.208B01E4002@bag.python.org> Author: jesse.noller Date: Fri Nov 28 19:37:06 2008 New Revision: 67420 Log: Merge r67419 - mp doc fixes Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/includes/mp_distributing.py python/branches/release26-maint/Doc/library/multiprocessing.rst Modified: python/branches/release26-maint/Doc/includes/mp_distributing.py ============================================================================== --- python/branches/release26-maint/Doc/includes/mp_distributing.py (original) +++ python/branches/release26-maint/Doc/includes/mp_distributing.py Fri Nov 28 19:37:06 2008 @@ -37,7 +37,6 @@ _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) Modified: python/branches/release26-maint/Doc/library/multiprocessing.rst ============================================================================== --- python/branches/release26-maint/Doc/library/multiprocessing.rst (original) +++ python/branches/release26-maint/Doc/library/multiprocessing.rst Fri Nov 28 19:37:06 2008 @@ -26,6 +26,29 @@ import it will result in an :exc:`ImportError`. See :issue:`3770` for additional information. +.. note:: + + Functionality within this package requires that the ``__main__`` method be + importable by the children. This is covered in :ref:`multiprocessing-programming` + however it is worth pointing out here. This means that some examples, such + as the :class:`multiprocessing.Pool` examples will not work in the + interactive interpreter. For example:: + + >>> from multiprocessing import Pool + >>> p = Pool(5) + >>> def f(x): + ... return x*x + ... + >>> p.map(f, [1,2,3]) + Process PoolWorker-1: + Process PoolWorker-2: + Traceback (most recent call last): + Traceback (most recent call last): + AttributeError: 'module' object has no attribute 'f' + AttributeError: 'module' object has no attribute 'f' + AttributeError: 'module' object has no attribute 'f' + + The :class:`Process` class ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -34,17 +57,36 @@ follows the API of :class:`threading.Thread`. A trivial example of a multiprocess program is :: - from multiprocessing import Process + from multiprocessing import Process - def f(name): - print 'hello', name + def f(name): + print 'hello', name - if __name__ == '__main__': - p = Process(target=f, args=('bob',)) - p.start() - p.join() + if __name__ == '__main__': + p = Process(target=f, args=('bob',)) + p.start() + p.join() -Here the function ``f`` is run in a child process. +To show the individual process IDs involved, here is an expanded example:: + + from multiprocessing import Process + import os + + def info(title): + print title + print 'module name:', __name__ + print 'parent process:', os.getppid() + print 'process id:', os.getpid() + + def f(name): + info('function f') + print 'hello', name + + if __name__ == '__main__': + info('main line') + p = Process(target=f, args=('bob',)) + p.start() + p.join() For an explanation of why (on Windows) the ``if __name__ == '__main__'`` part is necessary, see :ref:`multiprocessing-programming`. @@ -234,7 +276,7 @@ if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes - result = pool.applyAsync(f, [10]) # evaluate "f(10)" asynchronously + result = pool.apply_async(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]" @@ -307,7 +349,7 @@ semantics. Multiple processes may be given the same name. The initial name is set by the constructor. - .. method:: is_alive() + .. method:: is_alive Return whether the process is alive. @@ -816,6 +858,9 @@ 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 that on OS/X ``sem_timedwait`` is unsupported, so timeout arguments + for these will be ignored. .. note:: @@ -1089,6 +1134,27 @@ 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:: get_server() + + Returns a :class:`Server` object which represents the actual server under + the control of the Manager. The :class:`Server` object supports the + :meth:`serve_forever` method:: + + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address=('', 50000), authkey='abc')) + >>> server = m.get_server() + >>> s.serve_forever() + + :class:`Server` additionally have an :attr:`address` attribute. + + .. method:: connect() + + Connect a local manager object to a remote manager process:: + + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address='127.0.0.1', authkey='abc)) + >>> m.connect() + .. method:: shutdown() Stop the process used by the manager. This is only available if @@ -1267,19 +1333,20 @@ >>> queue = Queue.Queue() >>> class QueueManager(BaseManager): pass ... - >>> QueueManager.register('getQueue', callable=lambda:queue) + >>> QueueManager.register('get_queue', callable=lambda:queue) >>> m = QueueManager(address=('', 50000), authkey='abracadabra') - >>> m.serveForever() + >>> s = m.get_server() + >>> s.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() + >>> QueueManager.register('get_queue') + >>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra') + >>> m.connect() + >>> queue = m.get_queue() >>> queue.put('hello') Another client can also use it:: @@ -1293,6 +1360,27 @@ >>> queue.get() 'hello' +Local processes can also access that queue, using the code from above on the +client to access it remotely:: + + >>> from multiprocessing import Process, Queue + >>> from multiprocessing.managers import BaseManager + >>> class Worker(Process): + ... def __init__(self, q): + ... self.q = q + ... super(Worker, self).__init__() + ... def run(self): + ... self.q.put('local hello') + ... + >>> queue = Queue() + >>> w = Worker(queue) + >>> w.start() + >>> class QueueManager(BaseManager): pass + ... + >>> QueueManager.register('get_queue', callable=lambda: queue) + >>> m = QueueManager(address=('', 50000), authkey='abracadabra') + >>> s = m.get_server() + >>> s.serve_forever() Proxy Objects ~~~~~~~~~~~~~ @@ -1507,7 +1595,7 @@ The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool.map_async`. - .. method:: get([timeout) + .. method:: get([timeout]) Return the result when it arrives. If *timeout* is not ``None`` and the result does not arrive within *timeout* seconds then @@ -1537,7 +1625,7 @@ if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes - result = pool.applyAsync(f, (10,)) # evaluate "f(10)" asynchronously + result = pool.apply_async(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]" @@ -1548,7 +1636,7 @@ print it.next(timeout=1) # prints "4" unless your computer is *very* slow import time - result = pool.applyAsync(time.sleep, (10,)) + result = pool.apply_async(time.sleep, (10,)) print result.get(timeout=1) # raises TimeoutError From python-checkins at python.org Fri Nov 28 19:59:35 2008 From: python-checkins at python.org (jesse.noller) Date: Fri, 28 Nov 2008 19:59:35 +0100 (CET) Subject: [Python-checkins] r67423 - python/trunk/Lib/multiprocessing/__init__.py Message-ID: <20081128185935.A6F6D1E4002@bag.python.org> Author: jesse.noller Date: Fri Nov 28 19:59:35 2008 New Revision: 67423 Log: issue4238: bsd support for cpu_count Modified: python/trunk/Lib/multiprocessing/__init__.py Modified: python/trunk/Lib/multiprocessing/__init__.py ============================================================================== --- python/trunk/Lib/multiprocessing/__init__.py (original) +++ python/trunk/Lib/multiprocessing/__init__.py Fri Nov 28 19:59:35 2008 @@ -113,7 +113,7 @@ num = int(os.environ['NUMBER_OF_PROCESSORS']) except (ValueError, KeyError): num = 0 - elif sys.platform == 'darwin': + elif 'bsd' in sys.platform or sys.platform == 'darwin': try: num = int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: From buildbot at python.org Fri Nov 28 20:09:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 19:09:12 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081128190912.7142C1E4023@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/1322 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: christian.heimes,jesse.noller BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Nov 28 20:33:33 2008 From: python-checkins at python.org (christian.heimes) Date: Fri, 28 Nov 2008 20:33:33 +0100 (CET) Subject: [Python-checkins] r67424 - in python/trunk/Doc/includes: mp_benchmarks.py mp_distributing.py mp_newtype.py mp_pool.py mp_synchronize.py mp_webserver.py mp_workers.py Message-ID: <20081128193333.F30711E4002@bag.python.org> Author: christian.heimes Date: Fri Nov 28 20:33:33 2008 New Revision: 67424 Log: Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5 Modified: 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 Modified: python/trunk/Doc/includes/mp_benchmarks.py ============================================================================== --- python/trunk/Doc/includes/mp_benchmarks.py (original) +++ python/trunk/Doc/includes/mp_benchmarks.py Fri Nov 28 20:33:33 2008 @@ -1,6 +1,9 @@ # # Simple benchmarks for the multiprocessing package # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time, sys, multiprocessing, threading, Queue, gc Modified: python/trunk/Doc/includes/mp_distributing.py ============================================================================== --- python/trunk/Doc/includes/mp_distributing.py (original) +++ python/trunk/Doc/includes/mp_distributing.py Fri Nov 28 20:33:33 2008 @@ -3,6 +3,9 @@ # # Depends on `multiprocessing` package -- tested with `processing-0.60` # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# __all__ = ['Cluster', 'Host', 'get_logger', 'current_process'] Modified: python/trunk/Doc/includes/mp_newtype.py ============================================================================== --- python/trunk/Doc/includes/mp_newtype.py (original) +++ python/trunk/Doc/includes/mp_newtype.py Fri Nov 28 20:33:33 2008 @@ -2,6 +2,9 @@ # This module shows how to use arbitrary callables with a subclass of # `BaseManager`. # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# from multiprocessing import freeze_support from multiprocessing.managers import BaseManager, BaseProxy Modified: python/trunk/Doc/includes/mp_pool.py ============================================================================== --- python/trunk/Doc/includes/mp_pool.py (original) +++ python/trunk/Doc/includes/mp_pool.py Fri Nov 28 20:33:33 2008 @@ -1,6 +1,9 @@ # # A test of `multiprocessing.Pool` class # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import multiprocessing import time Modified: python/trunk/Doc/includes/mp_synchronize.py ============================================================================== --- python/trunk/Doc/includes/mp_synchronize.py (original) +++ python/trunk/Doc/includes/mp_synchronize.py Fri Nov 28 20:33:33 2008 @@ -1,6 +1,9 @@ # # A test file for the `multiprocessing` package # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time, sys, random from Queue import Empty Modified: python/trunk/Doc/includes/mp_webserver.py ============================================================================== --- python/trunk/Doc/includes/mp_webserver.py (original) +++ python/trunk/Doc/includes/mp_webserver.py Fri Nov 28 20:33:33 2008 @@ -8,6 +8,9 @@ # Not sure if we should synchronize access to `socket.accept()` method by # using a process-shared lock -- does not seem to be necessary. # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import os import sys Modified: python/trunk/Doc/includes/mp_workers.py ============================================================================== --- python/trunk/Doc/includes/mp_workers.py (original) +++ python/trunk/Doc/includes/mp_workers.py Fri Nov 28 20:33:33 2008 @@ -7,6 +7,9 @@ # in the original order then consider using `Pool.map()` or # `Pool.imap()` (which will save on the amount of code needed anyway). # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time import random From buildbot at python.org Fri Nov 28 20:35:15 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 19:35:15 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081128193516.2A3221E4002@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/347 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: jesse.noller 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 Nov 28 21:16:02 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 20:16:02 +0000 Subject: [Python-checkins] buildbot failure in ARM Linux EABI 3.0 Message-ID: <20081128201602.A693F1E4002@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/106 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: christian.heimes,jesse.noller BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Nov 28 23:01:40 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 28 Nov 2008 23:01:40 +0100 (CET) Subject: [Python-checkins] r67426 - in sandbox/trunk/2to3/lib2to3: fixes/fix_imports.py tests/test_fixers.py Message-ID: <20081128220140.BB3431E4002@bag.python.org> Author: benjamin.peterson Date: Fri Nov 28 23:01:40 2008 New Revision: 67426 Log: don't replace a module name if it is in the middle of a attribute lookup This fix also stops module names from being replaced if they are not in an attribute lookup. Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py 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 Fri Nov 28 23:01:40 2008 @@ -76,10 +76,7 @@ """ % mod_list # Find usages of module members in code e.g. thread.foo(bar) - # We differentiate between "bare_with_attr" and "bare_name" for the benfit - # of the match() override in FixImports. yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names - yield "bare_name=(%s)" % bare_names class FixImports(fixer_base.BaseFix): @@ -126,8 +123,7 @@ import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) else: # Replace usage of the module. - bare_name = results.get("bare_with_attr") or results.get("bare_name") - bare_name = bare_name[0] + bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) 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 Fri Nov 28 23:01:40 2008 @@ -1509,6 +1509,16 @@ """ % (new, new, new) self.check(b, a) + b = """ + import %s + x.%s + """ % (old, old) + a = """ + import %s + x.%s + """ % (new, old) + self.check(b, a) + class Test_imports2(Test_imports): From python-checkins at python.org Fri Nov 28 23:07:41 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 28 Nov 2008 23:07:41 +0100 (CET) Subject: [Python-checkins] r67427 - sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Message-ID: <20081128220741.CD3DA1E4002@bag.python.org> Author: benjamin.peterson Date: Fri Nov 28 23:07:41 2008 New Revision: 67427 Log: fix spelling in comment Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py 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 Fri Nov 28 23:07:41 2008 @@ -100,8 +100,8 @@ match = super(FixImports, self).match results = match(node) if results: - # Module usage could be in the trailier of an attribute lookup, so - # we might have nested matches when "bare_with_attr" is present. + # Module usage could be in the trailer of an attribute lookup, so we + # might have nested matches when "bare_with_attr" is present. if "bare_with_attr" not in results and \ any([match(obj) for obj in attr_chain(node, "parent")]): return False From python-checkins at python.org Fri Nov 28 23:12:14 2008 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 28 Nov 2008 23:12:14 +0100 (CET) Subject: [Python-checkins] r67428 - in python/trunk/Lib/lib2to3: fixer_base.py fixer_util.py fixes/fix_dict.py fixes/fix_except.py fixes/fix_imports.py fixes/fix_imports2.py fixes/fix_next.py fixes/fix_numliterals.py fixes/fix_renames.py fixes/fix_urllib.py pgen2/parse.py pytree.py refactor.py tests tests/data tests/test_fixers.py tests/test_refactor.py Message-ID: <20081128221214.DB1B71E4002@bag.python.org> Author: benjamin.peterson Date: Fri Nov 28 23:12:14 2008 New Revision: 67428 Log: Merged revisions 67384,67386-67387,67389-67390,67392,67399-67400,67403-67405,67426 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r67384 | benjamin.peterson | 2008-11-25 16:13:31 -0600 (Tue, 25 Nov 2008) | 4 lines don't duplicate calls to start_tree() RefactoringTool.pre_order values now holds a list of the fixers while pre_order_mapping holds the dict. ........ r67386 | benjamin.peterson | 2008-11-25 16:44:52 -0600 (Tue, 25 Nov 2008) | 1 line #4423 fix_imports was still replacing usage of a module if attributes were being used ........ r67387 | benjamin.peterson | 2008-11-25 16:47:54 -0600 (Tue, 25 Nov 2008) | 1 line fix broken test ........ r67389 | benjamin.peterson | 2008-11-25 17:13:17 -0600 (Tue, 25 Nov 2008) | 1 line remove compatibility code; we only cater to 2.5+ ........ r67390 | benjamin.peterson | 2008-11-25 22:03:36 -0600 (Tue, 25 Nov 2008) | 1 line fix #3994; the usage of changed imports was fixed in nested cases ........ r67392 | benjamin.peterson | 2008-11-26 11:11:40 -0600 (Wed, 26 Nov 2008) | 1 line simpilfy and comment fix_imports ........ r67399 | benjamin.peterson | 2008-11-26 11:47:03 -0600 (Wed, 26 Nov 2008) | 1 line remove more compatibility code ........ r67400 | benjamin.peterson | 2008-11-26 12:07:41 -0600 (Wed, 26 Nov 2008) | 1 line set svn:ignore ........ r67403 | benjamin.peterson | 2008-11-26 13:11:11 -0600 (Wed, 26 Nov 2008) | 1 line wrap import ........ r67404 | benjamin.peterson | 2008-11-26 13:29:49 -0600 (Wed, 26 Nov 2008) | 1 line build the fix_imports pattern in compile_pattern, so MAPPING can be changed and reflected in the pattern ........ r67405 | benjamin.peterson | 2008-11-26 14:01:24 -0600 (Wed, 26 Nov 2008) | 1 line stop ugly messages about runtime errors being from printed ........ r67426 | benjamin.peterson | 2008-11-28 16:01:40 -0600 (Fri, 28 Nov 2008) | 5 lines don't replace a module name if it is in the middle of a attribute lookup This fix also stops module names from being replaced if they are not in an attribute lookup. ........ Modified: python/trunk/Lib/lib2to3/ (props changed) python/trunk/Lib/lib2to3/fixer_base.py python/trunk/Lib/lib2to3/fixer_util.py python/trunk/Lib/lib2to3/fixes/fix_dict.py python/trunk/Lib/lib2to3/fixes/fix_except.py python/trunk/Lib/lib2to3/fixes/fix_imports.py python/trunk/Lib/lib2to3/fixes/fix_imports2.py python/trunk/Lib/lib2to3/fixes/fix_next.py python/trunk/Lib/lib2to3/fixes/fix_numliterals.py python/trunk/Lib/lib2to3/fixes/fix_renames.py python/trunk/Lib/lib2to3/fixes/fix_urllib.py python/trunk/Lib/lib2to3/pgen2/parse.py python/trunk/Lib/lib2to3/pytree.py python/trunk/Lib/lib2to3/refactor.py python/trunk/Lib/lib2to3/tests/ (props changed) python/trunk/Lib/lib2to3/tests/data/ (props changed) python/trunk/Lib/lib2to3/tests/test_fixers.py python/trunk/Lib/lib2to3/tests/test_refactor.py Modified: python/trunk/Lib/lib2to3/fixer_base.py ============================================================================== --- python/trunk/Lib/lib2to3/fixer_base.py (original) +++ python/trunk/Lib/lib2to3/fixer_base.py Fri Nov 28 23:12:14 2008 @@ -7,12 +7,6 @@ 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 Modified: python/trunk/Lib/lib2to3/fixer_util.py ============================================================================== --- python/trunk/Lib/lib2to3/fixer_util.py (original) +++ python/trunk/Lib/lib2to3/fixer_util.py Fri Nov 28 23:12:14 2008 @@ -153,30 +153,6 @@ 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 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 Fri Nov 28 23:12:14 2008 @@ -28,7 +28,7 @@ from .. import patcomp from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot from .. import fixer_util 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 Fri Nov 28 23:12:14 2008 @@ -25,7 +25,7 @@ from .. import pytree from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list def find_excepts(nodes): for i, n in enumerate(nodes): 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 Fri Nov 28 23:12:14 2008 @@ -1,9 +1,9 @@ """Fix incompatible imports and module references.""" -# Author: Collin Winter +# Authors: Collin Winter, Nick Edds # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {'StringIO': 'io', 'cStringIO': 'io', @@ -61,36 +61,49 @@ def build_pattern(mapping=MAPPING): - mod_list = ' | '.join(["module='" + key + "'" for key in mapping.keys()]) - mod_name_list = ' | '.join(["module_name='" + key + "'" for key in mapping.keys()]) - yield """import_name< 'import' ((%s) + mod_list = ' | '.join(["module_name='%s'" % key for key in mapping]) + bare_names = alternates(mapping.keys()) + + yield """name_import=import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > - """ % mod_name_list + """ % mod_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > - """ % mod_name_list - # Find usages of module members in code e.g. urllib.foo(bar) - yield """power< (%s) - trailer<'.' any > any* > - """ % mod_name_list - yield """bare_name=%s""" % alternates(mapping.keys()) + """ % mod_list + + # Find usages of module members in code e.g. thread.foo(bar) + yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names + class FixImports(fixer_base.BaseFix): - PATTERN = "|".join(build_pattern()) + order = "pre" # Pre-order tree traversal + # This is overridden in fix_imports2. mapping = MAPPING - # Don't match the node if it's within another match + def build_pattern(self): + return "|".join(build_pattern(self.mapping)) + + def compile_pattern(self): + # We override this, so MAPPING can be pragmatically altered and the + # changes will be reflected in PATTERN. + self.PATTERN = self.build_pattern() + super(FixImports, self).compile_pattern() + + # Don't match the node if it's within another match. def match(self, node): match = super(FixImports, self).match results = match(node) if results: - if any([match(obj) for obj in attr_chain(node, "parent")]): + # Module usage could be in the trailier of an attribute lookup, so + # we might have nested matches when "bare_with_attr" is present. + if "bare_with_attr" not in results and \ + any([match(obj) for obj in attr_chain(node, "parent")]): return False return results return False @@ -100,20 +113,17 @@ self.replace = {} def transform(self, node, results): - import_mod = results.get("module") - mod_name = results.get("module_name") - bare_name = results.get("bare_name") - - if import_mod or mod_name: - new_name = self.mapping[(import_mod or mod_name).value] - + import_mod = results.get("module_name") if import_mod: - self.replace[import_mod.value] = new_name + new_name = self.mapping[(import_mod or mod_name).value] + if "name_import" in results: + # If it's not a "from x import x, y" or "import x as y" import, + # marked its usage to be replaced. + self.replace[import_mod.value] = new_name import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) - elif mod_name: - mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) - elif bare_name: - bare_name = bare_name[0] + else: + # Replace usage of the module. + bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) Modified: python/trunk/Lib/lib2to3/fixes/fix_imports2.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_imports2.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_imports2.py Fri Nov 28 23:12:14 2008 @@ -10,7 +10,6 @@ class FixImports2(fix_imports.FixImports): - PATTERN = "|".join((fix_imports.build_pattern(MAPPING))) order = "post" 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 Fri Nov 28 23:12:14 2008 @@ -9,7 +9,7 @@ from ..pgen2 import token from ..pygram import python_symbols as syms from .. import fixer_base -from ..fixer_util import Name, Call, find_binding, any +from ..fixer_util import Name, Call, find_binding bind_warning = "Calls to builtin next() possibly shadowed by global binding" 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 Fri Nov 28 23:12:14 2008 @@ -6,7 +6,7 @@ # Local imports from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Number, set +from ..fixer_util import Number class FixNumliterals(fixer_base.BaseFix): 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 Fri Nov 28 23:12:14 2008 @@ -8,7 +8,7 @@ # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {"sys": {"maxint" : "maxsize"}, } Modified: python/trunk/Lib/lib2to3/fixes/fix_urllib.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_urllib.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_urllib.py Fri Nov 28 23:12:14 2008 @@ -7,7 +7,7 @@ # Local imports from .fix_imports import alternates, FixImports from .. import fixer_base -from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain, any, set +from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain MAPPING = {'urllib': [ ('urllib.request', @@ -65,7 +65,9 @@ class FixUrllib(FixImports): - PATTERN = "|".join(build_pattern()) + + def build_pattern(self): + return "|".join(build_pattern()) def transform_import(self, node, results): """Transform for the basic import case. Replaces the old Modified: python/trunk/Lib/lib2to3/pgen2/parse.py ============================================================================== --- python/trunk/Lib/lib2to3/pgen2/parse.py (original) +++ python/trunk/Lib/lib2to3/pgen2/parse.py Fri Nov 28 23:12:14 2008 @@ -10,12 +10,6 @@ """ -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - # Local imports from . import token Modified: python/trunk/Lib/lib2to3/pytree.py ============================================================================== --- python/trunk/Lib/lib2to3/pytree.py (original) +++ python/trunk/Lib/lib2to3/pytree.py Fri Nov 28 23:12:14 2008 @@ -11,6 +11,9 @@ __author__ = "Guido van Rossum " +import sys +from StringIO import StringIO + HUGE = 0x7FFFFFFF # maximum repeat count, default max @@ -655,6 +658,11 @@ elif self.name == "bare_name": yield self._bare_name_matches(nodes) else: + # The reason for this is that hitting the recursion limit usually + # results in some ugly messages about how RuntimeErrors are being + # ignored. + save_stderr = sys.stderr + sys.stderr = StringIO() try: for count, r in self._recursive_matches(nodes, 0): if self.name: @@ -667,6 +675,8 @@ if self.name: r[self.name] = nodes[:count] yield count, r + finally: + sys.stderr = save_stderr def _iterative_matches(self, nodes): """Helper to iteratively yield the matches.""" Modified: python/trunk/Lib/lib2to3/refactor.py ============================================================================== --- python/trunk/Lib/lib2to3/refactor.py (original) +++ python/trunk/Lib/lib2to3/refactor.py Fri Nov 28 23:12:14 2008 @@ -123,8 +123,8 @@ logger=self.logger) self.pre_order, self.post_order = self.get_fixers() - self.pre_order = get_headnode_dict(self.pre_order) - self.post_order = get_headnode_dict(self.post_order) + self.pre_order_mapping = get_headnode_dict(self.pre_order) + self.post_order_mapping = get_headnode_dict(self.post_order) self.files = [] # List of files that were or should be modified @@ -290,13 +290,12 @@ # Two calls to chain are required because pre_order.values() # will be a list of lists of fixers: # [[, ], []] - all_fixers = chain(chain(*self.pre_order.values()),\ - chain(*self.post_order.values())) + all_fixers = chain(self.pre_order, self.post_order) for fixer in all_fixers: fixer.start_tree(tree, name) - self.traverse_by(self.pre_order, tree.pre_order()) - self.traverse_by(self.post_order, tree.post_order()) + self.traverse_by(self.pre_order_mapping, tree.pre_order()) + self.traverse_by(self.post_order_mapping, tree.post_order()) for fixer in all_fixers: fixer.finish_tree(tree, name) 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 Fri Nov 28 23:12:14 2008 @@ -15,10 +15,7 @@ from operator import itemgetter # Local imports -from .. import pygram -from .. import pytree -from .. import refactor -from .. import fixer_util +from lib2to3 import pygram, pytree, refactor, fixer_util class FixerTestCase(support.TestCase): @@ -30,10 +27,9 @@ self.fixer_log = [] self.filename = "" - for order in (self.refactor.pre_order.values(),\ - self.refactor.post_order.values()): - for fixer in chain(*order): - fixer.log = self.fixer_log + for fixer in chain(self.refactor.pre_order, + self.refactor.post_order): + fixer.log = self.fixer_log def _check(self, before, after): before = support.reformat(before) @@ -1488,6 +1484,44 @@ """ % (new, new) self.check(b, a) + b = """ + from %s import x + %s = 23 + """ % (old, old) + a = """ + from %s import x + %s = 23 + """ % (new, old) + self.check(b, a) + + s = """ + def f(): + %s.method() + """ % (old,) + self.unchanged(s) + + # test nested usage + b = """ + import %s + %s.bar(%s.foo) + """ % (old, old, old) + a = """ + import %s + %s.bar(%s.foo) + """ % (new, new, new) + self.check(b, a) + + b = """ + import %s + x.%s + """ % (old, old) + a = """ + import %s + x.%s + """ % (new, old) + self.check(b, a) + + class Test_imports2(Test_imports): fixer = "imports2" Modified: python/trunk/Lib/lib2to3/tests/test_refactor.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_refactor.py (original) +++ python/trunk/Lib/lib2to3/tests/test_refactor.py Fri Nov 28 23:12:14 2008 @@ -161,7 +161,7 @@ self.assertEqual(len(rt.post_order), 0) rt = self.rt(explicit=["myfixes.fix_explicit"]) - for fix in rt.post_order[None]: + for fix in rt.post_order: if isinstance(fix, FixExplicit): break else: From g.brandl at gmx.net Fri Nov 28 23:42:24 2008 From: g.brandl at gmx.net (Georg Brandl) Date: Fri, 28 Nov 2008 23:42:24 +0100 Subject: [Python-checkins] r67419 - in python/trunk/Doc: includes/mp_distributing.py library/multiprocessing.rst In-Reply-To: <20081128182254.6C2911E4002@bag.python.org> References: <20081128182254.6C2911E4002@bag.python.org> Message-ID: jesse.noller schrieb: > Author: jesse.noller > Date: Fri Nov 28 19:22:54 2008 > New Revision: 67419 > > Log: > mp docs - fix issues 4012,3518,4193 > > > Modified: > python/trunk/Doc/includes/mp_distributing.py > python/trunk/Doc/library/multiprocessing.rst > @@ -1267,19 +1333,20 @@ > >>> queue = Queue.Queue() > >>> class QueueManager(BaseManager): pass > ... > - >>> QueueManager.register('getQueue', callable=lambda:queue) > + >>> QueueManager.register('get_queue', callable=lambda:queue) > >>> m = QueueManager(address=('', 50000), authkey='abracadabra') > - >>> m.serveForever() > + >>> s = m.get_server() > + >>> s.serveForever() Shouldn't that be serve_forever() too? 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 Sat Nov 29 00:04:30 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:04:30 +0100 (CET) Subject: [Python-checkins] r67430 - in python/branches/release26-maint: Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/fix_dict.py Lib/lib2to3/fixes/fix_except.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_imports2.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_numliterals.py Lib/lib2to3/fixes/fix_renames.py Lib/lib2to3/fixes/fix_urllib.py Lib/lib2to3/pgen2/parse.py Lib/lib2to3/pytree.py Lib/lib2to3/refactor.py Lib/lib2to3/tests Lib/lib2to3/tests/data Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_refactor.py Message-ID: <20081128230430.914FC1E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:04:28 2008 New Revision: 67430 Log: Merged revisions 67428 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r67428 | benjamin.peterson | 2008-11-28 16:12:14 -0600 (Fri, 28 Nov 2008) | 57 lines Merged revisions 67384,67386-67387,67389-67390,67392,67399-67400,67403-67405,67426 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r67384 | benjamin.peterson | 2008-11-25 16:13:31 -0600 (Tue, 25 Nov 2008) | 4 lines don't duplicate calls to start_tree() RefactoringTool.pre_order values now holds a list of the fixers while pre_order_mapping holds the dict. ........ r67386 | benjamin.peterson | 2008-11-25 16:44:52 -0600 (Tue, 25 Nov 2008) | 1 line #4423 fix_imports was still replacing usage of a module if attributes were being used ........ r67387 | benjamin.peterson | 2008-11-25 16:47:54 -0600 (Tue, 25 Nov 2008) | 1 line fix broken test ........ r67389 | benjamin.peterson | 2008-11-25 17:13:17 -0600 (Tue, 25 Nov 2008) | 1 line remove compatibility code; we only cater to 2.5+ ........ r67390 | benjamin.peterson | 2008-11-25 22:03:36 -0600 (Tue, 25 Nov 2008) | 1 line fix #3994; the usage of changed imports was fixed in nested cases ........ r67392 | benjamin.peterson | 2008-11-26 11:11:40 -0600 (Wed, 26 Nov 2008) | 1 line simpilfy and comment fix_imports ........ r67399 | benjamin.peterson | 2008-11-26 11:47:03 -0600 (Wed, 26 Nov 2008) | 1 line remove more compatibility code ........ r67400 | benjamin.peterson | 2008-11-26 12:07:41 -0600 (Wed, 26 Nov 2008) | 1 line set svn:ignore ........ r67403 | benjamin.peterson | 2008-11-26 13:11:11 -0600 (Wed, 26 Nov 2008) | 1 line wrap import ........ r67404 | benjamin.peterson | 2008-11-26 13:29:49 -0600 (Wed, 26 Nov 2008) | 1 line build the fix_imports pattern in compile_pattern, so MAPPING can be changed and reflected in the pattern ........ r67405 | benjamin.peterson | 2008-11-26 14:01:24 -0600 (Wed, 26 Nov 2008) | 1 line stop ugly messages about runtime errors being from printed ........ r67426 | benjamin.peterson | 2008-11-28 16:01:40 -0600 (Fri, 28 Nov 2008) | 5 lines don't replace a module name if it is in the middle of a attribute lookup This fix also stops module names from being replaced if they are not in an attribute lookup. ........ ................ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/lib2to3/fixer_base.py python/branches/release26-maint/Lib/lib2to3/fixer_util.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_dict.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_except.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports2.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_numliterals.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_renames.py python/branches/release26-maint/Lib/lib2to3/fixes/fix_urllib.py python/branches/release26-maint/Lib/lib2to3/pgen2/parse.py python/branches/release26-maint/Lib/lib2to3/pytree.py python/branches/release26-maint/Lib/lib2to3/refactor.py python/branches/release26-maint/Lib/lib2to3/tests/ (props changed) python/branches/release26-maint/Lib/lib2to3/tests/data/ (props changed) python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py Modified: python/branches/release26-maint/Lib/lib2to3/fixer_base.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixer_base.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixer_base.py Sat Nov 29 00:04:28 2008 @@ -7,12 +7,6 @@ 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 Modified: python/branches/release26-maint/Lib/lib2to3/fixer_util.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixer_util.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixer_util.py Sat Nov 29 00:04:28 2008 @@ -153,30 +153,6 @@ 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 Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_dict.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_dict.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_dict.py Sat Nov 29 00:04:28 2008 @@ -28,7 +28,7 @@ from .. import patcomp from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot from .. import fixer_util Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_except.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_except.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_except.py Sat Nov 29 00:04:28 2008 @@ -25,7 +25,7 @@ from .. import pytree from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list def find_excepts(nodes): for i, n in enumerate(nodes): Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports.py Sat Nov 29 00:04:28 2008 @@ -1,9 +1,9 @@ """Fix incompatible imports and module references.""" -# Author: Collin Winter +# Authors: Collin Winter, Nick Edds # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {'StringIO': 'io', 'cStringIO': 'io', @@ -61,36 +61,49 @@ def build_pattern(mapping=MAPPING): - mod_list = ' | '.join(["module='" + key + "'" for key in mapping.keys()]) - mod_name_list = ' | '.join(["module_name='" + key + "'" for key in mapping.keys()]) - yield """import_name< 'import' ((%s) + mod_list = ' | '.join(["module_name='%s'" % key for key in mapping]) + bare_names = alternates(mapping.keys()) + + yield """name_import=import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > - """ % mod_name_list + """ % mod_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > - """ % mod_name_list - # Find usages of module members in code e.g. urllib.foo(bar) - yield """power< (%s) - trailer<'.' any > any* > - """ % mod_name_list - yield """bare_name=%s""" % alternates(mapping.keys()) + """ % mod_list + + # Find usages of module members in code e.g. thread.foo(bar) + yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names + class FixImports(fixer_base.BaseFix): - PATTERN = "|".join(build_pattern()) + order = "pre" # Pre-order tree traversal + # This is overridden in fix_imports2. mapping = MAPPING - # Don't match the node if it's within another match + def build_pattern(self): + return "|".join(build_pattern(self.mapping)) + + def compile_pattern(self): + # We override this, so MAPPING can be pragmatically altered and the + # changes will be reflected in PATTERN. + self.PATTERN = self.build_pattern() + super(FixImports, self).compile_pattern() + + # Don't match the node if it's within another match. def match(self, node): match = super(FixImports, self).match results = match(node) if results: - if any([match(obj) for obj in attr_chain(node, "parent")]): + # Module usage could be in the trailier of an attribute lookup, so + # we might have nested matches when "bare_with_attr" is present. + if "bare_with_attr" not in results and \ + any([match(obj) for obj in attr_chain(node, "parent")]): return False return results return False @@ -100,20 +113,17 @@ self.replace = {} def transform(self, node, results): - import_mod = results.get("module") - mod_name = results.get("module_name") - bare_name = results.get("bare_name") - - if import_mod or mod_name: - new_name = self.mapping[(import_mod or mod_name).value] - + import_mod = results.get("module_name") if import_mod: - self.replace[import_mod.value] = new_name + new_name = self.mapping[(import_mod or mod_name).value] + if "name_import" in results: + # If it's not a "from x import x, y" or "import x as y" import, + # marked its usage to be replaced. + self.replace[import_mod.value] = new_name import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) - elif mod_name: - mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) - elif bare_name: - bare_name = bare_name[0] + else: + # Replace usage of the module. + bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports2.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports2.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_imports2.py Sat Nov 29 00:04:28 2008 @@ -10,7 +10,6 @@ class FixImports2(fix_imports.FixImports): - PATTERN = "|".join((fix_imports.build_pattern(MAPPING))) order = "post" Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_next.py Sat Nov 29 00:04:28 2008 @@ -9,7 +9,7 @@ from ..pgen2 import token from ..pygram import python_symbols as syms from .. import fixer_base -from ..fixer_util import Name, Call, find_binding, any +from ..fixer_util import Name, Call, find_binding bind_warning = "Calls to builtin next() possibly shadowed by global binding" Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_numliterals.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_numliterals.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_numliterals.py Sat Nov 29 00:04:28 2008 @@ -6,7 +6,7 @@ # Local imports from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Number, set +from ..fixer_util import Number class FixNumliterals(fixer_base.BaseFix): Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_renames.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_renames.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_renames.py Sat Nov 29 00:04:28 2008 @@ -8,7 +8,7 @@ # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {"sys": {"maxint" : "maxsize"}, } Modified: python/branches/release26-maint/Lib/lib2to3/fixes/fix_urllib.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/fixes/fix_urllib.py (original) +++ python/branches/release26-maint/Lib/lib2to3/fixes/fix_urllib.py Sat Nov 29 00:04:28 2008 @@ -7,7 +7,7 @@ # Local imports from .fix_imports import alternates, FixImports from .. import fixer_base -from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain, any, set +from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain MAPPING = {'urllib': [ ('urllib.request', @@ -65,7 +65,9 @@ class FixUrllib(FixImports): - PATTERN = "|".join(build_pattern()) + + def build_pattern(self): + return "|".join(build_pattern()) def transform_import(self, node, results): """Transform for the basic import case. Replaces the old Modified: python/branches/release26-maint/Lib/lib2to3/pgen2/parse.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/pgen2/parse.py (original) +++ python/branches/release26-maint/Lib/lib2to3/pgen2/parse.py Sat Nov 29 00:04:28 2008 @@ -10,12 +10,6 @@ """ -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - # Local imports from . import token Modified: python/branches/release26-maint/Lib/lib2to3/pytree.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/pytree.py (original) +++ python/branches/release26-maint/Lib/lib2to3/pytree.py Sat Nov 29 00:04:28 2008 @@ -11,6 +11,9 @@ __author__ = "Guido van Rossum " +import sys +from StringIO import StringIO + HUGE = 0x7FFFFFFF # maximum repeat count, default max @@ -655,6 +658,11 @@ elif self.name == "bare_name": yield self._bare_name_matches(nodes) else: + # The reason for this is that hitting the recursion limit usually + # results in some ugly messages about how RuntimeErrors are being + # ignored. + save_stderr = sys.stderr + sys.stderr = StringIO() try: for count, r in self._recursive_matches(nodes, 0): if self.name: @@ -667,6 +675,8 @@ if self.name: r[self.name] = nodes[:count] yield count, r + finally: + sys.stderr = save_stderr def _iterative_matches(self, nodes): """Helper to iteratively yield the matches.""" Modified: python/branches/release26-maint/Lib/lib2to3/refactor.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/refactor.py (original) +++ python/branches/release26-maint/Lib/lib2to3/refactor.py Sat Nov 29 00:04:28 2008 @@ -123,8 +123,8 @@ logger=self.logger) self.pre_order, self.post_order = self.get_fixers() - self.pre_order = get_headnode_dict(self.pre_order) - self.post_order = get_headnode_dict(self.post_order) + self.pre_order_mapping = get_headnode_dict(self.pre_order) + self.post_order_mapping = get_headnode_dict(self.post_order) self.files = [] # List of files that were or should be modified @@ -290,13 +290,12 @@ # Two calls to chain are required because pre_order.values() # will be a list of lists of fixers: # [[, ], []] - all_fixers = chain(chain(*self.pre_order.values()),\ - chain(*self.post_order.values())) + all_fixers = chain(self.pre_order, self.post_order) for fixer in all_fixers: fixer.start_tree(tree, name) - self.traverse_by(self.pre_order, tree.pre_order()) - self.traverse_by(self.post_order, tree.post_order()) + self.traverse_by(self.pre_order_mapping, tree.pre_order()) + self.traverse_by(self.post_order_mapping, tree.post_order()) for fixer in all_fixers: fixer.finish_tree(tree, name) Modified: python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/test_fixers.py Sat Nov 29 00:04:28 2008 @@ -15,10 +15,7 @@ from operator import itemgetter # Local imports -from .. import pygram -from .. import pytree -from .. import refactor -from .. import fixer_util +from lib2to3 import pygram, pytree, refactor, fixer_util class FixerTestCase(support.TestCase): @@ -30,10 +27,9 @@ self.fixer_log = [] self.filename = "" - for order in (self.refactor.pre_order.values(),\ - self.refactor.post_order.values()): - for fixer in chain(*order): - fixer.log = self.fixer_log + for fixer in chain(self.refactor.pre_order, + self.refactor.post_order): + fixer.log = self.fixer_log def _check(self, before, after): before = support.reformat(before) @@ -1488,6 +1484,44 @@ """ % (new, new) self.check(b, a) + b = """ + from %s import x + %s = 23 + """ % (old, old) + a = """ + from %s import x + %s = 23 + """ % (new, old) + self.check(b, a) + + s = """ + def f(): + %s.method() + """ % (old,) + self.unchanged(s) + + # test nested usage + b = """ + import %s + %s.bar(%s.foo) + """ % (old, old, old) + a = """ + import %s + %s.bar(%s.foo) + """ % (new, new, new) + self.check(b, a) + + b = """ + import %s + x.%s + """ % (old, old) + a = """ + import %s + x.%s + """ % (new, old) + self.check(b, a) + + class Test_imports2(Test_imports): fixer = "imports2" Modified: python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py ============================================================================== --- python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py (original) +++ python/branches/release26-maint/Lib/lib2to3/tests/test_refactor.py Sat Nov 29 00:04:28 2008 @@ -161,7 +161,7 @@ self.assertEqual(len(rt.post_order), 0) rt = self.rt(explicit=["myfixes.fix_explicit"]) - for fix in rt.post_order[None]: + for fix in rt.post_order: if isinstance(fix, FixExplicit): break else: From python-checkins at python.org Sat Nov 29 00:14:08 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:14:08 +0100 (CET) Subject: [Python-checkins] r67431 - in sandbox/trunk/2to3: find_pattern.py lib2to3/tests/benchmark.py scripts scripts/benchmark.py scripts/find_pattern.py Message-ID: <20081128231408.5A8031E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:14:08 2008 New Revision: 67431 Log: add a scripts directory; move things to it Added: sandbox/trunk/2to3/scripts/ sandbox/trunk/2to3/scripts/benchmark.py (props changed) - copied unchanged from r67399, /sandbox/trunk/2to3/lib2to3/tests/benchmark.py sandbox/trunk/2to3/scripts/find_pattern.py (props changed) - copied unchanged from r67399, /sandbox/trunk/2to3/find_pattern.py Removed: sandbox/trunk/2to3/find_pattern.py sandbox/trunk/2to3/lib2to3/tests/benchmark.py Deleted: sandbox/trunk/2to3/find_pattern.py ============================================================================== --- sandbox/trunk/2to3/find_pattern.py Sat Nov 29 00:14:08 2008 +++ (empty file) @@ -1,97 +0,0 @@ -#!/usr/bin/env python - -"""Script that makes determining PATTERN for a new fix much easier. - -Figuring out exactly what PATTERN I want for a given fixer class is -getting tedious. This script will step through each possible subtree -for a given string, allowing you to select which one you want. It will -then try to figure out an appropriate pattern to match that tree. This -pattern will require some editing (it will be overly restrictive) but -should provide a solid base to work with and handle the tricky parts. - -Usage: - - python find_pattern.py "g.throw(E, V, T)" - -This will step through each subtree in the parse. To reject a -candidate subtree, hit enter; to accept a candidate, hit "y" and -enter. The pattern will be spit out to stdout. - -For example, the above will yield a succession of possible snippets, -skipping all leaf-only trees. I accept - -'g.throw(E, V, T)' - -This causes find_pattern to spit out - -power< 'g' trailer< '.' 'throw' > - trailer< '(' arglist< 'E' ',' 'V' ',' 'T' > ')' > > - - -Some minor tweaks later, I'm left with - -power< any trailer< '.' 'throw' > - trailer< '(' args=arglist< exc=any ',' val=any [',' tb=any] > ')' > > - -which is exactly what I was after. - -Larger snippets can be placed in a file (as opposed to a command-line -arg) and processed with the -f option. -""" - -__author__ = "Collin Winter " - -# Python imports -import optparse -import sys -from StringIO import StringIO - -# Local imports -from lib2to3 import pytree -from lib2to3.pgen2 import driver -from lib2to3.pygram import python_symbols, python_grammar - -driver = driver.Driver(python_grammar, convert=pytree.convert) - -def main(args): - parser = optparse.OptionParser(usage="find_pattern.py [options] [string]") - parser.add_option("-f", "--file", action="store", - help="Read a code snippet from the specified file") - - # Parse command line arguments - options, args = parser.parse_args(args) - if options.file: - tree = driver.parse_file(options.file) - elif len(args) > 1: - tree = driver.parse_stream(StringIO(args[1] + "\n")) - else: - print >>sys.stderr, "You must specify an input file or an input string" - return 1 - - examine_tree(tree) - return 0 - -def examine_tree(tree): - for node in tree.post_order(): - if isinstance(node, pytree.Leaf): - continue - print repr(str(node)) - verdict = raw_input() - if verdict.strip(): - print find_pattern(node) - return - -def find_pattern(node): - if isinstance(node, pytree.Leaf): - return repr(node.value) - - return find_symbol(node.type) + \ - "< " + " ".join(find_pattern(n) for n in node.children) + " >" - -def find_symbol(sym): - for n, v in python_symbols.__dict__.items(): - if v == sym: - return n - -if __name__ == "__main__": - sys.exit(main(sys.argv)) Deleted: sandbox/trunk/2to3/lib2to3/tests/benchmark.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/benchmark.py Sat Nov 29 00:14:08 2008 +++ (empty file) @@ -1,58 +0,0 @@ -#!/usr/bin/env python2.5 -""" -This is a benchmarking script to test the speed of 2to3's pattern matching -system. It's equivalent to "refactor.py -f all" for every Python module -in sys.modules, but without engaging the actual transformations. -""" - -__author__ = "Collin Winter " - -# Python imports -import os.path -import sys -from time import time - -# Test imports -from .support import adjust_path -adjust_path() - -# Local imports -from .. import refactor - -### Mock code for refactor.py and the fixers -############################################################################### -class Options: - def __init__(self, **kwargs): - for k, v in kwargs.items(): - setattr(self, k, v) - - self.verbose = False - -def dummy_transform(*args, **kwargs): - pass - -### Collect list of modules to match against -############################################################################### -files = [] -for mod in sys.modules.values(): - if mod is None or not hasattr(mod, '__file__'): - continue - f = mod.__file__ - if f.endswith('.pyc'): - f = f[:-1] - if f.endswith('.py'): - files.append(f) - -### Set up refactor and run the benchmark -############################################################################### -options = Options(fix=["all"], print_function=False, doctests_only=False) -refactor = refactor.RefactoringTool(options) -for fixer in refactor.fixers: - # We don't want them to actually fix the tree, just match against it. - fixer.transform = dummy_transform - -t = time() -for f in files: - print "Matching", f - refactor.refactor_file(f) -print "%d seconds to match %d files" % (time() - t, len(sys.modules)) From buildbot at python.org Sat Nov 29 00:14:47 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 23:14:47 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 2.5 Message-ID: <20081128231447.590E21E4002@bag.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%202.5/builds/0 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_curses test_ioctl Traceback (most recent call last): File "./Lib/test/regrtest.py", line 549, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/home2/buildbot/slave/2.5.loewis-sun/build/Lib/test/test_curses.py", line 271, in main(stdscr) File "/home2/buildbot/slave/2.5.loewis-sun/build/Lib/test/test_curses.py", line 255, in main module_funcs(stdscr) File "/home2/buildbot/slave/2.5.loewis-sun/build/Lib/test/test_curses.py", line 167, in module_funcs curses.halfdelay(1) error: halfdelay() returned ERR ====================================================================== ERROR: test_ioctl_signed_unsigned_code_param (test.test_ioctl.IoctlTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/2.5.loewis-sun/build/Lib/test/test_ioctl.py", line 56, in test_ioctl_signed_unsigned_code_param saved_winsz = fcntl.ioctl(mfd, termios.TIOCGWINSZ, "\0"*8) IOError: [Errno 22] Invalid argument sincerely, -The Buildbot From python-checkins at python.org Sat Nov 29 00:18:46 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:18:46 +0100 (CET) Subject: [Python-checkins] r67432 - python/trunk/Tools/scripts/svneol.py Message-ID: <20081128231846.460711E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:18:46 2008 New Revision: 67432 Log: SVN format 9 is the same it seems 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 Nov 29 00:18:46 2008 @@ -39,9 +39,9 @@ format = int(open(os.path.join(root, ".svn", "format")).read().strip()) except IOError: return [] - if format == 8: - # In version 8, committed props are stored in prop-base, - # local modifications in props + if format in (8, 9): + # In version 8 and 9, 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" From python-checkins at python.org Sat Nov 29 00:18:48 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:18:48 +0100 (CET) Subject: [Python-checkins] r67433 - in sandbox/trunk/2to3: lib2to3/__init__.py lib2to3/fixes/fix_execfile.py lib2to3/fixes/fix_funcattrs.py lib2to3/fixes/fix_idioms.py lib2to3/fixes/fix_import.py lib2to3/fixes/fix_imports.py lib2to3/fixes/fix_imports2.py lib2to3/fixes/fix_itertools.py lib2to3/fixes/fix_itertools_imports.py lib2to3/fixes/fix_standarderror.py lib2to3/fixes/fix_types.py lib2to3/fixes/fix_urllib.py lib2to3/fixes/fix_xreadlines.py lib2to3/fixes/fix_zip.py lib2to3/tests/data/infinite_recursion.py lib2to3/tests/test_all_fixers.py lib2to3/tests/test_parser.py setup.py Message-ID: <20081128231848.F13171E4036@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:18:48 2008 New Revision: 67433 Log: run svneol.py Modified: sandbox/trunk/2to3/lib2to3/__init__.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_import.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_imports2.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_types.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py (props changed) sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py (props changed) sandbox/trunk/2to3/lib2to3/tests/data/infinite_recursion.py (props changed) sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py (props changed) sandbox/trunk/2to3/lib2to3/tests/test_parser.py (props changed) sandbox/trunk/2to3/setup.py (props changed) From python-checkins at python.org Sat Nov 29 00:23:21 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:23:21 +0100 (CET) Subject: [Python-checkins] r67434 - sandbox/trunk/2to3/HACKING Message-ID: <20081128232321.C76701E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:23:21 2008 New Revision: 67434 Log: a few updates to HACKING Modified: sandbox/trunk/2to3/HACKING Modified: sandbox/trunk/2to3/HACKING ============================================================================== --- sandbox/trunk/2to3/HACKING (original) +++ sandbox/trunk/2to3/HACKING Sat Nov 29 00:23:21 2008 @@ -1,34 +1,26 @@ Tips/tricks/hints for writing new fixers: - * Don't write your own PATTERN from scratch; that's what find_pattern.py - is for. + * Don't write your own PATTERN from scratch; that's what + scripts/find_pattern.py is for. - * If your fixer works by changing a node's children list or a leaf's - value, be sure to call the node/leaf's changed() method. This to - be sure refactor.py will recognize that the tree has changed. - - * If you're making changes to pgen2, tokenize or any other part of the - parsing system (sometimes even pytree), you might want to check out - the 'dummy' fixer. It doesn't make any changes to the file, so you - just see what the parser does. + * If your fixer works by changing a node's children list or a leaf's value, + be sure to call the node/leaf's changed() method. This to be sure the main + script will recognize that the tree has changed. Putting 2to3 to work somewhere else: - * By default, 2to3 uses a merger of Python 2.x and Python 3's grammars. - If you want to support a different grammar, just replace the - Grammar.txt file with Grammar/Grammar from your chosen Python version. + * By default, 2to3 uses a merger of Python 2.x and Python 3's grammars. If + you want to support a different grammar, just replace the Grammar.txt file + with Grammar/Grammar from your chosen Python version. * The real heart of 2to3 is the concrete syntax tree parser in pgen2; this - chunk of the system is suitable for a wide range of applications that - require CST transformation. All that's required is to rip off the fixer - layer and replace it with something else that walks the tree. One - application would be a tool to check/enforce style guidelines; this - could leverage 90% of the existing infrastructure with primarily - cosmetic changes (e.g., fixes/fix_*.py -> styles/style_*.py). - - * The examples/ directory contains fixers that show off 2to3's flexibility, - such as a fixer for whitespace. + chunk of the system is suitable for a wide range of applications that + require CST transformation. All that's required is to rip off the fixer + layer and replace it with something else that walks the tree. One + application would be a tool to check/enforce style guidelines; this could + leverage 90% of the existing infrastructure with primarily cosmetic + changes (e.g., fixes/fix_*.py -> styles/style_*.py). TODO @@ -36,18 +28,16 @@ Simple: ####### - * Refactor common code out of fixes/fix_*.py into fixes.util (on-going). + * Refactor common code out of fixes/fix_*.py into fixer_util (on-going). Complex: ######## - - * Replace tuple usage in patterns and node.children with lists (95% - done). Simplify fixers accordingly (mostly done, I think). - * Come up with a scheme to hide the details of suite indentation (some - kind of custom pytree node for suites, probably). This will - automatically reindent all code with spaces, tied into a refactor.py - flag that allows you to specify the indent level. + * Come up with a scheme to hide the details of suite indentation (some kind + of custom pytree node for suites, probably). This will automatically + reindent all code with spaces, tied into a refactor.py flag that allows + you to specify the indent level. - * Remove the need to explicitly assign a node's parent attribute. + * Remove the need to explicitly assign a node's parent attribute. This + could be gone with a magic children list. From python-checkins at python.org Sat Nov 29 00:25:03 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:25:03 +0100 (CET) Subject: [Python-checkins] r67435 - sandbox/trunk/2to3/lib2to3/refactor.py Message-ID: <20081128232503.E8B531E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:25:03 2008 New Revision: 67435 Log: rename pre/post_order_mapping to pre/post_order_heads Modified: sandbox/trunk/2to3/lib2to3/refactor.py Modified: sandbox/trunk/2to3/lib2to3/refactor.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/refactor.py (original) +++ sandbox/trunk/2to3/lib2to3/refactor.py Sat Nov 29 00:25:03 2008 @@ -123,8 +123,8 @@ logger=self.logger) self.pre_order, self.post_order = self.get_fixers() - self.pre_order_mapping = get_headnode_dict(self.pre_order) - self.post_order_mapping = get_headnode_dict(self.post_order) + self.pre_order_heads = get_headnode_dict(self.pre_order) + self.post_order_heads = get_headnode_dict(self.post_order) self.files = [] # List of files that were or should be modified @@ -294,8 +294,8 @@ for fixer in all_fixers: fixer.start_tree(tree, name) - self.traverse_by(self.pre_order_mapping, tree.pre_order()) - self.traverse_by(self.post_order_mapping, tree.post_order()) + self.traverse_by(self.pre_order_heads, tree.pre_order()) + self.traverse_by(self.post_order_heads, tree.post_order()) for fixer in all_fixers: fixer.finish_tree(tree, name) From buildbot at python.org Sat Nov 29 00:27:14 2008 From: buildbot at python.org (buildbot at python.org) Date: Fri, 28 Nov 2008 23:27:14 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081128232714.725A51E4002@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/546 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_calendar test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sat Nov 29 00:28:51 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:28:51 +0100 (CET) Subject: [Python-checkins] r67437 - sandbox/trunk/2to3/README Message-ID: <20081128232851.BA3C31E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:28:51 2008 New Revision: 67437 Log: README updates Modified: sandbox/trunk/2to3/README Modified: sandbox/trunk/2to3/README ============================================================================== --- sandbox/trunk/2to3/README (original) +++ sandbox/trunk/2to3/README Sat Nov 29 00:28:51 2008 @@ -3,17 +3,17 @@ A refactoring tool for converting Python 2.x code to 3.0. -This is a work in progress! Bugs should be reported to -http://bugs.python.org/ under the "2to3" category. +This is a work in progress! Bugs should be reported to http://bugs.python.org/ +under the "2to3" category. General usage ============= -Run ``./2to3`` to convert stdin (``-``), files or directories given -as arguments. By default, the tool outputs a unified diff-formatted patch -on standard output and a "what was changed" summary on standard error, -but the ``-w`` option can be given to write back converted files, creating +Run ``./2to3`` to convert stdin (``-``), files or directories given as +arguments. By default, the tool outputs a unified diff-formatted patch on +standard output and a "what was changed" summary on standard error, but the +``-w`` option can be given to write back converted files, creating ``.bak``-named backup files. 2to3 must be run with at least Python 2.5. The intended path for migrating to @@ -32,10 +32,10 @@ lib2to3/pygram.py - code specific to the Python grammar example.py - example input for play.py and fix_*.py find_pattern.py - script to help determine the PATTERN for a new fix -lib2to3/Grammar.txt - Python grammar input (a copy of Python 2.5's Grammar/Grammar) +lib2to3/Grammar.txt - Python grammar input (accepts 2.x and 3.x syntax) lib2to3/Grammar.pickle - pickled grammar tables (generated file, not in subversion) lib2to3/PatternGrammar.txt - grammar for the pattern language used by patcomp.py -lib2to3PatternGrammar.pickle - pickled pattern grammar tables (generated file) +lib2to3/PatternGrammar.pickle - pickled pattern grammar tables (generated file) lib2to3/pgen2/ - Parser generator and driver ([1]_, [2]_) lib2to3/fixes/ - Individual transformations lib2to3tests/ - Test files for pytree, fixers, grammar, etc @@ -217,8 +217,8 @@ ===== .. [#1] I modified tokenize.py to yield a NL pseudo-token for backslash - continuations, so the original source can be reproduced exactly. - The modified version can be found at pgen2/tokenize.py. + continuations, so the original source can be reproduced exactly. The + modified version can be found at lib2to3/pgen2/tokenize.py. .. [#2] I developed pgen2 while I was at Elemental Security. I modified it while at Google to suit the needs of this refactoring tool. @@ -227,8 +227,8 @@ Development =========== -The HACKING file has a list of TODOs -- some simple, some complex -- that -would make good introductions for anyone new to 2to3. +The HACKING file has a list of TODOs -- some simple, some complex -- that would +make good introductions for anyone new to 2to3. Licensing From python-checkins at python.org Sat Nov 29 00:29:29 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:29:29 +0100 (CET) Subject: [Python-checkins] r67438 - sandbox/trunk/2to3/HACKING Message-ID: <20081128232929.085EB1E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:29:28 2008 New Revision: 67438 Log: we really need docs for fixers Modified: sandbox/trunk/2to3/HACKING Modified: sandbox/trunk/2to3/HACKING ============================================================================== --- sandbox/trunk/2to3/HACKING (original) +++ sandbox/trunk/2to3/HACKING Sat Nov 29 00:29:28 2008 @@ -30,6 +30,8 @@ * Refactor common code out of fixes/fix_*.py into fixer_util (on-going). + * Document how to write fixers. + Complex: ######## From python-checkins at python.org Sat Nov 29 00:32:14 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 29 Nov 2008 00:32:14 +0100 (CET) Subject: [Python-checkins] r67439 - sandbox/trunk/2to3/README Message-ID: <20081128233214.DB1F81E4002@bag.python.org> Author: benjamin.peterson Date: Sat Nov 29 00:32:14 2008 New Revision: 67439 Log: how I'm licensing Modified: sandbox/trunk/2to3/README Modified: sandbox/trunk/2to3/README ============================================================================== --- sandbox/trunk/2to3/README (original) +++ sandbox/trunk/2to3/README Sat Nov 29 00:32:14 2008 @@ -249,3 +249,8 @@ licensed to the PSF under a contributor agreement. --Collin Winter + +All of my contributions are copyrighted to me and licensed to PSF under the +Python contributor agreement. + +--Benjamin Peterson From python-checkins at python.org Sat Nov 29 00:43:00 2008 From: python-checkins at python.org (jeremy.hylton) Date: Sat, 29 Nov 2008 00:43:00 +0100 (CET) Subject: [Python-checkins] r67440 - python/trunk/Modules/_multiprocessing/semaphore.c Message-ID: <20081128234300.3736E1E4002@bag.python.org> Author: jeremy.hylton Date: Sat Nov 29 00:42:59 2008 New Revision: 67440 Log: Move definition int sval into branch of ifdef where it is used. Otherwise, you get a warning about an undefined variable. Modified: python/trunk/Modules/_multiprocessing/semaphore.c Modified: python/trunk/Modules/_multiprocessing/semaphore.c ============================================================================== --- python/trunk/Modules/_multiprocessing/semaphore.c (original) +++ python/trunk/Modules/_multiprocessing/semaphore.c Sat Nov 29 00:42:59 2008 @@ -512,7 +512,6 @@ static PyObject * semlock_iszero(SemLockObject *self) { - int sval; #if HAVE_BROKEN_SEM_GETVALUE if (sem_trywait(self->handle) < 0) { if (errno == EAGAIN) @@ -524,6 +523,7 @@ Py_RETURN_FALSE; } #else + int sval; if (SEM_GETVALUE(self->handle, &sval) < 0) return mp_SetError(NULL, MP_STANDARD_ERROR); return PyBool_FromLong((long)sval == 0); From python-checkins at python.org Sat Nov 29 01:09:16 2008 From: python-checkins at python.org (jeremy.hylton) Date: Sat, 29 Nov 2008 01:09:16 +0100 (CET) Subject: [Python-checkins] r67441 - python/trunk/Lib/test/test_httplib.py Message-ID: <20081129000916.C23DB1E4002@bag.python.org> Author: jeremy.hylton Date: Sat Nov 29 01:09:16 2008 New Revision: 67441 Log: Reflow long lines. Modified: python/trunk/Lib/test/test_httplib.py Modified: python/trunk/Lib/test/test_httplib.py ============================================================================== --- python/trunk/Lib/test/test_httplib.py (original) +++ python/trunk/Lib/test/test_httplib.py Sat Nov 29 01:09:16 2008 @@ -107,19 +107,23 @@ for hp in ("www.python.org:abc", "www.python.org:"): self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) - for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", + 8000), ("www.python.org:80", "www.python.org", 80), ("www.python.org", "www.python.org", 80), ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): http = httplib.HTTP(hp) c = http._conn - if h != c.host: self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) - if p != c.port: self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + if h != c.host: + self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: + self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) def test_response_headers(self): # test response with multiple message headers with the same field name. text = ('HTTP/1.1 200 OK\r\n' - 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE";' + ' Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' ' Path="/acme"\r\n' '\r\n' @@ -187,7 +191,8 @@ resp.close() def test_negative_content_length(self): - sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: -1\r\n\r\nHello\r\n') + sock = FakeSocket('HTTP/1.1 200 OK\r\n' + 'Content-Length: -1\r\n\r\nHello\r\n') resp = httplib.HTTPResponse(sock, method="GET") resp.begin() self.assertEquals(resp.read(), 'Hello\r\n') From buildbot at python.org Sat Nov 29 01:33:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 00:33:30 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081129003331.093481E4002@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/350 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: jeremy.hylton BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socket ====================================================================== ERROR: testShutdown (test.test_socket.BasicTCPTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socket.py", line 120, in _tearDown self.fail(msg) AssertionError: [Errno 57] Socket is not connected make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Nov 29 01:58:30 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 00:58:30 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081129005830.464FB1E4002@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/340 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: jeremy.hylton BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From python-checkins at python.org Sat Nov 29 02:09:35 2008 From: python-checkins at python.org (jeremy.hylton) Date: Sat, 29 Nov 2008 02:09:35 +0100 (CET) Subject: [Python-checkins] r67442 - in python/trunk/Lib: httplib.py xmlrpclib.py Message-ID: <20081129010935.9CAAA1E4002@bag.python.org> Author: jeremy.hylton Date: Sat Nov 29 02:09:35 2008 New Revision: 67442 Log: Send HTTP headers and message body in a single send() call. This change addresses part of issue 4336. Change endheaders() to take an optional message_body argument that is sent along with the headers. Change xmlrpclib and httplib's other methods to use this new interface. It is more efficient to make a single send() call, which should get the entire client request into one packet (assuming it is smaller than the MTU) and will avoid the long pause for delayed ack following timeout. Also: - Add a comment about the buffer size for makefile(). - Extract _set_content_length() method and fix whitespace issues there. Modified: python/trunk/Lib/httplib.py python/trunk/Lib/xmlrpclib.py Modified: python/trunk/Lib/httplib.py ============================================================================== --- python/trunk/Lib/httplib.py (original) +++ python/trunk/Lib/httplib.py Sat Nov 29 02:09:35 2008 @@ -326,6 +326,11 @@ # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. def __init__(self, sock, debuglevel=0, strict=0, method=None): + # The buffer size is specified as zero, because the headers of + # the response are read with readline(). If the reads were + # buffered the readline() calls could consume some of the + # response, which make be read via a recv() on the underlying + # socket. self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.strict = strict @@ -729,7 +734,7 @@ """ self._buffer.append(s) - def _send_output(self): + def _send_output(self, message_body=None): """Send the currently buffered request and clear the buffer. Appends an extra \\r\\n to the buffer. @@ -737,6 +742,11 @@ self._buffer.extend(("", "")) msg = "\r\n".join(self._buffer) del self._buffer[:] + # If msg and message_body are sent in a single send() call, + # it will avoid performance problems caused by the interaction + # between delayed ack and the Nagle algorithim. + if message_body is not None: + msg += message_body self.send(msg) def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): @@ -857,15 +867,20 @@ str = '%s: %s' % (header, '\r\n\t'.join(values)) self._output(str) - def endheaders(self): - """Indicate that the last header line has been sent to the server.""" + def endheaders(self, message_body=None): + """Indicate that the last header line has been sent to the server. + This method sends the request to the server. The optional + message_body argument can be used to pass message body + associated with the request. The message body will be sent in + the same packet as the message headers if possible. The + message_body should be a string. + """ if self.__state == _CS_REQ_STARTED: self.__state = _CS_REQ_SENT else: raise CannotSendHeader() - - self._send_output() + self._send_output(message_body) def request(self, method, url, body=None, headers={}): """Send a complete request to the server.""" @@ -879,6 +894,24 @@ # try one more time self._send_request(method, url, body, headers) + def _set_content_length(self, body): + # Set the content-length based on the body. + thelen = None + try: + thelen = str(len(body)) + except TypeError, te: + # If this is a file-like object, try to + # fstat its file descriptor + import os + try: + thelen = str(os.fstat(body.fileno()).st_size) + except (AttributeError, OSError): + # Don't send a length if this failed + if self.debuglevel > 0: print "Cannot stat!!" + + if thelen is not None: + self.putheader('Content-Length', thelen) + def _send_request(self, method, url, body, headers): # honour explicitly requested Host: and Accept-Encoding headers header_names = dict.fromkeys([k.lower() for k in headers]) @@ -891,27 +924,15 @@ self.putrequest(method, url, **skips) if body and ('content-length' not in header_names): - thelen=None - try: - thelen=str(len(body)) - except TypeError, te: - # If this is a file-like object, try to - # fstat its file descriptor - import os - try: - thelen = str(os.fstat(body.fileno()).st_size) - except (AttributeError, OSError): - # Don't send a length if this failed - if self.debuglevel > 0: print "Cannot stat!!" - - if thelen is not None: - self.putheader('Content-Length',thelen) + self._set_content_length(body) for hdr, value in headers.iteritems(): self.putheader(hdr, value) - self.endheaders() - - if body: - self.send(body) + if isinstance(body, str): + self.endheaders(body) + else: + self.endheaders() + if body: # when body is a file rather than a string + self.send(body) def getresponse(self): "Get the response from the server." Modified: python/trunk/Lib/xmlrpclib.py ============================================================================== --- python/trunk/Lib/xmlrpclib.py (original) +++ python/trunk/Lib/xmlrpclib.py Sat Nov 29 02:09:35 2008 @@ -1346,9 +1346,7 @@ def send_content(self, connection, request_body): connection.putheader("Content-Type", "text/xml") connection.putheader("Content-Length", str(len(request_body))) - connection.endheaders() - if request_body: - connection.send(request_body) + connection.endheaders(request_body) ## # Parse response. From buildbot at python.org Sat Nov 29 02:12:36 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 01:12:36 +0000 Subject: [Python-checkins] buildbot failure in ppc Debian unstable trunk Message-ID: <20081129011236.4637D1E4002@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/2112 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: jeremy.hylton 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 Nov 29 02:14:32 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 01:14:32 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20081129011433.05C501E4002@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/679 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: amaury.forgeotdarc,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_distutils test_posix ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 43, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sat Nov 29 03:03:32 2008 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sat, 29 Nov 2008 03:03:32 +0100 (CET) Subject: [Python-checkins] r67444 - python/trunk/Objects/unicodeobject.c Message-ID: <20081129020332.3A9601E4002@bag.python.org> Author: amaury.forgeotdarc Date: Sat Nov 29 03:03:32 2008 New Revision: 67444 Log: Fix a small typo in docstring Modified: python/trunk/Objects/unicodeobject.c Modified: python/trunk/Objects/unicodeobject.c ============================================================================== --- python/trunk/Objects/unicodeobject.c (original) +++ python/trunk/Objects/unicodeobject.c Sat Nov 29 03:03:32 2008 @@ -7680,7 +7680,7 @@ } PyDoc_STRVAR(splitlines__doc__, -"S.splitlines([keepends]]) -> list of strings\n\ +"S.splitlines([keepends]) -> list of strings\n\ \n\ Return a list of the lines in S, breaking at line boundaries.\n\ Line breaks are not included in the resulting list unless keepends\n\ From buildbot at python.org Sat Nov 29 03:12:06 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 02:12:06 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20081129021206.7270C1E4002@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/1326 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 test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Nov 29 03:12:43 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 02:12:43 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081129021243.3A6CA1E4002@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/1096 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: jeremy.hylton BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 Traceback (most recent call last): File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\threading.py", line 522, in __bootstrap_inner self.run() File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\test\test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "S:\buildbots\python.x64\trunk.nelson-win64\build\lib\bsddb\dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30994, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') sincerely, -The Buildbot From buildbot at python.org Sat Nov 29 04:10:34 2008 From: buildbot at python.org (buildbot at python.org) Date: Sat, 29 Nov 2008 03:10:34 +0000 Subject: [Python-checkins] buildbot failure in x86 W2k8 trunk Message-ID: <20081129031035.04BDF1E4002@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/343 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 BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "S:\buildbots\python\trunk.nelson-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() 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/0 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: amaury.forgeotdarc,benjamin.peterson,georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Nov 30 04:07:33 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 30 Nov 2008 04:07:33 +0100 (CET) Subject: [Python-checkins] r67445 - python/trunk/Doc/library/stringio.rst Message-ID: <20081130030733.97C441E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 30 04:07:33 2008 New Revision: 67445 Log: StringIO.close() stops you from using the buffer, too Modified: python/trunk/Doc/library/stringio.rst Modified: python/trunk/Doc/library/stringio.rst ============================================================================== --- python/trunk/Doc/library/stringio.rst (original) +++ python/trunk/Doc/library/stringio.rst Sun Nov 30 04:07:33 2008 @@ -37,7 +37,8 @@ .. method:: StringIO.close() - Free the memory buffer. + Free the memory buffer. Attempting to do further operations with a closed + :class:`StringIO` object will raise a :exc:`ValueError`. Example usage:: From buildbot at python.org Sun Nov 30 05:13:17 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 04:13:17 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20081130041317.3DCFF1E4002@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/681 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_posix test_subprocess ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Sun Nov 30 09:29:54 2008 From: python-checkins at python.org (thomas.lee) Date: Sun, 30 Nov 2008 09:29:54 +0100 (CET) Subject: [Python-checkins] r67447 - in python/branches/tlee-ast-optimize: Doc/c-api/arg.rst Doc/conf.py Doc/howto/unicode.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/library/bdb.rst Doc/library/collections.rst Doc/library/ctypes.rst Doc/library/httplib.rst Doc/library/io.rst Doc/library/locale.rst Doc/library/multiprocessing.rst Doc/library/os.rst Doc/library/pdb.rst Doc/library/sqlite3.rst Doc/library/stringio.rst Doc/library/sys.rst Doc/reference/datamodel.rst Doc/tools/sphinxext/download.html Lib/asyncore.py Lib/distutils/msvc9compiler.py Lib/doctest.py Lib/httplib.py Lib/io.py Lib/lib-tk/turtle.py Lib/lib2to3 Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/fix_dict.py Lib/lib2to3/fixes/fix_except.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_imports2.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_numliterals.py Lib/lib2to3/fixes/fix_renames.py Lib/lib2to3/fixes/fix_urllib.py Lib/lib2to3/pgen2/parse.py Lib/lib2to3/pytree.py Lib/lib2to3/refactor.py Lib/lib2to3/tests Lib/lib2to3/tests/data Lib/lib2to3/tests/data/fixers Lib/lib2to3/tests/data/fixers/myfixes Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_refactor.py Lib/multiprocessing/__init__.py Lib/multiprocessing/pool.py Lib/optparse.py Lib/test/test_bytes.py Lib/test/test_descr.py Lib/test/test_fileio.py Lib/test/test_httplib.py Lib/test/test_imageop.py Lib/test/test_io.py Lib/test/test_parser.py Lib/test/test_unicodedata.py Lib/test/test_xmlrpc.py Lib/uuid.py Lib/xmlrpclib.py Misc/NEWS Modules/Setup.dist Modules/_fileio.c Modules/_multiprocessing/semaphore.c Modules/imageop.c Modules/parsermodule.c Objects/bytearrayobject.c Objects/typeobject.c Objects/unicodeobject.c PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/pythoncore.vcproj PC/os2vacpp/makefile PC/os2vacpp/makefile.omk PCbuild/pythoncore.vcproj Python/ast.c Python/pythonrun.c Tools/msi/msi.py Tools/scripts/svneol.py configure configure.in Message-ID: <20081130082954.D89391E4002@bag.python.org> Author: thomas.lee Date: Sun Nov 30 09:29:52 2008 New Revision: 67447 Log: Merged revisions 67189,67224-67227,67234,67243,67245-67246,67266,67277-67279,67283,67287,67289,67291,67295,67301-67303,67307,67318,67320,67326,67330,67332,67336,67342-67343,67348-67349,67353,67355,67359,67362,67364-67365,67367-67368,67370,67373,67376,67396,67398,67407,67411,67414,67419,67423-67424,67428,67432,67440-67442,67444-67445 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r67189 | benjamin.peterson | 2008-11-12 08:56:06 +1100 (Wed, 12 Nov 2008) | 1 line use correct name ................ r67224 | georg.brandl | 2008-11-15 19:10:04 +1100 (Sat, 15 Nov 2008) | 2 lines #4324: fix getlocale() argument. ................ r67225 | brett.cannon | 2008-11-16 09:33:25 +1100 (Sun, 16 Nov 2008) | 1 line Clarify the docs for the 'strict' argument to httplib.HTTPConnection. ................ r67226 | brett.cannon | 2008-11-16 09:40:44 +1100 (Sun, 16 Nov 2008) | 4 lines The docs for httplib.HTTPConnection.putheader() have claimed for quite a while that their could be an arbitrary number of values passed in. Turns out the code did not match that. The code now matches the docs. ................ r67227 | georg.brandl | 2008-11-16 19:00:17 +1100 (Sun, 16 Nov 2008) | 2 lines #4316: fix configure.in markup problem. ................ r67234 | benjamin.peterson | 2008-11-17 04:54:55 +1100 (Mon, 17 Nov 2008) | 1 line run autoconf ................ r67243 | benjamin.peterson | 2008-11-18 08:39:05 +1100 (Tue, 18 Nov 2008) | 1 line a few fixes on the download page ................ r67245 | benjamin.peterson | 2008-11-18 09:05:19 +1100 (Tue, 18 Nov 2008) | 1 line improve __hash__ docs ................ r67246 | benjamin.peterson | 2008-11-18 09:39:09 +1100 (Tue, 18 Nov 2008) | 5 lines when __getattr__ is a descriptor, call it correctly; fixes #4230 patch from Ziga Seilnacht ................ r67266 | amaury.forgeotdarc | 2008-11-19 09:19:37 +1100 (Wed, 19 Nov 2008) | 4 lines #4317: Fix an Array Bounds Read in imageop.rgb2rgb8. Will backport to 2.4. ................ r67277 | skip.montanaro | 2008-11-19 14:35:41 +1100 (Wed, 19 Nov 2008) | 1 line patch from issue 1108 ................ r67278 | georg.brandl | 2008-11-19 18:59:09 +1100 (Wed, 19 Nov 2008) | 2 lines Try to fix problems with verbatim. ................ r67279 | martin.v.loewis | 2008-11-19 20:09:41 +1100 (Wed, 19 Nov 2008) | 2 lines Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__ ................ r67283 | martin.v.loewis | 2008-11-20 00:51:44 +1100 (Thu, 20 Nov 2008) | 1 line Issue #4289: Remove Cancel button from AdvancedDlg. ................ r67287 | josiah.carlson | 2008-11-20 05:26:12 +1100 (Thu, 20 Nov 2008) | 2 lines Fix for issue 4332 in trunk. ................ r67289 | brett.cannon | 2008-11-20 07:29:39 +1100 (Thu, 20 Nov 2008) | 2 lines Ignore .pyc and .pyo files. ................ r67291 | benjamin.peterson | 2008-11-20 08:49:09 +1100 (Thu, 20 Nov 2008) | 5 lines make sure that bytearray methods return a new bytearray even if there is no change Fixes #4348 Reviewed by Brett ................ r67295 | benjamin.peterson | 2008-11-20 15:05:12 +1100 (Thu, 20 Nov 2008) | 1 line move useful sys.settrace information to the function's documentation from the debugger ................ r67301 | benjamin.peterson | 2008-11-21 08:25:31 +1100 (Fri, 21 Nov 2008) | 1 line fix indentation and a sphinx warning ................ r67302 | benjamin.peterson | 2008-11-21 08:44:23 +1100 (Fri, 21 Nov 2008) | 1 line oops! didn't mean to disable that test ................ r67303 | benjamin.peterson | 2008-11-21 09:06:22 +1100 (Fri, 21 Nov 2008) | 1 line backport r67300 ................ r67307 | amaury.forgeotdarc | 2008-11-21 10:34:31 +1100 (Fri, 21 Nov 2008) | 9 lines Fixed issue #4233. Changed semantic of _fileio.FileIO's close() method on file objects with closefd=False. The file descriptor is still kept open but the file object behaves like a closed file. The FileIO object also got a new readonly attribute closefd. Approved by Barry Backport of r67106 from the py3k branch ................ r67318 | amaury.forgeotdarc | 2008-11-22 09:05:48 +1100 (Sat, 22 Nov 2008) | 4 lines #4363: Let uuid.uuid1() and uuid.uuid4() run even if the ctypes module is not present. Will backport to 2.6 ................ r67320 | benjamin.peterson | 2008-11-22 09:27:24 +1100 (Sat, 22 Nov 2008) | 4 lines don't segfault when \N escapes are used and unicodedata fails to load Fixes #4367 ................ r67326 | benjamin.peterson | 2008-11-22 12:59:15 +1100 (Sat, 22 Nov 2008) | 1 line backport r67325: make FileIO.mode always contain 'b' ................ r67330 | georg.brandl | 2008-11-22 19:34:14 +1100 (Sat, 22 Nov 2008) | 2 lines #4364: fix attribute name on ctypes object. ................ r67332 | georg.brandl | 2008-11-22 19:45:33 +1100 (Sat, 22 Nov 2008) | 2 lines Fix typo. ................ r67336 | georg.brandl | 2008-11-22 21:08:50 +1100 (Sat, 22 Nov 2008) | 2 lines Fix error about "-*-" being mandatory in coding cookies. ................ r67342 | amaury.forgeotdarc | 2008-11-23 06:39:38 +1100 (Sun, 23 Nov 2008) | 3 lines yuvconvert.c is a part of the "sv" module, an old IRIX thing and certainly not useful for any Windows build. ................ r67343 | amaury.forgeotdarc | 2008-11-23 07:01:18 +1100 (Sun, 23 Nov 2008) | 5 lines #3996: On Windows, PyOS_CheckStack is supposed to protect the interpreter from stack overflow. But doing this, it always crashes when the stack is nearly full. Reviewed by Martin von Loewis. Will backport to 2.6. ................ r67348 | benjamin.peterson | 2008-11-23 13:09:41 +1100 (Sun, 23 Nov 2008) | 1 line raise a better error ................ r67349 | matthias.klose | 2008-11-24 00:37:03 +1100 (Mon, 24 Nov 2008) | 3 lines - Modules/Setup.dist: Mention _functools in section "Modules that should always be present (non UNIX dependent)" ................ r67353 | matthias.klose | 2008-11-24 00:54:42 +1100 (Mon, 24 Nov 2008) | 2 lines - Fix typo in last checkin ................ r67355 | georg.brandl | 2008-11-24 06:17:25 +1100 (Mon, 24 Nov 2008) | 2 lines #4392: fix parameter name. ................ r67359 | georg.brandl | 2008-11-24 08:57:30 +1100 (Mon, 24 Nov 2008) | 2 lines #4399: fix typo. ................ r67362 | gregory.p.smith | 2008-11-24 11:41:43 +1100 (Mon, 24 Nov 2008) | 2 lines Document PY_SSIZE_T_CLEAN for PyArg_ParseTuple. ................ r67364 | benjamin.peterson | 2008-11-24 12:16:29 +1100 (Mon, 24 Nov 2008) | 2 lines replace reference to debugger-hooks ................ r67365 | benjamin.peterson | 2008-11-24 15:09:03 +1100 (Mon, 24 Nov 2008) | 1 line #4396 make the parser module correctly validate the with syntax ................ r67367 | georg.brandl | 2008-11-25 03:16:07 +1100 (Tue, 25 Nov 2008) | 2 lines Fix typo. ................ r67368 | georg.brandl | 2008-11-25 06:56:47 +1100 (Tue, 25 Nov 2008) | 2 lines #4404: make clear what "path" is. ................ r67370 | jeremy.hylton | 2008-11-25 09:00:29 +1100 (Tue, 25 Nov 2008) | 8 lines Add unittests that verify documented behavior of public methods in Transport class. These methods can be overridden. The tests verify that the overridden methods are called, and that changes to the connection have a visible effect on the request. ................ r67373 | benjamin.peterson | 2008-11-25 14:43:14 +1100 (Tue, 25 Nov 2008) | 2 lines always check the return value of NEW_IDENTIFIER ................ r67376 | benjamin.peterson | 2008-11-25 15:07:45 +1100 (Tue, 25 Nov 2008) | 17 lines Merged revisions 67183,67191,67371 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r67183 | benjamin.peterson | 2008-11-10 21:51:33 -0600 (Mon, 10 Nov 2008) | 1 line handle 'import x as y' in fix_imports; this still needs more work... ........ r67191 | benjamin.peterson | 2008-11-11 17:24:51 -0600 (Tue, 11 Nov 2008) | 1 line super() is good ........ r67371 | benjamin.peterson | 2008-11-24 16:02:00 -0600 (Mon, 24 Nov 2008) | 1 line don't blow up in the metaclass fixer when assignments in the class statement aren't simple ........ ................ r67396 | matthias.klose | 2008-11-27 04:32:49 +1100 (Thu, 27 Nov 2008) | 2 lines - Modules/Setup.dist: Mention _elementtree and _pickle. ................ r67398 | benjamin.peterson | 2008-11-27 04:39:17 +1100 (Thu, 27 Nov 2008) | 1 line fix typo in sqlite3 docs ................ r67407 | matthias.klose | 2008-11-27 18:45:25 +1100 (Thu, 27 Nov 2008) | 2 lines - Modules/Setup.dist: Update pyexpat ................ r67411 | matthias.klose | 2008-11-27 21:14:22 +1100 (Thu, 27 Nov 2008) | 2 lines - Modules/Setup.dist: Update _elementtree, add _bisect, datetime ................ r67414 | christian.heimes | 2008-11-28 22:02:32 +1100 (Fri, 28 Nov 2008) | 1 line Fixed issue ##3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an exception ................ r67419 | jesse.noller | 2008-11-29 05:22:54 +1100 (Sat, 29 Nov 2008) | 2 lines mp docs - fix issues 4012,3518,4193 ................ r67423 | jesse.noller | 2008-11-29 05:59:35 +1100 (Sat, 29 Nov 2008) | 2 lines issue4238: bsd support for cpu_count ................ r67424 | christian.heimes | 2008-11-29 06:33:33 +1100 (Sat, 29 Nov 2008) | 1 line Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5 ................ r67428 | benjamin.peterson | 2008-11-29 09:12:14 +1100 (Sat, 29 Nov 2008) | 57 lines Merged revisions 67384,67386-67387,67389-67390,67392,67399-67400,67403-67405,67426 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r67384 | benjamin.peterson | 2008-11-25 16:13:31 -0600 (Tue, 25 Nov 2008) | 4 lines don't duplicate calls to start_tree() RefactoringTool.pre_order values now holds a list of the fixers while pre_order_mapping holds the dict. ........ r67386 | benjamin.peterson | 2008-11-25 16:44:52 -0600 (Tue, 25 Nov 2008) | 1 line #4423 fix_imports was still replacing usage of a module if attributes were being used ........ r67387 | benjamin.peterson | 2008-11-25 16:47:54 -0600 (Tue, 25 Nov 2008) | 1 line fix broken test ........ r67389 | benjamin.peterson | 2008-11-25 17:13:17 -0600 (Tue, 25 Nov 2008) | 1 line remove compatibility code; we only cater to 2.5+ ........ r67390 | benjamin.peterson | 2008-11-25 22:03:36 -0600 (Tue, 25 Nov 2008) | 1 line fix #3994; the usage of changed imports was fixed in nested cases ........ r67392 | benjamin.peterson | 2008-11-26 11:11:40 -0600 (Wed, 26 Nov 2008) | 1 line simpilfy and comment fix_imports ........ r67399 | benjamin.peterson | 2008-11-26 11:47:03 -0600 (Wed, 26 Nov 2008) | 1 line remove more compatibility code ........ r67400 | benjamin.peterson | 2008-11-26 12:07:41 -0600 (Wed, 26 Nov 2008) | 1 line set svn:ignore ........ r67403 | benjamin.peterson | 2008-11-26 13:11:11 -0600 (Wed, 26 Nov 2008) | 1 line wrap import ........ r67404 | benjamin.peterson | 2008-11-26 13:29:49 -0600 (Wed, 26 Nov 2008) | 1 line build the fix_imports pattern in compile_pattern, so MAPPING can be changed and reflected in the pattern ........ r67405 | benjamin.peterson | 2008-11-26 14:01:24 -0600 (Wed, 26 Nov 2008) | 1 line stop ugly messages about runtime errors being from printed ........ r67426 | benjamin.peterson | 2008-11-28 16:01:40 -0600 (Fri, 28 Nov 2008) | 5 lines don't replace a module name if it is in the middle of a attribute lookup This fix also stops module names from being replaced if they are not in an attribute lookup. ........ ................ r67432 | benjamin.peterson | 2008-11-29 10:18:46 +1100 (Sat, 29 Nov 2008) | 1 line SVN format 9 is the same it seems ................ r67440 | jeremy.hylton | 2008-11-29 10:42:59 +1100 (Sat, 29 Nov 2008) | 4 lines Move definition int sval into branch of ifdef where it is used. Otherwise, you get a warning about an undefined variable. ................ r67441 | jeremy.hylton | 2008-11-29 11:09:16 +1100 (Sat, 29 Nov 2008) | 2 lines Reflow long lines. ................ r67442 | jeremy.hylton | 2008-11-29 12:09:35 +1100 (Sat, 29 Nov 2008) | 18 lines Send HTTP headers and message body in a single send() call. This change addresses part of issue 4336. Change endheaders() to take an optional message_body argument that is sent along with the headers. Change xmlrpclib and httplib's other methods to use this new interface. It is more efficient to make a single send() call, which should get the entire client request into one packet (assuming it is smaller than the MTU) and will avoid the long pause for delayed ack following timeout. Also: - Add a comment about the buffer size for makefile(). - Extract _set_content_length() method and fix whitespace issues there. ................ r67444 | amaury.forgeotdarc | 2008-11-29 13:03:32 +1100 (Sat, 29 Nov 2008) | 2 lines Fix a small typo in docstring ................ r67445 | benjamin.peterson | 2008-11-30 14:07:33 +1100 (Sun, 30 Nov 2008) | 1 line StringIO.close() stops you from using the buffer, too ................ Modified: python/branches/tlee-ast-optimize/ (props changed) python/branches/tlee-ast-optimize/Doc/c-api/arg.rst python/branches/tlee-ast-optimize/Doc/conf.py python/branches/tlee-ast-optimize/Doc/howto/unicode.rst python/branches/tlee-ast-optimize/Doc/includes/mp_benchmarks.py python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py python/branches/tlee-ast-optimize/Doc/includes/mp_newtype.py python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py python/branches/tlee-ast-optimize/Doc/library/bdb.rst python/branches/tlee-ast-optimize/Doc/library/collections.rst python/branches/tlee-ast-optimize/Doc/library/ctypes.rst python/branches/tlee-ast-optimize/Doc/library/httplib.rst python/branches/tlee-ast-optimize/Doc/library/io.rst python/branches/tlee-ast-optimize/Doc/library/locale.rst python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst python/branches/tlee-ast-optimize/Doc/library/os.rst python/branches/tlee-ast-optimize/Doc/library/pdb.rst python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst python/branches/tlee-ast-optimize/Doc/library/stringio.rst python/branches/tlee-ast-optimize/Doc/library/sys.rst python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst python/branches/tlee-ast-optimize/Doc/tools/sphinxext/download.html python/branches/tlee-ast-optimize/Lib/asyncore.py python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py python/branches/tlee-ast-optimize/Lib/doctest.py python/branches/tlee-ast-optimize/Lib/httplib.py python/branches/tlee-ast-optimize/Lib/io.py python/branches/tlee-ast-optimize/Lib/lib-tk/turtle.py python/branches/tlee-ast-optimize/Lib/lib2to3/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.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_import.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports2.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_next.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_numliterals.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_renames.py python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_urllib.py python/branches/tlee-ast-optimize/Lib/lib2to3/pgen2/parse.py python/branches/tlee-ast-optimize/Lib/lib2to3/pytree.py python/branches/tlee-ast-optimize/Lib/lib2to3/refactor.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/fixers/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/tests/data/fixers/myfixes/ (props changed) python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_fixers.py python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py python/branches/tlee-ast-optimize/Lib/multiprocessing/__init__.py python/branches/tlee-ast-optimize/Lib/multiprocessing/pool.py python/branches/tlee-ast-optimize/Lib/optparse.py python/branches/tlee-ast-optimize/Lib/test/test_bytes.py python/branches/tlee-ast-optimize/Lib/test/test_descr.py python/branches/tlee-ast-optimize/Lib/test/test_fileio.py python/branches/tlee-ast-optimize/Lib/test/test_httplib.py python/branches/tlee-ast-optimize/Lib/test/test_imageop.py python/branches/tlee-ast-optimize/Lib/test/test_io.py python/branches/tlee-ast-optimize/Lib/test/test_parser.py python/branches/tlee-ast-optimize/Lib/test/test_unicodedata.py python/branches/tlee-ast-optimize/Lib/test/test_xmlrpc.py python/branches/tlee-ast-optimize/Lib/uuid.py python/branches/tlee-ast-optimize/Lib/xmlrpclib.py python/branches/tlee-ast-optimize/Misc/NEWS python/branches/tlee-ast-optimize/Modules/Setup.dist python/branches/tlee-ast-optimize/Modules/_fileio.c python/branches/tlee-ast-optimize/Modules/_multiprocessing/semaphore.c python/branches/tlee-ast-optimize/Modules/imageop.c python/branches/tlee-ast-optimize/Modules/parsermodule.c python/branches/tlee-ast-optimize/Objects/bytearrayobject.c python/branches/tlee-ast-optimize/Objects/typeobject.c python/branches/tlee-ast-optimize/Objects/unicodeobject.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/PC/os2vacpp/makefile python/branches/tlee-ast-optimize/PC/os2vacpp/makefile.omk python/branches/tlee-ast-optimize/PCbuild/pythoncore.vcproj python/branches/tlee-ast-optimize/Python/ast.c python/branches/tlee-ast-optimize/Python/pythonrun.c python/branches/tlee-ast-optimize/Tools/msi/msi.py python/branches/tlee-ast-optimize/Tools/scripts/svneol.py python/branches/tlee-ast-optimize/configure python/branches/tlee-ast-optimize/configure.in Modified: python/branches/tlee-ast-optimize/Doc/c-api/arg.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/c-api/arg.rst (original) +++ python/branches/tlee-ast-optimize/Doc/c-api/arg.rst Sun Nov 30 09:29:52 2008 @@ -32,7 +32,7 @@ converted to C strings using the default encoding. If this conversion fails, a :exc:`UnicodeError` is raised. -``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int] +``s#`` (string, Unicode or any read buffer compatible object) [const char \*, int (or :ctype:`Py_ssize_t`, see below)] This variant on ``s`` stores into two C variables, the first one a pointer to a character string, the second one its length. In this case the Python string may contain embedded null bytes. Unicode objects pass back a pointer to the default @@ -40,6 +40,11 @@ other read-buffer compatible objects pass back a reference to the raw internal data representation. + Starting with Python 2.5 the type of the length argument can be + controlled by defining the macro :cmacro:`PY_SSIZE_T_CLEAN` before + including :file:`Python.h`. If the macro is defined, length is a + :ctype:`Py_ssize_t` rather than an int. + ``s*`` (string, Unicode, or any buffer compatible object) [Py_buffer \*] Similar to ``s#``, this code fills a Py_buffer structure provided by the caller. The buffer gets locked, so that the caller can subsequently use the buffer even Modified: python/branches/tlee-ast-optimize/Doc/conf.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/conf.py (original) +++ python/branches/tlee-ast-optimize/Doc/conf.py Sun Nov 30 09:29:52 2008 @@ -138,6 +138,8 @@ \strong{Python Software Foundation}\\ Email: \email{docs at python.org} } +\let\Verbatim=\OriginalVerbatim +\let\endVerbatim=\endOriginalVerbatim ''' # Documents to append as an appendix to all manuals. Modified: python/branches/tlee-ast-optimize/Doc/howto/unicode.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/howto/unicode.rst (original) +++ python/branches/tlee-ast-optimize/Doc/howto/unicode.rst Sun Nov 30 09:29:52 2008 @@ -410,9 +410,9 @@ The syntax is inspired by Emacs's notation for specifying variables local to a file. Emacs supports many different variables, but Python only supports -'coding'. The ``-*-`` symbols indicate that the comment is special; within -them, you must supply the name ``coding`` and the name of your chosen encoding, -separated by ``':'``. +'coding'. The ``-*-`` symbols indicate to Emacs that the comment is special; +they have no significance to Python but are a convention. Python looks for +``coding: name`` or ``coding=name`` in the comment. If you don't include such a comment, the default encoding used will be ASCII. Versions of Python before 2.4 were Euro-centric and assumed Latin-1 as a default Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_benchmarks.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_benchmarks.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_benchmarks.py Sun Nov 30 09:29:52 2008 @@ -1,6 +1,9 @@ # # Simple benchmarks for the multiprocessing package # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time, sys, multiprocessing, threading, Queue, gc Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_distributing.py Sun Nov 30 09:29:52 2008 @@ -3,6 +3,9 @@ # # Depends on `multiprocessing` package -- tested with `processing-0.60` # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# __all__ = ['Cluster', 'Host', 'get_logger', 'current_process'] @@ -37,7 +40,6 @@ _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) Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_newtype.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_newtype.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_newtype.py Sun Nov 30 09:29:52 2008 @@ -2,6 +2,9 @@ # This module shows how to use arbitrary callables with a subclass of # `BaseManager`. # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# from multiprocessing import freeze_support from multiprocessing.managers import BaseManager, BaseProxy Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_pool.py Sun Nov 30 09:29:52 2008 @@ -1,6 +1,9 @@ # # A test of `multiprocessing.Pool` class # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import multiprocessing import time Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_synchronize.py Sun Nov 30 09:29:52 2008 @@ -1,6 +1,9 @@ # # A test file for the `multiprocessing` package # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time, sys, random from Queue import Empty Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_webserver.py Sun Nov 30 09:29:52 2008 @@ -8,6 +8,9 @@ # Not sure if we should synchronize access to `socket.accept()` method by # using a process-shared lock -- does not seem to be necessary. # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import os import sys Modified: python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py ============================================================================== --- python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py (original) +++ python/branches/tlee-ast-optimize/Doc/includes/mp_workers.py Sun Nov 30 09:29:52 2008 @@ -7,6 +7,9 @@ # in the original order then consider using `Pool.map()` or # `Pool.imap()` (which will save on the amount of code needed anyway). # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time import random Modified: python/branches/tlee-ast-optimize/Doc/library/bdb.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/bdb.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/bdb.rst Sun Nov 30 09:29:52 2008 @@ -107,8 +107,9 @@ The *arg* parameter depends on the previous event. - For more information on trace functions, see :ref:`debugger-hooks`. For - more information on code and frame objects, refer to :ref:`types`. + See the documentation for :func:`sys.settrace` for more information on the + trace function. For more information on code and frame objects, refer to + :ref:`types`. .. method:: dispatch_line(frame) 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 Sun Nov 30 09:29:52 2008 @@ -60,7 +60,7 @@ :class:`Iterable`, and ``__len__`` ``index``, and ``count`` :class:`Container` -:class:`MutableSequnce` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and +:class:`MutableSequence` :class:`Sequence` ``__getitem__`` Inherited Sequence methods and ``__delitem__``, ``append``, ``reverse``, ``extend``, ``pop``, ``insert``, ``remove``, and ``__iadd__`` and ``__len__`` @@ -487,16 +487,16 @@ self-documenting code. They can be used wherever regular tuples are used, and they add the ability to access fields by name instead of position index. -.. function:: namedtuple(typename, fieldnames, [verbose]) +.. function:: namedtuple(typename, field_names, [verbose]) Returns a new tuple subclass named *typename*. The new subclass is used to create tuple-like objects that have fields accessible by attribute lookup as well as being indexable and iterable. Instances of the subclass also have a - helpful docstring (with typename and fieldnames) and a helpful :meth:`__repr__` + helpful docstring (with typename and field_names) and a helpful :meth:`__repr__` method which lists the tuple contents in a ``name=value`` format. - The *fieldnames* are a single string with each fieldname separated by whitespace - and/or commas, for example ``'x y'`` or ``'x, y'``. Alternatively, *fieldnames* + The *field_names* are a single string with each fieldname separated by whitespace + and/or commas, for example ``'x y'`` or ``'x, y'``. Alternatively, *field_names* can be a sequence of strings such as ``['x', 'y']``. Any valid Python identifier may be used for a fieldname except for names 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 Nov 30 09:29:52 2008 @@ -1370,7 +1370,7 @@ All these classes can be instantiated by calling them with at least one argument, the pathname of the shared library. If you have an existing handle to -an already loaded shard library, it can be passed as the ``handle`` named +an already loaded shared library, it can be passed as the ``handle`` named parameter, otherwise the underlying platforms ``dlopen`` or :meth:`LoadLibrary` function is used to load the library into the process, and to get a handle to it. 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 Nov 30 09:29:52 2008 @@ -40,7 +40,8 @@ server. It should be instantiated passing it a host and optional port number. If no port number is passed, the port is extracted from the host string if it has the form ``host:port``, else the default HTTP port (80) is - used. When True, the optional parameter *strict* causes ``BadStatusLine`` to + used. When True, the optional parameter *strict* (which defaults to a false + value) causes ``BadStatusLine`` to 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 Modified: python/branches/tlee-ast-optimize/Doc/library/io.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/io.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/io.rst Sun Nov 30 09:29:52 2008 @@ -214,8 +214,10 @@ .. method:: close() - Flush and close this stream. This method has no effect if the file is - already closed. + Flush and close this stream. This method has no effect if the file is + already closed. Once the file is closed, any operation on the file + (e.g. reading or writing) will raise an :exc:`IOError`. The internal + file descriptor isn't closed if *closefd* was False. .. attribute:: closed Modified: python/branches/tlee-ast-optimize/Doc/library/locale.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/locale.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/locale.rst Sun Nov 30 09:29:52 2008 @@ -492,7 +492,7 @@ Example:: >>> import locale - >>> loc = locale.getlocale(locale.LC_ALL) # get current locale + >>> loc = locale.getlocale() # get current locale >>> locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name might vary with platform >>> locale.strcoll('f\xe4n', 'foo') # compare a string containing an umlaut >>> locale.setlocale(locale.LC_ALL, '') # use user's preferred locale Modified: python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/multiprocessing.rst Sun Nov 30 09:29:52 2008 @@ -26,6 +26,29 @@ import it will result in an :exc:`ImportError`. See :issue:`3770` for additional information. +.. note:: + + Functionality within this package requires that the ``__main__`` method be + importable by the children. This is covered in :ref:`multiprocessing-programming` + however it is worth pointing out here. This means that some examples, such + as the :class:`multiprocessing.Pool` examples will not work in the + interactive interpreter. For example:: + + >>> from multiprocessing import Pool + >>> p = Pool(5) + >>> def f(x): + ... return x*x + ... + >>> p.map(f, [1,2,3]) + Process PoolWorker-1: + Process PoolWorker-2: + Traceback (most recent call last): + Traceback (most recent call last): + AttributeError: 'module' object has no attribute 'f' + AttributeError: 'module' object has no attribute 'f' + AttributeError: 'module' object has no attribute 'f' + + The :class:`Process` class ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -34,17 +57,36 @@ follows the API of :class:`threading.Thread`. A trivial example of a multiprocess program is :: - from multiprocessing import Process + from multiprocessing import Process - def f(name): - print 'hello', name + def f(name): + print 'hello', name - if __name__ == '__main__': - p = Process(target=f, args=('bob',)) - p.start() - p.join() + if __name__ == '__main__': + p = Process(target=f, args=('bob',)) + p.start() + p.join() -Here the function ``f`` is run in a child process. +To show the individual process IDs involved, here is an expanded example:: + + from multiprocessing import Process + import os + + def info(title): + print title + print 'module name:', __name__ + print 'parent process:', os.getppid() + print 'process id:', os.getpid() + + def f(name): + info('function f') + print 'hello', name + + if __name__ == '__main__': + info('main line') + p = Process(target=f, args=('bob',)) + p.start() + p.join() For an explanation of why (on Windows) the ``if __name__ == '__main__'`` part is necessary, see :ref:`multiprocessing-programming`. @@ -234,7 +276,7 @@ if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes - result = pool.applyAsync(f, [10]) # evaluate "f(10)" asynchronously + result = pool.apply_async(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]" @@ -307,7 +349,7 @@ semantics. Multiple processes may be given the same name. The initial name is set by the constructor. - .. method:: is_alive() + .. method:: is_alive Return whether the process is alive. @@ -816,6 +858,9 @@ 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 that on OS/X ``sem_timedwait`` is unsupported, so timeout arguments + for these will be ignored. .. note:: @@ -874,7 +919,7 @@ Note that *lock* is a keyword only argument. - Note that an array of :data:`ctypes.c_char` has *value* and *rawvalue* + Note that an array of :data:`ctypes.c_char` has *value* and *raw* attributes which allow one to use it to store and retrieve strings. @@ -923,7 +968,7 @@ :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`` + Note that an array of :data:`ctypes.c_char` has ``value`` and ``raw`` attributes which allow one to use it to store and retrieve strings -- see documentation for :mod:`ctypes`. @@ -1089,6 +1134,27 @@ 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:: get_server() + + Returns a :class:`Server` object which represents the actual server under + the control of the Manager. The :class:`Server` object supports the + :meth:`serve_forever` method:: + + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address=('', 50000), authkey='abc')) + >>> server = m.get_server() + >>> s.serve_forever() + + :class:`Server` additionally have an :attr:`address` attribute. + + .. method:: connect() + + Connect a local manager object to a remote manager process:: + + >>> from multiprocessing.managers import BaseManager + >>> m = BaseManager(address='127.0.0.1', authkey='abc)) + >>> m.connect() + .. method:: shutdown() Stop the process used by the manager. This is only available if @@ -1267,19 +1333,20 @@ >>> queue = Queue.Queue() >>> class QueueManager(BaseManager): pass ... - >>> QueueManager.register('getQueue', callable=lambda:queue) + >>> QueueManager.register('get_queue', callable=lambda:queue) >>> m = QueueManager(address=('', 50000), authkey='abracadabra') - >>> m.serveForever() + >>> s = m.get_server() + >>> s.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() + >>> QueueManager.register('get_queue') + >>> m = QueueManager(address=('foo.bar.org', 50000), authkey='abracadabra') + >>> m.connect() + >>> queue = m.get_queue() >>> queue.put('hello') Another client can also use it:: @@ -1293,6 +1360,27 @@ >>> queue.get() 'hello' +Local processes can also access that queue, using the code from above on the +client to access it remotely:: + + >>> from multiprocessing import Process, Queue + >>> from multiprocessing.managers import BaseManager + >>> class Worker(Process): + ... def __init__(self, q): + ... self.q = q + ... super(Worker, self).__init__() + ... def run(self): + ... self.q.put('local hello') + ... + >>> queue = Queue() + >>> w = Worker(queue) + >>> w.start() + >>> class QueueManager(BaseManager): pass + ... + >>> QueueManager.register('get_queue', callable=lambda: queue) + >>> m = QueueManager(address=('', 50000), authkey='abracadabra') + >>> s = m.get_server() + >>> s.serve_forever() Proxy Objects ~~~~~~~~~~~~~ @@ -1507,7 +1595,7 @@ The class of the result returned by :meth:`Pool.apply_async` and :meth:`Pool.map_async`. - .. method:: get([timeout) + .. method:: get([timeout]) Return the result when it arrives. If *timeout* is not ``None`` and the result does not arrive within *timeout* seconds then @@ -1537,7 +1625,7 @@ if __name__ == '__main__': pool = Pool(processes=4) # start 4 worker processes - result = pool.applyAsync(f, (10,)) # evaluate "f(10)" asynchronously + result = pool.apply_async(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]" @@ -1548,7 +1636,7 @@ print it.next(timeout=1) # prints "4" unless your computer is *very* slow import time - result = pool.applyAsync(time.sleep, (10,)) + result = pool.apply_async(time.sleep, (10,)) print result.get(timeout=1) # raises TimeoutError @@ -1782,7 +1870,7 @@ Below is an example session with logging turned on:: >>> import multiprocessing, logging - >>> logger = multiprocessing.getLogger() + >>> logger = multiprocessing.get_logger() >>> logger.setLevel(logging.INFO) >>> logger.warning('doomed') [WARNING/MainProcess] doomed 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 Nov 30 09:29:52 2008 @@ -933,10 +933,10 @@ .. function:: listdir(path) - Return a list containing the names of the entries in the directory. The list is - in arbitrary order. It does not include the special entries ``'.'`` and - ``'..'`` even if they are present in the directory. Availability: - Unix, Windows. + Return a list containing the names of the entries in the directory given by + *path*. The list is in arbitrary order. It does not include the special + entries ``'.'`` and ``'..'`` even if they are present in the + directory. Availability: Unix, Windows. .. versionchanged:: 2.3 On Windows NT/2k/XP and Unix, if *path* is a Unicode object, the result will be Modified: python/branches/tlee-ast-optimize/Doc/library/pdb.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/pdb.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/pdb.rst Sun Nov 30 09:29:52 2008 @@ -351,68 +351,3 @@ q(uit) Quit from the debugger. The program being executed is aborted. - - -.. _debugger-hooks: - -How It Works -============ - -Some changes were made to the interpreter: - -* ``sys.settrace(func)`` sets the global trace function - -* there can also a local trace function (see later) - -Trace functions have three arguments: *frame*, *event*, and *arg*. *frame* is -the current stack frame. *event* is a string: ``'call'``, ``'line'``, -``'return'``, ``'exception'``, ``'c_call'``, ``'c_return'``, or -``'c_exception'``. *arg* depends on the event type. - -The global trace function is invoked (with *event* set to ``'call'``) whenever a -new local scope is entered; it should return a reference to the local trace -function to be used that scope, or ``None`` if the scope shouldn't be traced. - -The local trace function should return a reference to itself (or to another -function for further tracing in that scope), or ``None`` to turn off tracing in -that scope. - -Instance methods are accepted (and very useful!) as trace functions. - -The events have the following meaning: - -``'call'`` - A function is called (or some other code block entered). The global trace - function is called; *arg* is ``None``; the return value specifies the local - trace function. - -``'line'`` - The interpreter is about to execute a new line of code (sometimes multiple line - events on one line exist). The local trace function is called; *arg* is - ``None``; the return value specifies the new local trace function. - -``'return'`` - A function (or other code block) is about to return. The local trace function - is called; *arg* is the value that will be returned. The trace function's - return value is ignored. - -``'exception'`` - An exception has occurred. The local trace function is called; *arg* is a - triple ``(exception, value, traceback)``; the return value specifies the new - local trace function. - -``'c_call'`` - A C function is about to be called. This may be an extension function or a - builtin. *arg* is the C function object. - -``'c_return'`` - A C function has returned. *arg* is ``None``. - -``'c_exception'`` - A C function has thrown an exception. *arg* is ``None``. - -Note that as an exception is propagated down the chain of callers, an -``'exception'`` event is generated at each level. - -For more information on code and frame objects, refer to :ref:`types`. - Modified: python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/sqlite3.rst Sun Nov 30 09:29:52 2008 @@ -223,8 +223,8 @@ .. attribute:: Connection.isolation_level - Get or set the current isolation level. :const:`None` for autocommit mode or one of - "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section + Get or set the current isolation level. :const:`None` for autocommit mode or + one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section :ref:`sqlite3-controlling-transactions` for a more detailed explanation. Modified: python/branches/tlee-ast-optimize/Doc/library/stringio.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/library/stringio.rst (original) +++ python/branches/tlee-ast-optimize/Doc/library/stringio.rst Sun Nov 30 09:29:52 2008 @@ -37,7 +37,8 @@ .. method:: StringIO.close() - Free the memory buffer. + Free the memory buffer. Attempting to do further operations with a closed + :class:`StringIO` object will raise a :exc:`ValueError`. Example usage:: 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 Sun Nov 30 09:29:52 2008 @@ -712,11 +712,60 @@ single: debugger Set the system's trace function, which allows you to implement a Python - source code debugger in Python. See section :ref:`debugger-hooks` in the - chapter on the Python debugger. The function is thread-specific; for a + source code debugger in Python. The function is thread-specific; for a debugger to support multiple threads, it must be registered using :func:`settrace` for each thread being debugged. + Trace functions should have three arguments: *frame*, *event*, and + *arg*. *frame* is the current stack frame. *event* is a string: ``'call'``, + ``'line'``, ``'return'``, ``'exception'``, ``'c_call'``, ``'c_return'``, or + ``'c_exception'``. *arg* depends on the event type. + + The trace function is invoked (with *event* set to ``'call'``) whenever a new + local scope is entered; it should return a reference to a local trace + function to be used that scope, or ``None`` if the scope shouldn't be traced. + + The local trace function should return a reference to itself (or to another + function for further tracing in that scope), or ``None`` to turn off tracing + in that scope. + + The events have the following meaning: + + ``'call'`` + A function is called (or some other code block entered). The + global trace function is called; *arg* is ``None``; the return value + specifies the local trace function. + + ``'line'`` + The interpreter is about to execute a new line of code (sometimes multiple + line events on one line exist). The local trace function is called; *arg* + is ``None``; the return value specifies the new local trace function. + + ``'return'`` + A function (or other code block) is about to return. The local trace + function is called; *arg* is the value that will be returned. The trace + function's return value is ignored. + + ``'exception'`` + An exception has occurred. The local trace function is called; *arg* is a + tuple ``(exception, value, traceback)``; the return value specifies the + new local trace function. + + ``'c_call'`` + A C function is about to be called. This may be an extension function or + a builtin. *arg* is the C function object. + + ``'c_return'`` + A C function has returned. *arg* is ``None``. + + ``'c_exception'`` + A C function has thrown an exception. *arg* is ``None``. + + Note that as an exception is propagated down the chain of callers, an + ``'exception'`` event is generated at each level. + + For more information on code and frame objects, refer to :ref:`types`. + .. note:: The :func:`settrace` function is intended only for implementing debuggers, Modified: python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst ============================================================================== --- python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst (original) +++ python/branches/tlee-ast-optimize/Doc/reference/datamodel.rst Sun Nov 30 09:29:52 2008 @@ -1365,21 +1365,21 @@ object: dictionary builtin: hash - Called for the key object for dictionary operations, and by the built-in - function :func:`hash`. Should return an integer usable as a hash value - for dictionary operations. The only required property is that objects which - compare equal have the same hash value; it is advised to somehow mix together - (e.g., using exclusive or) the hash values for the components of the object that - also play a part in comparison of objects. + Called by built-in function :func:`hash` and for operations on members of + hashed collections including :class:`set`, :class:`frozenset`, and + :class:`dict`. :meth:`__hash__` should return an integer. The only required + property is that objects which compare equal have the same hash value; it is + advised to somehow mix together (e.g. using exclusive or) the hash values for + the components of the object that also play a part in comparison of objects. If a class does not define a :meth:`__cmp__` or :meth:`__eq__` method it should not define a :meth:`__hash__` operation either; if it defines :meth:`__cmp__` or :meth:`__eq__` but not :meth:`__hash__`, its instances - will not be usable as dictionary keys. If a class defines mutable objects + will not be usable in hashed collections. If a class defines mutable objects and implements a :meth:`__cmp__` or :meth:`__eq__` method, it should not - implement :meth:`__hash__`, since the dictionary implementation requires that - a key's hash value is immutable (if the object's hash value changes, it will - be in the wrong hash bucket). + implement :meth:`__hash__`, since hashable collection implementations require + that a object's hash value is immutable (if the object's hash value changes, + it will be in the wrong hash bucket). User-defined classes have :meth:`__cmp__` and :meth:`__hash__` methods by default; with them, all objects compare unequal (except with themselves) @@ -1389,13 +1389,13 @@ change the meaning of :meth:`__cmp__` or :meth:`__eq__` such that the hash value returned is no longer appropriate (e.g. by switching to a value-based concept of equality instead of the default identity based equality) can - explicitly flag themselves as being unhashable by setting - ``__hash__ = None`` in the class definition. Doing so means that not only - will instances of the class raise an appropriate :exc:`TypeError` when - a program attempts to retrieve their hash value, but they will also be - correctly identified as unhashable when checking - ``isinstance(obj, collections.Hashable)`` (unlike classes which define - their own :meth:`__hash__` to explicitly raise :exc:`TypeError`). + explicitly flag themselves as being unhashable by setting ``__hash__ = None`` + in the class definition. Doing so means that not only will instances of the + class raise an appropriate :exc:`TypeError` when a program attempts to + retrieve their hash value, but they will also be correctly identified as + unhashable when checking ``isinstance(obj, collections.Hashable)`` (unlike + classes which define their own :meth:`__hash__` to explicitly raise + :exc:`TypeError`). .. versionchanged:: 2.5 :meth:`__hash__` may now also return a long integer object; the 32-bit Modified: python/branches/tlee-ast-optimize/Doc/tools/sphinxext/download.html ============================================================================== --- python/branches/tlee-ast-optimize/Doc/tools/sphinxext/download.html (original) +++ python/branches/tlee-ast-optimize/Doc/tools/sphinxext/download.html Sun Nov 30 09:29:52 2008 @@ -14,7 +14,7 @@

To download an archive containing all the documents for this version of Python in one of various formats, follow one of links in this table. The numbers -in the table are the size of the download files in Kilobytes.

+in the table are the size of the download files in megabytes.

FormatPacked as .zipPacked as .tar.bz2
@@ -54,7 +54,7 @@

Problems

If you have comments or suggestions for the Python documentation, please send -email to docs at python.org.

+email to docs at python.org.

{% endif %} {% endblock %} 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 Sun Nov 30 09:29:52 2008 @@ -615,6 +615,6 @@ fcntl.fcntl(fd, fcntl.F_SETFL, flags) def set_file(self, fd): - self._fileno = fd self.socket = file_wrapper(fd) + self._fileno = self.socket.fileno() self.add_channel() Modified: python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py (original) +++ python/branches/tlee-ast-optimize/Lib/distutils/msvc9compiler.py Sun Nov 30 09:29:52 2008 @@ -316,7 +316,7 @@ self.__version = VERSION self.__root = r"Software\Microsoft\VisualStudio" # self.__macros = MACROS - self.__path = [] + self.__paths = [] # target platform (.plat_name is consistent with 'bdist') self.plat_name = None self.__arch = None # deprecated name Modified: python/branches/tlee-ast-optimize/Lib/doctest.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/doctest.py (original) +++ python/branches/tlee-ast-optimize/Lib/doctest.py Sun Nov 30 09:29:52 2008 @@ -854,12 +854,12 @@ """ if module is None: return True + elif inspect.getmodule(object) is not None: + return module is inspect.getmodule(object) elif inspect.isfunction(object): return module.__dict__ is object.func_globals elif inspect.isclass(object): return module.__name__ == object.__module__ - elif inspect.getmodule(object) is not None: - return module is inspect.getmodule(object) elif hasattr(object, '__module__'): return module.__name__ == object.__module__ elif isinstance(object, property): 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 Nov 30 09:29:52 2008 @@ -326,6 +326,11 @@ # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. def __init__(self, sock, debuglevel=0, strict=0, method=None): + # The buffer size is specified as zero, because the headers of + # the response are read with readline(). If the reads were + # buffered the readline() calls could consume some of the + # response, which make be read via a recv() on the underlying + # socket. self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.strict = strict @@ -729,7 +734,7 @@ """ self._buffer.append(s) - def _send_output(self): + def _send_output(self, message_body=None): """Send the currently buffered request and clear the buffer. Appends an extra \\r\\n to the buffer. @@ -737,6 +742,11 @@ self._buffer.extend(("", "")) msg = "\r\n".join(self._buffer) del self._buffer[:] + # If msg and message_body are sent in a single send() call, + # it will avoid performance problems caused by the interaction + # between delayed ack and the Nagle algorithim. + if message_body is not None: + msg += message_body self.send(msg) def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): @@ -846,7 +856,7 @@ # For HTTP/1.0, the server will assume "not chunked" pass - def putheader(self, header, value): + def putheader(self, header, *values): """Send a request header line to the server. For example: h.putheader('Accept', 'text/html') @@ -854,18 +864,23 @@ if self.__state != _CS_REQ_STARTED: raise CannotSendHeader() - str = '%s: %s' % (header, value) + str = '%s: %s' % (header, '\r\n\t'.join(values)) self._output(str) - def endheaders(self): - """Indicate that the last header line has been sent to the server.""" + def endheaders(self, message_body=None): + """Indicate that the last header line has been sent to the server. + This method sends the request to the server. The optional + message_body argument can be used to pass message body + associated with the request. The message body will be sent in + the same packet as the message headers if possible. The + message_body should be a string. + """ if self.__state == _CS_REQ_STARTED: self.__state = _CS_REQ_SENT else: raise CannotSendHeader() - - self._send_output() + self._send_output(message_body) def request(self, method, url, body=None, headers={}): """Send a complete request to the server.""" @@ -879,6 +894,24 @@ # try one more time self._send_request(method, url, body, headers) + def _set_content_length(self, body): + # Set the content-length based on the body. + thelen = None + try: + thelen = str(len(body)) + except TypeError, te: + # If this is a file-like object, try to + # fstat its file descriptor + import os + try: + thelen = str(os.fstat(body.fileno()).st_size) + except (AttributeError, OSError): + # Don't send a length if this failed + if self.debuglevel > 0: print "Cannot stat!!" + + if thelen is not None: + self.putheader('Content-Length', thelen) + def _send_request(self, method, url, body, headers): # honour explicitly requested Host: and Accept-Encoding headers header_names = dict.fromkeys([k.lower() for k in headers]) @@ -891,27 +924,15 @@ self.putrequest(method, url, **skips) if body and ('content-length' not in header_names): - thelen=None - try: - thelen=str(len(body)) - except TypeError, te: - # If this is a file-like object, try to - # fstat its file descriptor - import os - try: - thelen = str(os.fstat(body.fileno()).st_size) - except (AttributeError, OSError): - # Don't send a length if this failed - if self.debuglevel > 0: print "Cannot stat!!" - - if thelen is not None: - self.putheader('Content-Length',thelen) + self._set_content_length(body) for hdr, value in headers.iteritems(): self.putheader(hdr, value) - self.endheaders() - - if body: - self.send(body) + if isinstance(body, str): + self.endheaders(body) + else: + self.endheaders() + if body: # when body is a file rather than a string + self.send(body) def getresponse(self): "Get the response from the server." @@ -989,6 +1010,7 @@ # set up delegation to flesh out interface self.send = conn.send self.putrequest = conn.putrequest + self.putheader = conn.putheader self.endheaders = conn.endheaders self.set_debuglevel = conn.set_debuglevel @@ -1008,10 +1030,6 @@ "Provide a getfile, since the superclass' does not use this concept." return self.file - def putheader(self, header, *values): - "The superclass allows only one value argument." - self._conn.putheader(header, '\r\n\t'.join(values)) - def getreply(self): """Compat definition since superclass does not define it. Modified: python/branches/tlee-ast-optimize/Lib/io.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/io.py (original) +++ python/branches/tlee-ast-optimize/Lib/io.py Sun Nov 30 09:29:52 2008 @@ -238,8 +238,6 @@ raise ValueError("invalid buffering size") if buffering == 0: if binary: - raw._name = file - raw._mode = mode return raw raise ValueError("can't have unbuffered text I/O") if updating: @@ -251,11 +249,8 @@ else: raise ValueError("unknown mode: %r" % mode) if binary: - buffer.name = file - buffer.mode = mode return buffer text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering) - text.name = file text.mode = mode return text @@ -622,6 +617,10 @@ # that _fileio._FileIO inherits from io.RawIOBase (which would be hard # to do since _fileio.c is written in C). + def __init__(self, name, mode="r", closefd=True): + _fileio._FileIO.__init__(self, name, mode, closefd) + self._name = name + def close(self): _fileio._FileIO.close(self) RawIOBase.close(self) @@ -630,10 +629,6 @@ def name(self): return self._name - @property - def mode(self): - return self._mode - class BufferedIOBase(IOBase): @@ -767,6 +762,14 @@ def closed(self): return self.raw.closed + @property + def name(self): + return self.raw.name + + @property + def mode(self): + return self.raw.mode + ### Lower-level APIs ### def fileno(self): @@ -1473,6 +1476,10 @@ def closed(self): return self.buffer.closed + @property + def name(self): + return self.buffer.name + def fileno(self): return self.buffer.fileno() 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 Sun Nov 30 09:29:52 2008 @@ -359,7 +359,7 @@ 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._rootwindow = self.winfo_toplevel() self.width, self.height = width, height self.canvwidth, self.canvheight = canvwidth, canvheight self.bg = "white" @@ -379,7 +379,7 @@ 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) + self._rootwindow.bind('', self.onResize) def reset(self, canvwidth=None, canvheight=None, bg = None): """Ajust canvas and scrollbars according to given canvas size.""" Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_base.py Sun Nov 30 09:29:52 2008 @@ -7,12 +7,6 @@ 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 Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixer_util.py Sun Nov 30 09:29:52 2008 @@ -153,30 +153,6 @@ 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 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 Nov 30 09:29:52 2008 @@ -28,7 +28,7 @@ from .. import patcomp from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot, set +from ..fixer_util import Name, Call, LParen, RParen, ArgList, Dot from .. import fixer_util 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 Nov 30 09:29:52 2008 @@ -25,7 +25,7 @@ from .. import pytree from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Assign, Attr, Name, is_tuple, is_list, reversed +from ..fixer_util import Assign, Attr, Name, is_tuple, is_list def find_excepts(nodes): for i, n in enumerate(nodes): 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 Nov 30 09:29:52 2008 @@ -13,7 +13,7 @@ # Local imports from .. import fixer_base from os.path import dirname, join, exists, pathsep -from ..fixer_util import FromImport +from ..fixer_util import FromImport, syms class FixImport(fixer_base.BaseFix): @@ -26,11 +26,14 @@ def transform(self, node, results): imp = results['imp'] - if unicode(imp).startswith('.'): + mod_name = unicode(imp.children[0] if imp.type == syms.dotted_as_name \ + else imp) + + if mod_name.startswith('.'): # Already a new-style import return - if not probably_a_local_import(unicode(imp), self.filename): + if not probably_a_local_import(mod_name, self.filename): # I guess this is a global import -- skip it! return 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 Nov 30 09:29:52 2008 @@ -1,9 +1,9 @@ """Fix incompatible imports and module references.""" -# Author: Collin Winter +# Authors: Collin Winter, Nick Edds # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {'StringIO': 'io', 'cStringIO': 'io', @@ -61,36 +61,49 @@ def build_pattern(mapping=MAPPING): - mod_list = ' | '.join(["module='" + key + "'" for key in mapping.keys()]) - mod_name_list = ' | '.join(["module_name='" + key + "'" for key in mapping.keys()]) - yield """import_name< 'import' ((%s) + mod_list = ' | '.join(["module_name='%s'" % key for key in mapping]) + bare_names = alternates(mapping.keys()) + + yield """name_import=import_name< 'import' ((%s) | dotted_as_names< any* (%s) any* >) > """ % (mod_list, mod_list) yield """import_from< 'from' (%s) 'import' ['('] ( any | import_as_name< any 'as' any > | import_as_names< any* >) [')'] > - """ % mod_name_list + """ % mod_list yield """import_name< 'import' dotted_as_name< (%s) 'as' any > > - """ % mod_name_list - # Find usages of module members in code e.g. urllib.foo(bar) - yield """power< (%s) - trailer<'.' any > any* > - """ % mod_name_list - yield """bare_name=%s""" % alternates(mapping.keys()) + """ % mod_list + + # Find usages of module members in code e.g. thread.foo(bar) + yield "power< bare_with_attr=(%s) trailer<'.' any > any* >" % bare_names + class FixImports(fixer_base.BaseFix): - PATTERN = "|".join(build_pattern()) + order = "pre" # Pre-order tree traversal + # This is overridden in fix_imports2. mapping = MAPPING - # Don't match the node if it's within another match + def build_pattern(self): + return "|".join(build_pattern(self.mapping)) + + def compile_pattern(self): + # We override this, so MAPPING can be pragmatically altered and the + # changes will be reflected in PATTERN. + self.PATTERN = self.build_pattern() + super(FixImports, self).compile_pattern() + + # Don't match the node if it's within another match. def match(self, node): match = super(FixImports, self).match results = match(node) if results: - if any([match(obj) for obj in attr_chain(node, "parent")]): + # Module usage could be in the trailier of an attribute lookup, so + # we might have nested matches when "bare_with_attr" is present. + if "bare_with_attr" not in results and \ + any([match(obj) for obj in attr_chain(node, "parent")]): return False return results return False @@ -100,20 +113,17 @@ self.replace = {} def transform(self, node, results): - import_mod = results.get("module") - mod_name = results.get("module_name") - bare_name = results.get("bare_name") - - if import_mod or mod_name: - new_name = self.mapping[(import_mod or mod_name).value] - + import_mod = results.get("module_name") if import_mod: - self.replace[import_mod.value] = new_name + new_name = self.mapping[(import_mod or mod_name).value] + if "name_import" in results: + # If it's not a "from x import x, y" or "import x as y" import, + # marked its usage to be replaced. + self.replace[import_mod.value] = new_name import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) - elif mod_name: - mod_name.replace(Name(new_name, prefix=mod_name.get_prefix())) - elif bare_name: - bare_name = bare_name[0] + else: + # Replace usage of the module. + bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports2.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports2.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_imports2.py Sun Nov 30 09:29:52 2008 @@ -10,7 +10,6 @@ class FixImports2(fix_imports.FixImports): - PATTERN = "|".join((fix_imports.build_pattern(MAPPING))) order = "post" Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_metaclass.py Sun Nov 30 09:29:52 2008 @@ -110,8 +110,11 @@ if simple_node.type == syms.simple_stmt and simple_node.children: expr_node = simple_node.children[0] if expr_node.type == syms.expr_stmt and expr_node.children: - leaf_node = expr_node.children[0] - if leaf_node.value == '__metaclass__': + # Check if the expr_node is a simple assignment. + left_node = expr_node.children[0] + if isinstance(left_node, Leaf) and \ + left_node.value == '__metaclass__': + # We found a assignment to __metaclass__. fixup_simple_stmt(node, i, simple_node) remove_trailing_newline(simple_node) yield (node, i, simple_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 Nov 30 09:29:52 2008 @@ -9,7 +9,7 @@ from ..pgen2 import token from ..pygram import python_symbols as syms from .. import fixer_base -from ..fixer_util import Name, Call, find_binding, any +from ..fixer_util import Name, Call, find_binding bind_warning = "Calls to builtin next() possibly shadowed by global binding" 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 Nov 30 09:29:52 2008 @@ -6,7 +6,7 @@ # Local imports from ..pgen2 import token from .. import fixer_base -from ..fixer_util import Number, set +from ..fixer_util import Number class FixNumliterals(fixer_base.BaseFix): 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 Nov 30 09:29:52 2008 @@ -8,7 +8,7 @@ # Local imports from .. import fixer_base -from ..fixer_util import Name, attr_chain, any, set +from ..fixer_util import Name, attr_chain MAPPING = {"sys": {"maxint" : "maxsize"}, } Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_urllib.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_urllib.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/fixes/fix_urllib.py Sun Nov 30 09:29:52 2008 @@ -7,7 +7,7 @@ # Local imports from .fix_imports import alternates, FixImports from .. import fixer_base -from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain, any, set +from ..fixer_util import Name, Comma, FromImport, Newline, attr_chain MAPPING = {'urllib': [ ('urllib.request', @@ -65,7 +65,9 @@ class FixUrllib(FixImports): - PATTERN = "|".join(build_pattern()) + + def build_pattern(self): + return "|".join(build_pattern()) def transform_import(self, node, results): """Transform for the basic import case. Replaces the old Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/pgen2/parse.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/pgen2/parse.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/pgen2/parse.py Sun Nov 30 09:29:52 2008 @@ -10,12 +10,6 @@ """ -# Get a usable 'set' constructor -try: - set -except NameError: - from sets import Set as set - # Local imports from . import token Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/pytree.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/pytree.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/pytree.py Sun Nov 30 09:29:52 2008 @@ -11,6 +11,9 @@ __author__ = "Guido van Rossum " +import sys +from StringIO import StringIO + HUGE = 0x7FFFFFFF # maximum repeat count, default max @@ -655,6 +658,11 @@ elif self.name == "bare_name": yield self._bare_name_matches(nodes) else: + # The reason for this is that hitting the recursion limit usually + # results in some ugly messages about how RuntimeErrors are being + # ignored. + save_stderr = sys.stderr + sys.stderr = StringIO() try: for count, r in self._recursive_matches(nodes, 0): if self.name: @@ -667,6 +675,8 @@ if self.name: r[self.name] = nodes[:count] yield count, r + finally: + sys.stderr = save_stderr def _iterative_matches(self, nodes): """Helper to iteratively yield the matches.""" 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 Nov 30 09:29:52 2008 @@ -123,8 +123,8 @@ logger=self.logger) self.pre_order, self.post_order = self.get_fixers() - self.pre_order = get_headnode_dict(self.pre_order) - self.post_order = get_headnode_dict(self.post_order) + self.pre_order_mapping = get_headnode_dict(self.pre_order) + self.post_order_mapping = get_headnode_dict(self.post_order) self.files = [] # List of files that were or should be modified @@ -290,13 +290,12 @@ # Two calls to chain are required because pre_order.values() # will be a list of lists of fixers: # [[, ], []] - all_fixers = chain(chain(*self.pre_order.values()),\ - chain(*self.post_order.values())) + all_fixers = chain(self.pre_order, self.post_order) for fixer in all_fixers: fixer.start_tree(tree, name) - self.traverse_by(self.pre_order, tree.pre_order()) - self.traverse_by(self.post_order, tree.post_order()) + self.traverse_by(self.pre_order_mapping, tree.pre_order()) + self.traverse_by(self.post_order_mapping, tree.post_order()) for fixer in all_fixers: fixer.finish_tree(tree, name) 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 Nov 30 09:29:52 2008 @@ -15,10 +15,7 @@ from operator import itemgetter # Local imports -from .. import pygram -from .. import pytree -from .. import refactor -from .. import fixer_util +from lib2to3 import pygram, pytree, refactor, fixer_util class FixerTestCase(support.TestCase): @@ -30,10 +27,9 @@ self.fixer_log = [] self.filename = "" - for order in (self.refactor.pre_order.values(),\ - self.refactor.post_order.values()): - for fixer in chain(*order): - fixer.log = self.fixer_log + for fixer in chain(self.refactor.pre_order, + self.refactor.post_order): + fixer.log = self.fixer_log def _check(self, before, after): before = support.reformat(before) @@ -1488,6 +1484,44 @@ """ % (new, new) self.check(b, a) + b = """ + from %s import x + %s = 23 + """ % (old, old) + a = """ + from %s import x + %s = 23 + """ % (new, old) + self.check(b, a) + + s = """ + def f(): + %s.method() + """ % (old,) + self.unchanged(s) + + # test nested usage + b = """ + import %s + %s.bar(%s.foo) + """ % (old, old, old) + a = """ + import %s + %s.bar(%s.foo) + """ % (new, new, new) + self.check(b, a) + + b = """ + import %s + x.%s + """ % (old, old) + a = """ + import %s + x.%s + """ % (new, old) + self.check(b, a) + + class Test_imports2(Test_imports): fixer = "imports2" @@ -2622,7 +2656,7 @@ def check(self, b, a): self.unchanged("from future_builtins import map; " + b, a) - FixerTestCase.check(self, b, a) + super(Test_map, self).check(b, a) def test_prefix_preservation(self): b = """x = map( f, 'abc' )""" @@ -2729,7 +2763,7 @@ def check(self, b, a): self.unchanged("from future_builtins import zip; " + b, a) - FixerTestCase.check(self, b, a) + super(Test_zip, self).check(b, a) def test_zip_basic(self): b = """x = zip(a, b, c)""" @@ -3274,7 +3308,7 @@ fixer = "import" def setUp(self): - FixerTestCase.setUp(self) + super(Test_import, self).setUp() # Need to replace fix_import's exists method # so we can check that it's doing the right thing self.files_checked = [] @@ -3293,9 +3327,9 @@ def check_both(self, b, a): self.always_exists = True - FixerTestCase.check(self, b, a) + super(Test_import, self).check(b, a) self.always_exists = False - FixerTestCase.unchanged(self, b) + super(Test_import, self).unchanged(b) def test_files_checked(self): def p(path): @@ -3372,6 +3406,11 @@ a = "from . import foo, bar" self.check_both(b, a) + def test_import_as(self): + b = "import foo as x" + a = "from . import foo as x" + self.check_both(b, a) + def test_dotted_import(self): b = "import foo.bar" a = "from . import foo.bar" @@ -3766,6 +3805,17 @@ """ self.check(b, a) + b = """ + class X: + __metaclass__ = Meta + save.py = 23 + """ + a = """ + class X(metaclass=Meta): + save.py = 23 + """ + self.check(b, a) + class Test_getcwdu(FixerTestCase): Modified: python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py (original) +++ python/branches/tlee-ast-optimize/Lib/lib2to3/tests/test_refactor.py Sun Nov 30 09:29:52 2008 @@ -161,7 +161,7 @@ self.assertEqual(len(rt.post_order), 0) rt = self.rt(explicit=["myfixes.fix_explicit"]) - for fix in rt.post_order[None]: + for fix in rt.post_order: if isinstance(fix, FixExplicit): break else: 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 Nov 30 09:29:52 2008 @@ -113,7 +113,7 @@ num = int(os.environ['NUMBER_OF_PROCESSORS']) except (ValueError, KeyError): num = 0 - elif sys.platform == 'darwin': + elif 'bsd' in sys.platform or sys.platform == 'darwin': try: num = int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: 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 Nov 30 09:29:52 2008 @@ -149,7 +149,7 @@ def imap(self, func, iterable, chunksize=1): ''' - Equivalent of `itertool.imap()` -- can be MUCH slower than `Pool.map()` + Equivalent of `itertools.imap()` -- can be MUCH slower than `Pool.map()` ''' assert self._state == RUN if chunksize == 1: Modified: python/branches/tlee-ast-optimize/Lib/optparse.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/optparse.py (original) +++ python/branches/tlee-ast-optimize/Lib/optparse.py Sun Nov 30 09:29:52 2008 @@ -799,7 +799,7 @@ parser.print_version() parser.exit() else: - raise RuntimeError, "unknown action %r" % self.action + raise ValueError("unknown action %r" % self.action) return 1 Modified: python/branches/tlee-ast-optimize/Lib/test/test_bytes.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_bytes.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_bytes.py Sun Nov 30 09:29:52 2008 @@ -721,6 +721,16 @@ b.insert(0, Indexable(ord('A'))) self.assertEqual(b, b'A') + def test_copied(self): + # Issue 4348. Make sure that operations that don't mutate the array + # copy the bytes. + b = bytearray(b'abc') + self.assertFalse(b is b.replace(b'abc', b'cde', 0)) + + t = bytearray([i for i in range(256)]) + x = bytearray(b'') + self.assertFalse(x is x.translate(t)) + def test_partition_bytearray_doesnt_share_nullstring(self): a, b, c = bytearray(b"x").partition(b"y") self.assertEqual(b, b"") Modified: python/branches/tlee-ast-optimize/Lib/test/test_descr.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_descr.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_descr.py Sun Nov 30 09:29:52 2008 @@ -4289,6 +4289,46 @@ c[1:2] = 3 self.assertEqual(c.value, 3) + def test_getattr_hooks(self): + # issue 4230 + + class Descriptor(object): + counter = 0 + def __get__(self, obj, objtype=None): + def getter(name): + self.counter += 1 + raise AttributeError(name) + return getter + + descr = Descriptor() + class A(object): + __getattribute__ = descr + class B(object): + __getattr__ = descr + class C(object): + __getattribute__ = descr + __getattr__ = descr + + self.assertRaises(AttributeError, getattr, A(), "attr") + self.assertEquals(descr.counter, 1) + self.assertRaises(AttributeError, getattr, B(), "attr") + self.assertEquals(descr.counter, 2) + self.assertRaises(AttributeError, getattr, C(), "attr") + self.assertEquals(descr.counter, 4) + + import gc + class EvilGetattribute(object): + # This used to segfault + def __getattr__(self, name): + raise AttributeError(name) + def __getattribute__(self, name): + del EvilGetattribute.__getattr__ + for i in range(5): + gc.collect() + raise AttributeError(name) + + self.assertRaises(AttributeError, getattr, EvilGetattribute(), "attr") + class DictProxyTests(unittest.TestCase): def setUp(self): Modified: python/branches/tlee-ast-optimize/Lib/test/test_fileio.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_fileio.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_fileio.py Sun Nov 30 09:29:52 2008 @@ -50,7 +50,7 @@ # verify expected attributes exist f = self.f - self.assertEquals(f.mode, "w") + self.assertEquals(f.mode, "wb") self.assertEquals(f.closed, False) # verify the attributes are readonly @@ -160,7 +160,7 @@ def testModeStrings(self): # check invalid mode strings - for mode in ("", "aU", "wU+", "rb", "rt"): + for mode in ("", "aU", "wU+", "rw", "rt"): try: f = _fileio._FileIO(TESTFN, mode) except ValueError: 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 Nov 30 09:29:52 2008 @@ -107,19 +107,23 @@ for hp in ("www.python.org:abc", "www.python.org:"): self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) - for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", + 8000), ("www.python.org:80", "www.python.org", 80), ("www.python.org", "www.python.org", 80), ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): http = httplib.HTTP(hp) c = http._conn - if h != c.host: self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) - if p != c.port: self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + if h != c.host: + self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: + self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) def test_response_headers(self): # test response with multiple message headers with the same field name. text = ('HTTP/1.1 200 OK\r\n' - 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE";' + ' Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' ' Path="/acme"\r\n' '\r\n' @@ -187,7 +191,8 @@ resp.close() def test_negative_content_length(self): - sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: -1\r\n\r\nHello\r\n') + sock = FakeSocket('HTTP/1.1 200 OK\r\n' + 'Content-Length: -1\r\n\r\nHello\r\n') resp = httplib.HTTPResponse(sock, method="GET") resp.begin() self.assertEquals(resp.read(), 'Hello\r\n') Modified: python/branches/tlee-ast-optimize/Lib/test/test_imageop.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_imageop.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_imageop.py Sun Nov 30 09:29:52 2008 @@ -15,6 +15,7 @@ _VALUES = (1, 2, 2**10, 2**15-1, 2**15, 2**15+1, 2**31-2, 2**31-1) VALUES = tuple( -x for x in reversed(_VALUES) ) + (0,) + _VALUES AAAAA = "A" * 1024 +MAX_LEN = 2**20 class InputValidationTests(unittest.TestCase): @@ -26,7 +27,7 @@ strlen = abs(width * height) if size: strlen *= size - if strlen < 1024: + if strlen < MAX_LEN: data = "A" * strlen else: data = AAAAA Modified: python/branches/tlee-ast-optimize/Lib/test/test_io.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_io.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_io.py Sun Nov 30 09:29:52 2008 @@ -272,6 +272,30 @@ self.assertRaises(ValueError, io.open, test_support.TESTFN, 'w', closefd=False) + def testReadClosed(self): + with io.open(test_support.TESTFN, "w") as f: + f.write("egg\n") + with io.open(test_support.TESTFN, "r") as f: + file = io.open(f.fileno(), "r", closefd=False) + self.assertEqual(file.read(), "egg\n") + file.seek(0) + file.close() + self.assertRaises(ValueError, file.read) + + def test_no_closefd_with_filename(self): + # can't use closefd in combination with a file name + self.assertRaises(ValueError, + io.open, test_support.TESTFN, "r", closefd=False) + + def test_closefd_attr(self): + with io.open(test_support.TESTFN, "wb") as f: + f.write(b"egg\n") + with io.open(test_support.TESTFN, "r") as f: + self.assertEqual(f.buffer.raw.closefd, True) + file = io.open(f.fileno(), "r", closefd=False) + self.assertEqual(file.buffer.raw.closefd, False) + + class MemorySeekTestMixin: def testInit(self): @@ -1225,6 +1249,9 @@ class MiscIOTest(unittest.TestCase): + def tearDown(self): + test_support.unlink(test_support.TESTFN) + def testImport__all__(self): for name in io.__all__: obj = getattr(io, name, None) @@ -1237,6 +1264,34 @@ self.assert_(issubclass(obj, io.IOBase)) + def test_attributes(self): + f = io.open(test_support.TESTFN, "wb", buffering=0) + self.assertEquals(f.mode, "wb") + f.close() + + f = io.open(test_support.TESTFN, "U") + self.assertEquals(f.name, test_support.TESTFN) + self.assertEquals(f.buffer.name, test_support.TESTFN) + self.assertEquals(f.buffer.raw.name, test_support.TESTFN) + self.assertEquals(f.mode, "U") + self.assertEquals(f.buffer.mode, "rb") + self.assertEquals(f.buffer.raw.mode, "rb") + f.close() + + f = io.open(test_support.TESTFN, "w+") + self.assertEquals(f.mode, "w+") + self.assertEquals(f.buffer.mode, "rb+") # Does it really matter? + self.assertEquals(f.buffer.raw.mode, "rb+") + + g = io.open(f.fileno(), "wb", closefd=False) + self.assertEquals(g.mode, "wb") + self.assertEquals(g.raw.mode, "wb") + self.assertEquals(g.name, f.fileno()) + self.assertEquals(g.raw.name, f.fileno()) + f.close() + g.close() + + def test_main(): test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, BufferedReaderTest, BufferedWriterTest, Modified: python/branches/tlee-ast-optimize/Lib/test/test_parser.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_parser.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_parser.py Sun Nov 30 09:29:52 2008 @@ -196,6 +196,10 @@ def test_assert(self): self.check_suite("assert alo < ahi and blo < bhi\n") + def test_with(self): + self.check_suite("with open('x'): pass\n") + self.check_suite("with open('x') as f: pass\n") + def test_position(self): # An absolutely minimal test of position information. Better # tests would be a big project. 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 Sun Nov 30 09:29:52 2008 @@ -4,9 +4,13 @@ (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. -"""#" -import unittest, test.test_support +""" + +import sys +import unittest import hashlib +import subprocess +import test.test_support encoding = 'utf-8' @@ -196,6 +200,25 @@ class UnicodeMiscTest(UnicodeDatabaseTest): + def test_failed_import_during_compiling(self): + # Issue 4367 + # Decoding \N escapes requires the unicodedata module. If it can't be + # imported, we shouldn't segfault. + + # This program should raise a SyntaxError in the eval. + code = "import sys;" \ + "sys.modules['unicodedata'] = None;" \ + """eval("u'\N{SOFT HYPHEN}'")""" + args = [sys.executable, "-c", code] + # We use a subprocess because the unicodedata module may already have + # been loaded in this process. + popen = subprocess.Popen(args, stderr=subprocess.PIPE) + popen.wait() + self.assertEqual(popen.returncode, 1) + error = "SyntaxError: (unicode error) \N escapes not supported " \ + "(can't load unicodedata module)" + self.assertTrue(error in popen.stderr.read()) + def test_decimal_numeric_consistent(self): # Test that decimal and numeric are consistent, # i.e. if a character has a decimal value, Modified: python/branches/tlee-ast-optimize/Lib/test/test_xmlrpc.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/test/test_xmlrpc.py (original) +++ python/branches/tlee-ast-optimize/Lib/test/test_xmlrpc.py Sun Nov 30 09:29:52 2008 @@ -9,6 +9,7 @@ import mimetools import httplib import socket +import StringIO import os from test import test_support @@ -639,9 +640,93 @@ os.remove("xmldata.txt") os.remove(test_support.TESTFN) +class FakeSocket: + + def __init__(self): + self.data = StringIO.StringIO() + + def send(self, buf): + self.data.write(buf) + return len(buf) + + def sendall(self, buf): + self.data.write(buf) + + def getvalue(self): + return self.data.getvalue() + + def makefile(self, x, y): + raise RuntimeError + +class FakeTransport(xmlrpclib.Transport): + """A Transport instance that records instead of sending a request. + + This class replaces the actual socket used by httplib with a + FakeSocket object that records the request. It doesn't provide a + response. + """ + + def make_connection(self, host): + conn = xmlrpclib.Transport.make_connection(self, host) + conn._conn.sock = self.fake_socket = FakeSocket() + return conn + +class TransportSubclassTestCase(unittest.TestCase): + + def issue_request(self, transport_class): + """Return an HTTP request made via transport_class.""" + transport = transport_class() + proxy = xmlrpclib.ServerProxy("http://example.com/", + transport=transport) + try: + proxy.pow(6, 8) + except RuntimeError: + return transport.fake_socket.getvalue() + return None + + def test_custom_user_agent(self): + class TestTransport(FakeTransport): + + def send_user_agent(self, conn): + xmlrpclib.Transport.send_user_agent(self, conn) + conn.putheader("X-Test", "test_custom_user_agent") + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_custom_user_agent\r\n" in req) + + def test_send_host(self): + class TestTransport(FakeTransport): + + def send_host(self, conn, host): + xmlrpclib.Transport.send_host(self, conn, host) + conn.putheader("X-Test", "test_send_host") + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_send_host\r\n" in req) + + def test_send_request(self): + class TestTransport(FakeTransport): + + def send_request(self, conn, url, body): + xmlrpclib.Transport.send_request(self, conn, url, body) + conn.putheader("X-Test", "test_send_request") + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_send_request\r\n" in req) + + def test_send_content(self): + class TestTransport(FakeTransport): + + def send_content(self, conn, body): + conn.putheader("X-Test", "test_send_content") + xmlrpclib.Transport.send_content(self, conn, body) + + req = self.issue_request(TestTransport) + self.assert_("X-Test: test_send_content\r\n" in req) + def test_main(): xmlrpc_tests = [XMLRPCTestCase, HelperTestCase, DateTimeTestCase, - BinaryTestCase, FaultTestCase] + BinaryTestCase, FaultTestCase, TransportSubclassTestCase] # The test cases against a SimpleXMLRPCServer raise a socket error # 10035 (WSAEWOULDBLOCK) in the server thread handle_request call when Modified: python/branches/tlee-ast-optimize/Lib/uuid.py ============================================================================== --- python/branches/tlee-ast-optimize/Lib/uuid.py (original) +++ python/branches/tlee-ast-optimize/Lib/uuid.py Sun Nov 30 09:29:52 2008 @@ -479,8 +479,8 @@ # When the system provides a version-1 UUID generator, use it (but don't # use UuidCreate here because its UUIDs don't conform to RFC 4122). - _buffer = ctypes.create_string_buffer(16) if _uuid_generate_time and node is clock_seq is None: + _buffer = ctypes.create_string_buffer(16) _uuid_generate_time(_buffer) return UUID(bytes=_buffer.raw) @@ -516,8 +516,8 @@ """Generate a random UUID.""" # When the system provides a version-4 UUID generator, use it. - _buffer = ctypes.create_string_buffer(16) if _uuid_generate_random: + _buffer = ctypes.create_string_buffer(16) _uuid_generate_random(_buffer) return UUID(bytes=_buffer.raw) 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 Nov 30 09:29:52 2008 @@ -1346,9 +1346,7 @@ def send_content(self, connection, request_body): connection.putheader("Content-Type", "text/xml") connection.putheader("Content-Length", str(len(request_body))) - connection.endheaders() - if request_body: - connection.send(request_body) + connection.endheaders(request_body) ## # Parse response. Modified: python/branches/tlee-ast-optimize/Misc/NEWS ============================================================================== --- python/branches/tlee-ast-optimize/Misc/NEWS (original) +++ python/branches/tlee-ast-optimize/Misc/NEWS Sun Nov 30 09:29:52 2008 @@ -12,6 +12,25 @@ Core and Builtins ----------------- +- Issue #3996: On Windows, the PyOS_CheckStack function would cause the + interpreter to abort ("Fatal Python error: Could not reset the stack!") + instead of throwing a MemoryError. + +- Issue #4367: Python would segfault during compiling when the unicodedata + module couldn't be imported and \N escapes were present. + +- Issue #4233: Changed semantic of ``_fileio.FileIO``'s ``close()`` + method on file objects with closefd=False. The file descriptor is still + kept open but the file object behaves like a closed file. The ``FileIO`` + object also got a new readonly attribute ``closefd``. + +- Issue #4348: Some bytearray methods returned that didn't cause any change to + the bytearray, returned the same bytearray instead of a copy. + +- Issue #4317: Fixed a crash in the imageop.rgb2rgb8() function. + +- Issue #4230: If ``__getattr__`` is a descriptor, it now functions correctly. + - Issue #4048: The parser module now correctly validates relative imports. - Issue #4225: ``from __future__ import unicode_literals`` didn't work in an @@ -38,6 +57,19 @@ Library ------- +- Issue #3741: DISTUTILS_USE_SDK set causes msvc9compiler.py to raise an + exception. + +- Issue #4363: The uuid.uuid1() and uuid.uuid4() functions now work even if + the ctypes module is not present. + +- FileIO's mode attribute now always includes ``"b"``. + +- Issue #4116: Resolve member name conflict in ScrolledCanvas.__init__. + +- httplib.HTTPConnection.putheader() now accepts an arbitrary number of values + for any header, matching what the documentation has claimed for a while. + - Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. @@ -57,6 +89,8 @@ Build ----- +- Issue #4289: Remove Cancel button from AdvancedDlg. + - Issue #1656675: Register a drop handler for .py* files on Windows. - Issue #4120: Exclude manifest from extension modules in VS2008. @@ -75,6 +109,11 @@ - Issue #4122: On Windows, fix a compilation error when using the Py_UNICODE_ISSPACE macro in an extension module. +Extension Modules +----------------- + +- Issue #4396: The parser module now correctly validates the with statement. + What's New in Python 2.6 final ============================== Modified: python/branches/tlee-ast-optimize/Modules/Setup.dist ============================================================================== --- python/branches/tlee-ast-optimize/Modules/Setup.dist (original) +++ python/branches/tlee-ast-optimize/Modules/Setup.dist Sun Nov 30 09:29:52 2008 @@ -179,6 +179,11 @@ #_collections _collectionsmodule.c # Container types #itertools itertoolsmodule.c # Functions creating iterators for efficient looping #strop stropmodule.c # String manipulations +#_functools _functoolsmodule.c # Tools for working with functions and callable objects +#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c # elementtree accelerator +#_pickle _pickle.c # pickle accelerator +#datetime datetimemodule.c # date/time type +#_bisect _bisectmodule.c # Bisection algorithms #unicodedata unicodedata.c # static Unicode character database @@ -468,8 +473,7 @@ # # More information on Expat can be found at www.libexpat.org. # -#EXPAT_DIR=/usr/local/src/expat-1.95.2 -#pyexpat pyexpat.c -DHAVE_EXPAT_H -I$(EXPAT_DIR)/lib -L$(EXPAT_DIR) -lexpat +#pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI # Hye-Shik Chang's CJKCodecs 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 Nov 30 09:29:52 2008 @@ -61,10 +61,7 @@ fileio_close(PyFileIOObject *self) { if (!self->closefd) { - if (PyErr_WarnEx(PyExc_RuntimeWarning, - "Trying to close unclosable fd!", 3) < 0) { - return NULL; - } + self->fd = -1; Py_RETURN_NONE; } errno = internal_close(self); @@ -211,6 +208,8 @@ flags |= O_CREAT; append = 1; break; + case 'b': + break; case '+': if (plus) goto bad_mode; @@ -685,12 +684,12 @@ { if (self->readable) { if (self->writable) - return "r+"; + return "rb+"; else - return "r"; + return "rb"; } else - return "w"; + return "wb"; } static PyObject * @@ -821,6 +820,12 @@ } static PyObject * +get_closefd(PyFileIOObject *self, void *closure) +{ + return PyBool_FromLong((long)(self->closefd)); +} + +static PyObject * get_mode(PyFileIOObject *self, void *closure) { return PyString_FromString(mode_string(self)); @@ -828,6 +833,8 @@ static PyGetSetDef fileio_getsetlist[] = { {"closed", (getter)get_closed, NULL, "True if the file is closed"}, + {"closefd", (getter)get_closefd, NULL, + "True if the file descriptor will be closed"}, {"mode", (getter)get_mode, NULL, "String giving the file mode"}, {0}, }; Modified: python/branches/tlee-ast-optimize/Modules/_multiprocessing/semaphore.c ============================================================================== --- python/branches/tlee-ast-optimize/Modules/_multiprocessing/semaphore.c (original) +++ python/branches/tlee-ast-optimize/Modules/_multiprocessing/semaphore.c Sun Nov 30 09:29:52 2008 @@ -512,7 +512,6 @@ static PyObject * semlock_iszero(SemLockObject *self) { - int sval; #if HAVE_BROKEN_SEM_GETVALUE if (sem_trywait(self->handle) < 0) { if (errno == EAGAIN) @@ -524,6 +523,7 @@ Py_RETURN_FALSE; } #else + int sval; if (SEM_GETVALUE(self->handle, &sval) < 0) return mp_SetError(NULL, MP_STANDARD_ERROR); return PyBool_FromLong((long)sval == 0); 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 Nov 30 09:29:52 2008 @@ -590,7 +590,7 @@ if ( !PyArg_ParseTuple(args, "s#ii", &cp, &len, &x, &y) ) return 0; - if ( !check_multiply_size(len*4, x, "x", y, "y", 4) ) + if ( !check_multiply_size(len, x, "x", y, "y", 4) ) return 0; nlen = x*y; if ( !check_multiply(nlen, x, y) ) 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 Nov 30 09:29:52 2008 @@ -1559,7 +1559,7 @@ /* compound_stmt: - * if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef | decorated + * if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated */ static int validate_compound_stmt(node *tree) @@ -1577,6 +1577,7 @@ || (ntype == while_stmt) || (ntype == for_stmt) || (ntype == try_stmt) + || (ntype == with_stmt) || (ntype == funcdef) || (ntype == classdef) || (ntype == decorated)) @@ -2617,6 +2618,38 @@ return ok; } +/* with_var +with_var: 'as' expr + */ +static int +validate_with_var(node *tree) +{ + int nch = NCH(tree); + int ok = (validate_ntype(tree, with_var) + && (nch == 2) + && validate_name(CHILD(tree, 0), "as") + && validate_expr(CHILD(tree, 1))); + return ok; +} + +/* with_stmt + * 0 1 2 -2 -1 +with_stmt: 'with' test [ with_var ] ':' suite + */ +static int +validate_with_stmt(node *tree) +{ + int nch = NCH(tree); + int ok = (validate_ntype(tree, with_stmt) + && ((nch == 4) || (nch == 5)) + && validate_name(CHILD(tree, 0), "with") + && validate_test(CHILD(tree, 1)) + && (nch == 4 || validate_with_var(CHILD(tree, 2))) + && validate_colon(RCHILD(tree, -2)) + && validate_suite(RCHILD(tree, -1))); + return ok; +} + /* funcdef: * * -5 -4 -3 -2 -1 @@ -2993,6 +3026,9 @@ case funcdef: res = validate_funcdef(tree); break; + case with_stmt: + res = validate_with_stmt(tree); + break; case classdef: res = validate_class(tree); break; Modified: python/branches/tlee-ast-optimize/Objects/bytearrayobject.c ============================================================================== --- python/branches/tlee-ast-optimize/Objects/bytearrayobject.c (original) +++ python/branches/tlee-ast-optimize/Objects/bytearrayobject.c Sun Nov 30 09:29:52 2008 @@ -1423,7 +1423,7 @@ { register char *input, *output; register const char *table; - register Py_ssize_t i, c, changed = 0; + register Py_ssize_t i, c; PyObject *input_obj = (PyObject*)self; const char *output_start; Py_ssize_t inlen; @@ -1469,14 +1469,8 @@ /* 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; + *output++ = table[c]; } - if (changed || !PyByteArray_CheckExact(input_obj)) - goto done; - Py_DECREF(result); - Py_INCREF(input_obj); - result = input_obj; goto done; } @@ -1491,13 +1485,6 @@ if (trans_table[c] != -1) if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) continue; - changed = 1; - } - if (!changed && PyByteArray_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - result = input_obj; - goto done; } /* Fix the size of the resulting string */ if (inlen > 0) @@ -1526,15 +1513,10 @@ !memcmp(target+offset+1, pattern+1, length-2) ) -/* Bytes ops must return a string. */ -/* If the object is subclass of bytes, create a copy */ +/* Bytes ops must return a string, create a copy */ Py_LOCAL(PyByteArrayObject *) return_self(PyByteArrayObject *self) { - if (PyByteArray_CheckExact(self)) { - Py_INCREF(self); - return (PyByteArrayObject *)self; - } return (PyByteArrayObject *)PyByteArray_FromStringAndSize( PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self)); 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 Nov 30 09:29:52 2008 @@ -5391,6 +5391,24 @@ } static PyObject * +call_attribute(PyObject *self, PyObject *attr, PyObject *name) +{ + PyObject *res, *descr = NULL; + descrgetfunc f = Py_TYPE(attr)->tp_descr_get; + + if (f != NULL) { + descr = f(attr, self, (PyObject *)(Py_TYPE(self))); + if (descr == NULL) + return NULL; + else + attr = descr; + } + res = PyObject_CallFunctionObjArgs(attr, name, NULL); + Py_XDECREF(descr); + return res; +} + +static PyObject * slot_tp_getattr_hook(PyObject *self, PyObject *name) { PyTypeObject *tp = Py_TYPE(self); @@ -5409,24 +5427,39 @@ if (getattribute_str == NULL) return NULL; } + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when the attribute is present. So we use + _PyType_Lookup and create the method only when needed, with + call_attribute. */ getattr = _PyType_Lookup(tp, getattr_str); if (getattr == NULL) { /* No __getattr__ hook: use a simpler dispatcher */ tp->tp_getattro = slot_tp_getattro; return slot_tp_getattro(self, name); } + Py_INCREF(getattr); + /* speed hack: we could use lookup_maybe, but that would resolve the + method fully for each attribute lookup for classes with + __getattr__, even when self has the default __getattribute__ + method. So we use _PyType_Lookup and create the method only when + needed, with call_attribute. */ getattribute = _PyType_Lookup(tp, getattribute_str); if (getattribute == NULL || (Py_TYPE(getattribute) == &PyWrapperDescr_Type && ((PyWrapperDescrObject *)getattribute)->d_wrapped == (void *)PyObject_GenericGetAttr)) res = PyObject_GenericGetAttr(self, name); - else - res = PyObject_CallFunctionObjArgs(getattribute, self, name, NULL); + else { + Py_INCREF(getattribute); + res = call_attribute(self, getattribute, name); + Py_DECREF(getattribute); + } if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { PyErr_Clear(); - res = PyObject_CallFunctionObjArgs(getattr, self, name, NULL); + res = call_attribute(self, getattr, name); } + Py_DECREF(getattr); return res; } 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 Nov 30 09:29:52 2008 @@ -7680,7 +7680,7 @@ } PyDoc_STRVAR(splitlines__doc__, -"S.splitlines([keepends]]) -> list of strings\n\ +"S.splitlines([keepends]) -> list of strings\n\ \n\ Return a list of the lines in S, breaking at line boundaries.\n\ Line breaks are not included in the resulting list unless keepends\n\ 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 Nov 30 09:29:52 2008 @@ -747,10 +747,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\yuvconvert.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\zipimport.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 Nov 30 09:29:52 2008 @@ -821,9 +821,6 @@ RelativePath="..\..\Modules\xxsubtype.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 Sun Nov 30 09:29:52 2008 @@ -1171,14 +1171,6 @@ > - - - - Modified: python/branches/tlee-ast-optimize/PC/os2vacpp/makefile ============================================================================== --- python/branches/tlee-ast-optimize/PC/os2vacpp/makefile (original) +++ python/branches/tlee-ast-optimize/PC/os2vacpp/makefile Sun Nov 30 09:29:52 2008 @@ -203,8 +203,7 @@ $(PATHOBJ)\StropModule.obj \ $(PATHOBJ)\StructModule.obj \ $(PATHOBJ)\TimeModule.obj \ - $(PATHOBJ)\ThreadModule.obj \ - $(PATHOBJ)\YUVConvert.obj + $(PATHOBJ)\ThreadModule.obj # Standalone Parser Generator Program (Shares Some of Python's Modules) PGEN = \ @@ -1113,8 +1112,7 @@ $(PY_INCLUDE)\pyerrors.h $(PY_INCLUDE)\pyfpe.h $(PY_INCLUDE)\pystate.h \ $(PY_INCLUDE)\python.h $(PY_INCLUDE)\pythonrun.h $(PY_INCLUDE)\rangeobject.h \ $(PY_INCLUDE)\sliceobject.h $(PY_INCLUDE)\stringobject.h \ - $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h \ - $(PY_MODULES)\yuv.h + $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h syslogmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \ $(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \ @@ -1198,8 +1196,6 @@ $(PY_INCLUDE)\sliceobject.h $(PY_INCLUDE)\stringobject.h \ $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h -yuvconvert.obj: $(PY_MODULES)\yuv.h - zlibmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h $(PY_INCLUDE)\classobject.h \ $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h pyconfig.h \ $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h $(PY_INCLUDE)\floatobject.h \ Modified: python/branches/tlee-ast-optimize/PC/os2vacpp/makefile.omk ============================================================================== --- python/branches/tlee-ast-optimize/PC/os2vacpp/makefile.omk (original) +++ python/branches/tlee-ast-optimize/PC/os2vacpp/makefile.omk Sun Nov 30 09:29:52 2008 @@ -164,8 +164,7 @@ StropModule.obj \ StructModule.obj \ TimeModule.obj \ - ThreadModule.obj \ - YUVConvert.obj + ThreadModule.obj # Omitted Modules (and Description/Reason): # @@ -803,8 +802,7 @@ intrcheck.h listobject.h longobject.h methodobject.h modsupport.h \ moduleobject.h mymalloc.h myproto.h object.h objimpl.h pydebug.h \ pyerrors.h pyfpe.h pystate.h python.h pythonrun.h rangeobject.h \ - sliceobject.h stringobject.h sysmodule.h traceback.h tupleobject.h \ - yuv.h + sliceobject.h stringobject.h sysmodule.h traceback.h tupleobject.h syslogmodule.obj: abstract.h ceval.h classobject.h cobject.h \ complexobject.h pyconfig.h dictobject.h fileobject.h floatobject.h \ @@ -854,8 +852,6 @@ pythonrun.h rangeobject.h sliceobject.h stringobject.h sysmodule.h \ traceback.h tupleobject.h -yuvconvert.obj: yuv.h - zlibmodule.obj: abstract.h ceval.h classobject.h cobject.h complexobject.h \ pyconfig.h dictobject.h fileobject.h floatobject.h funcobject.h \ import.h intobject.h intrcheck.h listobject.h longobject.h \ 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 Nov 30 09:29:52 2008 @@ -1171,14 +1171,6 @@ > - - - - 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 Nov 30 09:29:52 2008 @@ -47,7 +47,8 @@ static identifier new_identifier(const char* n, PyArena *arena) { PyObject* id = PyString_InternFromString(n); - PyArena_AddPyObject(arena, id); + if (id != NULL) + PyArena_AddPyObject(arena, id); return id; } @@ -604,6 +605,7 @@ */ REQ(n, fplist); for (i = 0; i < len; i++) { + PyObject *arg_id; const node *fpdef_node = CHILD(n, 2*i); const node *child; expr_ty arg; @@ -612,9 +614,12 @@ child = CHILD(fpdef_node, 0); if (TYPE(child) == NAME) { if (!forbidden_check(c, n, STR(child))) - return NULL; - arg = Name(NEW_IDENTIFIER(child), Store, LINENO(child), - child->n_col_offset, c->c_arena); + return NULL; + arg_id = NEW_IDENTIFIER(child); + if (!arg_id) + return NULL; + arg = Name(arg_id, Store, LINENO(child), child->n_col_offset, + c->c_arena); } else { assert(TYPE(fpdef_node) == fpdef); @@ -724,11 +729,14 @@ } } if (TYPE(CHILD(ch, 0)) == NAME) { + PyObject *id; expr_ty name; 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, + id = NEW_IDENTIFIER(CHILD(ch, 0)); + if (!id) + goto error; + name = Name(id, Param, LINENO(ch), ch->n_col_offset, c->c_arena); if (!name) goto error; @@ -741,12 +749,16 @@ if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; vararg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!vararg) + goto error; i += 3; break; case DOUBLESTAR: if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) goto error; kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); + if (!kwarg) + goto error; i += 3; break; default: @@ -1282,11 +1294,14 @@ node *ch = CHILD(n, 0); switch (TYPE(ch)) { - case NAME: + case NAME: { /* All names start in Load context, but may later be changed. */ - return Name(NEW_IDENTIFIER(ch), Load, LINENO(n), n->n_col_offset, - c->c_arena); + PyObject *name = NEW_IDENTIFIER(ch); + if (!name) + return NULL; + return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena); + } case STRING: { PyObject *str = parsestrplus(c, n); if (!str) { @@ -1294,13 +1309,14 @@ if (PyErr_ExceptionMatches(PyExc_UnicodeError)){ PyObject *type, *value, *tback, *errstr; PyErr_Fetch(&type, &value, &tback); - errstr = ((PyUnicodeErrorObject *)value)->reason; + errstr = PyObject_Str(value); if (errstr) { char *s = ""; char buf[128]; s = PyString_AsString(errstr); PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); ast_error(n, buf); + Py_DECREF(errstr); } else { ast_error(n, "(unicode error) unknown error"); } @@ -1543,7 +1559,10 @@ return ast_for_call(c, CHILD(n, 1), left_expr); } else if (TYPE(CHILD(n, 0)) == DOT ) { - return Attribute(left_expr, NEW_IDENTIFIER(CHILD(n, 1)), Load, + PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1)); + if (!attr_id) + return NULL; + return Attribute(left_expr, attr_id, Load, LINENO(n), n->n_col_offset, c->c_arena); } else { @@ -2317,7 +2336,7 @@ dotted_as_name: dotted_name ['as' NAME] dotted_name: NAME ('.' NAME)* */ - PyObject *str; + PyObject *str, *name; loop: switch (TYPE(n)) { @@ -2325,8 +2344,13 @@ str = NULL; if (NCH(n) == 3) { str = NEW_IDENTIFIER(CHILD(n, 2)); + if (!str) + return NULL; } - return alias(NEW_IDENTIFIER(CHILD(n, 0)), str, c->c_arena); + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, str, c->c_arena); case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); @@ -2338,12 +2362,18 @@ return NULL; assert(!a->asname); a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + if (!a->asname) + return NULL; return a; } break; case dotted_name: - if (NCH(n) == 1) - return alias(NEW_IDENTIFIER(CHILD(n, 0)), NULL, c->c_arena); + if (NCH(n) == 1) { + name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!name) + return NULL; + return alias(name, NULL, c->c_arena); + } else { /* Create a string of the form "a.b.c" */ int i; @@ -3022,6 +3052,7 @@ ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) { /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */ + PyObject *classname; asdl_seq *bases, *s; REQ(n, classdef); @@ -3033,16 +3064,22 @@ s = ast_for_suite(c, CHILD(n, 3)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), + n->n_col_offset, c->c_arena); } /* check for empty base list */ if (TYPE(CHILD(n,3)) == RPAR) { s = ast_for_suite(c, CHILD(n,5)); if (!s) - return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), NULL, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); + return NULL; + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), + n->n_col_offset, c->c_arena); } /* else handle the base class list */ @@ -3053,7 +3090,10 @@ s = ast_for_suite(c, CHILD(n, 6)); if (!s) return NULL; - return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, s, decorator_seq, + classname = NEW_IDENTIFIER(CHILD(n, 1)); + if (!classname) + return NULL; + return ClassDef(classname, bases, s, decorator_seq, LINENO(n), n->n_col_offset, c->c_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 Nov 30 09:29:52 2008 @@ -1797,7 +1797,7 @@ EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { int errcode = _resetstkoflw(); - if (errcode) + if (errcode == 0) { Py_FatalError("Could not reset the stack!"); } 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 Nov 30 09:29:52 2008 @@ -716,18 +716,15 @@ ##################################################################### # Advanced Dialog. advanced = PyDialog(db, "AdvancedDlg", x, y, w, h, modal, title, - "CompilePyc", "Next", "Cancel") + "CompilePyc", "Ok", "Ok") advanced.title("Advanced Options for [ProductName]") # A radio group with two options: allusers, justme advanced.checkbox("CompilePyc", 135, 60, 230, 50, 3, - "COMPILEALL", "Compile .py files to byte code after installation", "Next") + "COMPILEALL", "Compile .py files to byte code after installation", "Ok") - c = advanced.next("Finish", "Cancel") + c = advanced.cancel("Ok", "CompilePyc", name="Ok") # Button just has location of cancel button. c.event("EndDialog", "Return") - c = advanced.cancel("Cancel", "CompilePyc") - c.event("SpawnDialog", "CancelDlg") - ##################################################################### # Existing Directory dialog dlg = Dialog(db, "ExistingDirectoryDlg", 50, 30, 200, 80, modal, title, 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 Nov 30 09:29:52 2008 @@ -39,9 +39,9 @@ format = int(open(os.path.join(root, ".svn", "format")).read().strip()) except IOError: return [] - if format == 8: - # In version 8, committed props are stored in prop-base, - # local modifications in props + if format in (8, 9): + # In version 8 and 9, 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" Modified: python/branches/tlee-ast-optimize/configure ============================================================================== --- python/branches/tlee-ast-optimize/configure (original) +++ python/branches/tlee-ast-optimize/configure Sun Nov 30 09:29:52 2008 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 66764 . +# From configure.in Revision: 67227 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.7. # @@ -2090,7 +2090,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6A-S) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. Modified: python/branches/tlee-ast-optimize/configure.in ============================================================================== --- python/branches/tlee-ast-optimize/configure.in (original) +++ python/branches/tlee-ast-optimize/configure.in Sun Nov 30 09:29:52 2008 @@ -261,7 +261,7 @@ # Defining _XOPEN_SOURCE on NetBSD version prior to the introduction of # _NETBSD_SOURCE disables certain features (eg. setgroups). Reported by # Marc Recht - NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6[A-S]) + NetBSD/1.5 | NetBSD/1.5.* | NetBSD/1.6 | NetBSD/1.6.* | NetBSD/1.6@<:@A-S@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage # of union __?sigval. Reported by Stuart Bishop. From python-checkins at python.org Sun Nov 30 12:08:27 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 30 Nov 2008 12:08:27 +0100 (CET) Subject: [Python-checkins] r67449 - in python/trunk: Misc/NEWS Tools/msi/msi.py Message-ID: <20081130110827.0EE781E4002@bag.python.org> Author: martin.v.loewis Date: Sun Nov 30 12:08:26 2008 New Revision: 67449 Log: Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". Modified: python/trunk/Misc/NEWS python/trunk/Tools/msi/msi.py Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Nov 30 12:08:26 2008 @@ -89,6 +89,8 @@ Build ----- +- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". + - Issue #4289: Remove Cancel button from AdvancedDlg. - Issue #1656675: Register a drop handler for .py* files on Windows. Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Sun Nov 30 12:08:26 2008 @@ -1248,7 +1248,10 @@ "[TARGETDIR]Doc\\"+docfile , "REGISTRY.doc"), ("Modules", -1, prefix+r"\Modules", "+", None, "REGISTRY"), ("AppPaths", -1, r"Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe", - "", r"[TARGETDIR]Python.exe", "REGISTRY.def") + "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), + ("DisplayIcon", -1, + r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From python-checkins at python.org Sun Nov 30 12:09:54 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 30 Nov 2008 12:09:54 +0100 (CET) Subject: [Python-checkins] r67450 - in python/branches/release26-maint: Misc/NEWS Tools/msi/msi.py Message-ID: <20081130110954.332891E4016@bag.python.org> Author: martin.v.loewis Date: Sun Nov 30 12:09:53 2008 New Revision: 67450 Log: Merged revisions 67449 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67449 | martin.v.loewis | 2008-11-30 12:08:26 +0100 (So, 30 Nov 2008) | 3 lines Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Tools/msi/msi.py Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Sun Nov 30 12:09:53 2008 @@ -79,6 +79,8 @@ Build ----- +- Issue #4389: Add icon to the uninstall entry in "add-and-remove-programs". + - Issue #4289: Remove Cancel button from AdvancedDlg. - Issue #1656675: Register a drop handler for .py* files on Windows. Modified: python/branches/release26-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release26-maint/Tools/msi/msi.py (original) +++ python/branches/release26-maint/Tools/msi/msi.py Sun Nov 30 12:09:53 2008 @@ -1247,7 +1247,10 @@ "[TARGETDIR]Doc\\"+docfile , "REGISTRY.doc"), ("Modules", -1, prefix+r"\Modules", "+", None, "REGISTRY"), ("AppPaths", -1, r"Software\Microsoft\Windows\CurrentVersion\App Paths\Python.exe", - "", r"[TARGETDIR]Python.exe", "REGISTRY.def") + "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), + ("DisplayIcon", -1, + r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From buildbot at python.org Sun Nov 30 13:03:21 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 12:03:21 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu trunk Message-ID: <20081130120321.D194E1E4002@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/528 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,martin.v.loewis 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 Sun Nov 30 13:29:50 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 12:29:50 +0000 Subject: [Python-checkins] buildbot failure in i386 Ubuntu 3.0 Message-ID: <20081130122950.7D6F31E4002@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/626 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: Traceback (most recent call last): File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/multiprocessing/managers.py", line 188, in handle_request result = func(c, *args, **kwds) File "/home/pybot/buildarea/3.0.klose-ubuntu-i386/build/Lib/multiprocessing/managers.py", line 306, in debug_info keys.sort() TypeError: unorderable types: str() < int() 1 test failed: test_multiprocessing make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Nov 30 13:41:23 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 12:41:23 +0000 Subject: [Python-checkins] buildbot failure in sparc Debian 3.0 Message-ID: <20081130124123.8E8F61E4002@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/721 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_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Nov 30 13:50:35 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 12:50:35 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20081130125036.2F8831E4002@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/683 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_doctest test_posix test_subprocess ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Sun Nov 30 14:31:22 2008 From: python-checkins at python.org (matthias.klose) Date: Sun, 30 Nov 2008 14:31:22 +0100 (CET) Subject: [Python-checkins] r67452 - python/branches/release25-maint/Tools/faqwiz/move-faqwiz.sh Message-ID: <20081130133122.C724E1E4002@bag.python.org> Author: matthias.klose Date: Sun Nov 30 14:31:22 2008 New Revision: 67452 Log: - Tools/faqwiz/move-faqwiz.sh: Fix unsecure use of temporary files Modified: python/branches/release25-maint/Tools/faqwiz/move-faqwiz.sh Modified: python/branches/release25-maint/Tools/faqwiz/move-faqwiz.sh ============================================================================== --- python/branches/release25-maint/Tools/faqwiz/move-faqwiz.sh (original) +++ python/branches/release25-maint/Tools/faqwiz/move-faqwiz.sh Sun Nov 30 14:31:22 2008 @@ -9,7 +9,7 @@ # blackjesus:~> ./move-faqwiz.sh 2\.1 3\.2 # Moving FAQ question 02.001 to 03.002 -if [ x$2 == x ]; then +if [ x$2 = x ]; then echo "Need 2 args: original_version final_version." exit 2 fi @@ -19,7 +19,7 @@ exit 2 fi -function cut_n_pad() { +cut_n_pad() { t=`echo $1 | cut -d. -f $2` export $3=`echo $t | awk "{ tmp = \\$0; l = length(tmp); for (i = 0; i < $2-l+1; i++) { tmp = "0".tmp } print tmp }"` } @@ -28,7 +28,13 @@ cut_n_pad $1 2 suffix1 cut_n_pad $2 1 prefix2 cut_n_pad $2 2 suffix2 -tmpfile=tmp$RANDOM.tmp +if which tempfile >/dev/null; then + tmpfile=$(tempfile -d .) +elif [ -n "$RANDOM" ]; then + tmpfile=tmp$RANDOM.tmp +else + tmpfile=tmp$$.tmp +fi file1=faq$prefix1.$suffix1.htp file2=faq$prefix2.$suffix2.htp From python-checkins at python.org Sun Nov 30 14:33:28 2008 From: python-checkins at python.org (matthias.klose) Date: Sun, 30 Nov 2008 14:33:28 +0100 (CET) Subject: [Python-checkins] r67453 - in python/branches/release24-maint: Misc/NEWS Tools/faqwiz/move-faqwiz.sh Message-ID: <20081130133328.56AEA1E4002@bag.python.org> Author: matthias.klose Date: Sun Nov 30 14:33:28 2008 New Revision: 67453 Log: - Tools/faqwiz/move-faqwiz.sh: Fix unsecure use of temporary files. Modified: python/branches/release24-maint/Misc/NEWS python/branches/release24-maint/Tools/faqwiz/move-faqwiz.sh Modified: python/branches/release24-maint/Misc/NEWS ============================================================================== --- python/branches/release24-maint/Misc/NEWS (original) +++ python/branches/release24-maint/Misc/NEWS Sun Nov 30 14:33:28 2008 @@ -55,6 +55,11 @@ Build ----- +Tools/Demos +----------- + +- Tools/faqwiz/move-faqwiz.sh: Fix unsecure use of temporary files. + What's New in Python 2.4.5? ============================= Modified: python/branches/release24-maint/Tools/faqwiz/move-faqwiz.sh ============================================================================== --- python/branches/release24-maint/Tools/faqwiz/move-faqwiz.sh (original) +++ python/branches/release24-maint/Tools/faqwiz/move-faqwiz.sh Sun Nov 30 14:33:28 2008 @@ -9,7 +9,7 @@ # blackjesus:~> ./move-faqwiz.sh 2\.1 3\.2 # Moving FAQ question 02.001 to 03.002 -if [ x$2 == x ]; then +if [ x$2 = x ]; then echo "Need 2 args: original_version final_version." exit 2 fi @@ -19,7 +19,7 @@ exit 2 fi -function cut_n_pad() { +cut_n_pad() { t=`echo $1 | cut -d. -f $2` export $3=`echo $t | awk "{ tmp = \\$0; l = length(tmp); for (i = 0; i < $2-l+1; i++) { tmp = "0".tmp } print tmp }"` } @@ -28,7 +28,13 @@ cut_n_pad $1 2 suffix1 cut_n_pad $2 1 prefix2 cut_n_pad $2 2 suffix2 -tmpfile=tmp$RANDOM.tmp +if which tempfile >/dev/null; then + tmpfile=$(tempfile -d .) +elif [ -n "$RANDOM" ]; then + tmpfile=tmp$RANDOM.tmp +else + tmpfile=tmp$$.tmp +fi file1=faq$prefix1.$suffix1.htp file2=faq$prefix2.$suffix2.htp From buildbot at python.org Sun Nov 30 15:13:12 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 14:13:12 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 2.5 Message-ID: <20081130141312.8B7531E4002@bag.python.org> The Buildbot has detected a new failure of OS X x86 2.5. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%202.5/builds/44 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch branches/release25-maint] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/2.5.noller-osx86/build/Lib/threading.py", line 486, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/2.5.noller-osx86/build/Lib/test/test_urllib2_localnet.py", line 64, in run self._RequestHandlerClass) File "/Users/buildbot/buildarea/2.5.noller-osx86/build/Lib/test/test_urllib2_localnet.py", line 22, in __init__ RequestHandlerClass) File "/Users/buildbot/buildarea/2.5.noller-osx86/build/Lib/SocketServer.py", line 330, in __init__ self.server_bind() File "/Users/buildbot/buildarea/2.5.noller-osx86/build/Lib/BaseHTTPServer.py", line 101, in server_bind SocketServer.TCPServer.server_bind(self) File "/Users/buildbot/buildarea/2.5.noller-osx86/build/Lib/SocketServer.py", line 341, in server_bind self.socket.bind(self.server_address) File "", line 1, in bind error: (48, 'Address already in use') sincerely, -The Buildbot From python-checkins at python.org Sun Nov 30 15:43:24 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 30 Nov 2008 15:43:24 +0100 (CET) Subject: [Python-checkins] r67454 - python/trunk/configure.in Message-ID: <20081130144324.1FDA51E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 30 15:43:23 2008 New Revision: 67454 Log: note the version that works Modified: python/trunk/configure.in Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Sun Nov 30 15:43:23 2008 @@ -1,7 +1,7 @@ dnl *********************************************** dnl * Please run autoreconf to test your changes! * dnl *********************************************** -dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.63). +dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61). # Set VERSION so we only need to edit in one place (i.e., here) m4_define(PYTHON_VERSION, 2.7) From buildbot at python.org Sun Nov 30 16:00:25 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 15:00:25 +0000 Subject: [Python-checkins] buildbot failure in sparc Ubuntu 3.0 Message-ID: <20081130150025.5B1771E4032@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/806 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: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_doctest test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Nov 30 16:35:26 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 15:35:26 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20081130153526.510FD1E4002@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/355 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: sincerely, -The Buildbot From buildbot at python.org Sun Nov 30 18:42:16 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 17:42:16 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20081130174217.11FA51E4002@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/1649 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_bsddb3 test_urllib2_localnet test_urllibnet ====================================================================== ERROR: test01_badpointer (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 21, in test01_badpointer dbs = dbshelve.open(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 106, in open d.open(filename, dbname, filetype, flags, mode) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\dbshelve.py", line 171, in open self.db.open(*args, **kwargs) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test03_repr_closed_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 37, in test03_repr_closed_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\__init__.py", line 361, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test04_repr_db (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 43, in test04_repr_db db = hashopen(self.filename) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\__init__.py", line 361, in hashopen d.open(file, db.DB_HASH, flags, mode) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test05_double_free_make_key_dbt (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 65, in test05_double_free_make_key_dbt db.DB_CREATE | db.DB_THREAD) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test06_key_with_null_bytes (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 77, in test06_key_with_null_bytes db1.open(self.filename, None, db.DB_HASH, db.DB_CREATE) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== ERROR: test07_DB_set_flags_persists (bsddb.test.test_misc.MiscTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_misc.py", line 101, in test07_DB_set_flags_persists db1.open(self.filename, db.DB_HASH, db.DB_CREATE) DBFileExistsError: (17, 'File exists -- __fop_file_setup: Retry limit (100) exceeded') ====================================================================== FAIL: test_bad_address (test.test_urllib2_localnet.TestUrlopen) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_urllib2_localnet.py", line 477, in test_bad_address urllib2.urlopen, "http://www.python.invalid./") AssertionError: IOError not raised ====================================================================== FAIL: test_bad_address (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_urllibnet.py", line 140, in test_bad_address urllib.urlopen, "http://www.python.invalid./") AssertionError: IOError not raised sincerely, -The Buildbot From python-checkins at python.org Sun Nov 30 20:28:27 2008 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 30 Nov 2008 20:28:27 +0100 (CET) Subject: [Python-checkins] r67455 - in python/trunk: Misc/NEWS PC/msvcrtmodule.c Message-ID: <20081130192827.96A7A1E4002@bag.python.org> Author: martin.v.loewis Date: Sun Nov 30 20:28:27 2008 New Revision: 67455 Log: Issue #4365: Add crtassem.h constants to the msvcrt module. Modified: python/trunk/Misc/NEWS python/trunk/PC/msvcrtmodule.c Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Nov 30 20:28:27 2008 @@ -114,6 +114,8 @@ Extension Modules ----------------- +- Issue #4365: Add crtassem.h constants to the msvcrt module. + - Issue #4396: The parser module now correctly validates the with statement. Modified: python/trunk/PC/msvcrtmodule.c ============================================================================== --- python/trunk/PC/msvcrtmodule.c (original) +++ python/trunk/PC/msvcrtmodule.c Sun Nov 30 20:28:27 2008 @@ -22,6 +22,12 @@ #include #include +#ifdef _MSC_VER +#if _MSC_VER >= 1500 +#include +#endif +#endif + // Force the malloc heap to clean itself up, and free unused blocks // back to the OS. (According to the docs, only works on NT.) static PyObject * @@ -298,6 +304,7 @@ PyMODINIT_FUNC initmsvcrt(void) { + int st; PyObject *d; PyObject *m = Py_InitModule("msvcrt", msvcrt_functions); if (m == NULL) @@ -310,4 +317,21 @@ insertint(d, "LK_NBRLCK", _LK_NBRLCK); insertint(d, "LK_RLCK", _LK_RLCK); insertint(d, "LK_UNLCK", _LK_UNLCK); + + /* constants for the crt versions */ +#ifdef _VC_ASSEMBLY_PUBLICKEYTOKEN + st = PyModule_AddStringConstant(m, "VC_ASSEMBLY_PUBLICKEYTOKEN", + _VC_ASSEMBLY_PUBLICKEYTOKEN); + if (st < 0)return; +#endif +#ifdef _CRT_ASSEMBLY_VERSION + st = PyModule_AddStringConstant(m, "CRT_ASSEMBLY_VERSION", + _CRT_ASSEMBLY_VERSION); + if (st < 0)return; +#endif +#ifdef __LIBRARIES_ASSEMBLY_NAME_PREFIX + st = PyModule_AddStringConstant(m, "LIBRARIES_ASSEMBLY_NAME_PREFIX", + __LIBRARIES_ASSEMBLY_NAME_PREFIX); + if (st < 0)return; +#endif } From buildbot at python.org Sun Nov 30 21:21:19 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 20:21:19 +0000 Subject: [Python-checkins] buildbot failure in AMD64 W2k8 trunk Message-ID: <20081130202119.7A3661E4002@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/1100 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: nelson-win64 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_bsddb3 sincerely, -The Buildbot From python-checkins at python.org Sun Nov 30 22:12:34 2008 From: python-checkins at python.org (christian.heimes) Date: Sun, 30 Nov 2008 22:12:34 +0100 (CET) Subject: [Python-checkins] r67456 - python/branches/release26-maint/Doc/c-api/arg.rst Message-ID: <20081130211234.4A4B61E4002@bag.python.org> Author: christian.heimes Date: Sun Nov 30 22:12:34 2008 New Revision: 67456 Log: w# requires Py_ssize_t, not int. This documentation bug has cost me several hours of debugging :/ Modified: python/branches/release26-maint/Doc/c-api/arg.rst Modified: python/branches/release26-maint/Doc/c-api/arg.rst ============================================================================== --- python/branches/release26-maint/Doc/c-api/arg.rst (original) +++ python/branches/release26-maint/Doc/c-api/arg.rst Sun Nov 30 22:12:34 2008 @@ -251,7 +251,7 @@ or use ``w#`` instead. Only single-segment buffer objects are accepted; :exc:`TypeError` is raised for all others. -``w#`` (read-write character buffer) [char \*, int] +``w#`` (read-write character buffer) [char \*, Py_ssize_t] Like ``s#``, but accepts any object which implements the read-write buffer interface. The :ctype:`char \*` variable is set to point to the first byte of the buffer, and the :ctype:`int` is set to the length of the buffer. Only From python-checkins at python.org Sun Nov 30 22:16:28 2008 From: python-checkins at python.org (christian.heimes) Date: Sun, 30 Nov 2008 22:16:28 +0100 (CET) Subject: [Python-checkins] r67457 - python/trunk/Doc/c-api/arg.rst Message-ID: <20081130211628.ACDFC1E4002@bag.python.org> Author: christian.heimes Date: Sun Nov 30 22:16:28 2008 New Revision: 67457 Log: w# requires Py_ssize_t Modified: python/trunk/Doc/c-api/arg.rst Modified: python/trunk/Doc/c-api/arg.rst ============================================================================== --- python/trunk/Doc/c-api/arg.rst (original) +++ python/trunk/Doc/c-api/arg.rst Sun Nov 30 22:16:28 2008 @@ -251,7 +251,7 @@ or use ``w#`` instead. Only single-segment buffer objects are accepted; :exc:`TypeError` is raised for all others. -``w#`` (read-write character buffer) [char \*, int] +``w#`` (read-write character buffer) [char \*, Py_ssize_t] Like ``s#``, but accepts any object which implements the read-write buffer interface. The :ctype:`char \*` variable is set to point to the first byte of the buffer, and the :ctype:`int` is set to the length of the buffer. Only From python-checkins at python.org Sun Nov 30 22:46:17 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 30 Nov 2008 22:46:17 +0100 (CET) Subject: [Python-checkins] r67458 - python/trunk/Doc/tools/sphinxext/pyspecific.py Message-ID: <20081130214617.06A2D1E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 30 22:46:16 2008 New Revision: 67458 Log: fix pyspecific extensions that were broken by Sphinx's grand renaming Modified: python/trunk/Doc/tools/sphinxext/pyspecific.py Modified: python/trunk/Doc/tools/sphinxext/pyspecific.py ============================================================================== --- python/trunk/Doc/tools/sphinxext/pyspecific.py (original) +++ python/trunk/Doc/tools/sphinxext/pyspecific.py Sun Nov 30 22:46:16 2008 @@ -48,7 +48,7 @@ from docutils.io import StringOutput from docutils.utils import new_document from sphinx.builder import Builder -from sphinx.textwriter import TextWriter +from sphinx.writers.text import TextWriter class PydocTopicsBuilder(Builder): name = 'pydoc-topics' From python-checkins at python.org Sun Nov 30 23:01:38 2008 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 30 Nov 2008 23:01:38 +0100 (CET) Subject: [Python-checkins] r67459 - in python/branches/release26-maint: Doc/tools/sphinxext/pyspecific.py Message-ID: <20081130220138.0AC921E4002@bag.python.org> Author: benjamin.peterson Date: Sun Nov 30 23:01:37 2008 New Revision: 67459 Log: Merged revisions 67458 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r67458 | benjamin.peterson | 2008-11-30 15:46:16 -0600 (Sun, 30 Nov 2008) | 1 line fix pyspecific extensions that were broken by Sphinx's grand renaming ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/tools/sphinxext/pyspecific.py Modified: python/branches/release26-maint/Doc/tools/sphinxext/pyspecific.py ============================================================================== --- python/branches/release26-maint/Doc/tools/sphinxext/pyspecific.py (original) +++ python/branches/release26-maint/Doc/tools/sphinxext/pyspecific.py Sun Nov 30 23:01:37 2008 @@ -48,7 +48,7 @@ from docutils.io import StringOutput from docutils.utils import new_document from sphinx.builder import Builder -from sphinx.textwriter import TextWriter +from sphinx.writers.text import TextWriter class PydocTopicsBuilder(Builder): name = 'pydoc-topics' From martin at v.loewis.de Sun Nov 30 23:17:37 2008 From: martin at v.loewis.de (=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Sun, 30 Nov 2008 23:17:37 +0100 Subject: [Python-checkins] r67456 - python/branches/release26-maint/Doc/c-api/arg.rst In-Reply-To: <20081130211234.4A4B61E4002@bag.python.org> References: <20081130211234.4A4B61E4002@bag.python.org> Message-ID: <49331101.9090209@v.loewis.de> > w# requires Py_ssize_t, not int. > This documentation bug has cost me several hours of debugging :/ This patch is incorrect. Whether Py_ssize_t or int is required depends on whether PY_SSIZE_T_CLEAN is defined or not. The same holds for all other # arguments. Regards, Martin From buildbot at python.org Sun Nov 30 23:41:00 2008 From: buildbot at python.org (buildbot at python.org) Date: Sun, 30 Nov 2008 22:41:00 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.0 Message-ID: <20081130224100.D89F81E4002@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/552 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: 3 tests failed: test_calendar test_email test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot
FormatPacked as .zipPacked as .tar.bz2