[Python-checkins] r83492 - in python/branches/release26-maint: Lib/_MozillaCookieJar.py Lib/doctest.py Lib/imaplib.py Lib/pydoc.py Lib/test/test_doctest.py Makefile.pre.in Misc/NEWS
georg.brandl
python-checkins at python.org
Mon Aug 2 00:05:31 CEST 2010
Author: georg.brandl
Date: Mon Aug 2 00:05:31 2010
New Revision: 83492
Log:
Merged revisions 83392,83426 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/release27-maint
................
r83392 | georg.brandl | 2010-08-01 10:22:05 +0200 (So, 01 Aug 2010) | 1 line
#8471: reset _SpoofOut.buf to an empty string when truncating; if Unicode had been output previously, it had been coerced to a Unicode string, potentially making subsequent prints behave differently or raise UnicodeErrors.
................
r83426 | georg.brandl | 2010-08-01 21:06:51 +0200 (So, 01 Aug 2010) | 27 lines
Merged revisions 83370,83372-83374,83384 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r83370 | georg.brandl | 2010-07-31 23:51:48 +0200 (Sa, 31 Jul 2010) | 5 lines
#8198: the Helper class should not save the stdin and stdout objects
at import time, rather by default use the current streams like the
other APIs that output help.
........
r83372 | georg.brandl | 2010-08-01 00:05:54 +0200 (So, 01 Aug 2010) | 1 line
#4007: remove *.a and *.so.X.Y files in "make clean".
........
r83373 | georg.brandl | 2010-08-01 00:11:11 +0200 (So, 01 Aug 2010) | 1 line
#5147: revert accidental indentation of header constant for MozillaCookieJar.
........
r83374 | georg.brandl | 2010-08-01 00:32:52 +0200 (So, 01 Aug 2010) | 1 line
#5146: handle UID THREAD command correctly.
........
r83384 | georg.brandl | 2010-08-01 08:32:55 +0200 (So, 01 Aug 2010) | 1 line
Build properties using lambdas. This makes test_pyclbr pass again, because it does not think that input and output are methods anymore.
........
................
Modified:
python/branches/release26-maint/ (props changed)
python/branches/release26-maint/Lib/_MozillaCookieJar.py
python/branches/release26-maint/Lib/doctest.py
python/branches/release26-maint/Lib/imaplib.py
python/branches/release26-maint/Lib/pydoc.py
python/branches/release26-maint/Lib/test/test_doctest.py
python/branches/release26-maint/Makefile.pre.in
python/branches/release26-maint/Misc/NEWS
Modified: python/branches/release26-maint/Lib/_MozillaCookieJar.py
==============================================================================
--- python/branches/release26-maint/Lib/_MozillaCookieJar.py (original)
+++ python/branches/release26-maint/Lib/_MozillaCookieJar.py Mon Aug 2 00:05:31 2010
@@ -38,9 +38,9 @@
"""
magic_re = "#( Netscape)? HTTP Cookie File"
header = """\
- # Netscape HTTP Cookie File
- # http://www.netscape.com/newsref/std/cookie_spec.html
- # This is a generated file! Do not edit.
+# Netscape HTTP Cookie File
+# http://www.netscape.com/newsref/std/cookie_spec.html
+# This is a generated file! Do not edit.
"""
Modified: python/branches/release26-maint/Lib/doctest.py
==============================================================================
--- python/branches/release26-maint/Lib/doctest.py (original)
+++ python/branches/release26-maint/Lib/doctest.py Mon Aug 2 00:05:31 2010
@@ -263,6 +263,9 @@
StringIO.truncate(self, size)
if hasattr(self, "softspace"):
del self.softspace
+ if not self.buf:
+ # Reset it to an empty string, to make sure it's not unicode.
+ self.buf = ''
# Worst-case linear-time ellipsis matching.
def _ellipsis_match(want, got):
Modified: python/branches/release26-maint/Lib/imaplib.py
==============================================================================
--- python/branches/release26-maint/Lib/imaplib.py (original)
+++ python/branches/release26-maint/Lib/imaplib.py Mon Aug 2 00:05:31 2010
@@ -751,7 +751,7 @@
', '.join(Commands[command])))
name = 'UID'
typ, dat = self._simple_command(name, command, *args)
- if command in ('SEARCH', 'SORT'):
+ if command in ('SEARCH', 'SORT', 'THREAD'):
name = command
else:
name = 'FETCH'
Modified: python/branches/release26-maint/Lib/pydoc.py
==============================================================================
--- python/branches/release26-maint/Lib/pydoc.py (original)
+++ python/branches/release26-maint/Lib/pydoc.py Mon Aug 2 00:05:31 2010
@@ -1705,9 +1705,12 @@
'CONTEXTMANAGERS': ('context-managers', 'with'),
}
- def __init__(self, input, output):
- self.input = input
- self.output = output
+ def __init__(self, input=None, output=None):
+ self._input = input
+ self._output = output
+
+ input = property(lambda self: self._input or sys.stdin)
+ output = property(lambda self: self._output or sys.stdout)
def __repr__(self):
if inspect.stack()[1][3] == '?':
@@ -1884,7 +1887,7 @@
for modules whose descriptions contain the word "spam".
''')
-help = Helper(sys.stdin, sys.stdout)
+help = Helper()
class Scanner:
"""A generic tree iterator."""
Modified: python/branches/release26-maint/Lib/test/test_doctest.py
==============================================================================
--- python/branches/release26-maint/Lib/test/test_doctest.py (original)
+++ python/branches/release26-maint/Lib/test/test_doctest.py Mon Aug 2 00:05:31 2010
@@ -1508,7 +1508,33 @@
>>> test = doctest.DocTestParser().get_doctest(s, {}, 's', 's.py', 0)
Traceback (most recent call last):
ValueError: line 0 of the doctest for s has an option directive on a line with no example: '# doctest: +ELLIPSIS'
-"""
+
+ """
+
+ def test_unicode_output(self): r"""
+
+Check that unicode output works:
+
+ >>> u'\xe9'
+ u'\xe9'
+
+If we return unicode, SpoofOut's buf variable becomes automagically
+converted to unicode. This means all subsequent output becomes converted
+to unicode, and if the output contains non-ascii characters that failed.
+It used to be that this state change carried on between tests, meaning
+tests would fail if unicode has been output previously in the testrun.
+This test tests that this is no longer so:
+
+ >>> print u'abc'
+ abc
+
+And then return a string with non-ascii characters:
+
+ >>> print u'\xe9'.encode('utf-8')
+ é
+
+ """
+
def test_testsource(): r"""
Unit tests for `testsource()`.
Modified: python/branches/release26-maint/Makefile.pre.in
==============================================================================
--- python/branches/release26-maint/Makefile.pre.in (original)
+++ python/branches/release26-maint/Makefile.pre.in Mon Aug 2 00:05:31 2010
@@ -1137,10 +1137,11 @@
find $(srcdir) -name '*.py[co]' -exec rm -f {} ';'
clean: pycremoval
- find . -name '*.o' -exec rm -f {} ';'
+ find . -name '*.[oa]' -exec rm -f {} ';'
find . -name '*.s[ol]' -exec rm -f {} ';'
find $(srcdir)/build -name 'fficonfig.h' -exec rm -f {} ';' || true
find $(srcdir)/build -name 'fficonfig.py' -exec rm -f {} ';' || true
+ find . -name '*.so.[0-9]*.[0-9]*' -exec rm -f {} ';'
-rm -f Lib/lib2to3/*Grammar*.pickle
profile-removal:
Modified: python/branches/release26-maint/Misc/NEWS
==============================================================================
--- python/branches/release26-maint/Misc/NEWS (original)
+++ python/branches/release26-maint/Misc/NEWS Mon Aug 2 00:05:31 2010
@@ -89,8 +89,19 @@
Library
-------
+- Issue #5146: Handle UID THREAD command correctly in imaplib.
+
+- Issue #5147: Fix the header generated for cookie files written by
+ http.cookiejar.MozillaCookieJar.
+
+- Issue #8198: In pydoc, output all help text to the correct stream
+ when sys.stdout is reassigned.
+
- Issue #1019882: Fix IndexError when loading certain hotshot stats.
+- Issue #8471: In doctest, properly reset the output stream to an empty
+ string when Unicode was previously output.
+
- Issue #8397: Raise an error when attempting to mix iteration and regular
reads on a BZ2File object, rather than returning incorrect results.
More information about the Python-checkins
mailing list