Skip to content

Commit c0e22b7

Browse files
committed
Merged revisions 78101,78115,78117,78182,78188,78245,78386,78496 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78101 | georg.brandl | 2010-02-08 01:04:54 +0100 (Mo, 08 Feb 2010) | 1 line Fix test_fnmatch. ........ r78115 | georg.brandl | 2010-02-08 23:40:51 +0100 (Mo, 08 Feb 2010) | 1 line Fix missing string formatting placeholder. ........ r78117 | georg.brandl | 2010-02-08 23:48:37 +0100 (Mo, 08 Feb 2010) | 1 line Convert test failure from output-producing to self.fail(). ........ r78182 | georg.brandl | 2010-02-14 09:18:23 +0100 (So, 14 Feb 2010) | 1 line #7926: fix stray parens. ........ r78188 | georg.brandl | 2010-02-14 14:38:12 +0100 (So, 14 Feb 2010) | 1 line #7926: fix-up wording. ........ r78245 | georg.brandl | 2010-02-19 20:36:08 +0100 (Fr, 19 Feb 2010) | 1 line #7967: PyXML is no more. ........ r78386 | georg.brandl | 2010-02-23 22:48:57 +0100 (Di, 23 Feb 2010) | 1 line #6544: fix refleak in kqueue, occurring in certain error conditions. ........ r78496 | georg.brandl | 2010-02-27 15:58:08 +0100 (Sa, 27 Feb 2010) | 1 line Link to http://www.python.org/dev/workflow/ from bugs page. ........
1 parent 1b37e87 commit c0e22b7

6 files changed

Lines changed: 41 additions & 38 deletions

File tree

Doc/bugs.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ In the case of documentation bugs, look at the most recent development docs at
2323
http://docs.python.org/dev to see if the bug has been fixed.
2424

2525
If the problem you're reporting is not already in the bug tracker, go back to
26-
the Python Bug Tracker. If you don't already have a tracker account, select the
27-
"Register" link in the sidebar and undergo the registration procedure.
28-
Otherwise, if you're not logged in, enter your credentials and select "Login".
29-
It is not possible to submit a bug report anonymously.
26+
the Python Bug Tracker and log in. If you don't already have a tracker account,
27+
select the "Register" link or, if you use OpenID, one of the OpenID provider
28+
logos in the sidebar. It is not possible to submit a bug report anonymously.
3029

3130
Being now logged in, you can submit a bug. Select the "Create New" link in the
3231
sidebar to open the bug reporting form.
@@ -43,7 +42,8 @@ were using (including version information as appropriate).
4342

4443
Each bug report will be assigned to a developer who will determine what needs to
4544
be done to correct the problem. You will receive an update each time action is
46-
taken on the bug.
45+
taken on the bug. See http://www.python.org/dev/workflow/ for a detailed
46+
description of the issue workflow.
4747

4848

4949
.. seealso::

Doc/whatsnew/2.6.rst

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,9 +350,10 @@ A high-level explanation of the context management protocol is:
350350

351351
* The code in *BLOCK* is executed.
352352

353-
* If *BLOCK* raises an exception, the :meth:`__exit__(type, value, traceback)`
354-
is called with the exception details, the same values returned by
355-
:func:`sys.exc_info`. The method's return value controls whether the exception
353+
* If *BLOCK* raises an exception, the context manager's :meth:`__exit__` method
354+
is called with three arguments, the exception details (``type, value, traceback``,
355+
the same values returned by :func:`sys.exc_info`, which can also be ``None``
356+
if no exception occurred). The method's return value controls whether an exception
356357
is re-raised: any false value re-raises the exception, and ``True`` will result
357358
in suppressing it. You'll only rarely want to suppress the exception, because
358359
if you do the author of the code containing the ':keyword:`with`' statement will
@@ -463,7 +464,7 @@ could be written as::
463464
with db_transaction(db) as cursor:
464465
...
465466

466-
The :mod:`contextlib` module also has a :func:`nested(mgr1, mgr2, ...)` function
467+
The :mod:`contextlib` module also has a ``nested(mgr1, mgr2, ...)`` function
467468
that combines a number of context managers so you don't need to write nested
468469
':keyword:`with`' statements. In this example, the single ':keyword:`with`'
469470
statement both starts a database transaction and acquires a thread lock::
@@ -472,8 +473,9 @@ statement both starts a database transaction and acquires a thread lock::
472473
with nested (db_transaction(db), lock) as (cursor, locked):
473474
...
474475

475-
Finally, the :func:`closing(object)` function returns *object* so that it can be
476-
bound to a variable, and calls ``object.close`` at the end of the block. ::
476+
Finally, the :func:`closing` function returns its argument so that it can be
477+
bound to a variable, and calls the argument's ``.close()`` method at the end
478+
of the block. ::
477479

478480
import urllib, sys
479481
from contextlib import closing

Lib/test/test_fnmatch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88

99
class FnmatchTestCase(unittest.TestCase):
10-
def check_match(self, filename, pattern, should_match=1):
10+
def check_match(self, filename, pattern, should_match=1, fn=fnmatch):
1111
if should_match:
12-
self.assertTrue(fnmatch(filename, pattern),
12+
self.assertTrue(fn(filename, pattern),
1313
"expected %r to match pattern %r"
1414
% (filename, pattern))
1515
else:
16-
self.assertTrue(not fnmatch(filename, pattern),
16+
self.assertTrue(not fn(filename, pattern),
1717
"expected %r not to match pattern %r"
1818
% (filename, pattern))
1919

@@ -52,8 +52,8 @@ def test_mix_bytes_str(self):
5252

5353
def test_fnmatchcase(self):
5454
check = self.check_match
55-
check('AbC', 'abc', 0)
56-
check('abc', 'AbC', 0)
55+
check('AbC', 'abc', 0, fnmatchcase)
56+
check('abc', 'AbC', 0, fnmatchcase)
5757

5858
def test_bytes(self):
5959
self.check_match(b'test', b'te*')

Lib/test/test_strftime.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,15 @@ def strftest1(self, now):
116116
try:
117117
result = time.strftime(e[0], now)
118118
except ValueError as error:
119-
print("Standard '%s' format gaver error:" % (e[0], error))
120-
continue
119+
self.fail("strftime '%s' format gave error: %s" % (e[0], error))
121120
if re.match(escapestr(e[1], self.ampm), result):
122121
continue
123122
if not result or result[0] == '%':
124-
print("Does not support standard '%s' format (%s)" % \
125-
(e[0], e[2]))
123+
self.fail("strftime does not support standard '%s' format (%s)"
124+
% (e[0], e[2]))
126125
else:
127-
print("Conflict for %s (%s):" % (e[0], e[2]))
128-
print(" Expected %s, but got %s" % (e[1], result))
126+
self.fail("Conflict for %s (%s): expected %s, but got %s"
127+
% (e[0], e[2], e[1], result))
129128

130129
def strftest2(self, now):
131130
nowsecs = str(int(now))[:-1]

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,9 @@ Library
781781
Extension Modules
782782
-----------------
783783

784+
- Issue #6544: fix a reference leak in the kqueue implementation's error
785+
handling.
786+
784787
- Stop providing crtassem.h symbols when compiling with Visual Studio 2010, as
785788
msvcr100.dll is not a platform assembly anymore.
786789

Modules/selectmodule.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,7 @@ static struct PyMemberDef kqueue_event_members[] = {
12411241
#undef KQ_OFF
12421242

12431243
static PyObject *
1244+
12441245
kqueue_event_repr(kqueue_event_Object *s)
12451246
{
12461247
char buf[1024];
@@ -1526,19 +1527,6 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
15261527
return NULL;
15271528
}
15281529

1529-
if (ch != NULL && ch != Py_None) {
1530-
it = PyObject_GetIter(ch);
1531-
if (it == NULL) {
1532-
PyErr_SetString(PyExc_TypeError,
1533-
"changelist is not iterable");
1534-
return NULL;
1535-
}
1536-
nchanges = PyObject_Size(ch);
1537-
if (nchanges < 0) {
1538-
return NULL;
1539-
}
1540-
}
1541-
15421530
if (otimeout == Py_None || otimeout == NULL) {
15431531
ptimeoutspec = NULL;
15441532
}
@@ -1574,11 +1562,22 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
15741562
return NULL;
15751563
}
15761564

1577-
if (nchanges) {
1565+
if (ch != NULL && ch != Py_None) {
1566+
it = PyObject_GetIter(ch);
1567+
if (it == NULL) {
1568+
PyErr_SetString(PyExc_TypeError,
1569+
"changelist is not iterable");
1570+
return NULL;
1571+
}
1572+
nchanges = PyObject_Size(ch);
1573+
if (nchanges < 0) {
1574+
goto error;
1575+
}
1576+
15781577
chl = PyMem_New(struct kevent, nchanges);
15791578
if (chl == NULL) {
15801579
PyErr_NoMemory();
1581-
return NULL;
1580+
goto error;
15821581
}
15831582
i = 0;
15841583
while ((ei = PyIter_Next(it)) != NULL) {
@@ -1601,7 +1600,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
16011600
evl = PyMem_New(struct kevent, nevents);
16021601
if (evl == NULL) {
16031602
PyErr_NoMemory();
1604-
return NULL;
1603+
goto error;
16051604
}
16061605
}
16071606

0 commit comments

Comments
 (0)