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 ........
This commit is contained in:
parent
f917e86b89
commit
5c7f8fb7fd
|
@ -1,6 +1,9 @@
|
||||||
#
|
#
|
||||||
# Simple benchmarks for the multiprocessing package
|
# Simple benchmarks for the multiprocessing package
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2006-2008, R Oudkerk
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
import time, sys, multiprocessing, threading, Queue, gc
|
import time, sys, multiprocessing, threading, Queue, gc
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
#
|
#
|
||||||
# Depends on `multiprocessing` package -- tested with `processing-0.60`
|
# 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']
|
__all__ = ['Cluster', 'Host', 'get_logger', 'current_process']
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
# This module shows how to use arbitrary callables with a subclass of
|
# This module shows how to use arbitrary callables with a subclass of
|
||||||
# `BaseManager`.
|
# `BaseManager`.
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2006-2008, R Oudkerk
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
from multiprocessing import freeze_support
|
from multiprocessing import freeze_support
|
||||||
from multiprocessing.managers import BaseManager, BaseProxy
|
from multiprocessing.managers import BaseManager, BaseProxy
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#
|
#
|
||||||
# A test of `multiprocessing.Pool` class
|
# A test of `multiprocessing.Pool` class
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2006-2008, R Oudkerk
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import time
|
import time
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#
|
#
|
||||||
# A test file for the `multiprocessing` package
|
# A test file for the `multiprocessing` package
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2006-2008, R Oudkerk
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
import time, sys, random
|
import time, sys, random
|
||||||
from Queue import Empty
|
from Queue import Empty
|
||||||
|
|
|
@ -8,6 +8,9 @@
|
||||||
# Not sure if we should synchronize access to `socket.accept()` method by
|
# Not sure if we should synchronize access to `socket.accept()` method by
|
||||||
# using a process-shared lock -- does not seem to be necessary.
|
# using a process-shared lock -- does not seem to be necessary.
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2006-2008, R Oudkerk
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
# in the original order then consider using `Pool.map()` or
|
# in the original order then consider using `Pool.map()` or
|
||||||
# `Pool.imap()` (which will save on the amount of code needed anyway).
|
# `Pool.imap()` (which will save on the amount of code needed anyway).
|
||||||
#
|
#
|
||||||
|
# Copyright (c) 2006-2008, R Oudkerk
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import random
|
import random
|
||||||
|
|
|
@ -223,8 +223,8 @@ Connection Objects
|
||||||
|
|
||||||
.. attribute:: Connection.isolation_level
|
.. attribute:: Connection.isolation_level
|
||||||
|
|
||||||
Get or set the current isolation level. :const:`None` for autocommit mode or one of
|
Get or set the current isolation level. :const:`None` for autocommit mode or
|
||||||
"DEFERRED", "IMMEDIATE" or "EXLUSIVE". See section
|
one of "DEFERRED", "IMMEDIATE" or "EXCLUSIVE". See section
|
||||||
:ref:`sqlite3-controlling-transactions` for a more detailed explanation.
|
:ref:`sqlite3-controlling-transactions` for a more detailed explanation.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,8 @@ The following methods of :class:`StringIO` objects require special mention:
|
||||||
|
|
||||||
.. method:: StringIO.close()
|
.. 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::
|
Example usage::
|
||||||
|
|
||||||
|
|
|
@ -113,7 +113,7 @@ def cpu_count():
|
||||||
num = int(os.environ['NUMBER_OF_PROCESSORS'])
|
num = int(os.environ['NUMBER_OF_PROCESSORS'])
|
||||||
except (ValueError, KeyError):
|
except (ValueError, KeyError):
|
||||||
num = 0
|
num = 0
|
||||||
elif sys.platform == 'darwin':
|
elif 'bsd' in sys.platform or sys.platform == 'darwin':
|
||||||
try:
|
try:
|
||||||
num = int(os.popen('sysctl -n hw.ncpu').read())
|
num = int(os.popen('sysctl -n hw.ncpu').read())
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
|
@ -107,19 +107,23 @@ class BasicTest(TestCase):
|
||||||
for hp in ("www.python.org:abc", "www.python.org:"):
|
for hp in ("www.python.org:abc", "www.python.org:"):
|
||||||
self.assertRaises(httplib.InvalidURL, httplib.HTTP, hp)
|
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:80", "www.python.org", 80),
|
||||||
("www.python.org", "www.python.org", 80),
|
("www.python.org", "www.python.org", 80),
|
||||||
("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)):
|
("[fe80::207:e9ff:fe9b]", "fe80::207:e9ff:fe9b", 80)):
|
||||||
http = httplib.HTTP(hp)
|
http = httplib.HTTP(hp)
|
||||||
c = http._conn
|
c = http._conn
|
||||||
if h != c.host: self.fail("Host incorrectly parsed: %s != %s" % (h, c.host))
|
if h != c.host:
|
||||||
if p != c.port: self.fail("Port incorrectly parsed: %s != %s" % (p, 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):
|
def test_response_headers(self):
|
||||||
# test response with multiple message headers with the same field name.
|
# test response with multiple message headers with the same field name.
|
||||||
text = ('HTTP/1.1 200 OK\r\n'
|
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";'
|
'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";'
|
||||||
' Path="/acme"\r\n'
|
' Path="/acme"\r\n'
|
||||||
'\r\n'
|
'\r\n'
|
||||||
|
@ -187,7 +191,8 @@ class BasicTest(TestCase):
|
||||||
resp.close()
|
resp.close()
|
||||||
|
|
||||||
def test_negative_content_length(self):
|
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 = httplib.HTTPResponse(sock, method="GET")
|
||||||
resp.begin()
|
resp.begin()
|
||||||
self.assertEquals(resp.read(), 'Hello\r\n')
|
self.assertEquals(resp.read(), 'Hello\r\n')
|
||||||
|
|
|
@ -512,7 +512,6 @@ semlock_getvalue(SemLockObject *self)
|
||||||
static PyObject *
|
static PyObject *
|
||||||
semlock_iszero(SemLockObject *self)
|
semlock_iszero(SemLockObject *self)
|
||||||
{
|
{
|
||||||
int sval;
|
|
||||||
#if HAVE_BROKEN_SEM_GETVALUE
|
#if HAVE_BROKEN_SEM_GETVALUE
|
||||||
if (sem_trywait(self->handle) < 0) {
|
if (sem_trywait(self->handle) < 0) {
|
||||||
if (errno == EAGAIN)
|
if (errno == EAGAIN)
|
||||||
|
@ -524,6 +523,7 @@ semlock_iszero(SemLockObject *self)
|
||||||
Py_RETURN_FALSE;
|
Py_RETURN_FALSE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
int sval;
|
||||||
if (SEM_GETVALUE(self->handle, &sval) < 0)
|
if (SEM_GETVALUE(self->handle, &sval) < 0)
|
||||||
return mp_SetError(NULL, MP_STANDARD_ERROR);
|
return mp_SetError(NULL, MP_STANDARD_ERROR);
|
||||||
return PyBool_FromLong((long)sval == 0);
|
return PyBool_FromLong((long)sval == 0);
|
||||||
|
|
|
@ -7680,7 +7680,7 @@ unicode_rsplit(PyUnicodeObject *self, PyObject *args)
|
||||||
}
|
}
|
||||||
|
|
||||||
PyDoc_STRVAR(splitlines__doc__,
|
PyDoc_STRVAR(splitlines__doc__,
|
||||||
"S.splitlines([keepends]]) -> list of strings\n\
|
"S.splitlines([keepends]) -> list of strings\n\
|
||||||
\n\
|
\n\
|
||||||
Return a list of the lines in S, breaking at line boundaries.\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\
|
Line breaks are not included in the resulting list unless keepends\n\
|
||||||
|
|
|
@ -39,9 +39,9 @@ def propfiles(root, fn):
|
||||||
format = int(open(os.path.join(root, ".svn", "format")).read().strip())
|
format = int(open(os.path.join(root, ".svn", "format")).read().strip())
|
||||||
except IOError:
|
except IOError:
|
||||||
return []
|
return []
|
||||||
if format == 8:
|
if format in (8, 9):
|
||||||
# In version 8, committed props are stored in prop-base,
|
# In version 8 and 9, committed props are stored in prop-base, local
|
||||||
# local modifications in props
|
# modifications in props
|
||||||
return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"),
|
return [os.path.join(root, ".svn", "prop-base", fn+".svn-base"),
|
||||||
os.path.join(root, ".svn", "props", fn+".svn-work")]
|
os.path.join(root, ".svn", "props", fn+".svn-work")]
|
||||||
raise ValueError, "Unknown repository format"
|
raise ValueError, "Unknown repository format"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
dnl ***********************************************
|
dnl ***********************************************
|
||||||
dnl * Please run autoreconf to test your changes! *
|
dnl * Please run autoreconf to test your changes! *
|
||||||
dnl ***********************************************
|
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)
|
# Set VERSION so we only need to edit in one place (i.e., here)
|
||||||
m4_define(PYTHON_VERSION, 2.6)
|
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(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV
|
||||||
AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX
|
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
|
if test "$with_threads" = "yes" -o -z "$with_threads"; then
|
||||||
AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
|
AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris
|
||||||
# posix4 on Solaris 2.6
|
# posix4 on Solaris 2.6
|
||||||
|
|
Loading…
Reference in New Issue