mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Merged revisions 74055 via svnmerge from
svn+ssh://svn.python.org/python/branches/py3k (Selected changes only.) ................ r74055 | alexandre.vassalotti | 2009-07-17 11:18:18 +0200 (Fr, 17 Jul 2009) | 55 lines Merged revisions 73995,74002,74005,74007-74008,74011,74019-74023 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r74008 | benjamin.peterson | 2009-07-14 20:46:42 -0400 (Tue, 14 Jul 2009) | 1 line update year ........ r74011 | ezio.melotti | 2009-07-15 13:07:04 -0400 (Wed, 15 Jul 2009) | 1 line methods' names pep8ification ........ r74019 | amaury.forgeotdarc | 2009-07-15 17:29:27 -0400 (Wed, 15 Jul 2009) | 2 lines #6076 Add a title to the IDLE Preferences window. ........ r74020 | georg.brandl | 2009-07-16 03:18:07 -0400 (Thu, 16 Jul 2009) | 1 line #5910: fix kqueue for calls with more than one event. ........ r74021 | georg.brandl | 2009-07-16 03:33:04 -0400 (Thu, 16 Jul 2009) | 1 line #6486: start with built in functions rather than "built in objects". ........ r74022 | georg.brandl | 2009-07-16 03:38:35 -0400 (Thu, 16 Jul 2009) | 1 line #6481: fix typo in os.system() replacement. ........ r74023 | jesse.noller | 2009-07-16 10:23:04 -0400 (Thu, 16 Jul 2009) | 1 line Issue 6433: multiprocessing.pool.map hangs on empty list ........ ................
This commit is contained in:
parent
a85ee5cfb6
commit
d80344f8d3
10 changed files with 37 additions and 7 deletions
|
@ -4,7 +4,7 @@ Copyright
|
||||||
|
|
||||||
Python and this documentation is:
|
Python and this documentation is:
|
||||||
|
|
||||||
Copyright © 2001-2008 Python Software Foundation. All rights reserved.
|
Copyright © 2001-2009 Python Software Foundation. All rights reserved.
|
||||||
|
|
||||||
Copyright © 2000 BeOpen.com. All rights reserved.
|
Copyright © 2000 BeOpen.com. All rights reserved.
|
||||||
|
|
||||||
|
|
|
@ -43,8 +43,9 @@ browse the table of contents (in front of the manual), or look for a specific
|
||||||
function, module or term in the index (in the back). And finally, if you enjoy
|
function, module or term in the index (in the back). And finally, if you enjoy
|
||||||
learning about random subjects, you choose a random page number (see module
|
learning about random subjects, you choose a random page number (see module
|
||||||
:mod:`random`) and read a section or two. Regardless of the order in which you
|
:mod:`random`) and read a section or two. Regardless of the order in which you
|
||||||
read the sections of this manual, it helps to start with chapter :ref:`builtin`,
|
read the sections of this manual, it helps to start with chapter
|
||||||
as the remainder of the manual assumes familiarity with this material.
|
:ref:`built-in-funcs`, as the remainder of the manual assumes familiarity with
|
||||||
|
this material.
|
||||||
|
|
||||||
Let the show begin!
|
Let the show begin!
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ Replacing :func:`os.system`
|
||||||
sts = os.system("mycmd" + " myarg")
|
sts = os.system("mycmd" + " myarg")
|
||||||
==>
|
==>
|
||||||
p = Popen("mycmd" + " myarg", shell=True)
|
p = Popen("mycmd" + " myarg", shell=True)
|
||||||
sts = os.waitpid(p.pid, 0)
|
sts = os.waitpid(p.pid, 0)[1]
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ class ConfigDialog(Toplevel):
|
||||||
self.wm_withdraw()
|
self.wm_withdraw()
|
||||||
|
|
||||||
self.configure(borderwidth=5)
|
self.configure(borderwidth=5)
|
||||||
|
self.title('IDLE Preferences')
|
||||||
self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
|
self.geometry("+%d+%d" % (parent.winfo_rootx()+20,
|
||||||
parent.winfo_rooty()+30))
|
parent.winfo_rooty()+30))
|
||||||
#Theme Elements. Each theme element key is its display name.
|
#Theme Elements. Each theme element key is its display name.
|
||||||
|
|
|
@ -208,6 +208,8 @@ class Pool(object):
|
||||||
chunksize, extra = divmod(len(iterable), len(self._pool) * 4)
|
chunksize, extra = divmod(len(iterable), len(self._pool) * 4)
|
||||||
if extra:
|
if extra:
|
||||||
chunksize += 1
|
chunksize += 1
|
||||||
|
if len(iterable) == 0:
|
||||||
|
chunksize = 0
|
||||||
|
|
||||||
task_batches = Pool._get_tasks(func, iterable, chunksize)
|
task_batches = Pool._get_tasks(func, iterable, chunksize)
|
||||||
result = MapResult(self._cache, chunksize, len(iterable), callback)
|
result = MapResult(self._cache, chunksize, len(iterable), callback)
|
||||||
|
|
|
@ -163,6 +163,22 @@ class TestKQueue(unittest.TestCase):
|
||||||
server.close()
|
server.close()
|
||||||
serverSocket.close()
|
serverSocket.close()
|
||||||
|
|
||||||
|
def testPair(self):
|
||||||
|
kq = select.kqueue()
|
||||||
|
a, b = socket.socketpair()
|
||||||
|
|
||||||
|
a.send(b'foo')
|
||||||
|
event1 = select.kevent(a, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)
|
||||||
|
event2 = select.kevent(b, select.KQ_FILTER_READ, select.KQ_EV_ADD | select.KQ_EV_ENABLE)
|
||||||
|
r = kq.control([event1, event2], 1, 1)
|
||||||
|
self.assertTrue(r)
|
||||||
|
self.assertFalse(r[0].flags & select.KQ_EV_ERROR)
|
||||||
|
self.assertEquals(b.recv(r[0].data), b'foo')
|
||||||
|
|
||||||
|
a.close()
|
||||||
|
b.close()
|
||||||
|
kq.close()
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
support.run_unittest(TestKQueue)
|
support.run_unittest(TestKQueue)
|
||||||
|
|
||||||
|
|
|
@ -991,6 +991,12 @@ class _TestPool(BaseTestCase):
|
||||||
self.assertEqual(pmap(sqr, list(range(100)), chunksize=20),
|
self.assertEqual(pmap(sqr, list(range(100)), chunksize=20),
|
||||||
list(map(sqr, list(range(100)))))
|
list(map(sqr, list(range(100)))))
|
||||||
|
|
||||||
|
def test_map_chunksize(self):
|
||||||
|
try:
|
||||||
|
self.pool.map_async(sqr, [], chunksize=1).get(timeout=TIMEOUT1)
|
||||||
|
except multiprocessing.TimeoutError:
|
||||||
|
self.fail("pool.map_async with chunksize stalled on null list")
|
||||||
|
|
||||||
def test_async(self):
|
def test_async(self):
|
||||||
res = self.pool.apply_async(sqr, (7, TIMEOUT1,))
|
res = self.pool.apply_async(sqr, (7, TIMEOUT1,))
|
||||||
get = TimingWrapper(res.get)
|
get = TimingWrapper(res.get)
|
||||||
|
|
|
@ -199,6 +199,7 @@ Walter D
|
||||||
Hans Eckardt
|
Hans Eckardt
|
||||||
Grant Edwards
|
Grant Edwards
|
||||||
John Ehresman
|
John Ehresman
|
||||||
|
Eric Eisner
|
||||||
Andrew Eland
|
Andrew Eland
|
||||||
Lance Ellinghaus
|
Lance Ellinghaus
|
||||||
David Ely
|
David Ely
|
||||||
|
|
|
@ -950,6 +950,8 @@ Library
|
||||||
- Issue #6459: distutils.command.build_ext.get_export_symbols now uses the
|
- Issue #6459: distutils.command.build_ext.get_export_symbols now uses the
|
||||||
"PyInit" prefix, rather than "init".
|
"PyInit" prefix, rather than "init".
|
||||||
|
|
||||||
|
- Issue #6433: fixed issues with multiprocessing.pool.map hanging on empty list
|
||||||
|
|
||||||
- Issue #6455: Fixed test_build_ext under win32.
|
- Issue #6455: Fixed test_build_ext under win32.
|
||||||
|
|
||||||
- Issue #6413: Fixed the log level in distutils.dist for announce.
|
- Issue #6413: Fixed the log level in distutils.dist for announce.
|
||||||
|
|
|
@ -1492,7 +1492,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
|
||||||
if (nevents < 0) {
|
if (nevents < 0) {
|
||||||
PyErr_Format(PyExc_ValueError,
|
PyErr_Format(PyExc_ValueError,
|
||||||
"Length of eventlist must be 0 or positive, got %d",
|
"Length of eventlist must be 0 or positive, got %d",
|
||||||
nchanges);
|
nevents);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,6 +1550,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
|
||||||
PyErr_NoMemory();
|
PyErr_NoMemory();
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
i = 0;
|
||||||
while ((ei = PyIter_Next(it)) != NULL) {
|
while ((ei = PyIter_Next(it)) != NULL) {
|
||||||
if (!kqueue_event_Check(ei)) {
|
if (!kqueue_event_Check(ei)) {
|
||||||
Py_DECREF(ei);
|
Py_DECREF(ei);
|
||||||
|
@ -1558,7 +1559,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args)
|
||||||
"select.kevent objects");
|
"select.kevent objects");
|
||||||
goto error;
|
goto error;
|
||||||
} else {
|
} else {
|
||||||
chl[i] = ((kqueue_event_Object *)ei)->e;
|
chl[i++] = ((kqueue_event_Object *)ei)->e;
|
||||||
}
|
}
|
||||||
Py_DECREF(ei);
|
Py_DECREF(ei);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue