From 5c7f8fb7fd020c9a30a8e6de7a480fbd27bec63a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 5 Dec 2008 09:00:55 +0000 Subject: [PATCH] Merged revisions 67398,67423-67424,67432,67440-67441,67444-67445,67454,67457,67463 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r67398 | benjamin.peterson | 2008-11-26 18:39:17 +0100 (Wed, 26 Nov 2008) | 1 line fix typo in sqlite3 docs ........ r67423 | jesse.noller | 2008-11-28 19:59:35 +0100 (Fri, 28 Nov 2008) | 2 lines issue4238: bsd support for cpu_count ........ r67424 | christian.heimes | 2008-11-28 20:33:33 +0100 (Fri, 28 Nov 2008) | 1 line Retain copyright of processing examples. This was requested by a Debian maintainer during packaging of the multiprocessing package for 2.4/2.5 ........ r67432 | benjamin.peterson | 2008-11-29 00:18:46 +0100 (Sat, 29 Nov 2008) | 1 line SVN format 9 is the same it seems ........ r67440 | jeremy.hylton | 2008-11-29 00:42:59 +0100 (Sat, 29 Nov 2008) | 4 lines Move definition int sval into branch of ifdef where it is used. Otherwise, you get a warning about an undefined variable. ........ r67441 | jeremy.hylton | 2008-11-29 01:09:16 +0100 (Sat, 29 Nov 2008) | 2 lines Reflow long lines. ........ r67444 | amaury.forgeotdarc | 2008-11-29 03:03:32 +0100 (Sat, 29 Nov 2008) | 2 lines Fix a small typo in docstring ........ r67445 | benjamin.peterson | 2008-11-30 04:07:33 +0100 (Sun, 30 Nov 2008) | 1 line StringIO.close() stops you from using the buffer, too ........ r67454 | benjamin.peterson | 2008-11-30 15:43:23 +0100 (Sun, 30 Nov 2008) | 1 line note the version that works ........ r67457 | christian.heimes | 2008-11-30 22:16:28 +0100 (Sun, 30 Nov 2008) | 1 line w# requires Py_ssize_t ........ r67463 | skip.montanaro | 2008-12-01 02:55:22 +0100 (Mon, 01 Dec 2008) | 1 line typo in comment ........ --- Doc/includes/mp_benchmarks.py | 3 +++ Doc/includes/mp_distributing.py | 3 +++ Doc/includes/mp_newtype.py | 3 +++ Doc/includes/mp_pool.py | 3 +++ Doc/includes/mp_synchronize.py | 3 +++ Doc/includes/mp_webserver.py | 3 +++ Doc/includes/mp_workers.py | 3 +++ Doc/library/sqlite3.rst | 4 ++-- Doc/library/stringio.rst | 3 ++- Lib/multiprocessing/__init__.py | 2 +- Lib/test/test_httplib.py | 15 ++++++++++----- Modules/_multiprocessing/semaphore.c | 2 +- Objects/unicodeobject.c | 2 +- Tools/scripts/svneol.py | 6 +++--- configure.in | 4 ++-- 15 files changed, 43 insertions(+), 16 deletions(-) diff --git a/Doc/includes/mp_benchmarks.py b/Doc/includes/mp_benchmarks.py index 425d6dee9b..16be77edce 100644 --- a/Doc/includes/mp_benchmarks.py +++ b/Doc/includes/mp_benchmarks.py @@ -1,6 +1,9 @@ # # Simple benchmarks for the multiprocessing package # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time, sys, multiprocessing, threading, Queue, gc diff --git a/Doc/includes/mp_distributing.py b/Doc/includes/mp_distributing.py index 3e9ffd65ea..5ec718bf47 100644 --- a/Doc/includes/mp_distributing.py +++ b/Doc/includes/mp_distributing.py @@ -3,6 +3,9 @@ # # Depends on `multiprocessing` package -- tested with `processing-0.60` # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# __all__ = ['Cluster', 'Host', 'get_logger', 'current_process'] diff --git a/Doc/includes/mp_newtype.py b/Doc/includes/mp_newtype.py index b9edc9e552..1858696aa0 100644 --- a/Doc/includes/mp_newtype.py +++ b/Doc/includes/mp_newtype.py @@ -2,6 +2,9 @@ # This module shows how to use arbitrary callables with a subclass of # `BaseManager`. # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# from multiprocessing import freeze_support from multiprocessing.managers import BaseManager, BaseProxy diff --git a/Doc/includes/mp_pool.py b/Doc/includes/mp_pool.py index e7aaaacaf3..9e89cbc607 100644 --- a/Doc/includes/mp_pool.py +++ b/Doc/includes/mp_pool.py @@ -1,6 +1,9 @@ # # A test of `multiprocessing.Pool` class # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import multiprocessing import time diff --git a/Doc/includes/mp_synchronize.py b/Doc/includes/mp_synchronize.py index ddcd338273..2f43ad8d95 100644 --- a/Doc/includes/mp_synchronize.py +++ b/Doc/includes/mp_synchronize.py @@ -1,6 +1,9 @@ # # A test file for the `multiprocessing` package # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time, sys, random from Queue import Empty diff --git a/Doc/includes/mp_webserver.py b/Doc/includes/mp_webserver.py index 4943f5d477..96d14c5443 100644 --- a/Doc/includes/mp_webserver.py +++ b/Doc/includes/mp_webserver.py @@ -8,6 +8,9 @@ # Not sure if we should synchronize access to `socket.accept()` method by # using a process-shared lock -- does not seem to be necessary. # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import os import sys diff --git a/Doc/includes/mp_workers.py b/Doc/includes/mp_workers.py index 07e4cdd2e0..e64a156ec9 100644 --- a/Doc/includes/mp_workers.py +++ b/Doc/includes/mp_workers.py @@ -7,6 +7,9 @@ # in the original order then consider using `Pool.map()` or # `Pool.imap()` (which will save on the amount of code needed anyway). # +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# import time import random diff --git a/Doc/library/sqlite3.rst b/Doc/library/sqlite3.rst index 6235f9ed3e..19b80abbe5 100644 --- a/Doc/library/sqlite3.rst +++ b/Doc/library/sqlite3.rst @@ -223,8 +223,8 @@ Connection Objects .. attribute:: Connection.isolation_level - Get or set the current isolation level. :const:`None` for autocommit mode or one of - "DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section + Get or set the current isolation level. :const:`None` for autocommit mode or + one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section :ref:`sqlite3-controlling-transactions` for a more detailed explanation. diff --git a/Doc/library/stringio.rst b/Doc/library/stringio.rst index 4736fc3a7c..19e15473fd 100644 --- a/Doc/library/stringio.rst +++ b/Doc/library/stringio.rst @@ -37,7 +37,8 @@ The following methods of :class:`StringIO` objects require special mention: .. method:: StringIO.close() - Free the memory buffer. + Free the memory buffer. Attempting to do further operations with a closed + :class:`StringIO` object will raise a :exc:`ValueError`. Example usage:: diff --git a/Lib/multiprocessing/__init__.py b/Lib/multiprocessing/__init__.py index f96505630a..10be01a6ba 100644 --- a/Lib/multiprocessing/__init__.py +++ b/Lib/multiprocessing/__init__.py @@ -113,7 +113,7 @@ def cpu_count(): num = int(os.environ['NUMBER_OF_PROCESSORS']) except (ValueError, KeyError): num = 0 - elif sys.platform == 'darwin': + elif 'bsd' in sys.platform or sys.platform == 'darwin': try: num = int(os.popen('sysctl -n hw.ncpu').read()) except ValueError: diff --git a/Lib/test/test_httplib.py b/Lib/test/test_httplib.py index e2560b61d5..c8c0648e51 100644 --- a/Lib/test/test_httplib.py +++ b/Lib/test/test_httplib.py @@ -107,19 +107,23 @@ class BasicTest(TestCase): for hp in ("www.python.org:abc", "www.python.org:"): self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp) - for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", 8000), + for hp, h, p in (("[fe80::207:e9ff:fe9b]:8000", "fe80::207:e9ff:fe9b", + 8000), ("www.python.org:80", "www.python.org", 80), ("www.python.org", "www.python.org", 80), ("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)): http = httplib.HTTP(hp) c = http._conn - if h != c.host: self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) - if p != c.port: self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) + if h != c.host: + self.fail("Host incorrectly parsed: %s != %s" % (h, c.host)) + if p != c.port: + self.fail("Port incorrectly parsed: %s != %s" % (p, c.host)) def test_response_headers(self): # test response with multiple message headers with the same field name. text = ('HTTP/1.1 200 OK\r\n' - 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' + 'Set-Cookie: Customer="WILE_E_COYOTE";' + ' Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' ' Path="/acme"\r\n' '\r\n' @@ -187,7 +191,8 @@ class BasicTest(TestCase): resp.close() def test_negative_content_length(self): - sock = FakeSocket('HTTP/1.1 200 OK\r\nContent-Length: -1\r\n\r\nHello\r\n') + sock = FakeSocket('HTTP/1.1 200 OK\r\n' + 'Content-Length: -1\r\n\r\nHello\r\n') resp = httplib.HTTPResponse(sock, method="GET") resp.begin() self.assertEquals(resp.read(), 'Hello\r\n') diff --git a/Modules/_multiprocessing/semaphore.c b/Modules/_multiprocessing/semaphore.c index a7ffd1ea7a..a5ba71e30c 100644 --- a/Modules/_multiprocessing/semaphore.c +++ b/Modules/_multiprocessing/semaphore.c @@ -512,7 +512,6 @@ semlock_getvalue(SemLockObject *self) static PyObject * semlock_iszero(SemLockObject *self) { - int sval; #if HAVE_BROKEN_SEM_GETVALUE if (sem_trywait(self->handle) < 0) { if (errno == EAGAIN) @@ -524,6 +523,7 @@ semlock_iszero(SemLockObject *self) Py_RETURN_FALSE; } #else + int sval; if (SEM_GETVALUE(self->handle, &sval) < 0) return mp_SetError(NULL, MP_STANDARD_ERROR); return PyBool_FromLong((long)sval == 0); diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 17424256a2..ba148430f1 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -7680,7 +7680,7 @@ unicode_rsplit(PyUnicodeObject *self, PyObject *args) } PyDoc_STRVAR(splitlines__doc__, -"S.splitlines([keepends]]) -> list of strings\n\ +"S.splitlines([keepends]) -> list of strings\n\ \n\ Return a list of the lines in S, breaking at line boundaries.\n\ Line breaks are not included in the resulting list unless keepends\n\ diff --git a/Tools/scripts/svneol.py b/Tools/scripts/svneol.py index 9e57bb4c0f..9357c7ed8d 100644 --- a/Tools/scripts/svneol.py +++ b/Tools/scripts/svneol.py @@ -39,9 +39,9 @@ def propfiles(root, fn): format = int(open(os.path.join(root, ".svn", "format")).read().strip()) except IOError: return [] - if format == 8: - # In version 8, committed props are stored in prop-base, - # local modifications in props + if format in (8, 9): + # In version 8 and 9, committed props are stored in prop-base, local + # modifications in props return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"), os.path.join(root, ".svn", "props", fn+".svn-work")] raise ValueError, "Unknown repository format" diff --git a/configure.in b/configure.in index 97a7d41b6f..cf70489a3d 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl *********************************************** dnl * Please run autoreconf to test your changes! * dnl *********************************************** -dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.63). +dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61). # Set VERSION so we only need to edit in one place (i.e., here) m4_define(PYTHON_VERSION, 2.6) @@ -1844,7 +1844,7 @@ AC_MSG_RESULT($SHLIBS) AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX -# only check for sem_ini if thread support is requested +# only check for sem_init if thread support is requested if test "$with_threads" = "yes" -o -z "$with_threads"; then AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris # posix4 on Solaris 2.6 -- 2.49.0