Skip to content

Commit 19841b0

Browse files
author
georg.brandl
committed
Merged revisions 74126,74130-74131,74149,74155,74157,74180-74183,74398 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k ................ r74126 | alexandre.vassalotti | 2009-07-21 02:39:03 +0200 (Di, 21 Jul 2009) | 14 lines Merged revisions 73871 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r73871 | alexandre.vassalotti | 2009-07-06 22:17:30 -0400 (Mon, 06 Jul 2009) | 7 lines Grow the allocated buffer in PyUnicode_EncodeUTF7 to avoid buffer overrun. Without this change, test_unicode.UnicodeTest.test_codecs_utf7 crashes in debug mode. What happens is the unicode string u'\U000abcde' with a length of 1 encodes to the string '+2m/c3g-' of length 8. Since only 5 bytes is reserved in the buffer, a buffer overrun occurs. ........ ................ r74130 | alexandre.vassalotti | 2009-07-21 02:57:50 +0200 (Di, 21 Jul 2009) | 2 lines Add ignore rule for the Doc/tools/jinga2/ directory. ................ r74131 | alexandre.vassalotti | 2009-07-21 04:51:58 +0200 (Di, 21 Jul 2009) | 13 lines Merged revisions 73683,73786 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r73683 | georg.brandl | 2009-06-29 10:44:49 -0400 (Mon, 29 Jun 2009) | 1 line Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint. ........ r73786 | benjamin.peterson | 2009-07-02 18:56:16 -0400 (Thu, 02 Jul 2009) | 1 line condense with assertRaises ........ ................ r74149 | ezio.melotti | 2009-07-21 22:37:52 +0200 (Di, 21 Jul 2009) | 9 lines Merged revisions 74148 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r74148 | ezio.melotti | 2009-07-21 23:18:27 +0300 (Tue, 21 Jul 2009) | 1 line #6536 fixed typo ........ ................ r74155 | alexandre.vassalotti | 2009-07-22 04:24:49 +0200 (Mi, 22 Jul 2009) | 2 lines Issue #6242: Fix deallocator of io.StringIO and io.BytesIO. ................ r74157 | alexandre.vassalotti | 2009-07-22 05:07:33 +0200 (Mi, 22 Jul 2009) | 2 lines Issue #6241: Better type checking for the arguments of io.StringIO. ................ r74180 | ezio.melotti | 2009-07-22 23:17:14 +0200 (Mi, 22 Jul 2009) | 9 lines Merged revisions 74179 via svnmerge from svn+ssh://[email protected]/python/trunk ........ r74179 | ezio.melotti | 2009-07-23 00:08:49 +0300 (Thu, 23 Jul 2009) | 1 line #6423 has_key -> in ........ ................ r74181 | alexandre.vassalotti | 2009-07-22 23:27:53 +0200 (Mi, 22 Jul 2009) | 6 lines Clean up test_curses. By using __stdout__ directly, test_curses caused regrtest.py to duplicate the output of some test results. ................ r74182 | alexandre.vassalotti | 2009-07-22 23:29:01 +0200 (Mi, 22 Jul 2009) | 2 lines Use assertGreater instead of assertTrue(x > y). ................ r74183 | alexandre.vassalotti | 2009-07-23 01:27:17 +0200 (Do, 23 Jul 2009) | 4 lines Specialize assertTrue checks when possible. We should get slightly more helpful failure messages with this change. ................ r74398 | georg.brandl | 2009-08-13 11:16:39 +0200 (Do, 13 Aug 2009) | 1 line #6694: fix old function names. ................ git-svn-id: http://svn.python.org/projects/python/branches/release31-maint@74400 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 5940944 commit 19841b0

15 files changed

Lines changed: 149 additions & 112 deletions

File tree

.bzrignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ TAGS
3737
.gdb_history
3838
Doc/tools/sphinx
3939
Doc/tools/jinja
40+
Doc/tools/jinja2
4041
Doc/tools/pygments
4142
Doc/tools/docutils
4243
Misc/python.pc

.hgignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Lib/plat-mac/errors.rsrc.df.rsrc
3939
Doc/tools/sphinx/
4040
Doc/tools/docutils/
4141
Doc/tools/jinja/
42+
Doc/tools/jinja2/
4243
Doc/tools/pygments/
4344
Misc/python.pc
4445
Modules/Setup

Doc/howto/urllib2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ than the URL you pass to .add_password() will also match. ::
492492

493493
.. note::
494494

495-
In the above example we only supplied our ``HHTPBasicAuthHandler`` to
495+
In the above example we only supplied our ``HTTPBasicAuthHandler`` to
496496
``build_opener``. By default openers have the handlers for normal situations
497497
-- ``ProxyHandler``, ``UnknownHandler``, ``HTTPHandler``,
498498
``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``,

Doc/library/cgi.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,20 +88,21 @@ input or the environment (depending on the value of various environment
8888
variables set according to the CGI standard). Since it may consume standard
8989
input, it should be instantiated only once.
9090

91-
The :class:`FieldStorage` instance can be indexed like a Python dictionary, and
92-
also supports the standard dictionary methods :meth:`__contains__` and
93-
:meth:`keys`. The built-in :func:`len` is also supported. Form fields
94-
containing empty strings are ignored and do not appear in the dictionary; to
95-
keep such values, provide a true value for the optional *keep_blank_values*
96-
keyword parameter when creating the :class:`FieldStorage` instance.
91+
The :class:`FieldStorage` instance can be indexed like a Python dictionary.
92+
It allows membership testing with the :keyword:`in` operator, and also supports
93+
the standard dictionary method :meth:`keys` and the built-in function
94+
:func:`len`. Form fields containing empty strings are ignored and do not appear
95+
in the dictionary; to keep such values, provide a true value for the optional
96+
*keep_blank_values* keyword parameter when creating the :class:`FieldStorage`
97+
instance.
9798

9899
For instance, the following code (which assumes that the
99100
:mailheader:`Content-Type` header and blank line have already been printed)
100101
checks that the fields ``name`` and ``addr`` are both set to a non-empty
101102
string::
102103

103104
form = cgi.FieldStorage()
104-
if not ("name" in form and "addr" in form):
105+
if "name" not in form or "addr" not in form:
105106
print("<H1>Error</H1>")
106107
print("Please fill in the name and addr fields.")
107108
return

Doc/library/itertools.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ Iterator Arguments Results
4949
:func:`chain` p, q, ... p0, p1, ... plast, q0, q1, ... ``chain('ABC', 'DEF') --> A B C D E F``
5050
:func:`compress` data, selectors (d[0] if s[0]), (d[1] if s[1]), ... ``compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F``
5151
:func:`dropwhile` pred, seq seq[n], seq[n+1], starting when pred fails ``dropwhile(lambda x: x<5, [1,4,6,4,1]) --> 6 4 1``
52-
:func:`filterfalse` pred, seq elements of seq where pred(elem) is False ``ifilterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
52+
:func:`filterfalse` pred, seq elements of seq where pred(elem) is False ``filterfalse(lambda x: x%2, range(10)) --> 0 2 4 6 8``
5353
:func:`groupby` iterable[, keyfunc] sub-iterators grouped by value of keyfunc(v)
5454
:func:`islice` seq, [start,] stop [, step] elements from seq[start:stop:step] ``islice('ABCDEFG', 2, None) --> C D E F G``
5555
:func:`starmap` func, seq func(\*seq[0]), func(\*seq[1]), ... ``starmap(pow, [(2,5), (3,2), (10,3)]) --> 32 9 1000``
5656
:func:`takewhile` pred, seq seq[0], seq[1], until pred fails ``takewhile(lambda x: x<5, [1,4,6,4,1]) --> 1 4``
5757
:func:`tee` it, n it1, it2 , ... itn splits one iterator into n
58-
:func:`zip_longest` p, q, ... (p[0], q[0]), (p[1], q[1]), ... ``izip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``
58+
:func:`zip_longest` p, q, ... (p[0], q[0]), (p[1], q[1]), ... ``zip_longest('ABCD', 'xy', fillvalue='-') --> Ax By C- D-``
5959
==================== ============================ ================================================= =============================================================
6060

6161
**Combinatoric generators:**

Lib/_pyio.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1924,8 +1924,10 @@ def __init__(self, initial_value="", newline="\n"):
19241924
# C version, even under Windows.
19251925
if newline is None:
19261926
self._writetranslate = False
1927-
if initial_value:
1927+
if initial_value is not None:
19281928
if not isinstance(initial_value, str):
1929+
raise TypeError("initial_value must be str or None, not {0}"
1930+
.format(type(initial_value).__name__))
19291931
initial_value = str(initial_value)
19301932
self.write(initial_value)
19311933
self.seek(0)

Lib/test/test_asynchat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def test_close_when_done(self):
214214
# the server might have been able to send a byte or two back, but this
215215
# at least checks that it received something and didn't just fail
216216
# (which could still result in the client not having received anything)
217-
self.assertTrue(len(s.buffer) > 0)
217+
self.assertGreater(len(s.buffer), 0)
218218

219219

220220
class TestAsynchat_WithPoll(TestAsynchat):

Lib/test/test_curses.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,16 +269,17 @@ def main(stdscr):
269269
finally:
270270
curses.resetty()
271271

272-
if __name__ == '__main__':
273-
curses.wrapper(main)
274-
unit_tests()
275-
else:
272+
def test_main():
276273
# testing setupterm() inside initscr/endwin
277274
# causes terminal breakage
278-
curses.setupterm(fd=sys.__stdout__.fileno())
275+
curses.setupterm(fd=sys.stdout.fileno())
279276
try:
280277
stdscr = curses.initscr()
281278
main(stdscr)
282279
finally:
283280
curses.endwin()
284281
unit_tests()
282+
283+
if __name__ == '__main__':
284+
curses.wrapper(main)
285+
unit_tests()

0 commit comments

Comments
 (0)