diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/library/argparse.rst --- a/Doc/library/argparse.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/library/argparse.rst Mon Aug 01 17:51:34 2011 -0400 @@ -1797,7 +1797,7 @@ .. method:: ArgumentParser.error(message) This method prints a usage message including the *message* to the - standard error and terminates the program with a status code of 2. + standard output and terminates the program with a status code of 2. .. _upgrading-optparse-code: diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/library/ctypes.rst --- a/Doc/library/ctypes.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/library/ctypes.rst Mon Aug 01 17:51:34 2011 -0400 @@ -865,10 +865,10 @@ struct cell; /* forward declaration */ - struct cell { + struct { char *name; struct cell *next; - }; + } cell; The straightforward translation into ctypes code would be this, but it does not work:: diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/library/os.rst --- a/Doc/library/os.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/library/os.rst Mon Aug 01 17:51:34 2011 -0400 @@ -2744,155 +2744,6 @@ Availability: Unix. -Interface to the scheduler --------------------------- - -These functions control how a process is allocated CPU time by the operating -system. They are only available on some Unix platforms. For more detailed -information, consult your Unix manpages. - -.. versionadded:: 3.3 - -The following scheduling policies are exposed if they are a supported by the -operating system. - -.. data:: SCHED_OTHER - - The default scheduling policy. - -.. data:: SCHED_BATCH - - Scheduling policy for CPU-intensive processes that tries to preserve - interactivity on the rest of the computer. - -.. data:: SCHED_IDLE - - Scheduling policy for extremely low priority background tasks. - -.. data:: SCHED_SPORADIC - - Scheduling policy for sporadic server programs. - -.. data:: SCHED_FIFO - - A First In First Out scheduling policy. - -.. data:: SCHED_RR - - A round-robin scheduling policy. - -.. data:: SCHED_RESET_ON_FORK - - This flag can OR'ed with any other scheduling policy. When a process with - this flag set forks, its child's scheduling policy and priority are reset to - the default. - - -.. class:: sched_param(sched_priority) - - This class represents tunable scheduling parameters used in - :func:`sched_setparam`, :func:`sched_setscheduler`, and - :func:`sched_getparam`. It is immutable. - - At the moment, there is only one possible parameter: - - .. attribute:: sched_priority - - The scheduling priority for a scheduling policy. - - -.. function:: sched_get_priority_min(policy) - - Get the minimum priority value for *policy*. *policy* is one of the - scheduling policy constants above. - - -.. function:: sched_get_priority_max(policy) - - Get the maximum priority value for *policy*. *policy* is one of the - scheduling policy constants above. - - -.. function:: sched_setscheduler(pid, policy, param) - - Set the scheduling policy for the process with PID *pid*. A *pid* of 0 means - the calling process. *policy* is one of the scheduling policy constants - above. *param* is a :class:`sched_param` instance. - - -.. function:: sched_getscheduler(pid) - - Return the scheduling policy for the process with PID *pid*. A *pid* of 0 - means the calling process. The result is one of the scheduling policy - constants above. - - -.. function:: sched_setparam(pid, param) - - Set a scheduling parameters for the process with PID *pid*. A *pid* of 0 means - the calling process. *param* is a :class:`sched_param` instance. - - -.. function:: sched_getparam(pid) - - Return the scheduling parameters as a :class:`sched_param` instance for the - process with PID *pid*. A *pid* of 0 means the calling process. - - -.. function:: sched_rr_get_interval(pid) - - Return the round-robin quantum in seconds for the process with PID *pid*. A - *pid* of 0 means the calling process. - - -.. function:: sched_yield() - - Voluntarily relinquish the CPU. - - -.. class:: cpu_set(ncpus) - - :class:`cpu_set` represents a set of CPUs on which a process is eligible to - run. *ncpus* is the number of CPUs the set should describe. Methods on - :class:`cpu_set` allow CPUs to be add or removed. - - :class:`cpu_set` supports the AND, OR, and XOR bitwise operations. For - example, given two cpu_sets, ``one`` and ``two``, ``one | two`` returns a - :class:`cpu_set` containing the cpus enabled both in ``one`` and ``two``. - - .. method:: set(i) - - Enable CPU *i*. - - .. method:: clear(i) - - Remove CPU *i*. - - .. method:: isset(i) - - Return ``True`` if CPU *i* is enabled in the set. - - .. method:: count() - - Return the number of enabled CPUs in the set. - - .. method:: zero() - - Clear the set completely. - - -.. function:: sched_setaffinity(pid, mask) - - Restrict the process with PID *pid* to a set of CPUs. *mask* is a - :class:`cpu_set` instance. - - -.. function:: sched_getaffinity(pid, size) - - Return the :class:`cpu_set` the process with PID *pid* is restricted to. The - result will contain *size* CPUs. - - .. _os-path: Miscellaneous System Information diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/library/shutil.rst --- a/Doc/library/shutil.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/library/shutil.rst Mon Aug 01 17:51:34 2011 -0400 @@ -101,9 +101,8 @@ :func:`copy2`. If *symlinks* is true, symbolic links in the source tree are represented as - symbolic links in the new tree, but the metadata of the original links is NOT - copied; if false or omitted, the contents and metadata of the linked files - are copied to the new tree. + symbolic links in the new tree; if false or omitted, the contents of the + linked files are copied to the new tree. When *symlinks* is false, if the file pointed by the symlink doesn't exist, a exception will be added in the list of errors raised in diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/library/stat.rst --- a/Doc/library/stat.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/library/stat.rst Mon Aug 01 17:51:34 2011 -0400 @@ -87,7 +87,7 @@ for f in os.listdir(top): pathname = os.path.join(top, f) - mode = os.stat(pathname).st_mode + mode = os.stat(pathname)[ST_MODE] if S_ISDIR(mode): # It's a directory, recurse into it walktree(pathname, callback) diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/library/stdtypes.rst --- a/Doc/library/stdtypes.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/library/stdtypes.rst Mon Aug 01 17:51:34 2011 -0400 @@ -2329,7 +2329,7 @@ >>> keys & {'eggs', 'bacon', 'salad'} {'bacon'} >>> keys ^ {'sausage', 'juice'} - {'juice', 'sausage', 'bacon', 'spam'} + {'juice', 'eggs', 'bacon', 'spam'} .. _typememoryview: diff -r 0c1c9bb590a9 -r bc362109eed8 Doc/whatsnew/3.0.rst --- a/Doc/whatsnew/3.0.rst Thu Aug 04 17:17:07 2011 +0200 +++ b/Doc/whatsnew/3.0.rst Mon Aug 01 17:51:34 2011 -0400 @@ -154,7 +154,9 @@ :meth:`dict.itervalues` methods are no longer supported. * :func:`map` and :func:`filter` return iterators. If you really need - a list, a quick fix is e.g. ``list(map(...))``, but a better fix is + a list and the input sequences are all of equal length, a quick + fix is to wrap :func:`map` in :func:`list`, e.g. ``list(map(...))``, + but a better fix is often to use a list comprehension (especially when the original code uses :keyword:`lambda`), or rewriting the code so it doesn't need a list at all. Particularly tricky is :func:`map` invoked for the @@ -162,6 +164,12 @@ regular :keyword:`for` loop (since creating a list would just be wasteful). + If the input sequences are not of equal length, :func:`map` will + stop at the termination of the shortest of the sequences. For full + compatibility with `map` from Python 2.x, also wrap the sequences in + :func:`itertools.zip_longest`, e.g. ``map(func, *sequences)`` becomes + ``list(map(func, itertools.zip_longest(*sequences)))``. + * :func:`range` now behaves like :func:`xrange` used to behave, except it works with values of arbitrary size. The latter no longer exists. diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/http/client.py --- a/Lib/http/client.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/http/client.py Mon Aug 01 17:51:34 2011 -0400 @@ -777,8 +777,8 @@ for d in data: self.sock.sendall(d) else: - raise TypeError("data should be a bytes-like object " - "or an iterable, got %r" % type(data)) + raise TypeError("data should be a bytes-like object\ + or an iterable, got %r " % type(it)) def _output(self, s): """Add a line of output to the current request buffer. diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/idlelib/PyShell.py Mon Aug 01 17:51:34 2011 -0400 @@ -10,7 +10,6 @@ import threading import traceback import types -import subprocess import linecache from code import InteractiveInterpreter @@ -38,6 +37,11 @@ HOST = '127.0.0.1' # python execution server on localhost loopback PORT = 0 # someday pass in host, port for remote debug capability +try: + from signal import SIGTERM +except ImportError: + SIGTERM = 15 + # Override warnings module to write to warning_stream. Initialize to send IDLE # internal warnings to the console. ScriptBinding.check_syntax() will # temporarily redirect the stream to the shell window to display warnings when @@ -340,12 +344,13 @@ self.port = PORT rpcclt = None - rpcsubproc = None + rpcpid = None def spawn_subprocess(self): if self.subprocess_arglist is None: self.subprocess_arglist = self.build_subprocess_arglist() - self.rpcsubproc = subprocess.Popen(self.subprocess_arglist) + args = self.subprocess_arglist + self.rpcpid = os.spawnv(os.P_NOWAIT, sys.executable, args) def build_subprocess_arglist(self): assert (self.port!=0), ( @@ -360,7 +365,12 @@ command = "__import__('idlelib.run').run.main(%r)" % (del_exitf,) else: command = "__import__('run').main(%r)" % (del_exitf,) - return [sys.executable] + w + ["-c", command, str(self.port)] + if sys.platform[:3] == 'win' and ' ' in sys.executable: + # handle embedded space in path by quoting the argument + decorated_exec = '"%s"' % sys.executable + else: + decorated_exec = sys.executable + return [decorated_exec] + w + ["-c", command, str(self.port)] def start_subprocess(self): addr = (HOST, self.port) @@ -418,7 +428,7 @@ pass # Kill subprocess, spawn a new one, accept connection. self.rpcclt.close() - self.terminate_subprocess() + self.unix_terminate() console = self.tkconsole was_executing = console.executing console.executing = False @@ -459,22 +469,23 @@ self.rpcclt.close() except AttributeError: # no socket pass - self.terminate_subprocess() + self.unix_terminate() self.tkconsole.executing = False self.rpcclt = None - def terminate_subprocess(self): - "Make sure subprocess is terminated" - try: - self.rpcsubproc.kill() - except OSError: - # process already terminated - return - else: + def unix_terminate(self): + "UNIX: make sure subprocess is terminated and collect status" + if hasattr(os, 'kill'): try: - self.rpcsubproc.wait() + os.kill(self.rpcpid, SIGTERM) except OSError: + # process already terminated: return + else: + try: + os.waitpid(self.rpcpid, 0) + except OSError: + return def transfer_path(self): self.runcommand("""if 1: diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/packaging/util.py --- a/Lib/packaging/util.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/packaging/util.py Mon Aug 01 17:51:34 2011 -0400 @@ -782,7 +782,7 @@ """ logger.debug('spawn: running %r', cmd) if dry_run: - logger.debug('dry run, no process actually spawned') + logging.debug('dry run, no process actually spawned') return if sys.platform == 'darwin': global _cfg_target, _cfg_target_split diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/regrtest.py --- a/Lib/test/regrtest.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/regrtest.py Mon Aug 01 17:51:34 2011 -0400 @@ -133,8 +133,6 @@ all - Enable all special resources. - none - Disable all special resources (this is the default). - audio - Tests that use the audio device. (There are known cases of broken audio drivers that can crash Python or even the Linux kernel.) @@ -389,9 +387,6 @@ if r == 'all': use_resources[:] = RESOURCE_NAMES continue - if r == 'none': - del use_resources[:] - continue remove = False if r[0] == '-': remove = True @@ -429,8 +424,6 @@ use_mp = 2 + multiprocessing.cpu_count() except (ImportError, NotImplementedError): use_mp = 3 - if use_mp == 1: - use_mp = None elif o == '--header': header = True elif o == '--slaveargs': diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_httplib.py --- a/Lib/test/test_httplib.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_httplib.py Mon Aug 01 17:51:34 2011 -0400 @@ -246,13 +246,6 @@ conn.request('GET', '/foo', body(), {'Content-Length': '11'}) self.assertEqual(sock.data, expected) - def test_send_type_error(self): - # See: Issue #12676 - conn = client.HTTPConnection('example.com') - conn.sock = FakeSocket('') - with self.assertRaises(TypeError): - conn.request('POST', 'test', conn) - def test_chunked(self): chunked_start = ( 'HTTP/1.1 200 OK\r\n' @@ -506,7 +499,8 @@ def test_local_good_hostname(self): # The (valid) cert validates the HTTP hostname import ssl - server = self.make_server(CERT_localhost) + from test.ssl_servers import make_https_server + server = make_https_server(self, CERT_localhost) context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(CERT_localhost) @@ -514,12 +508,12 @@ h.request('GET', '/nonexistent') resp = h.getresponse() self.assertEqual(resp.status, 404) - del server def test_local_bad_hostname(self): # The (valid) cert doesn't validate the HTTP hostname import ssl - server = self.make_server(CERT_fakehostname) + from test.ssl_servers import make_https_server + server = make_https_server(self, CERT_fakehostname) context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) context.verify_mode = ssl.CERT_REQUIRED context.load_verify_locations(CERT_fakehostname) @@ -537,7 +531,6 @@ h.request('GET', '/nonexistent') resp = h.getresponse() self.assertEqual(resp.status, 404) - del server class RequestBodyTest(TestCase): diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_locale.py --- a/Lib/test/test_locale.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_locale.py Mon Aug 01 17:51:34 2011 -0400 @@ -1,5 +1,4 @@ from test.support import run_unittest, verbose -from platform import linux_distribution import unittest import locale import sys @@ -392,8 +391,6 @@ # crasher from bug #7419 self.assertRaises(locale.Error, locale.setlocale, 12345) - @unittest.skipIf(linux_distribution()[0] == 'Fedora', "Fedora setlocale() " - "bug: https://bugzilla.redhat.com/show_bug.cgi?id=726536") def test_getsetlocale_issue1813(self): # Issue #1813: setting and getting the locale under a Turkish locale oldlocale = locale.setlocale(locale.LC_CTYPE) diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_posix.py --- a/Lib/test/test_posix.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_posix.py Mon Aug 01 17:51:34 2011 -0400 @@ -829,153 +829,6 @@ finally: posix.close(f) - requires_sched_h = unittest.skipUnless(hasattr(posix, 'sched_yield'), - "don't have scheduling support") - requires_sched_affinity = unittest.skipUnless(hasattr(posix, 'cpu_set'), - "don't have sched affinity support") - - @requires_sched_h - def test_sched_yield(self): - # This has no error conditions (at least on Linux). - posix.sched_yield() - - @requires_sched_h - def test_sched_priority(self): - # Round-robin usually has interesting priorities. - pol = posix.SCHED_RR - lo = posix.sched_get_priority_min(pol) - hi = posix.sched_get_priority_max(pol) - self.assertIsInstance(lo, int) - self.assertIsInstance(hi, int) - self.assertGreaterEqual(hi, lo) - # OSX evidently just returns 15 without checking the argument. - if sys.platform != "darwin": - self.assertRaises(OSError, posix.sched_get_priority_min, -23) - self.assertRaises(OSError, posix.sched_get_priority_max, -23) - - @unittest.skipUnless(hasattr(posix, 'sched_setscheduler'), "can't change scheduler") - def test_get_and_set_scheduler_and_param(self): - possible_schedulers = [sched for name, sched in posix.__dict__.items() - if name.startswith("SCHED_")] - mine = posix.sched_getscheduler(0) - self.assertIn(mine, possible_schedulers) - try: - init = posix.sched_getscheduler(1) - except OSError as e: - if e.errno != errno.EPERM: - raise - else: - self.assertIn(init, possible_schedulers) - self.assertRaises(OSError, posix.sched_getscheduler, -1) - self.assertRaises(OSError, posix.sched_getparam, -1) - param = posix.sched_getparam(0) - self.assertIsInstance(param.sched_priority, int) - try: - posix.sched_setscheduler(0, mine, param) - except OSError as e: - if e.errno != errno.EPERM: - raise - posix.sched_setparam(0, param) - self.assertRaises(OSError, posix.sched_setparam, -1, param) - self.assertRaises(OSError, posix.sched_setscheduler, -1, mine, param) - self.assertRaises(TypeError, posix.sched_setscheduler, 0, mine, None) - self.assertRaises(TypeError, posix.sched_setparam, 0, 43) - param = posix.sched_param(None) - self.assertRaises(TypeError, posix.sched_setparam, 0, param) - large = 214748364700 - param = posix.sched_param(large) - self.assertRaises(OverflowError, posix.sched_setparam, 0, param) - param = posix.sched_param(sched_priority=-large) - self.assertRaises(OverflowError, posix.sched_setparam, 0, param) - - @unittest.skipUnless(hasattr(posix, "sched_rr_get_interval"), "no function") - def test_sched_rr_get_interval(self): - try: - interval = posix.sched_rr_get_interval(0) - except OSError as e: - # This likely means that sched_rr_get_interval is only valid for - # processes with the SCHED_RR scheduler in effect. - if e.errno != errno.EINVAL: - raise - self.skipTest("only works on SCHED_RR processes") - self.assertIsInstance(interval, float) - # Reasonable constraints, I think. - self.assertGreaterEqual(interval, 0.) - self.assertLess(interval, 1.) - - @requires_sched_affinity - def test_sched_affinity(self): - mask = posix.sched_getaffinity(0, 1024) - self.assertGreaterEqual(mask.count(), 1) - self.assertIsInstance(mask, posix.cpu_set) - self.assertRaises(OSError, posix.sched_getaffinity, -1, 1024) - empty = posix.cpu_set(10) - posix.sched_setaffinity(0, mask) - self.assertRaises(OSError, posix.sched_setaffinity, 0, empty) - self.assertRaises(OSError, posix.sched_setaffinity, -1, mask) - - @requires_sched_affinity - def test_cpu_set_basic(self): - s = posix.cpu_set(10) - self.assertEqual(len(s), 10) - self.assertEqual(s.count(), 0) - s.set(0) - s.set(9) - self.assertTrue(s.isset(0)) - self.assertTrue(s.isset(9)) - self.assertFalse(s.isset(5)) - self.assertEqual(s.count(), 2) - s.clear(0) - self.assertFalse(s.isset(0)) - self.assertEqual(s.count(), 1) - s.zero() - self.assertFalse(s.isset(0)) - self.assertFalse(s.isset(9)) - self.assertEqual(s.count(), 0) - self.assertRaises(ValueError, s.set, -1) - self.assertRaises(ValueError, s.set, 10) - self.assertRaises(ValueError, s.clear, -1) - self.assertRaises(ValueError, s.clear, 10) - self.assertRaises(ValueError, s.isset, -1) - self.assertRaises(ValueError, s.isset, 10) - - @requires_sched_affinity - def test_cpu_set_cmp(self): - self.assertNotEqual(posix.cpu_set(11), posix.cpu_set(12)) - l = posix.cpu_set(10) - r = posix.cpu_set(10) - self.assertEqual(l, r) - l.set(1) - self.assertNotEqual(l, r) - r.set(1) - self.assertEqual(l, r) - - @requires_sched_affinity - def test_cpu_set_bitwise(self): - l = posix.cpu_set(5) - l.set(0) - l.set(1) - r = posix.cpu_set(5) - r.set(1) - r.set(2) - b = l & r - self.assertEqual(b.count(), 1) - self.assertTrue(b.isset(1)) - b = l | r - self.assertEqual(b.count(), 3) - self.assertTrue(b.isset(0)) - self.assertTrue(b.isset(1)) - self.assertTrue(b.isset(2)) - b = l ^ r - self.assertEqual(b.count(), 2) - self.assertTrue(b.isset(0)) - self.assertFalse(b.isset(1)) - self.assertTrue(b.isset(2)) - b = l - b |= r - self.assertIs(b, l) - self.assertEqual(l.count(), 3) - class PosixGroupsTester(unittest.TestCase): def setUp(self): @@ -1011,6 +864,7 @@ posix.setgroups(groups) self.assertListEqual(groups, posix.getgroups()) + def test_main(): try: support.run_unittest(PosixTester, PosixGroupsTester) diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_support.py --- a/Lib/test/test_support.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_support.py Mon Aug 01 17:51:34 2011 -0400 @@ -55,19 +55,9 @@ support.rmtree(TESTDIRN) def test_forget(self): - mod_filename = TESTFN + '.py' - with open(mod_filename, 'w') as f: - print('foo = 1', file=f) - sys.path.insert(0, os.curdir) - try: - mod = __import__(TESTFN) - self.assertIn(TESTFN, sys.modules) - - support.forget(TESTFN) - self.assertNotIn(TESTFN, sys.modules) - finally: - del sys.path[0] - support.unlink(mod_filename) + import smtplib + support.forget("smtplib") + self.assertNotIn("smtplib", sys.modules) def test_HOST(self): s = socket.socket() diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_sysconfig.py --- a/Lib/test/test_sysconfig.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_sysconfig.py Mon Aug 01 17:51:34 2011 -0400 @@ -306,20 +306,19 @@ env = os.environ.copy() env['MACOSX_DEPLOYMENT_TARGET'] = '10.1' - with open('/dev/null') as dev_null: - p = subprocess.Popen([ - sys.executable, '-c', - 'import sysconfig; print(sysconfig.get_platform())', - ], - stdout=subprocess.PIPE, - stderr=dev_null, - env=env) - test_platform = p.communicate()[0].strip() - test_platform = test_platform.decode('utf-8') - status = p.wait() + p = subprocess.Popen([ + sys.executable, '-c', + 'import sysconfig; print(sysconfig.get_platform())', + ], + stdout=subprocess.PIPE, + stderr=open('/dev/null'), + env=env) + test_platform = p.communicate()[0].strip() + test_platform = test_platform.decode('utf-8') + status = p.wait() - self.assertEqual(status, 0) - self.assertEqual(my_platform, test_platform) + self.assertEqual(status, 0) + self.assertEqual(my_platform, test_platform) class MakefileTests(unittest.TestCase): diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_telnetlib.py --- a/Lib/test/test_telnetlib.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_telnetlib.py Mon Aug 01 17:51:34 2011 -0400 @@ -39,7 +39,6 @@ def tearDown(self): self.evt.wait() self.thread.join() - del self.thread # Clear out any dangling Thread objects. def testBasic(self): # connects diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/test/test_urlparse.py --- a/Lib/test/test_urlparse.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/test/test_urlparse.py Mon Aug 01 17:51:34 2011 -0400 @@ -371,8 +371,6 @@ self.checkJoin('http:///', '..','http:///') self.checkJoin('', 'http://a/b/c/g?y/./x','http://a/b/c/g?y/./x') self.checkJoin('', 'http://a/./g', 'http://a/./g') - self.checkJoin('svn://pathtorepo/dir1', 'dir2', 'svn://pathtorepo/dir2') - self.checkJoin('svn+ssh://pathtorepo/dir1', 'dir2', 'svn+ssh://pathtorepo/dir2') def test_RFC2732(self): str_cases = [ diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/threading.py --- a/Lib/threading.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/threading.py Mon Aug 01 17:51:34 2011 -0400 @@ -20,7 +20,7 @@ __all__ = ['active_count', 'Condition', 'current_thread', 'enumerate', 'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread', 'Barrier', - 'Timer', 'ThreadError', 'setprofile', 'settrace', 'local', 'stack_size'] + 'Timer', 'setprofile', 'settrace', 'local', 'stack_size'] # Rename some stuff so "from threading import *" is safe _start_new_thread = _thread.start_new_thread diff -r 0c1c9bb590a9 -r bc362109eed8 Lib/urllib/parse.py --- a/Lib/urllib/parse.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Lib/urllib/parse.py Mon Aug 01 17:51:34 2011 -0400 @@ -38,8 +38,7 @@ # A classification of schemes ('' means apply by default) uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', 'wais', 'file', 'https', 'shttp', 'mms', - 'prospero', 'rtsp', 'rtspu', '', 'sftp', - 'svn', 'svn+ssh'] + 'prospero', 'rtsp', 'rtspu', '', 'sftp'] uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', 'imap', 'wais', 'file', 'mms', 'https', 'shttp', 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '', diff -r 0c1c9bb590a9 -r bc362109eed8 Makefile.pre.in --- a/Makefile.pre.in Thu Aug 04 17:17:07 2011 +0200 +++ b/Makefile.pre.in Mon Aug 01 17:51:34 2011 -0400 @@ -747,15 +747,14 @@ ###################################################################### -TESTOPTS= $(EXTRATESTOPTS) -TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) $(TESTPYTHONOPTS) -TESTRUNNER= $(TESTPYTHON) $(srcdir)/Tools/scripts/run_tests.py -TESTTIMEOUT= 3600 - # Run a basic set of regression tests. # This excludes some tests that are particularly resource-intensive. +TESTOPTS= $(EXTRATESTOPTS) +TESTPROG= $(srcdir)/Lib/test/regrtest.py +TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -E -bb $(TESTPYTHONOPTS) +TESTTIMEOUT= 3600 test: all platform - $(TESTRUNNER) $(TESTOPTS) + $(TESTPYTHON) $(TESTPROG) -j0 $(TESTOPTS) # Run the full test suite twice - once without .pyc files, and once with. # In the past, we've had problems where bugs in the marshalling or @@ -766,10 +765,10 @@ # sample data. testall: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f - $(TESTPYTHON) -E $(srcdir)/Lib/compileall.py + $(TESTPYTHON) $(srcdir)/Lib/compileall.py -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f - -$(TESTRUNNER) -u all $(TESTOPTS) - $(TESTRUNNER) -u all $(TESTOPTS) + -$(TESTPYTHON) $(TESTPROG) -j0 -uall $(TESTOPTS) + $(TESTPYTHON) $(TESTPROG) -j0 -uall $(TESTOPTS) # Run the test suite for both architectures in a Universal build on OSX. # Must be run on an Intel box. @@ -778,24 +777,25 @@ echo "This can only be used on OSX/i386" ;\ exit 1 ;\ fi - $(TESTRUNNER) -u all $(TESTOPTS) - $(RUNSHARED) /usr/libexec/oah/translate \ - ./$(BUILDPYTHON) -E -m test -j 0 -u all $(TESTOPTS) + $(TESTPYTHON) $(TESTPROG) -j0 -uall $(TESTOPTS) + $(RUNSHARED) /usr/libexec/oah/translate ./$(BUILDPYTHON) -E $(TESTPROG) -j0 -uall $(TESTOPTS) -# Like testall, but with only one pass and without multiple processes. +# Like testall, but with only one pass. # Run an optional script to include information about the build environment. buildbottest: all platform -@if which pybuildbot.identify >/dev/null 2>&1; then \ pybuildbot.identify "CC='$(CC)'" "CXX='$(CXX)'"; \ fi - $(TESTRUNNER) -j 1 -u all -W --timeout=$(TESTTIMEOUT) $(TESTOPTS) + $(TESTPYTHON) $(TESTPROG) -uall -rwW --timeout=$(TESTTIMEOUT) $(TESTOPTS) QUICKTESTOPTS= $(TESTOPTS) -x test_subprocess test_io test_lib2to3 \ test_multibytecodec test_urllib2_localnet test_itertools \ test_multiprocessing test_mailbox test_socket test_poll \ - test_select test_zipfile test_concurrent_futures + test_select test_zipfile quicktest: all platform - $(TESTRUNNER) $(QUICKTESTOPTS) + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + -$(TESTPYTHON) $(TESTPROG) -j0 $(QUICKTESTOPTS) + $(TESTPYTHON) $(TESTPROG) -j0 $(QUICKTESTOPTS) install: altinstall bininstall diff -r 0c1c9bb590a9 -r bc362109eed8 Misc/NEWS --- a/Misc/NEWS Thu Aug 04 17:17:07 2011 +0200 +++ b/Misc/NEWS Mon Aug 01 17:51:34 2011 -0400 @@ -249,19 +249,6 @@ Library ------- -- Issue #12540: Prevent zombie IDLE processes on Windows due to changes - in os.kill(). - -- Issue #12683: urlparse updated to include svn as schemes that uses relative - paths. (svn from 1.5 onwards support relative path). - -- Issue #12655: Expose functions from sched.h in the os module: sched_yield(), - sched_setscheduler(), sched_getscheduler(), sched_setparam(), - sched_get_min_priority(), sched_get_max_priority(), sched_rr_get_interval(), - sched_getaffinity(), sched_setaffinity(). - -- Add ThreadError to threading.__all__. - - Issues #11104, #8688: Fix the behavior of distutils' sdist command with manually-maintained MANIFEST files. @@ -1160,13 +1147,6 @@ Tests ----- -- Issue #11651: Improve the Makefile test targets to run more of the test suite - more quickly. The --multiprocess option is now enabled by default, reducing - the amount of time needed to run the tests. "make test" and "make quicktest" - now include some resource-intensive tests, but no longer run the test suite - twice to check for bugs in .pyc generation. Tools/scripts/run_test.py provides - as an easy platform-independent way to run test suite with sensible defaults. - - Issue #12331: The test suite for the packaging module can now run from an installed Python. diff -r 0c1c9bb590a9 -r bc362109eed8 Modules/posixmodule.c --- a/Modules/posixmodule.c Thu Aug 04 17:17:07 2011 +0200 +++ b/Modules/posixmodule.c Mon Aug 01 17:51:34 2011 -0400 @@ -11,6 +11,8 @@ compiler is assumed to be IBM's VisualAge C++ (VACPP). PYCC_GCC is used as the compiler specific macro for the EMX port of gcc to OS/2. */ +/* See also ../Dos/dosmodule.c */ + #ifdef __APPLE__ /* * Step 1 of support for weak-linking a number of symbols existing on @@ -103,10 +105,6 @@ #include #endif -#ifdef HAVE_SCHED_H -#include -#endif - #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__APPLE__) #ifdef HAVE_SYS_SOCKET_H #include @@ -1607,9 +1605,6 @@ static int initialized; static PyTypeObject StatResultType; static PyTypeObject StatVFSResultType; -#if defined(HAVE_SCHED_SETPARAM) || defined(HAVE_SCHED_SETSCHEDULER) -static PyTypeObject SchedParamType; -#endif static newfunc structseq_new; static PyObject * @@ -4549,566 +4544,6 @@ } #endif -#ifdef HAVE_SCHED_H - -PyDoc_STRVAR(posix_sched_get_priority_max__doc__, -"sched_get_priority_max(policy)\n\n\ -Get the maximum scheduling priority for *policy*."); - -static PyObject * -posix_sched_get_priority_max(PyObject *self, PyObject *args) -{ - int policy, max; - - if (!PyArg_ParseTuple(args, "i:sched_get_priority_max", &policy)) - return NULL; - max = sched_get_priority_max(policy); - if (max < 0) - return posix_error(); - return PyLong_FromLong(max); -} - -PyDoc_STRVAR(posix_sched_get_priority_min__doc__, -"sched_get_priority_min(policy)\n\n\ -Get the minimum scheduling priority for *policy*."); - -static PyObject * -posix_sched_get_priority_min(PyObject *self, PyObject *args) -{ - int policy, min; - - if (!PyArg_ParseTuple(args, "i:sched_get_priority_min", &policy)) - return NULL; - min = sched_get_priority_min(policy); - if (min < 0) - return posix_error(); - return PyLong_FromLong(min); -} - -#ifdef HAVE_SCHED_SETSCHEDULER - -PyDoc_STRVAR(posix_sched_getscheduler__doc__, -"sched_getscheduler(pid)\n\n\ -Get the scheduling policy for the process with a PID of *pid*.\n\ -Passing a PID of 0 returns the scheduling policy for the calling process."); - -static PyObject * -posix_sched_getscheduler(PyObject *self, PyObject *args) -{ - pid_t pid; - int policy; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID ":sched_getscheduler", &pid)) - return NULL; - policy = sched_getscheduler(pid); - if (policy < 0) - return posix_error(); - return PyLong_FromLong(policy); -} - -#endif - -#if defined(HAVE_SCHED_SETSCHEDULER) || defined(HAVE_SCHED_SETPARAM) - -static PyObject * -sched_param_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - PyObject *res, *priority; - static char *kwlist[] = {"sched_priority", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:sched_param", kwlist, &priority)) - return NULL; - res = PyStructSequence_New(type); - if (!res) - return NULL; - Py_INCREF(priority); - PyStructSequence_SET_ITEM(res, 0, priority); - return res; -} - -PyDoc_STRVAR(sched_param__doc__, -"sched_param(sched_priority): A scheduling parameter.\n\n\ -Current has only one field: sched_priority"); - -static PyStructSequence_Field sched_param_fields[] = { - {"sched_priority", "the scheduling priority"}, - {0} -}; - -static PyStructSequence_Desc sched_param_desc = { - "sched_param", /* name */ - sched_param__doc__, /* doc */ - sched_param_fields, - 1 -}; - -static int -convert_sched_param(PyObject *param, struct sched_param *res) -{ - long priority; - - if (Py_TYPE(param) != &SchedParamType) { - PyErr_SetString(PyExc_TypeError, "must have a sched_param object"); - return 0; - } - priority = PyLong_AsLong(PyStructSequence_GET_ITEM(param, 0)); - if (priority == -1 && PyErr_Occurred()) - return 0; - if (priority > INT_MAX || priority < INT_MIN) { - PyErr_SetString(PyExc_OverflowError, "sched_priority out of range"); - return 0; - } - res->sched_priority = Py_SAFE_DOWNCAST(priority, long, int); - return 1; -} - -#endif - -#ifdef HAVE_SCHED_SETSCHEDULER - -PyDoc_STRVAR(posix_sched_setscheduler__doc__, -"sched_setscheduler(pid, policy, param)\n\n\ -Set the scheduling policy, *policy*, for *pid*.\n\ -If *pid* is 0, the calling process is changed.\n\ -*param* is an instance of sched_param."); - -static PyObject * -posix_sched_setscheduler(PyObject *self, PyObject *args) -{ - pid_t pid; - int policy; - struct sched_param param; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "iO&:sched_setscheduler", - &pid, &policy, &convert_sched_param, ¶m)) - return NULL; - if (sched_setscheduler(pid, policy, ¶m)) - return posix_error(); - Py_RETURN_NONE; -} - -#endif - -#ifdef HAVE_SCHED_SETPARAM - -PyDoc_STRVAR(posix_sched_getparam__doc__, -"sched_getparam(pid) -> sched_param\n\n\ -Returns scheduling parameters for the process with *pid* as an instance of the\n\ -sched_param class. A PID of 0 means the calling process."); - -static PyObject * -posix_sched_getparam(PyObject *self, PyObject *args) -{ - pid_t pid; - struct sched_param param; - PyObject *res, *priority; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID ":sched_getparam", &pid)) - return NULL; - if (sched_getparam(pid, ¶m)) - return posix_error(); - res = PyStructSequence_New(&SchedParamType); - if (!res) - return NULL; - priority = PyLong_FromLong(param.sched_priority); - if (!priority) { - Py_DECREF(res); - return NULL; - } - PyStructSequence_SET_ITEM(res, 0, priority); - return res; -} - -PyDoc_STRVAR(posix_sched_setparam__doc__, -"sched_setparam(pid, param)\n\n\ -Set scheduling parameters for a process with PID *pid*.\n\ -A PID of 0 means the calling process."); - -static PyObject * -posix_sched_setparam(PyObject *self, PyObject *args) -{ - pid_t pid; - struct sched_param param; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "O&:sched_setparam", - &pid, &convert_sched_param, ¶m)) - return NULL; - if (sched_setparam(pid, ¶m)) - return posix_error(); - Py_RETURN_NONE; -} - -#endif - -#ifdef HAVE_SCHED_RR_GET_INTERVAL - -PyDoc_STRVAR(posix_sched_rr_get_interval__doc__, -"sched_rr_get_interval(pid) -> float\n\n\ -Return the round-robin quantum for the process with PID *pid* in seconds."); - -static PyObject * -posix_sched_rr_get_interval(PyObject *self, PyObject *args) -{ - pid_t pid; - struct timespec interval; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID ":sched_rr_get_interval", &pid)) - return NULL; - if (sched_rr_get_interval(pid, &interval)) - return posix_error(); - return PyFloat_FromDouble((double)interval.tv_sec + 1e-9*interval.tv_nsec); -} - -#endif - -PyDoc_STRVAR(posix_sched_yield__doc__, -"sched_yield()\n\n\ -Voluntarily relinquish the CPU."); - -static PyObject * -posix_sched_yield(PyObject *self, PyObject *noargs) -{ - if (sched_yield()) - return posix_error(); - Py_RETURN_NONE; -} - -#ifdef HAVE_SCHED_SETAFFINITY - -typedef struct { - PyObject_HEAD; - Py_ssize_t size; - int ncpus; - cpu_set_t *set; -} Py_cpu_set; - -static PyTypeObject cpu_set_type; - -static void -cpu_set_dealloc(Py_cpu_set *set) -{ - assert(set->set); - CPU_FREE(set->set); - Py_TYPE(set)->tp_free(set); -} - -static Py_cpu_set * -make_new_cpu_set(PyTypeObject *type, Py_ssize_t size) -{ - Py_cpu_set *set; - - if (size < 0) { - PyErr_SetString(PyExc_ValueError, "negative size"); - return NULL; - } - set = (Py_cpu_set *)type->tp_alloc(type, 0); - if (!set) - return NULL; - set->ncpus = size; - set->size = CPU_ALLOC_SIZE(size); - set->set = CPU_ALLOC(size); - if (!set->set) { - type->tp_free(set); - PyErr_NoMemory(); - return NULL; - } - CPU_ZERO_S(set->size, set->set); - return set; -} - -static PyObject * -cpu_set_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - int size; - - if (!_PyArg_NoKeywords("cpu_set()", kwargs) || - !PyArg_ParseTuple(args, "i:cpu_set", &size)) - return NULL; - return (PyObject *)make_new_cpu_set(type, size); -} - -static PyObject * -cpu_set_repr(Py_cpu_set *set) -{ - return PyUnicode_FromFormat("", set->ncpus); -} - -static Py_ssize_t -cpu_set_len(Py_cpu_set *set) -{ - return set->ncpus; -} - -static int -_get_cpu(Py_cpu_set *set, const char *requester, PyObject *args) -{ - int cpu; - if (!PyArg_ParseTuple(args, requester, &cpu)) - return -1; - if (cpu < 0) { - PyErr_SetString(PyExc_ValueError, "cpu < 0 not valid"); - return -1; - } - if (cpu >= set->ncpus) { - PyErr_SetString(PyExc_ValueError, "cpu too large for set"); - return -1; - } - return cpu; -} - -PyDoc_STRVAR(cpu_set_set_doc, -"cpu_set.set(i)\n\n\ -Add CPU *i* to the set."); - -static PyObject * -cpu_set_set(Py_cpu_set *set, PyObject *args) -{ - int cpu = _get_cpu(set, "i|set", args); - if (cpu == -1) - return NULL; - CPU_SET_S(cpu, set->size, set->set); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(cpu_set_count_doc, -"cpu_set.count() -> int\n\n\ -Return the number of CPUs active in the set."); - -static PyObject * -cpu_set_count(Py_cpu_set *set, PyObject *noargs) -{ - return PyLong_FromLong(CPU_COUNT_S(set->size, set->set)); -} - -PyDoc_STRVAR(cpu_set_clear_doc, -"cpu_set.clear(i)\n\n\ -Remove CPU *i* from the set."); - -static PyObject * -cpu_set_clear(Py_cpu_set *set, PyObject *args) -{ - int cpu = _get_cpu(set, "i|clear", args); - if (cpu == -1) - return NULL; - CPU_CLR_S(cpu, set->size, set->set); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(cpu_set_isset_doc, -"cpu_set.isset(i) -> bool\n\n\ -Test if CPU *i* is in the set."); - -static PyObject * -cpu_set_isset(Py_cpu_set *set, PyObject *args) -{ - int cpu = _get_cpu(set, "i|isset", args); - if (cpu == -1) - return NULL; - if (CPU_ISSET_S(cpu, set->size, set->set)) - Py_RETURN_TRUE; - Py_RETURN_FALSE; -} - -PyDoc_STRVAR(cpu_set_zero_doc, -"cpu_set.zero()\n\n\ -Clear the cpu_set."); - -static PyObject * -cpu_set_zero(Py_cpu_set *set, PyObject *noargs) -{ - CPU_ZERO_S(set->size, set->set); - Py_RETURN_NONE; -} - -static PyObject * -cpu_set_richcompare(Py_cpu_set *set, Py_cpu_set *other, int op) -{ - int eq; - - if ((op != Py_EQ && op != Py_NE) || Py_TYPE(other) != &cpu_set_type) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - eq = set->ncpus == other->ncpus && CPU_EQUAL_S(set->size, set->set, other->set); - if ((op == Py_EQ) ? eq : !eq) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -} - -#define CPU_SET_BINOP(name, op) \ - static PyObject * \ - do_cpu_set_##name(Py_cpu_set *left, Py_cpu_set *right, Py_cpu_set *res) { \ - if (res) { \ - Py_INCREF(res); \ - } \ - else { \ - res = make_new_cpu_set(&cpu_set_type, left->ncpus); \ - if (!res) \ - return NULL; \ - } \ - if (Py_TYPE(right) != &cpu_set_type || left->ncpus != right->ncpus) { \ - Py_DECREF(res); \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ - } \ - assert(left->size == right->size && right->size == res->size); \ - op(res->size, res->set, left->set, right->set); \ - return (PyObject *)res; \ - } \ - static PyObject * \ - cpu_set_##name(Py_cpu_set *left, Py_cpu_set *right) { \ - return do_cpu_set_##name(left, right, NULL); \ - } \ - static PyObject * \ - cpu_set_i##name(Py_cpu_set *left, Py_cpu_set *right) { \ - return do_cpu_set_##name(left, right, left); \ - } \ - -CPU_SET_BINOP(and, CPU_AND_S) -CPU_SET_BINOP(or, CPU_OR_S) -CPU_SET_BINOP(xor, CPU_XOR_S) -#undef CPU_SET_BINOP - -PyDoc_STRVAR(cpu_set_doc, -"cpu_set(size)\n\n\ -Create an empty mask of CPUs."); - -static PyNumberMethods cpu_set_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_bool*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - (binaryfunc)cpu_set_and, /*nb_and*/ - (binaryfunc)cpu_set_xor, /*nb_xor*/ - (binaryfunc)cpu_set_or, /*nb_or*/ - 0, /*nb_int*/ - 0, /*nb_reserved*/ - 0, /*nb_float*/ - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - (binaryfunc)cpu_set_iand, /*nb_inplace_and*/ - (binaryfunc)cpu_set_ixor, /*nb_inplace_xor*/ - (binaryfunc)cpu_set_ior, /*nb_inplace_or*/ -}; - -static PySequenceMethods cpu_set_as_sequence = { - (lenfunc)cpu_set_len, /* sq_length */ -}; - -static PyMethodDef cpu_set_methods[] = { - {"clear", (PyCFunction)cpu_set_clear, METH_VARARGS, cpu_set_clear_doc}, - {"count", (PyCFunction)cpu_set_count, METH_NOARGS, cpu_set_count_doc}, - {"isset", (PyCFunction)cpu_set_isset, METH_VARARGS, cpu_set_isset_doc}, - {"set", (PyCFunction)cpu_set_set, METH_VARARGS, cpu_set_set_doc}, - {"zero", (PyCFunction)cpu_set_zero, METH_NOARGS, cpu_set_zero_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject cpu_set_type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "posix.cpu_set", /* tp_name */ - sizeof(Py_cpu_set), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)cpu_set_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)cpu_set_repr, /* tp_repr */ - &cpu_set_as_number, /* tp_as_number */ - &cpu_set_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - PyObject_HashNotImplemented, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - cpu_set_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)cpu_set_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - cpu_set_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - cpu_set_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -PyDoc_STRVAR(posix_sched_setaffinity__doc__, -"sched_setaffinity(pid, cpu_set)\n\n\ -Set the affinity of the process with PID *pid* to *cpu_set*."); - -static PyObject * -posix_sched_setaffinity(PyObject *self, PyObject *args) -{ - pid_t pid; - Py_cpu_set *cpu_set; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "O!:schbed_setaffinity", - &pid, &cpu_set_type, &cpu_set)) - return NULL; - if (sched_setaffinity(pid, cpu_set->size, cpu_set->set)) - return posix_error(); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(posix_sched_getaffinity__doc__, -"sched_getaffinity(pid, ncpus) -> cpu_set\n\n\ -Return the affinity of the process with PID *pid*.\n\ -The returned cpu_set will be of size *ncpus*."); - -static PyObject * -posix_sched_getaffinity(PyObject *self, PyObject *args) -{ - pid_t pid; - int ncpus; - Py_cpu_set *res; - - if (!PyArg_ParseTuple(args, _Py_PARSE_PID "i:sched_getaffinity", - &pid, &ncpus)) - return NULL; - res = make_new_cpu_set(&cpu_set_type, ncpus); - if (!res) - return NULL; - if (sched_getaffinity(pid, res->size, res->set)) { - Py_DECREF(res); - return posix_error(); - } - return (PyObject *)res; -} - -#endif /* HAVE_SCHED_SETAFFINITY */ - -#endif /* HAVE_SCHED_H */ - /* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ /* IRIX has both /dev/ptc and /dev/ptmx, use ptmx */ #if defined(HAVE_DEV_PTC) && !defined(HAVE_DEV_PTMX) @@ -10071,30 +9506,6 @@ #ifdef HAVE_FORK {"fork", posix_fork, METH_NOARGS, posix_fork__doc__}, #endif /* HAVE_FORK */ -#ifdef HAVE_SCHED_H - {"sched_get_priority_max", posix_sched_get_priority_max, METH_VARARGS, posix_sched_get_priority_max__doc__}, - {"sched_get_priority_min", posix_sched_get_priority_min, METH_VARARGS, posix_sched_get_priority_min__doc__}, -#ifdef HAVE_SCHED_SETPARAM - {"sched_getparam", posix_sched_getparam, METH_VARARGS, posix_sched_getparam__doc__}, -#endif -#ifdef HAVE_SCHED_SETSCHEDULER - {"sched_getscheduler", posix_sched_getscheduler, METH_VARARGS, posix_sched_getscheduler__doc__}, -#endif -#ifdef HAVE_SCHED_RR_GET_INTERVAL - {"sched_rr_get_interval", posix_sched_rr_get_interval, METH_VARARGS, posix_sched_rr_get_interval__doc__}, -#endif -#ifdef HAVE_SCHED_SETPARAM - {"sched_setparam", posix_sched_setparam, METH_VARARGS, posix_sched_setparam__doc__}, -#endif -#ifdef HAVE_SCHED_SETSCHEDULER - {"sched_setscheduler", posix_sched_setscheduler, METH_VARARGS, posix_sched_setscheduler__doc__}, -#endif - {"sched_yield", posix_sched_yield, METH_NOARGS, posix_sched_yield__doc__}, -#ifdef HAVE_SCHED_SETAFFINITY - {"sched_setaffinity", posix_sched_setaffinity, METH_VARARGS, posix_sched_setaffinity__doc__}, - {"sched_getaffinity", posix_sched_getaffinity, METH_VARARGS, posix_sched_getaffinity__doc__}, -#endif -#endif #if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) {"openpty", posix_openpty, METH_NOARGS, posix_openpty__doc__}, #endif /* HAVE_OPENPTY || HAVE__GETPTY || HAVE_DEV_PTMX */ @@ -10832,24 +10243,6 @@ #endif #endif -#ifdef HAVE_SCHED_H - if (ins(d, "SCHED_FIFO", (long)SCHED_FIFO)) return -1; - if (ins(d, "SCHED_RR", (long)SCHED_RR)) return -1; -#ifdef SCHED_SPORADIC - if (ins(d, "SCHED_SPORADIC", (long)SCHED_SPORADIC) return -1; -#endif - if (ins(d, "SCHED_OTHER", (long)SCHED_OTHER)) return -1; -#ifdef SCHED_BATCH - if (ins(d, "SCHED_BATCH", (long)SCHED_BATCH)) return -1; -#endif -#ifdef SCHED_IDLE - if (ins(d, "SCHED_IDLE", (long)SCHED_IDLE)) return -1; -#endif -#ifdef SCHED_RESET_ON_FORK - if (ins(d, "SCHED_RESET_ON_FORK", (long)SCHED_RESET_ON_FORK)) return -1; -#endif -#endif - #if defined(PYOS_OS2) if (insertvalues(d)) return -1; #endif @@ -10912,13 +10305,6 @@ Py_INCREF(PyExc_OSError); PyModule_AddObject(m, "error", PyExc_OSError); -#ifdef HAVE_SCHED_SETAFFINITY - if (PyType_Ready(&cpu_set_type) < 0) - return NULL; - Py_INCREF(&cpu_set_type); - PyModule_AddObject(m, "cpu_set", (PyObject *)&cpu_set_type); -#endif - #ifdef HAVE_PUTENV if (posix_putenv_garbage == NULL) posix_putenv_garbage = PyDict_New(); @@ -10949,12 +10335,6 @@ ticks_per_second = 60; /* magic fallback value; may be bogus */ # endif #endif - -#if defined(HAVE_SCHED_SETPARAM) || defined(HAVE_SCHED_SETSCHEDULER) - sched_param_desc.name = MODNAME ".sched_param"; - PyStructSequence_InitType(&SchedParamType, &sched_param_desc); - SchedParamType.tp_new = sched_param_new; -#endif } #if defined(HAVE_WAITID) && !defined(__APPLE__) Py_INCREF((PyObject*) &WaitidResultType); @@ -10965,11 +10345,6 @@ Py_INCREF((PyObject*) &StatVFSResultType); PyModule_AddObject(m, "statvfs_result", (PyObject*) &StatVFSResultType); - -#if defined(HAVE_SCHED_SETPARAM) || defined(HAVE_SCHED_SETSCHEDULER) - Py_INCREF(&SchedParamType); - PyModule_AddObject(m, "sched_param", (PyObject *)&SchedParamType); -#endif initialized = 1; #ifdef __APPLE__ diff -r 0c1c9bb590a9 -r bc362109eed8 Tools/scripts/README --- a/Tools/scripts/README Thu Aug 04 17:17:07 2011 +0200 +++ b/Tools/scripts/README Mon Aug 01 17:51:34 2011 -0400 @@ -15,7 +15,7 @@ diff.py Print file diffs in context, unified, or ndiff formats dutree.py Format du(1) output as a tree sorted by size eptags.py Create Emacs TAGS file for Python modules -find_recursionlimit.py Find the maximum recursion limit on this machine +find_recursionlimit.py Find the maximum recursion limit on this machine finddiv.py A grep-like tool that looks for division operators findlinksto.py Recursively find symbolic links to a given path prefix findnocoding.py Find source files which need an encoding declaration @@ -53,7 +53,6 @@ reindent.py Change .py files to use 4-space indents reindent-rst.py Fix-up reStructuredText file whitespace rgrep.py Reverse grep through a file (useful for big logfiles) -run_tests.py Run the test suite with more sensible default options serve.py Small wsgiref-based web server, used in make serve in Doc suff.py Sort a list of files by suffix svneol.py Set svn:eol-style on all files in directory diff -r 0c1c9bb590a9 -r bc362109eed8 Tools/scripts/reindent.py --- a/Tools/scripts/reindent.py Thu Aug 04 17:17:07 2011 +0200 +++ b/Tools/scripts/reindent.py Mon Aug 01 17:51:34 2011 -0400 @@ -52,8 +52,8 @@ recurse = False dryrun = False makebackup = True +"A specified newline to be used in the output (set by --newline option)" spec_newline = None -"""A specified newline to be used in the output (set by --newline option)""" def usage(msg=None): diff -r 0c1c9bb590a9 -r bc362109eed8 Tools/scripts/run_tests.py --- a/Tools/scripts/run_tests.py Thu Aug 04 17:17:07 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -"""Run Python's test suite in a fast, rigorous way. - -The defaults are meant to be reasonably thorough, while skipping certain -tests that can be time-consuming or resource-intensive (e.g. largefile), -or distracting (e.g. audio and gui). These defaults can be overridden by -simply passing a -u option to this script. - -""" - -import os -import sys -import test.support - - -def is_multiprocess_flag(arg): - return arg.startswith('-j') or arg.startswith('--multiprocess') - - -def is_resource_use_flag(arg): - return arg.startswith('-u') or arg.startswith('--use') - - -def main(regrtest_args): - args = [sys.executable, - '-W', 'default', # Warnings set to 'default' - '-bb', # Warnings about bytes/bytearray - '-E', # Ignore environment variables - ] - # Allow user-specified interpreter options to override our defaults. - args.extend(test.support.args_from_interpreter_flags()) - args.extend(['-m', 'test', # Run the test suite - '-r', # Randomize test order - '-w', # Re-run failed tests in verbose mode - ]) - if not any(is_multiprocess_flag(arg) for arg in regrtest_args): - args.extend(['-j', '0']) # Use all CPU cores - if not any(is_resource_use_flag(arg) for arg in regrtest_args): - args.extend(['-u', 'all,-largefile,-audio,-gui']) - args.extend(regrtest_args) - print(' '.join(args)) - os.execv(sys.executable, args) - - -if __name__ == '__main__': - main(sys.argv[1:]) diff -r 0c1c9bb590a9 -r bc362109eed8 configure --- a/configure Thu Aug 04 17:17:07 2011 +0200 +++ b/configure Mon Aug 01 17:51:34 2011 -0400 @@ -6092,7 +6092,7 @@ for ac_header in asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -sched.h shadow.h signal.h stdint.h stropts.h termios.h \ +shadow.h signal.h stdint.h stropts.h termios.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ @@ -9339,7 +9339,6 @@ select sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ setgid sethostname \ setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \ - sched_setaffinity sched_setscheduler sched_setparam sched_rr_get_interval \ sigaction sigaltstack siginterrupt sigpending sigrelse \ sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ @@ -14419,8 +14418,8 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" +config_files="`echo $ac_config_files`" +config_headers="`echo $ac_config_headers`" _ACEOF diff -r 0c1c9bb590a9 -r bc362109eed8 configure.in --- a/configure.in Thu Aug 04 17:17:07 2011 +0200 +++ b/configure.in Mon Aug 01 17:51:34 2011 -0400 @@ -1301,7 +1301,7 @@ AC_CHECK_HEADERS(asm/types.h conio.h curses.h direct.h dlfcn.h errno.h \ fcntl.h grp.h \ ieeefp.h io.h langinfo.h libintl.h ncurses.h poll.h process.h pthread.h \ -sched.h shadow.h signal.h stdint.h stropts.h termios.h \ +shadow.h signal.h stdint.h stropts.h termios.h \ unistd.h utime.h \ sys/audioio.h sys/bsdtty.h sys/epoll.h sys/event.h sys/file.h sys/loadavg.h \ sys/lock.h sys/mkdev.h sys/modem.h \ @@ -2537,7 +2537,6 @@ select sem_open sem_timedwait sem_getvalue sem_unlink sendfile setegid seteuid \ setgid sethostname \ setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \ - sched_setaffinity sched_setscheduler sched_setparam sched_rr_get_interval \ sigaction sigaltstack siginterrupt sigpending sigrelse \ sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ diff -r 0c1c9bb590a9 -r bc362109eed8 pyconfig.h.in --- a/pyconfig.h.in Thu Aug 04 17:17:07 2011 +0200 +++ b/pyconfig.h.in Mon Aug 01 17:51:34 2011 -0400 @@ -650,21 +650,6 @@ /* Define to 1 if you have the `round' function. */ #undef HAVE_ROUND -/* Define to 1 if you have the header file. */ -#undef HAVE_SCHED_H - -/* Define to 1 if you have the `sched_rr_get_interval' function. */ -#undef HAVE_SCHED_RR_GET_INTERVAL - -/* Define to 1 if you have the `sched_setaffinity' function. */ -#undef HAVE_SCHED_SETAFFINITY - -/* Define to 1 if you have the `sched_setparam' function. */ -#undef HAVE_SCHED_SETPARAM - -/* Define to 1 if you have the `sched_setscheduler' function. */ -#undef HAVE_SCHED_SETSCHEDULER - /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT