Skip to content

Commit f004d9d

Browse files
committed
Merged revisions 73206,73232,73299,73683,74020,74185,74544,74643,74647,74817,74838-74839,74865,74946,75402,75459,75604,75696 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r73206 | georg.brandl | 2009-06-04 11:15:12 +0200 (Do, 04 Jun 2009) | 1 line python#3584: ignore trailing newlines when placing the caret for a SyntaxError location. ........ r73232 | georg.brandl | 2009-06-04 20:59:58 +0200 (Do, 04 Jun 2009) | 1 line Add test for python#3684. ........ r73299 | georg.brandl | 2009-06-08 20:41:36 +0200 (Mo, 08 Jun 2009) | 1 line Typo fix. ........ r73683 | georg.brandl | 2009-06-29 16:44:49 +0200 (Mo, 29 Jun 2009) | 1 line Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint. ........ r74020 | georg.brandl | 2009-07-16 09:18:07 +0200 (Do, 16 Jul 2009) | 1 line python#5910: fix kqueue for calls with more than one event. ........ r74185 | georg.brandl | 2009-07-23 11:17:09 +0200 (Do, 23 Jul 2009) | 1 line Fix the "pylocals" gdb command. ........ r74544 | georg.brandl | 2009-08-24 19:12:30 +0200 (Mo, 24 Aug 2009) | 1 line python#6775: fix python.org URLs in README. ........ r74643 | georg.brandl | 2009-09-04 08:59:20 +0200 (Fr, 04 Sep 2009) | 2 lines Issue python#2666: Handle BROWSER environment variable properly for unknown browser names in the webbrowser module. ........ r74647 | georg.brandl | 2009-09-04 10:17:04 +0200 (Fr, 04 Sep 2009) | 2 lines Issue python#5275: In Cookie's Cookie.load(), properly handle non-string arguments as documented. ........ r74817 | georg.brandl | 2009-09-16 11:05:11 +0200 (Mi, 16 Sep 2009) | 1 line Make deprecation notices as visible as warnings are right now. ........ r74838 | georg.brandl | 2009-09-16 18:22:12 +0200 (Mi, 16 Sep 2009) | 1 line Remove some more boilerplate from the actual tests in test_pdb. ........ r74839 | georg.brandl | 2009-09-16 18:36:39 +0200 (Mi, 16 Sep 2009) | 1 line Make the pdb displayhook compatible with the standard displayhook: do not print Nones. Add a test for that. ........ r74865 | georg.brandl | 2009-09-17 09:49:37 +0200 (Do, 17 Sep 2009) | 1 line python#6912: add "with" block support to pindent. ........ r74946 | georg.brandl | 2009-09-19 10:43:16 +0200 (Sa, 19 Sep 2009) | 1 line Update bug tracker reference. ........ r75402 | georg.brandl | 2009-10-14 17:51:48 +0200 (Mi, 14 Okt 2009) | 1 line python#7125: fix typo. ........ r75459 | georg.brandl | 2009-10-17 10:57:43 +0200 (Sa, 17 Okt 2009) | 1 line Fix refleaks in _ctypes PyCSimpleType_New, which fixes the refleak seen in test___all__. ........ r75604 | georg.brandl | 2009-10-22 13:36:50 +0200 (Do, 22 Okt 2009) | 1 line Fix stylesheet for multi-paragraph impl-details. ........ r75696 | georg.brandl | 2009-10-25 21:25:43 +0100 (So, 25 Okt 2009) | 1 line Fix a demo. ........
1 parent a7fef6a commit f004d9d

18 files changed

Lines changed: 99 additions & 55 deletions

File tree

Demo/comparisons/sortingtest.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,20 @@
2424
# - Handles blank input lines correctly
2525

2626
import re
27-
import string
2827
import sys
2928

3029
def main():
3130
prog = re.compile('^(.*)=([-+]?[0-9]+)')
3231
def makekey(item, prog=prog):
3332
match = prog.match(item)
3433
if match:
35-
var, num = match.group(1, 2)
36-
return string.atoi(num), var
34+
var, num = match.groups()
35+
return int(num), var
3736
else:
3837
# Bad input -- pretend it's a var with value 0
3938
return 0, item
40-
while 1:
41-
line = sys.stdin.readline()
42-
if not line:
43-
break
44-
items = line.split()
45-
items = map(makekey, items)
46-
items.sort()
39+
for line in sys.stdin:
40+
items = sorted(makekey(item) for item in line.split())
4741
for num, var in items:
4842
print "%s=%s" % (var, num),
4943
print

Doc/tools/sphinxext/pyspecific.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@
2020
Body.enum.converters['lowerroman'] = \
2121
Body.enum.converters['upperroman'] = lambda x: None
2222

23+
# monkey-patch HTML translator to give versionmodified paragraphs a class
24+
from sphinx.writers.html import HTMLTranslator
25+
from sphinx.locale import versionlabels
26+
HTMLTranslator.visit_versionmodified = new_visit_versionmodified
27+
28+
def new_visit_versionmodified(self, node):
29+
self.body.append(self.starttag(node, 'p', CLASS=node['type']))
30+
text = versionlabels[node['type']] % node['version']
31+
if len(node):
32+
text += ': '
33+
else:
34+
text += '.'
35+
self.body.append('<span class="versionmodified">%s</span>' % text)
36+
2337

2438
# Support for marking up and linking to bugs.python.org issues
2539

Doc/tools/sphinxext/static/basic.css

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55

66
/* -- main layout ----------------------------------------------------------- */
77

8-
div.documentwrapper {
9-
float: left;
10-
width: 100%;
11-
}
12-
13-
div.bodywrapper {
14-
margin: 0 0 0 230px;
15-
}
16-
178
div.clearer {
189
clear: both;
1910
}
@@ -338,6 +329,12 @@ dl.glossary dt {
338329
font-style: italic;
339330
}
340331

332+
p.deprecated {
333+
background-color: #ffe4e4;
334+
border: 1px solid #f66;
335+
padding: 7px
336+
}
337+
341338
.system-message {
342339
background-color: #fda;
343340
padding: 5px;
@@ -355,8 +352,12 @@ dl.glossary dt {
355352
border: 1px solid #ccc;
356353
}
357354

358-
.impl-detail p {
359-
margin: 0;
355+
.impl-detail .compound-first {
356+
margin-top: 0;
357+
}
358+
359+
.impl-detail .compound-last {
360+
margin-bottom: 0;
360361
}
361362

362363
/* -- code displays --------------------------------------------------------- */
@@ -405,7 +406,7 @@ img.math {
405406
vertical-align: middle;
406407
}
407408

408-
div.math p {
409+
div.body div.math p {
409410
text-align: center;
410411
}
411412

Lib/Cookie.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,9 @@ def load(self, rawdata):
624624
if type(rawdata) == type(""):
625625
self.__ParseString(rawdata)
626626
else:
627-
self.update(rawdata)
627+
# self.update() wouldn't call our custom __setitem__
628+
for k, v in rawdata.items():
629+
self[k] = v
628630
return
629631
# end load()
630632

Lib/multiprocessing/queues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def get(self, block=True, timeout=None):
109109
self._rlock.release()
110110

111111
def qsize(self):
112-
# Raises NotImplementError on Mac OSX because of broken sem_getvalue()
112+
# Raises NotImplementedError on Mac OSX because of broken sem_getvalue()
113113
return self._maxsize - self._sem._semlock._get_value()
114114

115115
def empty(self):

Lib/pdb.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ def displayhook(self, obj):
198198
"""Custom displayhook for the exec in default(), which prevents
199199
assignment of the _ variable in the builtins.
200200
"""
201-
print repr(obj)
201+
# reproduce the behavior of the standard displayhook, not printing None
202+
if obj is not None:
203+
print repr(obj)
202204

203205
def default(self, line):
204206
if line[:1] == '!': line = line[1:]

Lib/platform.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"""
1111
# This module is maintained by Marc-Andre Lemburg <mal@egenix.com>.
1212
# If you find problems, please submit bug reports/patches via the
13-
# Python SourceForge Project Page and assign them to "lemburg".
13+
# Python bug tracker (http://bugs.python.org) and assign them to "lemburg".
1414
#
1515
# Note: Please keep this module compatible to Python 1.5.2.
1616
#

Lib/test/test_kqueue.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,22 @@ def test_queue_event(self):
162162
server.close()
163163
serverSocket.close()
164164

165+
def testPair(self):
166+
kq = select.kqueue()
167+
a, b = socket.socketpair()
168+
169+
a.send(b'foo')
170+
event1 = select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)
171+
event2 = select.kevent(b, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)
172+
r = kq.control([event1, event2], 1, 1)
173+
self.assertTrue(r)
174+
self.assertFalse(r[0].flags & select.KQ_EV_ERROR)
175+
self.assertEquals(b.recv(r[0].data), b'foo')
176+
177+
a.close()
178+
b.close()
179+
kq.close()
180+
165181
def test_main():
166182
test_support.run_unittest(TestKQueue)
167183

Lib/test/test_traceback.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def get_exception_format(self, func, exc):
3434
def syntax_error_with_caret(self):
3535
compile("def fact(x):\n\treturn x!\n", "?", "exec")
3636

37+
def syntax_error_with_caret_2(self):
38+
compile("1 +\n", "?", "exec")
39+
3740
def syntax_error_without_caret(self):
3841
# XXX why doesn't compile raise the same traceback?
3942
import test.badsyntax_nocaret
@@ -49,6 +52,12 @@ def test_caret(self):
4952
self.assert_("^" in err[2]) # third line has caret
5053
self.assert_(err[1].find("!") == err[2].find("^")) # in the right place
5154

55+
err = self.get_exception_format(self.syntax_error_with_caret_2,
56+
SyntaxError)
57+
self.assert_("^" in err[2]) # third line has caret
58+
self.assert_(err[2].count('\n') == 1) # and no additional newline
59+
self.assert_(err[1].find("+") == err[2].find("^")) # in the right place
60+
5261
def test_nocaret(self):
5362
if is_jython:
5463
# jython adds a caret in this case (why shouldn't it?)

Lib/threading.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def acquire(self, blocking=1):
133133

134134
def release(self):
135135
if self.__owner is not current_thread():
136-
raise RuntimeError("cannot release un-aquired lock")
136+
raise RuntimeError("cannot release un-acquired lock")
137137
self.__count = count = self.__count - 1
138138
if not count:
139139
self.__owner = None
@@ -227,7 +227,7 @@ def _is_owned(self):
227227

228228
def wait(self, timeout=None):
229229
if not self._is_owned():
230-
raise RuntimeError("cannot wait on un-aquired lock")
230+
raise RuntimeError("cannot wait on un-acquired lock")
231231
waiter = _allocate_lock()
232232
waiter.acquire()
233233
self.__waiters.append(waiter)
@@ -269,7 +269,7 @@ def wait(self, timeout=None):
269269

270270
def notify(self, n=1):
271271
if not self._is_owned():
272-
raise RuntimeError("cannot notify on un-aquired lock")
272+
raise RuntimeError("cannot notify on un-acquired lock")
273273
__waiters = self.__waiters
274274
waiters = __waiters[:n]
275275
if not waiters:

0 commit comments

Comments
 (0)