#
# Simple benchmarks for the multiprocessing package
#
+# Copyright (c) 2006-2008, R Oudkerk
+# All rights reserved.
+#
import time, sys, multiprocessing, threading, Queue, gc
#\r
# Depends on `multiprocessing` package -- tested with `processing-0.60`\r
#\r
+# Copyright (c) 2006-2008, R Oudkerk\r
+# All rights reserved.\r
+#\r
\r
__all__ = ['Cluster', 'Host', 'get_logger', 'current_process']\r
\r
# 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
#
# A test of `multiprocessing.Pool` class
#
+# Copyright (c) 2006-2008, R Oudkerk
+# All rights reserved.
+#
import multiprocessing
import time
#
# A test file for the `multiprocessing` package
#
+# Copyright (c) 2006-2008, R Oudkerk
+# All rights reserved.
+#
import time, sys, random
from Queue import Empty
# 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
# 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
.. 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.
.. 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::
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:
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'
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')
static PyObject *
semlock_iszero(SemLockObject *self)
{
- int sval;
#if HAVE_BROKEN_SEM_GETVALUE
if (sem_trywait(self->handle) < 0) {
if (errno == EAGAIN)
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);
}
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\
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"
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)
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