From loewis@users.sourceforge.net Thu May 1 06:05:11 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 30 Apr 2003 22:05:11 -0700 Subject: [Python-checkins] python/dist/src/Lib DocXMLRPCServer.py,1.2,1.3 SimpleXMLRPCServer.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23617 Modified Files: DocXMLRPCServer.py SimpleXMLRPCServer.py Log Message: Patch #727805: Remove extra line ending from CGI responses. Index: DocXMLRPCServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/DocXMLRPCServer.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DocXMLRPCServer.py 24 Apr 2003 16:02:41 -0000 1.2 --- DocXMLRPCServer.py 1 May 2003 05:05:08 -0000 1.3 *************** *** 15,18 **** --- 15,19 ---- import types import re + import sys from SimpleXMLRPCServer import SimpleXMLRPCServer,\ *************** *** 270,274 **** print 'Content-Length: %d' % len(response) print ! print response def __init__(self): --- 271,275 ---- print 'Content-Length: %d' % len(response) print ! sys.stdout.write(response) def __init__(self): Index: SimpleXMLRPCServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/SimpleXMLRPCServer.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SimpleXMLRPCServer.py 29 Jan 2003 03:49:42 -0000 1.4 --- SimpleXMLRPCServer.py 1 May 2003 05:05:09 -0000 1.5 *************** *** 463,467 **** print 'Content-Length: %d' % len(response) print ! print response def handle_get(self): --- 463,467 ---- print 'Content-Length: %d' % len(response) print ! sys.stdout.write(response) def handle_get(self): *************** *** 486,490 **** print 'Content-Length: %d' % len(response) print ! print response def handle_request(self, request_text = None): --- 486,490 ---- print 'Content-Length: %d' % len(response) print ! sys.stdout.write(reponse) def handle_request(self, request_text = None): From loewis@users.sourceforge.net Thu May 1 06:20:48 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 30 Apr 2003 22:20:48 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.260,1.261 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv27238/Modules Modified Files: socketmodule.c Log Message: Patch #725942: Always rename emulation functions. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.260 retrieving revision 1.261 diff -C2 -d -r1.260 -r1.261 *** socketmodule.c 25 Apr 2003 05:48:32 -0000 1.260 --- socketmodule.c 1 May 2003 05:20:46 -0000 1.261 *************** *** 252,257 **** older releases don't have */ #undef HAVE_GETADDRINFO - /* avoid clashes with the C library definition of the symbol. */ - #define getaddrinfo fake_getaddrinfo #endif #endif --- 252,255 ---- *************** *** 259,265 **** --- 257,268 ---- /* I know this is a bad practice, but it is the easiest... */ #if !defined(HAVE_GETADDRINFO) + /* avoid clashes with the C library definition of the symbol. */ + #define getaddrinfo fake_getaddrinfo + #define gai_strerror fake_gai_strerror + #define freeaddrinfo fake_freeaddrinfo #include "getaddrinfo.c" #endif #if !defined(HAVE_GETNAMEINFO) + #define getnameinfo fake_getnameinfo #include "getnameinfo.c" #endif From loewis@users.sourceforge.net Thu May 1 06:25:32 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 30 Apr 2003 22:25:32 -0700 Subject: [Python-checkins] python/dist/src/Python pystate.c,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv28542 Modified Files: pystate.c Log Message: Patch #729300: Disable error message if Python is not built for threads. Index: pystate.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pystate.c,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** pystate.c 19 Apr 2003 15:41:49 -0000 2.26 --- pystate.c 1 May 2003 05:25:29 -0000 2.27 *************** *** 265,269 **** builds. */ ! #if defined(Py_DEBUG) if (new) { PyThreadState *check = PyGILState_GetThisThreadState(); --- 265,269 ---- builds. */ ! #if defined(Py_DEBUG) && defined(WITH_THREAD) if (new) { PyThreadState *check = PyGILState_GetThisThreadState(); From loewis@users.sourceforge.net Thu May 1 06:47:03 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Wed, 30 Apr 2003 22:47:03 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv1108 Modified Files: _tkinter.c Log Message: Convert tcl objects to strings in getvar/setvar. Fixes #730506. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** _tkinter.c 16 Apr 2003 20:34:55 -0000 1.155 --- _tkinter.c 1 May 2003 05:47:00 -0000 1.156 *************** *** 743,746 **** --- 743,752 ---- } + static char* + PyTclObject_TclString(PyObject *self) + { + return Tcl_GetString(((PyTclObject*)self)->value); + } + /* Like _str, but create Unicode if necessary. */ PyDoc_STRVAR(PyTclObject_string__doc__, *************** *** 1467,1470 **** --- 1473,1492 ---- } VarEvent; + static int + varname_converter(PyObject *in, void *_out) + { + char **out = (char**)_out; + if (PyString_Check(in)) { + *out = PyString_AsString(in); + return 1; + } + if (PyTclObject_Check(in)) { + *out = PyTclObject_TclString(in); + return 1; + } + /* XXX: Should give diagnostics. */ + return 0; + } + void var_perform(VarEvent *ev) *************** *** 1543,1547 **** Tcl_Obj *newval, *ok; ! if (PyArg_ParseTuple(args, "sO:setvar", &name1, &newValue)) { /* XXX Acquire tcl lock??? */ newval = AsObj(newValue); --- 1565,1570 ---- Tcl_Obj *newval, *ok; ! if (PyArg_ParseTuple(args, "O&O:setvar", ! varname_converter, &name1, &newValue)) { /* XXX Acquire tcl lock??? */ newval = AsObj(newValue); *************** *** 1605,1609 **** Tcl_Obj *tres; ! if (!PyArg_ParseTuple(args, "s|s:getvar", &name1, &name2)) return NULL; --- 1628,1633 ---- Tcl_Obj *tres; ! if (!PyArg_ParseTuple(args, "O&|s:getvar", ! varname_converter, &name1, &name2)) return NULL; From doerwalter@users.sourceforge.net Thu May 1 14:12:37 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 01 May 2003 06:12:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bool.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16487/Lib/test Modified Files: test_bool.py Log Message: Consistently use test_support.foo everywhere. Remove the last use of veris(). Remove now useless imports and functions. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_bool.py 27 Apr 2003 07:54:23 -0000 1.10 --- test_bool.py 1 May 2003 13:12:34 -0000 1.11 *************** *** 6,19 **** import os - from test.test_support import verbose, TestFailed, TESTFN, vereq, have_unicode - - def veris(a, b): - if a is not b: - raise TestFailed, "%r is %r" % (a, b) - - def verisnot(a, b): - if a is b: - raise TestFailed, "%r is %r" % (a, b) - class BoolTest(unittest.TestCase): --- 6,9 ---- *************** *** 218,222 **** self.assertIs("xyz".startswith("z"), False) ! if have_unicode: self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) --- 208,212 ---- self.assertIs("xyz".startswith("z"), False) ! if test_support.have_unicode: self.assertIs(unicode("xyz", 'ascii').endswith(unicode("z", 'ascii')), True) self.assertIs(unicode("xyz", 'ascii').endswith(unicode("x", 'ascii')), False) *************** *** 257,266 **** def test_fileclosed(self): try: ! f = file(TESTFN, "w") self.assertIs(f.closed, False) f.close() self.assertIs(f.closed, True) finally: ! os.remove(TESTFN) def test_operator(self): --- 247,256 ---- def test_fileclosed(self): try: ! f = file(test_support.TESTFN, "w") self.assertIs(f.closed, False) f.close() self.assertIs(f.closed, True) finally: ! os.remove(test_support.TESTFN) def test_operator(self): *************** *** 289,294 **** def test_marshal(self): import marshal ! veris(marshal.loads(marshal.dumps(True)), True) ! veris(marshal.loads(marshal.dumps(False)), False) def test_pickle(self): --- 279,284 ---- def test_marshal(self): import marshal ! self.assertIs(marshal.loads(marshal.dumps(True)), True) ! self.assertIs(marshal.loads(marshal.dumps(False)), False) def test_pickle(self): From doerwalter@users.sourceforge.net Thu May 1 18:46:11 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 01 May 2003 10:46:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_StringIO.py,1.15,1.16 test___all__.py,1.29,1.30 test_base64.py,1.5,1.6 test_bisect.py,1.8,1.9 test_bool.py,1.11,1.12 test_builtin.py,1.18,1.19 test_bz2.py,1.13,1.14 test_calendar.py,1.4,1.5 test_call.py,1.3,1.4 test_cfgparser.py,1.19,1.20 test_charmapcodec.py,1.6,1.7 test_codeccallbacks.py,1.11,1.12 test_codecs.py,1.8,1.9 test_copy.py,1.7,1.8 test_cpickle.py,1.14,1.15 test_csv.py,1.5,1.6 test_dummy_thread.py,1.3,1.4 test_enumerate.py,1.3,1.4 test_filecmp.py,1.1,1.2 test_getargs2.py,1.4,1.5 test_grp.py,1.15,1.16 test_hexoct.py,1.3,1.4 test_hmac.py,1.6,1.7 test_isinstance.py,1.6,1.7 test_itertools.py,1.5,1.6 test_optparse.py,1.1,1.2 test_os.py,1.17,1.18 test_parser.py,1.16,1.17 test_pep277.py,1.5,1.6 test_pickle.py,1.17,1.18 test_posix.py,1.5,1.6 test_pow.py,1.17,1.18 test_profilehooks.py,1.9,1.10 test_pwd.py,1.16,1.17 test_re.py,1.41,1.42 test_richcmp.py,1.8,1.9 test_sets.py,1.23,1.24 test_shelve.py,1.4,1.5 test_shutil.py,1.1,1.2 test_socket.py,1.63,1.64 test_str.py,1.2,1.3 test_string.py,1.24,1.25 test_strptime.py,1.12,1.13 test_support.py,1.51,1.52 test_sys.py,1.6,1.7 test_tarfile.py,1.7,1.8 test_tempfile.py,1.13,1.14 test_textwrap.py,1.18,1.19 test_timeout.py,1.13,1.14 test_trace.py,1.8,1.9 test_ucn.py,1.13,1.14 test_unicode.py,1.82,1.83 test_unicodedata.py,1.8,1.9 test_univnewlines.py,1.4,1.5 test_urllib.py,1.12,1.13 test_urllibnet.py,1.1,1.2 test_userdict.py,1.14,1.15 test_userlist.py,1.8,1.9 test_userstring.py,1.10,1.11 test_weakref.py,1.22,1.23 test_xpickle.py,1.3,1.4 test_zipimport.py,1.7,1.8 test_zlib.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18305 Modified Files: test_StringIO.py test___all__.py test_base64.py test_bisect.py test_bool.py test_builtin.py test_bz2.py test_calendar.py test_call.py test_cfgparser.py test_charmapcodec.py test_codeccallbacks.py test_codecs.py test_copy.py test_cpickle.py test_csv.py test_dummy_thread.py test_enumerate.py test_filecmp.py test_getargs2.py test_grp.py test_hexoct.py test_hmac.py test_isinstance.py test_itertools.py test_optparse.py test_os.py test_parser.py test_pep277.py test_pickle.py test_posix.py test_pow.py test_profilehooks.py test_pwd.py test_re.py test_richcmp.py test_sets.py test_shelve.py test_shutil.py test_socket.py test_str.py test_string.py test_strptime.py test_support.py test_sys.py test_tarfile.py test_tempfile.py test_textwrap.py test_timeout.py test_trace.py test_ucn.py test_unicode.py test_unicodedata.py test_univnewlines.py test_urllib.py test_urllibnet.py test_userdict.py test_userlist.py test_userstring.py test_weakref.py test_xpickle.py test_zipimport.py test_zlib.py Log Message: Combine the functionality of test_support.run_unittest() and test_support.run_classtests() into run_unittest() and use it wherever possible. Also don't use "from test.test_support import ...", but "from test import test_support" in a few spots. >From SF patch #662807. Index: test_StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_StringIO.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_StringIO.py 24 Apr 2003 15:50:10 -0000 1.15 --- test_StringIO.py 1 May 2003 17:45:30 -0000 1.16 *************** *** 106,113 **** def test_main(): ! test_support.run_unittest(TestStringIO) ! test_support.run_unittest(TestcStringIO) ! test_support.run_unittest(TestBufferStringIO) ! test_support.run_unittest(TestBuffercStringIO) if __name__ == '__main__': --- 106,115 ---- def test_main(): ! test_support.run_unittest( ! TestStringIO, ! TestcStringIO, ! TestBufferStringIO, ! TestBuffercStringIO ! ) if __name__ == '__main__': Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** test___all__.py 15 Apr 2003 11:10:33 -0000 1.29 --- test___all__.py 1 May 2003 17:45:31 -0000 1.30 *************** *** 193,199 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(AllTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 193,197 ---- def test_main(): ! test_support.run_unittest(AllTest) if __name__ == "__main__": Index: test_base64.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_base64.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_base64.py 22 Aug 2002 19:18:56 -0000 1.5 --- test_base64.py 1 May 2003 17:45:31 -0000 1.6 *************** *** 1,15 **** ! from unittest import TestCase ! from test.test_support import vereq, run_unittest ! from base64 import encodestring, decodestring ! class Base64TestCase(TestCase): def test_encodestring(self): ! vereq(encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n") ! vereq(encodestring("a"), "YQ==\n") ! vereq(encodestring("ab"), "YWI=\n") ! vereq(encodestring("abc"), "YWJj\n") ! vereq(encodestring(""), "") ! vereq(encodestring("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789!@#0^&*();:<>,. []{}"), --- 1,15 ---- ! import unittest ! from test import test_support ! import base64 ! class Base64TestCase(unittest.TestCase): def test_encodestring(self): ! self.assertEqual(base64.encodestring("www.python.org"), "d3d3LnB5dGhvbi5vcmc=\n") ! self.assertEqual(base64.encodestring("a"), "YQ==\n") ! self.assertEqual(base64.encodestring("ab"), "YWI=\n") ! self.assertEqual(base64.encodestring("abc"), "YWJj\n") ! self.assertEqual(base64.encodestring(""), "") ! self.assertEqual(base64.encodestring("abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789!@#0^&*();:<>,. []{}"), *************** *** 19,27 **** def test_decodestring(self): ! vereq(decodestring("d3d3LnB5dGhvbi5vcmc=\n"), "www.python.org") ! vereq(decodestring("YQ==\n"), "a") ! vereq(decodestring("YWI=\n"), "ab") ! vereq(decodestring("YWJj\n"), "abc") ! vereq(decodestring("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), --- 19,27 ---- def test_decodestring(self): ! self.assertEqual(base64.decodestring("d3d3LnB5dGhvbi5vcmc=\n"), "www.python.org") ! self.assertEqual(base64.decodestring("YQ==\n"), "a") ! self.assertEqual(base64.decodestring("YWI=\n"), "ab") ! self.assertEqual(base64.decodestring("YWJj\n"), "abc") ! self.assertEqual(base64.decodestring("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" "RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" "Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), *************** *** 29,36 **** "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789!@#0^&*();:<>,. []{}") ! vereq(decodestring(''), '') def test_main(): ! run_unittest(Base64TestCase) if __name__ == "__main__": --- 29,36 ---- "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789!@#0^&*();:<>,. []{}") ! self.assertEqual(base64.decodestring(''), '') def test_main(): ! test_support.run_unittest(Base64TestCase) if __name__ == "__main__": Index: test_bisect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bisect.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_bisect.py 27 Apr 2003 07:54:23 -0000 1.8 --- test_bisect.py 1 May 2003 17:45:32 -0000 1.9 *************** *** 199,204 **** def test_main(verbose=None): from test import test_bisect ! test_support.run_classtests(TestBisect, ! TestInsort) test_support.run_doctest(test_bisect, verbose) --- 199,203 ---- def test_main(verbose=None): from test import test_bisect ! test_support.run_unittest(TestBisect, TestInsort) test_support.run_doctest(test_bisect, verbose) Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_bool.py 1 May 2003 13:12:34 -0000 1.11 --- test_bool.py 1 May 2003 17:45:32 -0000 1.12 *************** *** 322,326 **** def test_main(): ! test_support.run_classtests(BoolTest) if __name__ == "__main__": --- 322,326 ---- def test_main(): ! test_support.run_unittest(BoolTest) if __name__ == "__main__": Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_builtin.py 22 Apr 2003 08:12:30 -0000 1.18 --- test_builtin.py 1 May 2003 17:45:33 -0000 1.19 *************** *** 1220,1226 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(BuiltinTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 1220,1224 ---- def test_main(): ! test.test_support.run_unittest(BuiltinTest) if __name__ == "__main__": Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_bz2.py 29 Apr 2003 14:53:08 -0000 1.13 --- test_bz2.py 1 May 2003 17:45:34 -0000 1.14 *************** *** 310,320 **** def test_main(): ! suite = unittest.TestSuite() ! for test in (BZ2FileTest, ! BZ2CompressorTest, ! BZ2DecompressorTest, ! FuncTest): ! suite.addTest(unittest.makeSuite(test)) ! test_support.run_suite(suite) if __name__ == '__main__': --- 310,319 ---- def test_main(): ! test_support.run_unittest( ! BZ2FileTest, ! BZ2CompressorTest, ! BZ2DecompressorTest, ! FuncTest ! ) if __name__ == '__main__': Index: test_calendar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_calendar.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_calendar.py 23 Jul 2002 19:03:45 -0000 1.4 --- test_calendar.py 1 May 2003 17:45:34 -0000 1.5 *************** *** 2,6 **** import unittest ! from test.test_support import run_unittest --- 2,6 ---- import unittest ! from test import test_support *************** *** 56,60 **** def test_main(): ! run_unittest(CalendarTestCase) if __name__ == "__main__": --- 56,60 ---- def test_main(): ! test_support.run_unittest(CalendarTestCase) if __name__ == "__main__": Index: test_call.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_call.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_call.py 23 Jul 2002 19:03:45 -0000 1.3 --- test_call.py 1 May 2003 17:45:34 -0000 1.4 *************** *** 1,4 **** import unittest ! from test.test_support import run_unittest # The test cases here cover several paths through the function calling --- 1,4 ---- import unittest ! from test import test_support # The test cases here cover several paths through the function calling *************** *** 125,129 **** def test_main(): ! run_unittest(CFunctionCalls) --- 125,129 ---- def test_main(): ! test_support.run_unittest(CFunctionCalls) Index: test_cfgparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cfgparser.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_cfgparser.py 31 Dec 2002 06:57:25 -0000 1.19 --- test_cfgparser.py 1 May 2003 17:45:34 -0000 1.20 *************** *** 323,331 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTests([unittest.makeSuite(ConfigParserTestCase), ! unittest.makeSuite(RawConfigParserTestCase), ! unittest.makeSuite(SafeConfigParserTestCase)]) ! test_support.run_suite(suite) if __name__ == "__main__": --- 323,331 ---- def test_main(): ! test_support.run_unittest( ! ConfigParserTestCase, ! RawConfigParserTestCase, ! SafeConfigParserTestCase ! ) if __name__ == "__main__": Index: test_charmapcodec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_charmapcodec.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_charmapcodec.py 14 Feb 2003 11:21:53 -0000 1.6 --- test_charmapcodec.py 1 May 2003 17:45:35 -0000 1.7 *************** *** 40,46 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(CharmapCodecTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 40,44 ---- def test_main(): ! test.test_support.run_unittest(CharmapCodecTest) if __name__ == "__main__": Index: test_codeccallbacks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeccallbacks.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_codeccallbacks.py 29 Apr 2003 20:59:55 -0000 1.11 --- test_codeccallbacks.py 1 May 2003 17:45:36 -0000 1.12 *************** *** 660,666 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(CodecCallbackTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 660,664 ---- def test_main(): ! test.test_support.run_unittest(CodecCallbackTest) if __name__ == "__main__": Index: test_codecs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codecs.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_codecs.py 24 Apr 2003 16:02:51 -0000 1.8 --- test_codecs.py 1 May 2003 17:45:36 -0000 1.9 *************** *** 334,344 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UTF16Test)) ! suite.addTest(unittest.makeSuite(EscapeDecodeTest)) ! suite.addTest(unittest.makeSuite(RecodingTest)) ! suite.addTest(unittest.makeSuite(PunycodeTest)) ! suite.addTest(unittest.makeSuite(NameprepTest)) ! test_support.run_suite(suite) --- 334,344 ---- def test_main(): ! test_support.run_unittest( ! UTF16Test, ! EscapeDecodeTest, ! RecodingTest, ! PunycodeTest, ! NameprepTest ! ) Index: test_copy.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_copy.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_copy.py 19 Feb 2003 01:19:28 -0000 1.7 --- test_copy.py 1 May 2003 17:45:36 -0000 1.8 *************** *** 517,523 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestCopy)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 517,521 ---- def test_main(): ! test_support.run_unittest(TestCopy) if __name__ == "__main__": Index: test_cpickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_cpickle.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_cpickle.py 21 Feb 2003 20:14:35 -0000 1.14 --- test_cpickle.py 1 May 2003 17:45:36 -0000 1.15 *************** *** 93,103 **** def test_main(): ! loader = unittest.TestLoader() ! suite = unittest.TestSuite() ! suite.addTest(loader.loadTestsFromTestCase(cPickleTests)) ! suite.addTest(loader.loadTestsFromTestCase(cPicklePicklerTests)) ! suite.addTest(loader.loadTestsFromTestCase(cPickleListPicklerTests)) ! suite.addTest(loader.loadTestsFromTestCase(cPickleFastPicklerTests)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 93,102 ---- def test_main(): ! test_support.run_unittest( ! cPickleTests, ! cPicklePicklerTests, ! cPickleListPicklerTests, ! cPickleFastPicklerTests ! ) if __name__ == "__main__": Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_csv.py 25 Apr 2003 14:43:14 -0000 1.5 --- test_csv.py 1 May 2003 17:45:36 -0000 1.6 *************** *** 7,11 **** import csv import gc ! from test.test_support import verbose class Test_Csv(unittest.TestCase): --- 7,11 ---- import csv import gc ! from test import test_support class Test_Csv(unittest.TestCase): *************** *** 569,573 **** if not hasattr(sys, "gettotalrefcount"): ! if verbose: print "*** skipping leakage tests ***" else: class NUL: --- 569,573 ---- if not hasattr(sys, "gettotalrefcount"): ! if test_support.verbose: print "*** skipping leakage tests ***" else: class NUL: *************** *** 641,654 **** self.assertEqual(delta < 5, True) ! def _testclasses(): mod = sys.modules[__name__] ! return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] ! ! def suite(): ! suite = unittest.TestSuite() ! for testclass in _testclasses(): ! suite.addTest(unittest.makeSuite(testclass)) ! return suite if __name__ == '__main__': ! unittest.main(defaultTest='suite') --- 641,650 ---- self.assertEqual(delta < 5, True) ! def test_main(): mod = sys.modules[__name__] ! test_support.run_unittest( ! *[getattr(mod, name) for name in dir(mod) if name.startswith('Test')] ! ) if __name__ == '__main__': ! test_main() Index: test_dummy_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_dummy_thread.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_dummy_thread.py 30 Apr 2003 03:03:37 -0000 1.3 --- test_dummy_thread.py 1 May 2003 17:45:36 -0000 1.4 *************** *** 163,171 **** print print "*** Using %s as _thread module ***" % _thread ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(LockTests)) ! suite.addTest(unittest.makeSuite(MiscTests)) ! suite.addTest(unittest.makeSuite(ThreadTests)) ! test_support.run_suite(suite) if __name__ == '__main__': --- 163,167 ---- print print "*** Using %s as _thread module ***" % _thread ! test_support.run_unittest(LockTests, MiscTests, ThreadTests) if __name__ == '__main__': Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_enumerate.py 23 Jul 2002 19:03:50 -0000 1.3 --- test_enumerate.py 1 May 2003 17:45:37 -0000 1.4 *************** *** 105,116 **** enum = MyEnum - def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(EnumerateTestCase)) - suite.addTest(unittest.makeSuite(SubclassTestCase)) - return suite - def test_main(): ! test_support.run_suite(suite()) if __name__ == "__main__": --- 105,110 ---- enum = MyEnum def test_main(): ! test_support.run_unittest(EnumerateTestCase, SubclassTestCase) if __name__ == "__main__": Index: test_filecmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_filecmp.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_filecmp.py 6 Feb 2003 17:42:45 -0000 1.1 --- test_filecmp.py 1 May 2003 17:45:37 -0000 1.2 *************** *** 120,127 **** def test_main(): ! suite = unittest.TestSuite() ! for cls in FileCompareTestCase, DirCompareTestCase: ! suite.addTest(unittest.makeSuite(cls)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 120,124 ---- def test_main(): ! test_support.run_unittest(FileCompareTestCase, DirCompareTestCase) if __name__ == "__main__": Index: test_getargs2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_getargs2.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_getargs2.py 24 Apr 2003 16:15:29 -0000 1.4 --- test_getargs2.py 1 May 2003 17:45:37 -0000 1.5 *************** *** 224,230 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(Signed_TestCase)) ! suite.addTest(unittest.makeSuite(Unsigned_TestCase)) try: from _testcapi import getargs_L, getargs_K --- 224,228 ---- def test_main(): ! tests = [Signed_TestCase, Unsigned_TestCase] try: from _testcapi import getargs_L, getargs_K *************** *** 232,237 **** pass # PY_LONG_LONG not available else: ! suite.addTest(unittest.makeSuite(LongLong_TestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 230,235 ---- pass # PY_LONG_LONG not available else: ! tests.append(LongLong_TestCase) ! test_support.run_unittest(*tests) if __name__ == "__main__": Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_grp.py 23 Apr 2003 19:50:24 -0000 1.15 --- test_grp.py 1 May 2003 17:45:37 -0000 1.16 *************** *** 98,104 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(GroupDatabaseTestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 98,102 ---- def test_main(): ! test_support.run_unittest(GroupDatabaseTestCase) if __name__ == "__main__": Index: test_hexoct.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hexoct.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_hexoct.py 18 Feb 2003 15:45:44 -0000 1.3 --- test_hexoct.py 1 May 2003 17:45:37 -0000 1.4 *************** *** 119,125 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TextHexOct)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 119,123 ---- def test_main(): ! test_support.run_unittest(TextHexOct) if __name__ == "__main__": Index: test_hmac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hmac.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_hmac.py 22 Aug 2002 19:38:14 -0000 1.6 --- test_hmac.py 1 May 2003 17:45:37 -0000 1.7 *************** *** 104,113 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestVectorsTestCase)) ! suite.addTest(unittest.makeSuite(ConstructorTestCase)) ! suite.addTest(unittest.makeSuite(SanityTestCase)) ! suite.addTest(unittest.makeSuite(CopyTestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 104,113 ---- def test_main(): ! test_support.run_unittest( ! TestVectorsTestCase, ! ConstructorTestCase, ! SanityTestCase, ! CopyTestCase ! ) if __name__ == "__main__": Index: test_isinstance.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_isinstance.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_isinstance.py 12 Dec 2002 19:14:07 -0000 1.6 --- test_isinstance.py 1 May 2003 17:45:37 -0000 1.7 *************** *** 249,257 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestIsInstanceExceptions)) ! suite.addTest(unittest.makeSuite(TestIsSubclassExceptions)) ! suite.addTest(unittest.makeSuite(TestIsInstanceIsSubclass)) ! test_support.run_suite(suite) --- 249,257 ---- def test_main(): ! test_support.run_unittest( ! TestIsInstanceExceptions, ! TestIsSubclassExceptions, ! TestIsInstanceIsSubclass ! ) Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_itertools.py 23 Feb 2003 04:40:07 -0000 1.5 --- test_itertools.py 1 May 2003 17:45:37 -0000 1.6 *************** *** 163,169 **** import test_itertools suite = unittest.TestSuite() ! for testclass in (TestBasicOps, ! ): ! suite.addTest(unittest.makeSuite(testclass)) test_support.run_suite(suite) test_support.run_doctest(test_itertools, verbose) --- 163,167 ---- import test_itertools suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestBasicOps)) test_support.run_suite(suite) test_support.run_doctest(test_itertools, verbose) Index: test_optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_optparse.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_optparse.py 21 Apr 2003 02:41:25 -0000 1.1 --- test_optparse.py 1 May 2003 17:45:38 -0000 1.2 *************** *** 1194,1209 **** funcargs=[s, wordmap]) - def _testclasses(): - mod = sys.modules[__name__] - return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] - - def suite(): - suite = unittest.TestSuite() - for testclass in _testclasses(): - suite.addTest(unittest.makeSuite(testclass)) - return suite - def test_main(): ! test_support.run_suite(suite()) if __name__ == '__main__': --- 1194,1202 ---- funcargs=[s, wordmap]) def test_main(): ! mod = sys.modules[__name__] ! test_support.run_unittest( ! *[getattr(mod, name) for name in dir(mod) if name.startswith('Test')] ! ) if __name__ == '__main__': Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_os.py 28 Apr 2003 03:13:03 -0000 1.17 --- test_os.py 1 May 2003 17:45:43 -0000 1.18 *************** *** 6,24 **** import unittest import warnings warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__) warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) - from test.test_support import TESTFN, run_classtests - class TemporaryFileTests(unittest.TestCase): def setUp(self): self.files = [] ! os.mkdir(TESTFN) def tearDown(self): for name in self.files: os.unlink(name) ! os.rmdir(TESTFN) def check_tempfile(self, name): --- 6,23 ---- import unittest import warnings + from test import test_support warnings.filterwarnings("ignore", "tempnam", RuntimeWarning, __name__) warnings.filterwarnings("ignore", "tmpnam", RuntimeWarning, __name__) class TemporaryFileTests(unittest.TestCase): def setUp(self): self.files = [] ! os.mkdir(test_support.TESTFN) def tearDown(self): for name in self.files: os.unlink(name) ! os.rmdir(test_support.TESTFN) def check_tempfile(self, name): *************** *** 37,44 **** self.check_tempfile(os.tempnam()) ! name = os.tempnam(TESTFN) self.check_tempfile(name) ! name = os.tempnam(TESTFN, "pfx") self.assert_(os.path.basename(name)[:3] == "pfx") self.check_tempfile(name) --- 36,43 ---- self.check_tempfile(os.tempnam()) ! name = os.tempnam(test_support.TESTFN) self.check_tempfile(name) ! name = os.tempnam(test_support.TESTFN, "pfx") self.assert_(os.path.basename(name)[:3] == "pfx") self.check_tempfile(name) *************** *** 85,90 **** class StatAttributeTests(unittest.TestCase): def setUp(self): ! os.mkdir(TESTFN) ! self.fname = os.path.join(TESTFN, "f1") f = open(self.fname, 'wb') f.write("ABC") --- 84,89 ---- class StatAttributeTests(unittest.TestCase): def setUp(self): ! os.mkdir(test_support.TESTFN) ! self.fname = os.path.join(test_support.TESTFN, "f1") f = open(self.fname, 'wb') f.write("ABC") *************** *** 93,97 **** def tearDown(self): os.unlink(self.fname) ! os.rmdir(TESTFN) def test_stat_attributes(self): --- 92,96 ---- def tearDown(self): os.unlink(self.fname) ! os.rmdir(test_support.TESTFN) def test_stat_attributes(self): *************** *** 239,246 **** # SUB2/ just a file kid # tmp3 ! sub1_path = join(TESTFN, "SUB1") sub11_path = join(sub1_path, "SUB11") ! sub2_path = join(TESTFN, "SUB2") ! tmp1_path = join(TESTFN, "tmp1") tmp2_path = join(sub1_path, "tmp2") tmp3_path = join(sub2_path, "tmp3") --- 238,245 ---- # SUB2/ just a file kid # tmp3 ! sub1_path = join(test_support.TESTFN, "SUB1") sub11_path = join(sub1_path, "SUB11") ! sub2_path = join(test_support.TESTFN, "SUB2") ! tmp1_path = join(test_support.TESTFN, "tmp1") tmp2_path = join(sub1_path, "tmp2") tmp3_path = join(sub2_path, "tmp3") *************** *** 255,259 **** # Walk top-down. ! all = list(os.walk(TESTFN)) self.assertEqual(len(all), 4) # We can't know which order SUB1 and SUB2 will appear in. --- 254,258 ---- # Walk top-down. ! all = list(os.walk(test_support.TESTFN)) self.assertEqual(len(all), 4) # We can't know which order SUB1 and SUB2 will appear in. *************** *** 262,266 **** flipped = all[0][1][0] != "SUB1" all[0][1].sort() ! self.assertEqual(all[0], (TESTFN, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) self.assertEqual(all[2 + flipped], (sub11_path, [], [])) --- 261,265 ---- flipped = all[0][1][0] != "SUB1" all[0][1].sort() ! self.assertEqual(all[0], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[1 + flipped], (sub1_path, ["SUB11"], ["tmp2"])) self.assertEqual(all[2 + flipped], (sub11_path, [], [])) *************** *** 269,273 **** # Prune the search. all = [] ! for root, dirs, files in os.walk(TESTFN): all.append((root, dirs, files)) # Don't descend into SUB1. --- 268,272 ---- # Prune the search. all = [] ! for root, dirs, files in os.walk(test_support.TESTFN): all.append((root, dirs, files)) # Don't descend into SUB1. *************** *** 276,284 **** dirs.remove('SUB1') self.assertEqual(len(all), 2) ! self.assertEqual(all[0], (TESTFN, ["SUB2"], ["tmp1"])) self.assertEqual(all[1], (sub2_path, [], ["tmp3"])) # Walk bottom-up. ! all = list(os.walk(TESTFN, topdown=False)) self.assertEqual(len(all), 4) # We can't know which order SUB1 and SUB2 will appear in. --- 275,283 ---- dirs.remove('SUB1') self.assertEqual(len(all), 2) ! self.assertEqual(all[0], (test_support.TESTFN, ["SUB2"], ["tmp1"])) self.assertEqual(all[1], (sub2_path, [], ["tmp3"])) # Walk bottom-up. ! all = list(os.walk(test_support.TESTFN, topdown=False)) self.assertEqual(len(all), 4) # We can't know which order SUB1 and SUB2 will appear in. *************** *** 287,291 **** flipped = all[3][1][0] != "SUB1" all[3][1].sort() ! self.assertEqual(all[3], (TESTFN, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[flipped], (sub11_path, [], [])) self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) --- 286,290 ---- flipped = all[3][1][0] != "SUB1" all[3][1].sort() ! self.assertEqual(all[3], (test_support.TESTFN, ["SUB1", "SUB2"], ["tmp1"])) self.assertEqual(all[flipped], (sub11_path, [], [])) self.assertEqual(all[flipped + 1], (sub1_path, ["SUB11"], ["tmp2"])) *************** *** 296,311 **** # (not so) subtlety is that rmdir will fail unless the dir's # kids are removed first, so bottom up is essential. ! for root, dirs, files in os.walk(TESTFN, topdown=False): for name in files: os.remove(join(root, name)) for name in dirs: os.rmdir(join(root, name)) ! os.rmdir(TESTFN) def test_main(): ! run_classtests(TemporaryFileTests, ! StatAttributeTests, ! EnvironTests, ! WalkTests) if __name__ == "__main__": --- 295,312 ---- # (not so) subtlety is that rmdir will fail unless the dir's # kids are removed first, so bottom up is essential. ! for root, dirs, files in os.walk(test_support.TESTFN, topdown=False): for name in files: os.remove(join(root, name)) for name in dirs: os.rmdir(join(root, name)) ! os.rmdir(test_support.TESTFN) def test_main(): ! test_support.run_unittest( ! TemporaryFileTests, ! StatAttributeTests, ! EnvironTests, ! WalkTests ! ) if __name__ == "__main__": Index: test_parser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_parser.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_parser.py 19 Feb 2003 02:35:06 -0000 1.16 --- test_parser.py 1 May 2003 17:45:44 -0000 1.17 *************** *** 375,383 **** def test_main(): ! loader = unittest.TestLoader() ! suite = unittest.TestSuite() ! suite.addTest(loader.loadTestsFromTestCase(RoundtripLegalSyntaxTestCase)) ! suite.addTest(loader.loadTestsFromTestCase(IllegalSyntaxTestCase)) ! test_support.run_suite(suite) --- 375,382 ---- def test_main(): ! test_support.run_unittest( ! RoundtripLegalSyntaxTestCase, ! IllegalSyntaxTestCase ! ) Index: test_pep277.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pep277.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_pep277.py 9 Nov 2002 05:26:15 -0000 1.5 --- test_pep277.py 1 May 2003 17:45:44 -0000 1.6 *************** *** 2,8 **** # open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir import os, unittest ! from test.test_support import TESTFN, TestSkipped, TestFailed, run_suite if not os.path.supports_unicode_filenames: ! raise TestSkipped, "test works only on NT+" filenames = [ --- 2,8 ---- # open, os.open, os.stat. os.listdir, os.rename, os.remove, os.mkdir, os.chdir, os.rmdir import os, unittest ! from test import test_support if not os.path.supports_unicode_filenames: ! raise test_support.TestSkipped, "test works only on NT+" filenames = [ *************** *** 29,37 **** class UnicodeFileTests(unittest.TestCase): ! files = [os.path.join(TESTFN, f) for f in filenames] def setUp(self): try: ! os.mkdir(TESTFN) except OSError: pass --- 29,37 ---- class UnicodeFileTests(unittest.TestCase): ! files = [os.path.join(test_support.TESTFN, f) for f in filenames] def setUp(self): try: ! os.mkdir(test_support.TESTFN) except OSError: pass *************** *** 43,47 **** def tearDown(self): ! deltree(TESTFN) def _apply_failure(self, fn, filename, expected_exception, --- 43,47 ---- def tearDown(self): ! deltree(test_support.TESTFN) def _apply_failure(self, fn, filename, expected_exception, *************** *** 49,57 **** try: fn(filename) ! raise TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: if check_fn_in_exception and details.filename != filename: ! raise TestFailed("Function '%s(%r) failed with " "bad filename in the exception: %r" % (fn.__name__, filename, --- 49,57 ---- try: fn(filename) ! raise test_support.TestFailed("Expected to fail calling '%s(%r)'" % (fn.__name__, filename)) except expected_exception, details: if check_fn_in_exception and details.filename != filename: ! raise test_support.TestFailed("Function '%s(%r) failed with " "bad filename in the exception: %r" % (fn.__name__, filename, *************** *** 78,84 **** def test_listdir(self): ! f1 = os.listdir(TESTFN) f1.sort() ! f2 = os.listdir(unicode(TESTFN,"mbcs")) f2.sort() print f1 --- 78,84 ---- def test_listdir(self): ! f1 = os.listdir(test_support.TESTFN) f1.sort() ! f2 = os.listdir(unicode(test_support.TESTFN,"mbcs")) f2.sort() print f1 *************** *** 91,95 **** def test_directory(self): ! dirname = os.path.join(TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() --- 91,95 ---- def test_directory(self): ! dirname = os.path.join(test_support.TESTFN,u'Gr\xfc\xdf-\u66e8\u66e9\u66eb') filename = u'\xdf-\u66e8\u66e9\u66eb' oldwd = os.getcwd() *************** *** 105,114 **** def test_main(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(UnicodeFileTests)) try: ! run_suite(suite) finally: ! deltree(TESTFN) if __name__ == "__main__": --- 105,112 ---- def test_main(): try: ! test_support.run_unittest(UnicodeFileTests) finally: ! deltree(test_support.TESTFN) if __name__ == "__main__": Index: test_pickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pickle.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_pickle.py 15 Feb 2003 03:01:09 -0000 1.17 --- test_pickle.py 1 May 2003 17:45:44 -0000 1.18 *************** *** 63,72 **** def test_main(): ! loader = unittest.TestLoader() ! suite = unittest.TestSuite() ! suite.addTest(loader.loadTestsFromTestCase(PickleTests)) ! suite.addTest(loader.loadTestsFromTestCase(PicklerTests)) ! suite.addTest(loader.loadTestsFromTestCase(PersPicklerTests)) ! test_support.run_suite(suite) test_support.run_doctest(pickle) --- 63,71 ---- def test_main(): ! test_support.run_unittest( ! PickleTests, ! PicklerTests, ! PersPicklerTests ! ) test_support.run_doctest(pickle) Index: test_posix.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_posix.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_posix.py 18 Mar 2003 13:30:14 -0000 1.5 --- test_posix.py 1 May 2003 17:45:45 -0000 1.6 *************** *** 1,10 **** "Test posix functions" ! from test.test_support import TestSkipped, TestFailed, TESTFN, run_suite try: import posix except ImportError: ! raise TestSkipped, "posix is not available" import time --- 1,10 ---- "Test posix functions" ! from test import test_support try: import posix except ImportError: ! raise test_support.TestSkipped, "posix is not available" import time *************** *** 20,28 **** def setUp(self): # create empty file ! fp = open(TESTFN, 'w+') fp.close() def tearDown(self): ! os.unlink(TESTFN) def testNoArgFunctions(self): --- 20,28 ---- def setUp(self): # create empty file ! fp = open(test_support.TESTFN, 'w+') fp.close() def tearDown(self): ! os.unlink(test_support.TESTFN) def testNoArgFunctions(self): *************** *** 47,51 **** def test_fstatvfs(self): if hasattr(posix, 'fstatvfs'): ! fp = open(TESTFN) try: self.assert_(posix.fstatvfs(fp.fileno())) --- 47,51 ---- def test_fstatvfs(self): if hasattr(posix, 'fstatvfs'): ! fp = open(test_support.TESTFN) try: self.assert_(posix.fstatvfs(fp.fileno())) *************** *** 55,59 **** def test_ftruncate(self): if hasattr(posix, 'ftruncate'): ! fp = open(TESTFN, 'w+') try: # we need to have some data to truncate --- 55,59 ---- def test_ftruncate(self): if hasattr(posix, 'ftruncate'): ! fp = open(test_support.TESTFN, 'w+') try: # we need to have some data to truncate *************** *** 66,70 **** def test_dup(self): if hasattr(posix, 'dup'): ! fp = open(TESTFN) try: fd = posix.dup(fp.fileno()) --- 66,70 ---- def test_dup(self): if hasattr(posix, 'dup'): ! fp = open(test_support.TESTFN) try: fd = posix.dup(fp.fileno()) *************** *** 76,81 **** def test_dup2(self): if hasattr(posix, 'dup2'): ! fp1 = open(TESTFN) ! fp2 = open(TESTFN) try: posix.dup2(fp1.fileno(), fp2.fileno()) --- 76,81 ---- def test_dup2(self): if hasattr(posix, 'dup2'): ! fp1 = open(test_support.TESTFN) ! fp2 = open(test_support.TESTFN) try: posix.dup2(fp1.fileno(), fp2.fileno()) *************** *** 85,89 **** def fdopen_helper(self, *args): ! fd = os.open(TESTFN, os.O_RDONLY) fp2 = posix.fdopen(fd, *args) fp2.close() --- 85,89 ---- def fdopen_helper(self, *args): ! fd = os.open(test_support.TESTFN, os.O_RDONLY) fp2 = posix.fdopen(fd, *args) fp2.close() *************** *** 97,101 **** def test_fstat(self): if hasattr(posix, 'fstat'): ! fp = open(TESTFN) try: self.assert_(posix.fstat(fp.fileno())) --- 97,101 ---- def test_fstat(self): if hasattr(posix, 'fstat'): ! fp = open(test_support.TESTFN) try: self.assert_(posix.fstat(fp.fileno())) *************** *** 105,122 **** def test_stat(self): if hasattr(posix, 'stat'): ! self.assert_(posix.stat(TESTFN)) def test_chdir(self): if hasattr(posix, 'chdir'): posix.chdir(os.curdir) ! self.assertRaises(OSError, posix.chdir, TESTFN) def test_lsdir(self): if hasattr(posix, 'lsdir'): ! self.assert_(TESTFN in posix.lsdir(os.curdir)) def test_access(self): if hasattr(posix, 'access'): ! self.assert_(posix.access(TESTFN, os.R_OK)) def test_umask(self): --- 105,122 ---- def test_stat(self): if hasattr(posix, 'stat'): ! self.assert_(posix.stat(test_support.TESTFN)) def test_chdir(self): if hasattr(posix, 'chdir'): posix.chdir(os.curdir) ! self.assertRaises(OSError, posix.chdir, test_support.TESTFN) def test_lsdir(self): if hasattr(posix, 'lsdir'): ! self.assert_(test_support.TESTFN in posix.lsdir(os.curdir)) def test_access(self): if hasattr(posix, 'access'): ! self.assert_(posix.access(test_support.TESTFN, os.R_OK)) def test_umask(self): *************** *** 150,160 **** if hasattr(posix, 'utime'): now = time.time() ! posix.utime(TESTFN, None) ! posix.utime(TESTFN, (now, now)) def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(PosixTester)) ! run_suite(suite) if __name__ == '__main__': --- 150,158 ---- if hasattr(posix, 'utime'): now = time.time() ! posix.utime(test_support.TESTFN, None) ! posix.utime(test_support.TESTFN, (now, now)) def test_main(): ! test_support.run_unittest(PosixTester) if __name__ == '__main__': Index: test_pow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pow.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_pow.py 3 Feb 2003 20:17:19 -0000 1.17 --- test_pow.py 1 May 2003 17:45:45 -0000 1.18 *************** *** 104,110 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(PowTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 104,108 ---- def test_main(): ! test.test_support.run_unittest(PowTest) if __name__ == "__main__": Index: test_profilehooks.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_profilehooks.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_profilehooks.py 23 Jul 2002 19:03:59 -0000 1.9 --- test_profilehooks.py 1 May 2003 17:45:46 -0000 1.10 *************** *** 350,358 **** def test_main(): ! loader = unittest.TestLoader() ! suite = unittest.TestSuite() ! suite.addTest(loader.loadTestsFromTestCase(ProfileHookTestCase)) ! suite.addTest(loader.loadTestsFromTestCase(ProfileSimulatorTestCase)) ! test_support.run_suite(suite) --- 350,357 ---- def test_main(): ! test_support.run_unittest( ! ProfileHookTestCase, ! ProfileSimulatorTestCase ! ) Index: test_pwd.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pwd.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_pwd.py 24 Apr 2003 16:02:52 -0000 1.16 --- test_pwd.py 1 May 2003 17:45:46 -0000 1.17 *************** *** 87,93 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(PwdTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 87,91 ---- def test_main(): ! test_support.run_unittest(PwdTest) if __name__ == "__main__": Index: test_re.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_re.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_re.py 27 Apr 2003 13:25:20 -0000 1.41 --- test_re.py 1 May 2003 17:45:47 -0000 1.42 *************** *** 2,6 **** sys.path = ['.'] + sys.path ! from test.test_support import verbose, run_suite import re from sre import Scanner --- 2,6 ---- sys.path = ['.'] + sys.path ! from test.test_support import verbose, run_unittest import re from sre import Scanner *************** *** 433,439 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(ReTests)) ! run_suite(suite) run_re_tests() --- 433,437 ---- def test_main(): ! run_unittest(ReTests) run_re_tests() Index: test_richcmp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_richcmp.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_richcmp.py 29 Apr 2003 21:31:18 -0000 1.8 --- test_richcmp.py 1 May 2003 17:45:47 -0000 1.9 *************** *** 353,357 **** def test_main(): ! test_support.run_classtests(VectorTest, NumberTest, MiscTest, DictTest, ListTest) if __name__ == "__main__": --- 353,357 ---- def test_main(): ! test_support.run_unittest(VectorTest, NumberTest, MiscTest, DictTest, ListTest) if __name__ == "__main__": Index: test_sets.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sets.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_sets.py 2 Mar 2003 00:36:10 -0000 1.23 --- test_sets.py 1 May 2003 17:45:48 -0000 1.24 *************** *** 659,698 **** #============================================================================== - def makeAllTests(): - suite = unittest.TestSuite() - for klass in (TestSetOfSets, - TestExceptionPropagation, - TestBasicOpsEmpty, - TestBasicOpsSingleton, - TestBasicOpsTuple, - TestBasicOpsTriple, - TestBinaryOps, - TestUpdateOps, - TestMutate, - TestSubsetEqualEmpty, - TestSubsetEqualNonEmpty, - TestSubsetEmptyNonEmpty, - TestSubsetPartial, - TestSubsetNonOverlap, - TestOnlySetsNumeric, - TestOnlySetsDict, - TestOnlySetsOperator, - TestCopyingEmpty, - TestCopyingSingleton, - TestCopyingTriple, - TestCopyingTuple, - TestCopyingNested, - ): - suite.addTest(unittest.makeSuite(klass)) - return suite - - #------------------------------------------------------------------------------ - __test__ = {'libreftest' : libreftest} def test_main(verbose=None): from test import test_sets ! suite = makeAllTests() ! test_support.run_suite(suite) test_support.run_doctest(test_sets, verbose) --- 659,690 ---- #============================================================================== __test__ = {'libreftest' : libreftest} def test_main(verbose=None): from test import test_sets ! test_support.run_unittest( ! TestSetOfSets, ! TestExceptionPropagation, ! TestBasicOpsEmpty, ! TestBasicOpsSingleton, ! TestBasicOpsTuple, ! TestBasicOpsTriple, ! TestBinaryOps, ! TestUpdateOps, ! TestMutate, ! TestSubsetEqualEmpty, ! TestSubsetEqualNonEmpty, ! TestSubsetEmptyNonEmpty, ! TestSubsetPartial, ! TestSubsetNonOverlap, ! TestOnlySetsNumeric, ! TestOnlySetsDict, ! TestOnlySetsOperator, ! TestCopyingEmpty, ! TestCopyingSingleton, ! TestCopyingTriple, ! TestCopyingTuple, ! TestCopyingNested ! ) test_support.run_doctest(test_sets, verbose) Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_shelve.py 19 Apr 2003 20:59:02 -0000 1.4 --- test_shelve.py 1 May 2003 17:45:48 -0000 1.5 *************** *** 122,134 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestAsciiFileShelve)) ! suite.addTest(unittest.makeSuite(TestBinaryFileShelve)) ! suite.addTest(unittest.makeSuite(TestProto2FileShelve)) ! suite.addTest(unittest.makeSuite(TestAsciiMemShelve)) ! suite.addTest(unittest.makeSuite(TestBinaryMemShelve)) ! suite.addTest(unittest.makeSuite(TestProto2MemShelve)) ! suite.addTest(unittest.makeSuite(TestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 122,134 ---- def test_main(): ! test_support.run_unittest( ! TestAsciiFileShelve, ! TestBinaryFileShelve, ! TestProto2FileShelve, ! TestAsciiMemShelve, ! TestBinaryMemShelve, ! TestProto2MemShelve, ! TestCase ! ) if __name__ == "__main__": Index: test_shutil.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shutil.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_shutil.py 24 Jan 2003 17:34:13 -0000 1.1 --- test_shutil.py 1 May 2003 17:45:49 -0000 1.2 *************** *** 15,28 **** - def suite(): - suite = unittest.TestSuite() - suite.addTest(unittest.makeSuite(TestShutil)) - return suite - - def test_main(): ! test_support.run_suite(suite()) if __name__ == '__main__': ! unittest.main(defaultTest='suite') --- 15,22 ---- def test_main(): ! test_support.run_unittest(TestShutil) if __name__ == '__main__': ! test_main() Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** test_socket.py 25 Apr 2003 15:11:23 -0000 1.63 --- test_socket.py 1 May 2003 17:45:49 -0000 1.64 *************** *** 684,698 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(GeneralModuleTests)) ! suite.addTest(unittest.makeSuite(BasicTCPTest)) if sys.platform != 'mac': ! suite.addTest(unittest.makeSuite(BasicUDPTest)) ! suite.addTest(unittest.makeSuite(NonBlockingTCPTests)) ! suite.addTest(unittest.makeSuite(FileObjectClassTestCase)) ! suite.addTest(unittest.makeSuite(UnbufferedFileObjectClassTestCase)) ! suite.addTest(unittest.makeSuite(LineBufferedFileObjectClassTestCase)) ! suite.addTest(unittest.makeSuite(SmallBufferedFileObjectClassTestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 684,699 ---- def test_main(): ! tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': ! tests.append(BasicUDPTest) ! ! tests.extend([ ! NonBlockingTCPTests, ! FileObjectClassTestCase, ! UnbufferedFileObjectClassTestCase, ! LineBufferedFileObjectClassTestCase, ! SmallBufferedFileObjectClassTestCase ! ]) ! test_support.run_unittest(*tests) if __name__ == "__main__": Index: test_str.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_str.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_str.py 31 Mar 2003 18:07:49 -0000 1.2 --- test_str.py 1 May 2003 17:45:50 -0000 1.3 *************** *** 20,26 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(StrTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 20,24 ---- def test_main(): ! test_support.run_unittest(StrTest) if __name__ == "__main__": Index: test_string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_string.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_string.py 21 Feb 2003 12:53:49 -0000 1.24 --- test_string.py 1 May 2003 17:45:50 -0000 1.25 *************** *** 96,103 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(StringTest)) ! suite.addTest(unittest.makeSuite(ModuleTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 96,100 ---- def test_main(): ! test_support.run_unittest(StringTest, ModuleTest) if __name__ == "__main__": Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_strptime.py 28 Apr 2003 21:30:13 -0000 1.12 --- test_strptime.py 1 May 2003 17:45:50 -0000 1.13 *************** *** 407,418 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(LocaleTime_Tests)) ! suite.addTest(unittest.makeSuite(TimeRETests)) ! suite.addTest(unittest.makeSuite(StrptimeTests)) ! suite.addTest(unittest.makeSuite(Strptime12AMPMTests)) ! suite.addTest(unittest.makeSuite(JulianTests)) ! suite.addTest(unittest.makeSuite(CalculationTests)) ! test_support.run_suite(suite) --- 407,418 ---- def test_main(): ! test_support.run_unittest( ! LocaleTime_Tests, ! TimeRETests, ! StrptimeTests, ! Strptime12AMPMTests, ! JulianTests, ! CalculationTests ! ) Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** test_support.py 27 Apr 2003 07:54:23 -0000 1.51 --- test_support.py 1 May 2003 17:45:51 -0000 1.52 *************** *** 230,242 **** ! def run_unittest(testclass): ! """Run tests from a unittest.TestCase-derived class.""" ! run_suite(unittest.makeSuite(testclass), testclass) ! ! def run_classtests(*classnames): suite = unittest.TestSuite() ! for cls in classnames: suite.addTest(unittest.makeSuite(cls)) ! run_suite(suite) --- 230,243 ---- ! def run_unittest(*classes): ! """Run tests from unittest.TestCase-derived classes.""" suite = unittest.TestSuite() ! for cls in classes: suite.addTest(unittest.makeSuite(cls)) ! if len(classes)==1: ! testclass = classes[0] ! else: ! testclass = None ! run_suite(suite, testclass) Index: test_sys.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sys.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_sys.py 1 Mar 2003 03:25:41 -0000 1.6 --- test_sys.py 1 May 2003 17:45:51 -0000 1.7 *************** *** 248,254 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(SysModuleTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 248,252 ---- def test_main(): ! test.test_support.run_unittest(SysModuleTest) if __name__ == "__main__": Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_tarfile.py 14 Apr 2003 01:18:32 -0000 1.7 --- test_tarfile.py 1 May 2003 17:45:51 -0000 1.8 *************** *** 241,265 **** bz2.BZ2File(tarname("bz2"), "wb").write(file(tarname(), "rb").read()) ! try: ! suite = unittest.TestSuite() ! ! suite.addTest(unittest.makeSuite(ReadTest)) ! suite.addTest(unittest.makeSuite(ReadStreamTest)) ! suite.addTest(unittest.makeSuite(WriteTest)) ! suite.addTest(unittest.makeSuite(WriteStreamTest)) ! ! if gzip: ! suite.addTest(unittest.makeSuite(ReadTestGzip)) ! suite.addTest(unittest.makeSuite(ReadStreamTestGzip)) ! suite.addTest(unittest.makeSuite(WriteTestGzip)) ! suite.addTest(unittest.makeSuite(WriteStreamTestGzip)) ! if bz2: ! suite.addTest(unittest.makeSuite(ReadTestBzip2)) ! suite.addTest(unittest.makeSuite(ReadStreamTestBzip2)) ! suite.addTest(unittest.makeSuite(WriteTestBzip2)) ! suite.addTest(unittest.makeSuite(WriteStreamTestBzip2)) ! test_support.run_suite(suite) finally: if gzip: --- 241,264 ---- bz2.BZ2File(tarname("bz2"), "wb").write(file(tarname(), "rb").read()) ! tests = [ ! ReadTest, ! ReadStreamTest, ! WriteTest, ! WriteStreamTest ! ] ! if gzip: ! tests.extend([ ! ReadTestGzip, ReadStreamTestGzip, ! WriteTestGzip, WriteStreamTestGzip ! ]) ! if bz2: ! tests.extend([ ! ReadTestBzip2, ReadStreamTestBzip2, ! WriteTestBzip2, WriteStreamTestBzip2 ! ]) ! try: ! test_support.run_unittest(*tests) finally: if gzip: Index: test_tempfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tempfile.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_tempfile.py 8 Jan 2003 16:30:34 -0000 1.13 --- test_tempfile.py 1 May 2003 17:45:51 -0000 1.14 *************** *** 646,653 **** def test_main(): ! suite = unittest.TestSuite() ! for c in test_classes: ! suite.addTest(unittest.makeSuite(c)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 646,650 ---- def test_main(): ! test_support.run_unittest(*test_classes) if __name__ == "__main__": Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_textwrap.py 9 Dec 2002 16:32:41 -0000 1.18 --- test_textwrap.py 1 May 2003 17:45:51 -0000 1.19 *************** *** 353,361 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(WrapTestCase)) ! suite.addTest(unittest.makeSuite(LongWordTestCase)) ! suite.addTest(unittest.makeSuite(IndentTestCases)) ! test_support.run_suite(suite) if __name__ == '__main__': --- 353,357 ---- def test_main(): ! test_support.run_unittest(WrapTestCase, LongWordTestCase, IndentTestCases) if __name__ == '__main__': Index: test_timeout.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_timeout.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_timeout.py 11 Apr 2003 15:14:05 -0000 1.13 --- test_timeout.py 1 May 2003 17:45:51 -0000 1.14 *************** *** 187,194 **** def test_main(): test_support.requires('network') ! ! suite = unittest.makeSuite(CreationTestCase) ! suite.addTest(unittest.makeSuite(TimeoutTestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 187,191 ---- def test_main(): test_support.requires('network') ! test_support.run_unittest(CreationTestCase, TimeoutTestCase) if __name__ == "__main__": Index: test_trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_trace.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_trace.py 29 Apr 2003 16:18:47 -0000 1.8 --- test_trace.py 1 May 2003 17:45:52 -0000 1.9 *************** *** 532,538 **** def test_main(): ! test_support.run_unittest(TraceTestCase) ! test_support.run_unittest(RaisingTraceFuncTestCase) ! test_support.run_unittest(JumpTestCase) if __name__ == "__main__": --- 532,540 ---- def test_main(): ! test_support.run_unittest( ! TraceTestCase, ! RaisingTraceFuncTestCase, ! JumpTestCase ! ) if __name__ == "__main__": Index: test_ucn.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ucn.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_ucn.py 7 Mar 2003 17:30:48 -0000 1.13 --- test_ucn.py 1 May 2003 17:45:52 -0000 1.14 *************** *** 139,145 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UnicodeNamesTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 139,143 ---- def test_main(): ! test_support.run_unittest(UnicodeNamesTest) if __name__ == "__main__": Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** test_unicode.py 2 Apr 2003 16:37:24 -0000 1.82 --- test_unicode.py 1 May 2003 17:45:53 -0000 1.83 *************** *** 699,705 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UnicodeTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 699,703 ---- def test_main(): ! test_support.run_unittest(UnicodeTest) if __name__ == "__main__": Index: test_unicodedata.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicodedata.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_unicodedata.py 7 Mar 2003 17:30:48 -0000 1.8 --- test_unicodedata.py 1 May 2003 17:45:53 -0000 1.9 *************** *** 204,212 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UnicodeMiscTest)) ! suite.addTest(unittest.makeSuite(UnicodeMethodsTest)) ! suite.addTest(unittest.makeSuite(UnicodeFunctionsTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 204,212 ---- def test_main(): ! test.test_support.run_unittest( ! UnicodeMiscTest, ! UnicodeMethodsTest, ! UnicodeFunctionsTest ! ) if __name__ == "__main__": Index: test_univnewlines.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_univnewlines.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_univnewlines.py 23 Jul 2002 19:04:08 -0000 1.4 --- test_univnewlines.py 1 May 2003 17:45:53 -0000 1.5 *************** *** 112,120 **** def test_main(): ! test_support.run_unittest(TestNativeNewlines) ! test_support.run_unittest(TestCRNewlines) ! test_support.run_unittest(TestLFNewlines) ! test_support.run_unittest(TestCRLFNewlines) ! test_support.run_unittest(TestMixedNewlines) if __name__ == '__main__': --- 112,122 ---- def test_main(): ! test_support.run_unittest( ! TestNativeNewlines, ! TestCRNewlines, ! TestLFNewlines, ! TestCRLFNewlines, ! TestMixedNewlines ! ) if __name__ == '__main__': Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_urllib.py 29 Apr 2003 05:08:06 -0000 1.12 --- test_urllib.py 1 May 2003 17:45:53 -0000 1.13 *************** *** 409,420 **** def test_main(): ! test_suite = unittest.TestSuite() ! test_suite.addTest(unittest.makeSuite(urlopen_FileTests)) ! test_suite.addTest(unittest.makeSuite(urlretrieve_FileTests)) ! test_suite.addTest(unittest.makeSuite(QuotingTests)) ! test_suite.addTest(unittest.makeSuite(UnquotingTests)) ! test_suite.addTest(unittest.makeSuite(urlencode_Tests)) ! test_suite.addTest(unittest.makeSuite(Pathname_Tests)) ! test_support.run_suite(test_suite) --- 409,420 ---- def test_main(): ! test_support.run_unittest( ! urlopen_FileTests, ! urlretrieve_FileTests, ! QuotingTests, ! UnquotingTests, ! urlencode_Tests, ! Pathname_Tests ! ) Index: test_urllibnet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllibnet.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_urllibnet.py 30 Mar 2003 04:54:24 -0000 1.1 --- test_urllibnet.py 1 May 2003 17:45:54 -0000 1.2 *************** *** 24,31 **** def test_main(): test_support.requires('network') ! ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(URLTimeoutTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 24,28 ---- def test_main(): test_support.requires('network') ! test_support.run_unittest(URLTimeoutTest) if __name__ == "__main__": Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_userdict.py 9 Mar 2003 07:05:14 -0000 1.14 --- test_userdict.py 1 May 2003 17:45:54 -0000 1.15 *************** *** 396,404 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestMappingProtocol)) ! suite.addTest(unittest.makeSuite(UserDictTest)) ! suite.addTest(unittest.makeSuite(UserDictMixinTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 396,404 ---- def test_main(): ! test.test_support.run_unittest( ! TestMappingProtocol, ! UserDictTest, ! UserDictMixinTest ! ) if __name__ == "__main__": Index: test_userlist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userlist.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_userlist.py 19 Feb 2003 02:35:06 -0000 1.8 --- test_userlist.py 1 May 2003 17:45:54 -0000 1.9 *************** *** 253,259 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UserListTest)) ! test.test_support.run_suite(suite) if __name__ == "__main__": --- 253,257 ---- def test_main(): ! test.test_support.run_unittest(UserListTest) if __name__ == "__main__": Index: test_userstring.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userstring.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_userstring.py 21 Feb 2003 12:53:49 -0000 1.10 --- test_userstring.py 1 May 2003 17:45:55 -0000 1.11 *************** *** 45,51 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(UserStringTest)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 45,49 ---- def test_main(): ! test_support.run_unittest(UserStringTest) if __name__ == "__main__": Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_weakref.py 9 Mar 2003 07:05:14 -0000 1.22 --- test_weakref.py 1 May 2003 17:45:55 -0000 1.23 *************** *** 535,544 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(ReferencesTestCase)) ! suite.addTest(unittest.makeSuite(MappingTestCase)) ! suite.addTest(unittest.makeSuite(WeakValueDictionaryTestCase)) ! suite.addTest(unittest.makeSuite(WeakKeyDictionaryTestCase)) ! test_support.run_suite(suite) --- 535,544 ---- def test_main(): ! test_support.run_unittest( ! ReferencesTestCase, ! MappingTestCase, ! WeakValueDictionaryTestCase, ! WeakKeyDictionaryTestCase ! ) Index: test_xpickle.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_xpickle.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_xpickle.py 19 Feb 2003 02:35:06 -0000 1.3 --- test_xpickle.py 1 May 2003 17:45:56 -0000 1.4 *************** *** 36,45 **** def test_main(): ! suite = unittest.TestSuite() ! for test in (DumpCPickle_LoadPickle, ! DumpPickle_LoadCPickle, ! ): ! suite.addTest(unittest.makeSuite(test)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 36,43 ---- def test_main(): ! test_support.run_unittest( ! DumpCPickle_LoadPickle, ! DumpPickle_LoadCPickle ! ) if __name__ == "__main__": Index: test_zipimport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipimport.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_zipimport.py 19 Feb 2003 02:35:06 -0000 1.7 --- test_zipimport.py 1 May 2003 17:45:56 -0000 1.8 *************** *** 188,193 **** def test_main(): ! test_support.run_unittest(UncompressedZipImportTestCase) ! test_support.run_unittest(CompressedZipImportTestCase) if __name__ == "__main__": --- 188,195 ---- def test_main(): ! test_support.run_unittest( ! UncompressedZipImportTestCase, ! CompressedZipImportTestCase ! ) if __name__ == "__main__": Index: test_zlib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zlib.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_zlib.py 27 Feb 2003 18:39:18 -0000 1.22 --- test_zlib.py 1 May 2003 17:45:56 -0000 1.23 *************** *** 480,489 **** def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(ChecksumTestCase)) ! suite.addTest(unittest.makeSuite(ExceptionTestCase)) ! suite.addTest(unittest.makeSuite(CompressTestCase)) ! suite.addTest(unittest.makeSuite(CompressObjectTestCase)) ! test_support.run_suite(suite) if __name__ == "__main__": --- 480,489 ---- def test_main(): ! test_support.run_unittest( ! ChecksumTestCase, ! ExceptionTestCase, ! CompressTestCase, ! CompressObjectTestCase ! ) if __name__ == "__main__": *************** *** 492,501 **** def test(tests=''): if not tests: tests = 'o' ! suite = unittest.TestSuite() ! if 'k' in tests: suite.addTest(unittest.makeSuite(ChecksumTestCase)) ! if 'x' in tests: suite.addTest(unittest.makeSuite(ExceptionTestCase)) ! if 'c' in tests: suite.addTest(unittest.makeSuite(CompressTestCase)) ! if 'o' in tests: suite.addTest(unittest.makeSuite(CompressObjectTestCase)) ! test_support.run_suite(suite) if False: --- 492,501 ---- def test(tests=''): if not tests: tests = 'o' ! testcases = [] ! if 'k' in tests: testcases.append(ChecksumTestCase) ! if 'x' in tests: testcases.append(ExceptionTestCase) ! if 'c' in tests: testcases.append(CompressTestCase) ! if 'o' in tests: testcases.append(CompressObjectTestCase) ! test_support.run_unittest(*testcases) if False: From klm@users.sourceforge.net Thu May 1 21:46:17 2003 From: klm@users.sourceforge.net (klm@users.sourceforge.net) Date: Thu, 01 May 2003 13:46:17 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.32,4.33 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv11225 Modified Files: python-mode.el Log Message: Allow for multiple parens around pdb prompt for (new) nested debugging sessions (and some cosmetic wording changes). Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.32 retrieving revision 4.33 diff -C2 -d -r4.32 -r4.33 *** python-mode.el 3 Mar 2003 17:09:44 -0000 4.32 --- python-mode.el 1 May 2003 20:46:14 -0000 4.33 *************** *** 484,488 **** "Regular expression pdbtrack uses to find a stack trace entry.") ! (defconst py-pdbtrack-input-prompt "\n[(<]?pdb[>)]? " "Regular expression pdbtrack uses to recognize a pdb prompt.") --- 484,488 ---- "Regular expression pdbtrack uses to find a stack trace entry.") ! (defconst py-pdbtrack-input-prompt "\n[(<]+pdb[>)]+ " "Regular expression pdbtrack uses to recognize a pdb prompt.") *************** *** 1291,1296 **** current function \(or class) or which defines the function \(or class). This is to provide for remote scripts, eg, Zope's 'Script ! (Python)' - put a _copy_ of the script in a python-mode buffer named ! for the script and pdbtrack will find it.)" ;; Instead of trying to piece things together from partial text ;; (which can be almost useless depending on Emacs version), we --- 1291,1296 ---- current function \(or class) or which defines the function \(or class). This is to provide for remote scripts, eg, Zope's 'Script ! (Python)' - put a _copy_ of the script in a buffer named for the ! script, and set to python-mode, and pdbtrack will find it.)" ;; Instead of trying to piece things together from partial text ;; (which can be almost useless depending on Emacs version), we *************** *** 1379,1383 **** (format "(Non-file source: '%s')" filename)) ! (t (format "Function/file not found: %s(), %s" funcname filename))) ) ) --- 1379,1383 ---- (format "(Non-file source: '%s')" filename)) ! (t (format "Not found: %s(), %s" funcname filename))) ) ) From klm@users.sourceforge.net Thu May 1 22:07:40 2003 From: klm@users.sourceforge.net (klm@users.sourceforge.net) Date: Thu, 01 May 2003 14:07:40 -0700 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,4.33,4.34 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21236 Modified Files: python-mode.el Log Message: Slightly more lenient pdbtrack prompt recognition, for people who use eg "pdb>". Index: python-mode.el =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v retrieving revision 4.33 retrieving revision 4.34 diff -C2 -d -r4.33 -r4.34 *** python-mode.el 1 May 2003 20:46:14 -0000 4.33 --- python-mode.el 1 May 2003 21:07:32 -0000 4.34 *************** *** 484,488 **** "Regular expression pdbtrack uses to find a stack trace entry.") ! (defconst py-pdbtrack-input-prompt "\n[(<]+pdb[>)]+ " "Regular expression pdbtrack uses to recognize a pdb prompt.") --- 484,488 ---- "Regular expression pdbtrack uses to find a stack trace entry.") ! (defconst py-pdbtrack-input-prompt "\n[(<]*pdb[>)]+ " "Regular expression pdbtrack uses to recognize a pdb prompt.") From jhylton@users.sourceforge.net Thu May 1 22:31:58 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 01 May 2003 14:31:58 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv32103 Modified Files: longobject.c Log Message: Silence compiler warnings in VC 7. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** longobject.c 17 Apr 2003 18:55:36 -0000 1.158 --- longobject.c 1 May 2003 21:31:53 -0000 1.159 *************** *** 1441,1445 **** carry += v->ob_digit[i+k] - z + ((twodigits)zz << SHIFT); ! v->ob_digit[i+k] = carry & MASK; carry = Py_ARITHMETIC_RIGHT_SHIFT(BASE_TWODIGITS_TYPE, carry, SHIFT); --- 1441,1445 ---- carry += v->ob_digit[i+k] - z + ((twodigits)zz << SHIFT); ! v->ob_digit[i+k] = (digit)(carry & MASK); carry = Py_ARITHMETIC_RIGHT_SHIFT(BASE_TWODIGITS_TYPE, carry, SHIFT); *************** *** 1460,1464 **** for (i = 0; i < size_w && i+k < size_v; ++i) { carry += v->ob_digit[i+k] + w->ob_digit[i]; ! v->ob_digit[i+k] = carry & MASK; carry = Py_ARITHMETIC_RIGHT_SHIFT( BASE_TWODIGITS_TYPE, --- 1460,1464 ---- for (i = 0; i < size_w && i+k < size_v; ++i) { carry += v->ob_digit[i+k] + w->ob_digit[i]; ! v->ob_digit[i+k] = (digit)(carry & MASK); carry = Py_ARITHMETIC_RIGHT_SHIFT( BASE_TWODIGITS_TYPE, From jackjansen@users.sourceforge.net Thu May 1 23:06:18 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 May 2003 15:06:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents Disk_Folder_File_Suite.py,NONE,1.1 System_Events_Suite.py,1.3,1.4 __init__.py,1.3,1.4 Disk_2d_Folder_2d_File_Suite.py,1.3,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents In directory sc8-pr-cvs1:/tmp/cvs-serv13075/Lib/plat-mac/lib-scriptpackages/SystemEvents Modified Files: System_Events_Suite.py __init__.py Added Files: Disk_Folder_File_Suite.py Removed Files: Disk_2d_Folder_2d_File_Suite.py Log Message: Rename funny long suite to Disk_File_Folder. --- NEW FILE: Disk_Folder_File_Suite.py --- """Suite Disk-Folder-File Suite: Terms and Events for controlling Disks, Folders, and Files Level 1, version 1 Generated from /System/Library/CoreServices/System Events.app AETE/AEUT resource version 1/0, language 0, script 0 """ import aetools import MacOS _code = 'cdis' class Disk_Folder_File_Suite_Events: _argmap_move = { 'to' : 'insh', } def move(self, _object, _attributes={}, **_arguments): """move: Move disk item(s) to a new location. Required argument: the object for the command Keyword argument to: The new location for the disk item(s). Keyword argument _attributes: AppleEvent attribute dictionary Returns: the reply for the command """ _code = 'core' _subcode = 'move' aetools.keysubst(_arguments, self._argmap_move) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] class alias(aetools.ComponentItem): """alias - An alias in the file system """ want = 'alis' class _Prop__3c_Inheritance_3e_(aetools.NProperty): """ - All of the properties of the superclass. """ which = 'c@#^' want = 'cobj' class _Prop_properties(aetools.NProperty): """properties - every property of the alias """ which = 'pALL' want = '****' class _Prop_version(aetools.NProperty): """version - the version of the application bundle referenced by the alias (visible at the bottom of the "Get Info" window) """ which = 'vers' want = 'utxt' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] aliases = alias class disk(aetools.ComponentItem): """disk - A disk in the file system """ want = 'cdis' class _Prop_capacity(aetools.NProperty): """capacity - the total number of bytes (free or used) on the disk """ which = 'capa' want = 'magn' class _Prop_ejectable(aetools.NProperty): """ejectable - Can the media be ejected (floppies, CD's, and so on)? """ which = 'isej' want = 'bool' class _Prop_format(aetools.NProperty): """format - the file system format of this disk """ which = 'dfmt' want = 'edfm' class _Prop_free_space(aetools.NProperty): """free space - the number of free bytes left on the disk """ which = 'frsp' want = 'magn' class _Prop_ignore_privileges(aetools.NProperty): """ignore privileges - Ignore permissions on this disk? """ which = 'igpr' want = 'bool' class _Prop_local_volume(aetools.NProperty): """local volume - Is the media a local volume (as opposed to a file server)? """ which = 'isrv' want = 'bool' class _Prop_startup(aetools.NProperty): """startup - Is this disk the boot disk? """ which = 'istd' want = 'bool' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] disks = disk class folder(aetools.ComponentItem): """folder - A folder in the file system """ want = 'cfol' # element 'alis' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cfol' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'cobj' as ['name', 'indx', 'rele', 'rang', 'test'] # element 'file' as ['name', 'indx', 'rele', 'rang', 'test'] folders = folder class item(aetools.ComponentItem): """item - An item in the file system """ want = 'cobj' class _Prop_POSIX_path(aetools.NProperty): """POSIX path - the POSIX file system path of the item """ which = 'posx' want = 'utxt' class _Prop_busy_status(aetools.NProperty): """busy status - Is the item busy? """ which = 'busy' want = 'bool' class _Prop_creation_date(aetools.NProperty): """creation date - the date on which the item was created """ which = 'ascd' want = '****' class _Prop_displayed_name(aetools.NProperty): """displayed name - the name of the item as displayed in the User Interface """ which = 'dnam' want = 'utxt' class _Prop_modification_date(aetools.NProperty): """modification date - the date on which the item was last modified """ which = 'asmo' want = '****' class _Prop_name(aetools.NProperty): """name - the name of the item """ which = 'pnam' want = 'utxt' class _Prop_name_extension(aetools.NProperty): """name extension - the extension portion of the name """ which = 'extn' want = 'utxt' class _Prop_package_folder(aetools.NProperty): """package folder - Is the item a package? """ which = 'pkgf' want = 'bool' class _Prop_path(aetools.NProperty): """path - the file system path of the item """ which = 'ppth' want = 'utxt' class _Prop_url(aetools.NProperty): """url - the url of the item """ which = 'url ' want = 'utxt' class _Prop_visible(aetools.NProperty): """visible - Is the item visible? """ which = 'pvis' want = 'bool' class _Prop_volume(aetools.NProperty): """volume - the volume on which the item resides """ which = 'volu' want = 'utxt' items = item class file(aetools.ComponentItem): """file - A file in the file system """ want = 'file' class _Prop_creator_type(aetools.NProperty): """creator type - the OSType identifying the application that created the file """ which = 'fcrt' want = 'utxt' class _Prop_file_type(aetools.NProperty): """file type - the OSType identifying the type of data contained in the file """ which = 'asty' want = 'utxt' class _Prop_physical_size(aetools.NProperty): """physical size - the actual space used by the file on disk """ which = 'phys' want = '****' class _Prop_product_version(aetools.NProperty): """product version - the version of the product (visible at the top of the "Get Info" window) """ which = 'ver2' want = 'utxt' class _Prop_size(aetools.NProperty): """size - the logical size of the file """ which = 'ptsz' want = '****' class _Prop_stationery(aetools.NProperty): """stationery - Is the file a stationery pad? """ which = 'pspd' want = 'bool' files = file alias._superclassnames = ['item'] alias._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'properties' : _Prop_properties, 'version' : _Prop_version, } alias._privelemdict = { 'alias' : alias, 'file' : file, 'folder' : folder, 'item' : item, } disk._superclassnames = ['item'] disk._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'capacity' : _Prop_capacity, 'ejectable' : _Prop_ejectable, 'format' : _Prop_format, 'free_space' : _Prop_free_space, 'ignore_privileges' : _Prop_ignore_privileges, 'local_volume' : _Prop_local_volume, 'properties' : _Prop_properties, 'startup' : _Prop_startup, } disk._privelemdict = { 'alias' : alias, 'file' : file, 'folder' : folder, 'item' : item, } folder._superclassnames = ['item'] folder._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'properties' : _Prop_properties, } folder._privelemdict = { 'alias' : alias, 'file' : file, 'folder' : folder, 'item' : item, } item._superclassnames = [] item._privpropdict = { 'POSIX_path' : _Prop_POSIX_path, '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'busy_status' : _Prop_busy_status, 'creation_date' : _Prop_creation_date, 'displayed_name' : _Prop_displayed_name, 'modification_date' : _Prop_modification_date, 'name' : _Prop_name, 'name_extension' : _Prop_name_extension, 'package_folder' : _Prop_package_folder, 'path' : _Prop_path, 'properties' : _Prop_properties, 'url' : _Prop_url, 'visible' : _Prop_visible, 'volume' : _Prop_volume, } item._privelemdict = { } file._superclassnames = ['item'] file._privpropdict = { '_3c_Inheritance_3e_' : _Prop__3c_Inheritance_3e_, 'creator_type' : _Prop_creator_type, 'file_type' : _Prop_file_type, 'physical_size' : _Prop_physical_size, 'product_version' : _Prop_product_version, 'properties' : _Prop_properties, 'size' : _Prop_size, 'stationery' : _Prop_stationery, 'version' : _Prop_version, } file._privelemdict = { } _Enum_edfm = { 'MS_2d_DOS_format' : 'dfms', # MS-DOS format 'Apple_Photo_format' : 'dfph', # Apple Photo format 'ISO_9660_format' : 'df96', # ISO 9660 format 'QuickTake_format' : 'dfqt', # QuickTake format 'AppleShare_format' : 'dfas', # AppleShare format 'High_Sierra_format' : 'dfhs', # High Sierra format 'Mac_OS_Extended_format' : 'dfh+', # Mac OS Extended format 'UDF_format' : 'dfud', # UDF format 'unknown_format' : 'df??', # unknown format 'audio_format' : 'dfau', # audio format 'Mac_OS_format' : 'dfhf', # Mac OS format 'UFS_format' : 'dfuf', # UFS format 'NFS_format' : 'dfnf', # NFS format 'ProDOS_format' : 'dfpr', # ProDOS format 'WebDAV_format' : 'dfwd', # WebDAV format } # # Indices of types declared in this module # _classdeclarations = { 'alis' : alias, 'cdis' : disk, 'cfol' : folder, 'cobj' : item, 'file' : file, } _propdeclarations = { 'ascd' : _Prop_creation_date, 'asmo' : _Prop_modification_date, 'asty' : _Prop_file_type, 'busy' : _Prop_busy_status, 'c@#^' : _Prop__3c_Inheritance_3e_, 'capa' : _Prop_capacity, 'dfmt' : _Prop_format, 'dnam' : _Prop_displayed_name, 'extn' : _Prop_name_extension, 'fcrt' : _Prop_creator_type, 'frsp' : _Prop_free_space, 'igpr' : _Prop_ignore_privileges, 'isej' : _Prop_ejectable, 'isrv' : _Prop_local_volume, 'istd' : _Prop_startup, 'pALL' : _Prop_properties, 'phys' : _Prop_physical_size, 'pkgf' : _Prop_package_folder, 'pnam' : _Prop_name, 'posx' : _Prop_POSIX_path, 'ppth' : _Prop_path, 'pspd' : _Prop_stationery, 'ptsz' : _Prop_size, 'pvis' : _Prop_visible, 'url ' : _Prop_url, 'ver2' : _Prop_product_version, 'vers' : _Prop_version, 'volu' : _Prop_volume, } _compdeclarations = { } _enumdeclarations = { 'edfm' : _Enum_edfm, } Index: System_Events_Suite.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/System_Events_Suite.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** System_Events_Suite.py 12 Apr 2003 22:27:10 -0000 1.3 --- System_Events_Suite.py 1 May 2003 22:06:15 -0000 1.4 *************** *** 51,55 **** applications = application application._superclassnames = [] ! import Disk_2d_Folder_2d_File_Suite import Standard_Suite import Folder_Actions_Suite --- 51,55 ---- applications = application application._superclassnames = [] ! import Disk_Folder_File_Suite import Standard_Suite import Folder_Actions_Suite *************** *** 64,76 **** application._privelemdict = { 'UI_element' : Processes_Suite.UI_element, ! 'alias' : Disk_2d_Folder_2d_File_Suite.alias, 'application_process' : Processes_Suite.application_process, 'desk_accessory_process' : Processes_Suite.desk_accessory_process, ! 'disk' : Disk_2d_Folder_2d_File_Suite.disk, 'document' : Standard_Suite.document, ! 'file' : Disk_2d_Folder_2d_File_Suite.file, ! 'folder' : Disk_2d_Folder_2d_File_Suite.folder, 'folder_action' : Folder_Actions_Suite.folder_action, ! 'item' : Disk_2d_Folder_2d_File_Suite.item, 'login_item' : Login_Items_Suite.login_item, 'process' : Processes_Suite.process, --- 64,76 ---- application._privelemdict = { 'UI_element' : Processes_Suite.UI_element, ! 'alias' : Disk_Folder_File_Suite.alias, 'application_process' : Processes_Suite.application_process, 'desk_accessory_process' : Processes_Suite.desk_accessory_process, ! 'disk' : Disk_Folder_File_Suite.disk, 'document' : Standard_Suite.document, ! 'file' : Disk_Folder_File_Suite.file, ! 'folder' : Disk_Folder_File_Suite.folder, 'folder_action' : Folder_Actions_Suite.folder_action, ! 'item' : Disk_Folder_File_Suite.item, 'login_item' : Login_Items_Suite.login_item, 'process' : Processes_Suite.process, Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/SystemEvents/__init__.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** __init__.py 12 Apr 2003 22:27:10 -0000 1.3 --- __init__.py 1 May 2003 22:06:15 -0000 1.4 *************** *** 6,10 **** import Standard_Suite import Text_Suite ! import Disk_2d_Folder_2d_File_Suite import Folder_Actions_Suite import Login_Items_Suite --- 6,10 ---- import Standard_Suite import Text_Suite ! import Disk_Folder_File_Suite import Folder_Actions_Suite import Login_Items_Suite *************** *** 18,22 **** '????' : Standard_Suite, '????' : Text_Suite, ! 'cdis' : Disk_2d_Folder_2d_File_Suite, 'faco' : Folder_Actions_Suite, 'logi' : Login_Items_Suite, --- 18,22 ---- '????' : Standard_Suite, '????' : Text_Suite, ! 'cdis' : Disk_Folder_File_Suite, 'faco' : Folder_Actions_Suite, 'logi' : Login_Items_Suite, *************** *** 32,36 **** '????' : ('SystemEvents.Standard_Suite', 'Standard_Suite'), '????' : ('SystemEvents.Text_Suite', 'Text_Suite'), ! 'cdis' : ('SystemEvents.Disk_2d_Folder_2d_File_Suite', 'Disk_2d_Folder_2d_File_Suite'), 'faco' : ('SystemEvents.Folder_Actions_Suite', 'Folder_Actions_Suite'), 'logi' : ('SystemEvents.Login_Items_Suite', 'Login_Items_Suite'), --- 32,36 ---- '????' : ('SystemEvents.Standard_Suite', 'Standard_Suite'), '????' : ('SystemEvents.Text_Suite', 'Text_Suite'), ! 'cdis' : ('SystemEvents.Disk_Folder_File_Suite', 'Disk_Folder_File_Suite'), 'faco' : ('SystemEvents.Folder_Actions_Suite', 'Folder_Actions_Suite'), 'logi' : ('SystemEvents.Login_Items_Suite', 'Login_Items_Suite'), *************** *** 43,47 **** from Standard_Suite import * from Text_Suite import * ! from Disk_2d_Folder_2d_File_Suite import * from Folder_Actions_Suite import * from Login_Items_Suite import * --- 43,47 ---- from Standard_Suite import * from Text_Suite import * ! from Disk_Folder_File_Suite import * from Folder_Actions_Suite import * from Login_Items_Suite import * *************** *** 68,76 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(color) - getbaseclasses(window) - getbaseclasses(application) - getbaseclasses(item) - getbaseclasses(document) getbaseclasses(character) getbaseclasses(attachment) --- 68,71 ---- *************** *** 79,82 **** --- 74,83 ---- getbaseclasses(attribute_run) getbaseclasses(text) + getbaseclasses(color) + getbaseclasses(window) + getbaseclasses(application) + getbaseclasses(item) + getbaseclasses(document) + getbaseclasses(application) getbaseclasses(login_item) getbaseclasses(file) *************** *** 171,175 **** getbaseclasses(combo_box) getbaseclasses(browser) - getbaseclasses(application) # --- 172,175 ---- *************** *** 177,185 **** # _classdeclarations = { - 'colr' : color, - 'cwin' : window, - 'capp' : application, - 'cobj' : item, - 'docu' : document, 'cha ' : character, 'atts' : attachment, --- 177,180 ---- *************** *** 188,191 **** --- 183,192 ---- 'catr' : attribute_run, 'ctxt' : text, + 'colr' : color, + 'cwin' : window, + 'capp' : application, + 'cobj' : item, + 'docu' : document, + 'capp' : application, 'logi' : login_item, 'file' : file, *************** *** 280,284 **** 'comB' : combo_box, 'broW' : browser, - 'capp' : application, } --- 281,284 ---- *************** *** 286,290 **** class SystemEvents(Standard_Suite_Events, Text_Suite_Events, ! Disk_2d_Folder_2d_File_Suite_Events, Folder_Actions_Suite_Events, Login_Items_Suite_Events, --- 286,290 ---- class SystemEvents(Standard_Suite_Events, Text_Suite_Events, ! Disk_Folder_File_Suite_Events, Folder_Actions_Suite_Events, Login_Items_Suite_Events, --- Disk_2d_Folder_2d_File_Suite.py DELETED --- From jackjansen@users.sourceforge.net Thu May 1 23:06:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 May 2003 15:06:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape __init__.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape In directory sc8-pr-cvs1:/tmp/cvs-serv13075/Lib/plat-mac/lib-scriptpackages/Netscape Modified Files: __init__.py Log Message: Rename funny long suite to Disk_File_Folder. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Netscape/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 12 Apr 2003 22:27:09 -0000 1.7 --- __init__.py 1 May 2003 22:06:12 -0000 1.8 *************** *** 62,67 **** getbaseclasses(window) getbaseclasses(application) - getbaseclasses(text) - getbaseclasses(styleset) getbaseclasses(StdSuites.Text_Suite.text_flow) getbaseclasses(StdSuites.Text_Suite.character) --- 62,65 ---- *************** *** 71,74 **** --- 69,74 ---- getbaseclasses(StdSuites.Text_Suite.paragraph) getbaseclasses(StdSuites.Text_Suite.text) + getbaseclasses(text) + getbaseclasses(styleset) # *************** *** 78,83 **** 'cwin' : window, 'capp' : application, - 'ctxt' : text, - 'stys' : styleset, 'cflo' : StdSuites.Text_Suite.text_flow, 'cha ' : StdSuites.Text_Suite.character, --- 78,81 ---- *************** *** 87,90 **** --- 85,90 ---- 'cpar' : StdSuites.Text_Suite.paragraph, 'ctxt' : StdSuites.Text_Suite.text, + 'ctxt' : text, + 'stys' : styleset, } From jackjansen@users.sourceforge.net Thu May 1 23:06:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 May 2003 15:06:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts genallsuites.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv13075/Mac/scripts Modified Files: genallsuites.py Log Message: Rename funny long suite to Disk_File_Folder. Index: genallsuites.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/genallsuites.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** genallsuites.py 29 Apr 2003 21:46:31 -0000 1.3 --- genallsuites.py 1 May 2003 22:06:10 -0000 1.4 *************** *** 29,33 **** output=os.path.join(DSTDIR, 'SystemEvents'), basepkgname='StdSuites', ! edit_modnames=[], verbose=verbose) gensuitemodule.processfile(CODEWARRIOR, output=os.path.join(DSTDIR, 'CodeWarrior'), --- 29,34 ---- output=os.path.join(DSTDIR, 'SystemEvents'), basepkgname='StdSuites', ! edit_modnames=[('Disk_2d_Folder_2d_File_Suite', 'Disk_Folder_File_Suite')], ! verbose=verbose) gensuitemodule.processfile(CODEWARRIOR, output=os.path.join(DSTDIR, 'CodeWarrior'), From jackjansen@users.sourceforge.net Thu May 1 23:06:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 May 2003 15:06:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior __init__.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior In directory sc8-pr-cvs1:/tmp/cvs-serv13075/Lib/plat-mac/lib-scriptpackages/CodeWarrior Modified Files: __init__.py Log Message: Rename funny long suite to Disk_File_Folder. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/CodeWarrior/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 12 Apr 2003 22:27:06 -0000 1.8 --- __init__.py 1 May 2003 22:06:11 -0000 1.9 *************** *** 48,51 **** --- 48,60 ---- # Set property and element dictionaries now that all classes have been defined # + getbaseclasses(character) + getbaseclasses(text) + getbaseclasses(window) + getbaseclasses(file) + getbaseclasses(line) + getbaseclasses(selection_2d_object) + getbaseclasses(application) + getbaseclasses(insertion_point) + getbaseclasses(document) getbaseclasses(single_class_browser) getbaseclasses(project_document) *************** *** 101,113 **** getbaseclasses(Debugger_Display) getbaseclasses(class_) - getbaseclasses(character) - getbaseclasses(text) - getbaseclasses(window) - getbaseclasses(file) - getbaseclasses(line) - getbaseclasses(selection_2d_object) - getbaseclasses(application) - getbaseclasses(insertion_point) - getbaseclasses(document) # --- 110,113 ---- *************** *** 115,118 **** --- 115,127 ---- # _classdeclarations = { + 'cha ' : character, + 'ctxt' : text, + 'cwin' : window, + 'file' : file, + 'clin' : line, + 'csel' : selection_2d_object, + 'capp' : application, + 'cins' : insertion_point, + 'docu' : document, '1BRW' : single_class_browser, 'PRJD' : project_document, *************** *** 168,180 **** 'DbDS' : Debugger_Display, 'Clas' : class_, - 'cha ' : character, - 'ctxt' : text, - 'cwin' : window, - 'file' : file, - 'clin' : line, - 'csel' : selection_2d_object, - 'capp' : application, - 'cins' : insertion_point, - 'docu' : document, } --- 177,180 ---- From jackjansen@users.sourceforge.net Thu May 1 23:06:44 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 May 2003 15:06:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder __init__.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder In directory sc8-pr-cvs1:/tmp/cvs-serv13075/Lib/plat-mac/lib-scriptpackages/Finder Modified Files: __init__.py Log Message: Rename funny long suite to Disk_File_Folder. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/Finder/__init__.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** __init__.py 12 Apr 2003 22:27:09 -0000 1.8 --- __init__.py 1 May 2003 22:06:12 -0000 1.9 *************** *** 68,82 **** # Set property and element dictionaries now that all classes have been defined # - getbaseclasses(process) - getbaseclasses(application_process) - getbaseclasses(desk_accessory_process) - getbaseclasses(application) - getbaseclasses(package) - getbaseclasses(file) - getbaseclasses(application_file) - getbaseclasses(alias_file) - getbaseclasses(internet_location_file) - getbaseclasses(document_file) - getbaseclasses(clipping) getbaseclasses(icon_view_options) getbaseclasses(label) --- 68,71 ---- *************** *** 86,96 **** getbaseclasses(icon_family) getbaseclasses(list_view_options) - getbaseclasses(application) getbaseclasses(item) ! getbaseclasses(trash_2d_object) ! getbaseclasses(desktop_2d_object) ! getbaseclasses(container) ! getbaseclasses(folder) ! getbaseclasses(disk) getbaseclasses(preferences_window) getbaseclasses(Finder_window) --- 75,86 ---- getbaseclasses(icon_family) getbaseclasses(list_view_options) getbaseclasses(item) ! getbaseclasses(package) ! getbaseclasses(file) ! getbaseclasses(application_file) ! getbaseclasses(alias_file) ! getbaseclasses(internet_location_file) ! getbaseclasses(document_file) ! getbaseclasses(clipping) getbaseclasses(preferences_window) getbaseclasses(Finder_window) *************** *** 98,101 **** --- 88,101 ---- getbaseclasses(clipping_window) getbaseclasses(information_window) + getbaseclasses(application) + getbaseclasses(process) + getbaseclasses(application_process) + getbaseclasses(desk_accessory_process) + getbaseclasses(application) + getbaseclasses(trash_2d_object) + getbaseclasses(desktop_2d_object) + getbaseclasses(container) + getbaseclasses(folder) + getbaseclasses(disk) getbaseclasses(StdSuites.Type_Names_Suite.double_integer) getbaseclasses(StdSuites.Type_Names_Suite.version) *************** *** 143,157 **** # _classdeclarations = { - 'prcs' : process, - 'pcap' : application_process, - 'pcda' : desk_accessory_process, - 'capp' : application, - 'pack' : package, - 'file' : file, - 'appf' : application_file, - 'alia' : alias_file, - 'inlf' : internet_location_file, - 'docf' : document_file, - 'clpf' : clipping, 'icop' : icon_view_options, 'clbl' : label, --- 143,146 ---- *************** *** 161,171 **** 'ifam' : icon_family, 'lvop' : list_view_options, - 'capp' : application, 'cobj' : item, ! 'ctrs' : trash_2d_object, ! 'cdsk' : desktop_2d_object, ! 'ctnr' : container, ! 'cfol' : folder, ! 'cdis' : disk, 'pwnd' : preferences_window, 'brow' : Finder_window, --- 150,161 ---- 'ifam' : icon_family, 'lvop' : list_view_options, 'cobj' : item, ! 'pack' : package, ! 'file' : file, ! 'appf' : application_file, ! 'alia' : alias_file, ! 'inlf' : internet_location_file, ! 'docf' : document_file, ! 'clpf' : clipping, 'pwnd' : preferences_window, 'brow' : Finder_window, *************** *** 173,176 **** --- 163,176 ---- 'lwnd' : clipping_window, 'iwnd' : information_window, + 'capp' : application, + 'prcs' : process, + 'pcap' : application_process, + 'pcda' : desk_accessory_process, + 'capp' : application, + 'ctrs' : trash_2d_object, + 'cdsk' : desktop_2d_object, + 'ctnr' : container, + 'cfol' : folder, + 'cdis' : disk, 'comp' : StdSuites.Type_Names_Suite.double_integer, 'vers' : StdSuites.Type_Names_Suite.version, From jackjansen@users.sourceforge.net Thu May 1 23:06:46 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 01 May 2003 15:06:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites __init__.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites In directory sc8-pr-cvs1:/tmp/cvs-serv13075/Lib/plat-mac/lib-scriptpackages/StdSuites Modified Files: __init__.py Log Message: Rename funny long suite to Disk_File_Folder. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/lib-scriptpackages/StdSuites/__init__.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** __init__.py 12 Apr 2003 22:27:10 -0000 1.7 --- __init__.py 1 May 2003 22:06:13 -0000 1.8 *************** *** 221,231 **** getbaseclasses(null) getbaseclasses(target_id) - getbaseclasses(paragraph) - getbaseclasses(character) - getbaseclasses(text_flow) - getbaseclasses(text_style_info) - getbaseclasses(line) - getbaseclasses(word) - getbaseclasses(text) getbaseclasses(graphic_group) getbaseclasses(oval) --- 221,224 ---- *************** *** 241,246 **** --- 234,250 ---- getbaseclasses(pixel_map) getbaseclasses(rectangle) + getbaseclasses(paragraph) + getbaseclasses(character) + getbaseclasses(text_flow) + getbaseclasses(text_style_info) + getbaseclasses(line) + getbaseclasses(word) + getbaseclasses(text) getbaseclasses(graphic_group) getbaseclasses(drawing_area) + getbaseclasses(cell) + getbaseclasses(column) + getbaseclasses(table) + getbaseclasses(row) getbaseclasses(AppleTalk_address) getbaseclasses(address_specification) *************** *** 255,262 **** getbaseclasses(IP_address) getbaseclasses(Ethernet_address) - getbaseclasses(cell) - getbaseclasses(column) - getbaseclasses(table) - getbaseclasses(row) # --- 259,262 ---- *************** *** 416,426 **** 'null' : null, 'targ' : target_id, - 'cpar' : paragraph, - 'cha ' : character, - 'cflo' : text_flow, - 'tsty' : text_style_info, - 'clin' : line, - 'cwor' : word, - 'ctxt' : text, 'cpic' : graphic_group, 'covl' : oval, --- 416,419 ---- *************** *** 436,441 **** --- 429,445 ---- 'cpix' : pixel_map, 'crec' : rectangle, + 'cpar' : paragraph, + 'cha ' : character, + 'cflo' : text_flow, + 'tsty' : text_style_info, + 'clin' : line, + 'cwor' : word, + 'ctxt' : text, 'cpic' : graphic_group, 'cdrw' : drawing_area, + 'ccel' : cell, + 'ccol' : column, + 'ctbl' : table, + 'crow' : row, 'cat ' : AppleTalk_address, 'cadr' : address_specification, *************** *** 450,457 **** 'cip ' : IP_address, 'cen ' : Ethernet_address, - 'ccel' : cell, - 'ccol' : column, - 'ctbl' : table, - 'crow' : row, } --- 454,457 ---- From rhettinger@users.sourceforge.net Fri May 2 10:06:36 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 02:06:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.30,1.31 test_builtin.py,1.19,1.20 test_glob.py,1.4,1.5 test_pyclbr.py,1.17,1.18 test_userdict.py,1.15,1.16 test_weakref.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14447 Modified Files: test___all__.py test_builtin.py test_glob.py test_pyclbr.py test_userdict.py test_weakref.py Log Message: Used sets.Set() to compare unordered sequences. Improves clarity and brevity. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** test___all__.py 1 May 2003 17:45:31 -0000 1.30 --- test___all__.py 2 May 2003 09:06:23 -0000 1.31 *************** *** 3,6 **** --- 3,7 ---- from test.test_support import verify, verbose + from sets import Set import sys import warnings *************** *** 43,50 **** if names.has_key("__builtins__"): del names["__builtins__"] ! keys = names.keys() ! keys.sort() ! all = list(sys.modules[modname].__all__) # in case it's a tuple ! all.sort() verify(keys==all, "%s != %s" % (keys, all)) --- 44,49 ---- if names.has_key("__builtins__"): del names["__builtins__"] ! keys = Set(names) ! all = Set(sys.modules[modname].__all__) verify(keys==all, "%s != %s" % (keys, all)) Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_builtin.py 1 May 2003 17:45:33 -0000 1.19 --- test_builtin.py 2 May 2003 09:06:25 -0000 1.20 *************** *** 3,6 **** --- 3,7 ---- import test.test_support, unittest from test.test_support import fcmp, have_unicode, TESTFN, unlink + from sets import Set import sys, warnings, cStringIO *************** *** 1160,1175 **** def test_vars(self): ! a = b = None ! a = vars().keys() ! b = dir() ! a.sort() ! b.sort() ! self.assertEqual(a, b) import sys ! a = vars(sys).keys() ! b = dir(sys) ! a.sort() ! b.sort() ! self.assertEqual(a, b) self.assertEqual(self.get_vars_f0(), {}) self.assertEqual(self.get_vars_f2(), {'a': 1, 'b': 2}) --- 1161,1167 ---- def test_vars(self): ! self.assertEqual(Set(vars()), Set(dir())) import sys ! self.assertEqual(Set(vars(sys)), Set(dir(sys))) self.assertEqual(self.get_vars_f0(), {}) self.assertEqual(self.get_vars_f2(), {'a': 1, 'b': 2}) Index: test_glob.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_glob.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_glob.py 23 Jul 2002 19:03:54 -0000 1.4 --- test_glob.py 2 May 2003 09:06:26 -0000 1.5 *************** *** 3,6 **** --- 3,7 ---- import glob import os + from sets import Set def mkdirs(fname): *************** *** 62,70 **** def assertSequencesEqual_noorder(self, l1, l2): ! l1 = list(l1) ! l2 = list(l2) ! l1.sort() ! l2.sort() ! self.assertEqual(l1, l2) def test_glob_literal(self): --- 63,67 ---- def assertSequencesEqual_noorder(self, l1, l2): ! self.assertEqual(Set(l1), Set(l2)) def test_glob_literal(self): Index: test_pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pyclbr.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_pyclbr.py 30 Dec 2002 07:21:32 -0000 1.17 --- test_pyclbr.py 2 May 2003 09:06:26 -0000 1.18 *************** *** 8,11 **** --- 8,12 ---- import pyclbr from unittest import TestCase + from sets import Set # This next line triggers an error on old versions of pyclbr. *************** *** 24,38 **** def assertListEq(self, l1, l2, ignore): ''' succeed iff {l1} - {ignore} == {l2} - {ignore} ''' ! l1.sort() ! l2.sort() ! try: ! for p1, p2 in (l1, l2), (l2, l1): ! for item in p1: ! ok = (item in p2) or (item in ignore) ! if not ok: ! self.fail("%r missing" % item) ! except: print >>sys.stderr, "l1=%r\nl2=%r\nignore=%r" % (l1, l2, ignore) ! raise def assertHasattr(self, obj, attr, ignore): --- 25,32 ---- def assertListEq(self, l1, l2, ignore): ''' succeed iff {l1} - {ignore} == {l2} - {ignore} ''' ! missing = (Set(l1) ^ Set(l2)) - Set(ignore) ! if missing: print >>sys.stderr, "l1=%r\nl2=%r\nignore=%r" % (l1, l2, ignore) ! self.fail("%r missing" % missing.pop()) def assertHasattr(self, obj, attr, ignore): Index: test_userdict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userdict.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_userdict.py 1 May 2003 17:45:54 -0000 1.15 --- test_userdict.py 2 May 2003 09:06:27 -0000 1.16 *************** *** 2,5 **** --- 2,6 ---- import test.test_support, unittest + from sets import Set import UserDict *************** *** 69,76 **** self.assert_(hasattr(iter, '__iter__')) x = list(iter) ! x.sort() ! lst.sort() ! ref.sort() ! self.assert_(x==lst==ref) check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys()) check_iterandlist(iter(d), d.keys(), self.reference.keys()) --- 70,74 ---- self.assert_(hasattr(iter, '__iter__')) x = list(iter) ! self.assert_(Set(x)==Set(lst)==Set(ref)) check_iterandlist(d.iterkeys(), d.keys(), self.reference.keys()) check_iterandlist(iter(d), d.keys(), self.reference.keys()) *************** *** 244,251 **** for k in u2: ikeys.append(k) - ikeys.sort() keys = u2.keys() ! keys.sort() ! self.assertEqual(ikeys, keys) # Test setdefault --- 242,247 ---- for k in u2: ikeys.append(k) keys = u2.keys() ! self.assertEqual(Set(ikeys), Set(keys)) # Test setdefault Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_weakref.py 1 May 2003 17:45:55 -0000 1.23 --- test_weakref.py 2 May 2003 09:06:28 -0000 1.24 *************** *** 5,8 **** --- 5,9 ---- from test import test_support + from sets import Set *************** *** 341,347 **** items1 = dict.items() items2 = dict.copy().items() ! items1.sort() ! items2.sort() ! self.assert_(items1 == items2, "cloning of weak-keyed dictionary did not work!") del items1, items2 --- 342,346 ---- items1 = dict.items() items2 = dict.copy().items() ! self.assert_(Set(items1) == Set(items2), "cloning of weak-keyed dictionary did not work!") del items1, items2 From rhettinger@users.sourceforge.net Fri May 2 10:36:12 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 02:36:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25887 Modified Files: test___all__.py Log Message: Added missing modules to __all__ check. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** test___all__.py 2 May 2003 09:06:23 -0000 1.31 --- test___all__.py 2 May 2003 09:36:07 -0000 1.32 *************** *** 55,58 **** --- 55,59 ---- self.check_all("BaseHTTPServer") + self.check_all("Bastion") self.check_all("CGIHTTPServer") self.check_all("ConfigParser") *************** *** 144,147 **** --- 145,149 ---- self.check_all("rexec") self.check_all("rfc822") + self.check_all("rlcompleter") self.check_all("robotparser") self.check_all("sched") *************** *** 156,159 **** --- 158,162 ---- self.check_all("socket") self.check_all("sre") + self.check_all("_strptime") self.check_all("statcache") self.check_all("symtable") *************** *** 164,167 **** --- 167,171 ---- self.check_all("textwrap") self.check_all("threading") + self.check_all("timeit") self.check_all("toaiff") self.check_all("tokenize") From montanaro@users.sourceforge.net Fri May 2 16:28:06 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 May 2003 08:28:06 -0700 Subject: [Python-checkins] python/dist/src README,1.170,1.171 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv18892 Modified Files: README Log Message: add note about building with bsddb185 and making it appear as bsddb. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.170 retrieving revision 1.171 diff -C2 -d -r1.170 -r1.171 *** README 25 Apr 2003 19:19:51 -0000 1.170 --- README 2 May 2003 15:27:59 -0000 1.171 *************** *** 256,259 **** --- 256,274 ---- above) so we can remove them!) + Unix platforms: If your vendor still ships (and you still use) Berkeley DB + 1.85 you will need to edit Modules/Setup to build the bsddb185 + module and add a line to sitecustomize.py which makes it the + default. In Modules/Setup a line like + + bsddb185 bsddbmodule.c + + should work. (You may need to add -I, -L or -l flags to direct the + compiler and linker to your include files and libraries.) You can + then force it to be the version people import by adding + + import bsddb185 as bsddb + + in sitecustomize.py. + 64-bit platforms: The modules audioop, imageop and rgbimg don't work. The setup.py script disables them on 64-bit installations. From anthonybaxter@users.sourceforge.net Fri May 2 16:40:53 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri, 02 May 2003 08:40:53 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.261,1.262 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24297 Modified Files: socketmodule.c Log Message: Patch 731209: Restore socketmodule's behaviour with dotted quad addresses to that of Python2.1. Such nnn.nnn.nnn.nnn addresses are just used directly, not passed to the resolver for a pointless lookup. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.261 retrieving revision 1.262 diff -C2 -d -r1.261 -r1.262 *** socketmodule.c 1 May 2003 05:20:46 -0000 1.261 --- socketmodule.c 2 May 2003 15:40:46 -0000 1.262 *************** *** 627,630 **** --- 627,632 ---- struct addrinfo hints, *res; int error; + int d1, d2, d3, d4; + char ch; memset((void *) addr_ret, '\0', sizeof(*addr_ret)); *************** *** 682,685 **** --- 684,701 ---- sin->sin_addr.s_addr = INADDR_BROADCAST; return sizeof(sin->sin_addr); + } + if (sscanf(name, "%d.%d.%d.%d%c", &d1, &d2, &d3, &d4, &ch) == 4 && + 0 <= d1 && d1 <= 255 && 0 <= d2 && d2 <= 255 && + 0 <= d3 && d3 <= 255 && 0 <= d4 && d4 <= 255) { + struct sockaddr_in *sin; + sin = (struct sockaddr_in *)addr_ret; + sin->sin_addr.s_addr = htonl( + ((long) d1 << 24) | ((long) d2 << 16) | + ((long) d3 << 8) | ((long) d4 << 0)); + sin->sin_family = AF_INET; + #ifdef HAVE_SOCKADDR_SA_LEN + sin->sin_len = sizeof(*sin); + #endif + return 4; } memset(&hints, 0, sizeof(hints)); From fdrake@users.sourceforge.net Fri May 2 19:08:20 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 May 2003 11:08:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.68,1.69 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv29005 Modified Files: l2hinit.perl Log Message: Remove section number from the title for use in the element in the document head. Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** l2hinit.perl 30 Oct 2002 21:51:18 -0000 1.68 --- l2hinit.perl 2 May 2003 18:08:16 -0000 1.69 *************** *** 664,670 **** $charset =~ s/_/\-/go; } join('', $MY_PARTIAL_HEADER, ! &meta_information($title), "", $title, "\n\n"); } --- 664,675 ---- $charset =~ s/_/\-/go; } + # Remove section number from the title for use in the + # element in the document head. + my $metatitle = "$title"; + $metatitle =~ s/^\d+(\.\d+)*\s*//; + join('', $MY_PARTIAL_HEADER, ! &meta_information($metatitle), "", $title, "\n\n"); } From fdrake@users.sourceforge.net Fri May 2 19:21:27 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 May 2003 11:21:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.69,1.70 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv5701 Modified Files: l2hinit.perl Log Message: Avoid extraneous blank line generated in the middle of the document head. Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** l2hinit.perl 2 May 2003 18:08:16 -0000 1.69 --- l2hinit.perl 2 May 2003 18:21:22 -0000 1.70 *************** *** 615,638 **** $MY_PARTIAL_HEADER = join('', ($DOCTYPE ? $DTDcomment : ''), ! "\n\n", ! ($BASE ? "\n" : ''), ! "\n", ($FAVORITES_ICON ! ? ('\n") : ''), ($EXTERNAL_UP_LINK ! ? ('\n") : ''), ! "\n", ($HAVE_TABLE_OF_CONTENTS ! ? ('' ! . ($HAVE_GENERAL_INDEX ? "\n" : '')) : ''), ($HAVE_GENERAL_INDEX ! ? '' . "\n" : ''), # disable for now -- Mozilla doesn't do well with multiple indexes --- 615,637 ---- $MY_PARTIAL_HEADER = join('', ($DOCTYPE ? $DTDcomment : ''), ! "\n", ! ($BASE ? "\n" : ''), ! "\n", ($FAVORITES_ICON ! ? ("\n") : ''), ($EXTERNAL_UP_LINK ! ? ("\n" : "'>")) : ''), ! "\n', ($HAVE_TABLE_OF_CONTENTS ! ? "\n" : ''), ($HAVE_GENERAL_INDEX ! ? "\n" : ''), # disable for now -- Mozilla doesn't do well with multiple indexes *************** *** 646,653 **** # generated node###.html page names. Won't work with the # rest of the Python doc tools. ! ? ("\n" ! . "\n") : ''), $more_links_mark, --- 645,652 ---- # generated node###.html page names. Won't work with the # rest of the Python doc tools. ! ? ("\n" ! . "\n") : ''), $more_links_mark, From tim_one@users.sourceforge.net Fri May 2 19:39:58 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 02 May 2003 11:39:58 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.60,1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv17845/python/Modules Modified Files: datetimemodule.c Log Message: SF patch 731504: Typo in datetimemodule.c comment. s/isofomat/isoformat/, by Steven Taschuk. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** datetimemodule.c 14 Apr 2003 22:01:57 -0000 1.60 --- datetimemodule.c 2 May 2003 18:39:55 -0000 1.61 *************** *** 2380,2384 **** } ! /* str() calls the appropriate isofomat() method. */ static PyObject * date_str(PyDateTime_Date *self) --- 2380,2384 ---- } ! /* str() calls the appropriate isoformat() method. */ static PyObject * date_str(PyDateTime_Date *self) From rhettinger@users.sourceforge.net Fri May 2 20:04:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 12:04:40 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30623/Lib/test Modified Files: test_itertools.py Log Message: SF bug #730685: itertools.islice stop argument is not optional * itertools.islice() stop argument did not perform as documented. * beefed-up test suite Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_itertools.py 1 May 2003 17:45:37 -0000 1.6 --- test_itertools.py 2 May 2003 19:04:37 -0000 1.7 *************** *** 78,82 **** self.assertEqual(list(islice(xrange(100), *args)), range(*tgtargs)) ! self.assertRaises(TypeError, islice, xrange(10)) self.assertRaises(TypeError, islice, xrange(10), 1, 2, 3, 4) self.assertRaises(ValueError, islice, xrange(10), -5, 10, 1) --- 78,88 ---- self.assertEqual(list(islice(xrange(100), *args)), range(*tgtargs)) ! # Test stop=None ! self.assertEqual(list(islice(xrange(10))), range(10)) ! self.assertEqual(list(islice(xrange(10), None)), range(10)) ! self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10)) ! self.assertEqual(list(islice(xrange(10), 1, None, 2)), range(1, 10, 2)) ! ! # Test invalid arguments self.assertRaises(TypeError, islice, xrange(10), 1, 2, 3, 4) self.assertRaises(ValueError, islice, xrange(10), -5, 10, 1) *************** *** 84,87 **** --- 90,98 ---- self.assertRaises(ValueError, islice, xrange(10), 1, 10, -1) self.assertRaises(ValueError, islice, xrange(10), 1, 10, 0) + self.assertRaises(ValueError, islice, xrange(10), 'a') + self.assertRaises(ValueError, islice, xrange(10), 'a', 1) + self.assertRaises(ValueError, islice, xrange(10), 1, 'a') + self.assertRaises(ValueError, islice, xrange(10), 'a', 1, 1) + self.assertRaises(ValueError, islice, xrange(10), 1, 'a', 1) self.assertEqual(len(list(islice(count(), 1, 10, sys.maxint))), 1) *************** *** 156,159 **** --- 167,225 ---- ... return izip(seq, islice(seq,1,len(seq))) + >>> def padnone(seq): + ... "Returns the sequence elements and then returns None indefinitely" + ... return chain(seq, repeat(None)) + + >>> def ncycles(seq, n): + ... "Returns the sequence elements n times" + ... return chain(*repeat(seq, n)) + + >>> def dotproduct(vec1, vec2): + ... return sum(imap(operator.mul, vec1, vec2)) + + + This is not part of the examples but it tests to make sure the definitions + perform as purported. + + >>> list(enumerate('abc')) + [(0, 'a'), (1, 'b'), (2, 'c')] + + >>> list(islice(tabulate(lambda x: 2*x), 4)) + [0, 2, 4, 6] + + >>> nth('abcde', 3) + ['d'] + + >>> all(lambda x: x%2==0, [2, 4, 6, 8]) + True + + >>> all(lambda x: x%2==0, [2, 3, 6, 8]) + False + + >>> some(lambda x: x%2==0, [2, 4, 6, 8]) + True + + >>> some(lambda x: x%2==0, [1, 3, 5, 9]) + False + + >>> no(lambda x: x%2==0, [1, 3, 5, 9]) + True + + >>> no(lambda x: x%2==0, [1, 2, 5, 9]) + False + + >>> list(pairwise('abc')) + [('a', 'b'), ('b', 'c')] + + >>> list(islice(padnone('abc'), 0, 6)) + ['a', 'b', 'c', None, None, None] + + >>> list(ncycles('abc', 3)) + ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] + + >>> dotproduct([1,2,3], [4,5,6]) + 32 + + """ *************** *** 161,169 **** def test_main(verbose=None): - import test_itertools suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestBasicOps)) test_support.run_suite(suite) - test_support.run_doctest(test_itertools, verbose) # verify reference counting --- 227,233 ---- *************** *** 175,178 **** --- 239,246 ---- counts.append(sys.gettotalrefcount()-i) print counts + + # doctest the examples in the library reference + import doctest + doctest.testmod(sys.modules[__name__]) if __name__ == "__main__": From rhettinger@users.sourceforge.net Fri May 2 20:04:39 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 12:04:39 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30623/Modules Modified Files: itertoolsmodule.c Log Message: SF bug #730685: itertools.islice stop argument is not optional * itertools.islice() stop argument did not perform as documented. * beefed-up test suite Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** itertoolsmodule.c 14 Apr 2003 15:31:27 -0000 1.10 --- itertoolsmodule.c 2 May 2003 19:04:37 -0000 1.11 *************** *** 472,496 **** { PyObject *seq; ! long a1=0, a2=0, a3=0, start=0, stop=0, step=1; ! PyObject *it; int numargs; isliceobject *lz; numargs = PyTuple_Size(args); ! if (!PyArg_ParseTuple(args, "Ol|ll:islice", &seq, &a1, &a2, &a3)) return NULL; if (numargs == 2) { ! stop = a1; ! } else if (numargs == 3) { ! start = a1; ! stop = a2; ! } else { ! start = a1; ! stop = a2; ! step = a3; } ! if (start<0 || stop<0) { PyErr_SetString(PyExc_ValueError, "Indices for islice() must be positive."); --- 472,516 ---- { PyObject *seq; ! long start=0, stop=-1, step=1; ! PyObject *it, *a1=NULL, *a2=NULL; int numargs; isliceobject *lz; numargs = PyTuple_Size(args); ! if (!PyArg_ParseTuple(args, "O|OOl:islice", &seq, &a1, &a2, &step)) return NULL; if (numargs == 2) { ! if (a1 != Py_None) { ! stop = PyInt_AsLong(a1); ! if (stop == -1) { ! if (PyErr_Occurred()) ! PyErr_Clear(); ! PyErr_SetString(PyExc_ValueError, ! "Stop argument must be an integer or None."); ! return NULL; ! } ! } ! } else if (numargs == 3 || numargs == 4) { ! start = PyInt_AsLong(a1); ! if (start == -1 && PyErr_Occurred()) { ! PyErr_Clear(); ! PyErr_SetString(PyExc_ValueError, ! "Start argument must be an integer."); ! return NULL; ! } ! if (a2 != Py_None) { ! stop = PyInt_AsLong(a2); ! if (stop == -1) { ! if (PyErr_Occurred()) ! PyErr_Clear(); ! PyErr_SetString(PyExc_ValueError, ! "Stop argument must be an integer or None."); ! return NULL; ! } ! } } ! if (start<0 || stop<-1) { PyErr_SetString(PyExc_ValueError, "Indices for islice() must be positive."); *************** *** 555,559 **** lz->cnt++; } ! if (lz->cnt >= lz->stop) return NULL; assert(PyIter_Check(it)); --- 575,579 ---- lz->cnt++; } ! if (lz->stop != -1 && lz->cnt >= lz->stop) return NULL; assert(PyIter_Check(it)); From rhettinger@users.sourceforge.net Fri May 2 20:04:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 12:04:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30623/Doc/lib Modified Files: libitertools.tex Log Message: SF bug #730685: itertools.islice stop argument is not optional * itertools.islice() stop argument did not perform as documented. * beefed-up test suite Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libitertools.tex 23 Apr 2003 00:09:42 -0000 1.7 --- libitertools.tex 2 May 2003 19:04:37 -0000 1.8 *************** *** 198,204 **** until start is reached. Afterward, elements are returned consecutively unless \var{step} is set higher than one which results in items being ! skipped. If \var{stop} is specified, then iteration stops at the ! specified element position; otherwise, it continues indefinitely or ! until the iterable is exhausted. Unlike regular slicing, \function{islice()} does not support negative values for \var{start}, \var{stop}, or \var{step}. Can be used to extract related fields --- 198,204 ---- until start is reached. Afterward, elements are returned consecutively unless \var{step} is set higher than one which results in items being ! skipped. If \var{stop} is not specified or is \code{None}, then iteration ! continues indefinitely; otherwise, it stops at the specified position. ! Unlike regular slicing, \function{islice()} does not support negative values for \var{start}, \var{stop}, or \var{step}. Can be used to extract related fields *************** *** 209,223 **** \begin{verbatim} def islice(iterable, *args): ! s = slice(*args) ! next = s.start or 0 ! stop = s.stop ! step = s.step or 1 for cnt, element in enumerate(iterable): if cnt < next: continue ! if cnt >= stop: break yield element ! next += step \end{verbatim} \end{funcdesc} --- 209,226 ---- \begin{verbatim} def islice(iterable, *args): ! if args: ! s = slice(*args) ! next = s.start or 0 ! stop = s.stop ! step = s.step or 1 ! else: ! next, stop, step = 0, None, 1 for cnt, element in enumerate(iterable): if cnt < next: continue ! if stop is not None and cnt >= stop: break yield element ! next += step \end{verbatim} \end{funcdesc} *************** *** 361,365 **** >>> def pairwise(seq): ... "s -> (s0,s1), (s1,s2), (s2, s3), ..." ! ... return izip(seq, islice(seq,1,len(seq))) >>> def padnone(seq): --- 364,368 ---- >>> def pairwise(seq): ... "s -> (s0,s1), (s1,s2), (s2, s3), ..." ! ... return izip(seq, islice(seq,1,None)) >>> def padnone(seq): From rhettinger@users.sourceforge.net Fri May 2 20:44:22 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 12:44:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25408/Doc/lib Modified Files: libitertools.tex Log Message: The previous made the stop argument optional. It is better to be explicit and just allow stop to be None. Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libitertools.tex 2 May 2003 19:04:37 -0000 1.8 --- libitertools.tex 2 May 2003 19:44:20 -0000 1.9 *************** *** 198,204 **** until start is reached. Afterward, elements are returned consecutively unless \var{step} is set higher than one which results in items being ! skipped. If \var{stop} is not specified or is \code{None}, then iteration ! continues indefinitely; otherwise, it stops at the specified position. ! Unlike regular slicing, \function{islice()} does not support negative values for \var{start}, \var{stop}, or \var{step}. Can be used to extract related fields --- 198,204 ---- until start is reached. Afterward, elements are returned consecutively unless \var{step} is set higher than one which results in items being ! skipped. If \var{stop} is \code{None}, then iteration continues until ! the iterator is exhausted, if at all; otherwise, it stops at the specified ! position. Unlike regular slicing, \function{islice()} does not support negative values for \var{start}, \var{stop}, or \var{step}. Can be used to extract related fields *************** *** 209,219 **** \begin{verbatim} def islice(iterable, *args): ! if args: ! s = slice(*args) ! next = s.start or 0 ! stop = s.stop ! step = s.step or 1 ! else: ! next, stop, step = 0, None, 1 for cnt, element in enumerate(iterable): if cnt < next: --- 209,216 ---- \begin{verbatim} def islice(iterable, *args): ! s = slice(*args) ! next = s.start or 0 ! stop = s.stop ! step = s.step or 1 for cnt, element in enumerate(iterable): if cnt < next: From rhettinger@users.sourceforge.net Fri May 2 20:44:23 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 12:44:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25408/Lib/test Modified Files: test_itertools.py Log Message: The previous made the stop argument optional. It is better to be explicit and just allow stop to be None. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_itertools.py 2 May 2003 19:04:37 -0000 1.7 --- test_itertools.py 2 May 2003 19:44:20 -0000 1.8 *************** *** 79,83 **** # Test stop=None - self.assertEqual(list(islice(xrange(10))), range(10)) self.assertEqual(list(islice(xrange(10), None)), range(10)) self.assertEqual(list(islice(xrange(10), 2, None)), range(2, 10)) --- 79,82 ---- *************** *** 85,88 **** --- 84,88 ---- # Test invalid arguments + self.assertRaises(TypeError, islice, xrange(10)) self.assertRaises(TypeError, islice, xrange(10), 1, 2, 3, 4) self.assertRaises(ValueError, islice, xrange(10), -5, 10, 1) From rhettinger@users.sourceforge.net Fri May 2 20:44:22 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 12:44:22 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25408/Modules Modified Files: itertoolsmodule.c Log Message: The previous made the stop argument optional. It is better to be explicit and just allow stop to be None. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** itertoolsmodule.c 2 May 2003 19:04:37 -0000 1.11 --- itertoolsmodule.c 2 May 2003 19:44:20 -0000 1.12 *************** *** 478,482 **** numargs = PyTuple_Size(args); ! if (!PyArg_ParseTuple(args, "O|OOl:islice", &seq, &a1, &a2, &step)) return NULL; --- 478,482 ---- numargs = PyTuple_Size(args); ! if (!PyArg_ParseTuple(args, "OO|Ol:islice", &seq, &a1, &a2, &step)) return NULL; *************** *** 492,496 **** } } ! } else if (numargs == 3 || numargs == 4) { start = PyInt_AsLong(a1); if (start == -1 && PyErr_Occurred()) { --- 492,496 ---- } } ! } else { start = PyInt_AsLong(a1); if (start == -1 && PyErr_Occurred()) { From rhettinger@users.sourceforge.net Fri May 2 21:11:32 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 13:11:32 -0700 Subject: [Python-checkins] python/dist/src/Objects dictnotes.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11623 Added Files: dictnotes.txt Log Message: Research notes and explorations for optimizing Python dictionaries. --- NEW FILE: dictnotes.txt --- NOTES ON OPTIMIZING DICTIONARIES ================================ Principal Use Cases for Dictionaries ------------------------------------ Passing keyword arguments Typically, one read and one write for 1 to 3 elements. Occurs frequently in normal python code. Class method lookup Dictionaries vary in size with 8 to 16 elements being common. Usually written once with many lookups. When base classes are used, there are many failed lookups followed by a lookup in a base class. Instance attribute lookup and Global variables Dictionaries vary in size. 4 to 10 elements are common. Both reads and writes are common. Builtins Frequent reads. Almost never written. Size 126 interned strings (as of Py2.3b1). A few keys are accessed much more frequently than others. Uniquification Dictionaries of any size. Bulk of work is in creation. Repeated writes to a smaller set of keys. Single read of each key. * Removing duplicates from a sequence. dict.fromkeys(seqn).keys() * Counting elements in a sequence. for e in seqn: d[e]=d.get(e,0) + 1 * Accumulating items in a dictionary of lists. for k, v in itemseqn: d.setdefault(k, []).append(v) Membership Testing Dictionaries of any size. Created once and then rarely changes. Single write to each key. Many calls to __contains__() or has_key(). Similar access patterns occur with replacement dictionaries such as with the % formatting operator. Data Layout (assuming a 32-bit box with 64 bytes per cache line) ---------------------------------------------------------------- Smalldicts (8 entries) are attached to the dictobject structure and the whole group nearly fills two consecutive cache lines. Larger dicts use the first half of the dictobject structure (one cache line) and a separate, continuous block of entries (at 12 bytes each for a total of 5.333 entries per cache line). Tunable Dictionary Parameters ----------------------------- * PyDict_MINSIZE. Currently set to 8. Must be a power of two. New dicts have to zero-out every cell. Each additional 8 consumes 1.5 cache lines. Increasing improves the sparseness of small dictionaries but costs time to read in the additional cache lines if they are not already in cache. That case is common when keyword arguments are passed. * Maximum dictionary load in PyDict_SetItem. Currently set to 2/3. Increasing this ratio makes dictionaries more dense resulting in more collisions. Decreasing it improves sparseness at the expense of spreading entries over more cache lines and at the cost of total memory consumed. The load test occurs in highly time sensitive code. Efforts to make the test more complex (for example, varying the load for different sizes) have degraded performance. * Growth rate upon hitting maximum load. Currently set to *2. Raising this to *4 results in half the number of resizes, less effort to resize, better sparseness for some (but not all dict sizes), and potentially double memory consumption depending on the size of the dictionary. Setting to *4 eliminates every other resize step. Tune-ups should be measured across a broad range of applications and use cases. A change to any parameter will help in some situations and hurt in others. The key is to find settings that help the most common cases and do the least damage to the less common cases. Results will vary dramatically depending on the exact number of keys, whether the keys are all strings, whether reads or writes dominate, the exact hash values of the keys (some sets of values have fewer collisions than others). Any one test or benchmark is likely to prove misleading. Results of Cache Locality Experiments ------------------------------------- When an entry is retrieved from memory, 4.333 adjacent entries are also retrieved into a cache line. Since accessing items in cache is *much* cheaper than a cache miss, an enticing idea is to probe the adjacent entries as a first step in collision resolution. Unfortunately, the introduction of any regularity into collision searches results in more collisions than the current random chaining approach. Exploiting cache locality at the expense of additional collisions fails to payoff when the entries are already loaded in cache (the expense is paid with no compensating benefit). This occurs in small dictionaries where the whole dictionary fits into a pair of cache lines. It also occurs frequently in large dictionaries which have a common access pattern where some keys are accessed much more frequently than others. The more popular entries *and* their collision chains tend to remain in cache. To exploit cache locality, change the collision resolution section in lookdict() and lookdict_string(). Set i^=1 at the top of the loop and move the i = (i << 2) + i + perturb + 1 to an unrolled version of the loop. This optimization strategy can be leveraged in several ways: * If the dictionary is kept sparse (through the tunable parameters), then the occurrence of additional collisions is lessened. * If lookdict() and lookdict_string() are specialized for small dicts and for largedicts, then the versions for large_dicts can be given an alternate search strategy without increasing collisions in small dicts which already have the maximum benefit of cache locality. * If the use case for a dictionary is known to have a random key access pattern (as opposed to a more common pattern with a Zipf's law distribution), then there will be more benefit for large dictionaries because any given key is no more likely than another to already be in cache. Optimizing the Search of Small Dictionaries ------------------------------------------- If lookdict() and lookdict_string() are specialized for smaller dictionaries, then a custom search approach can be implemented that exploits the small search space and cache locality. * The simplest example is a linear search of contiguous entries. This is simple to implement, guaranteed to terminate rapidly, never searches the same entry twice, and precludes the need to check for dummy entries. * A more advanced example is a self-organizing search so that the most frequently accessed entries get probed first. The organization adapts if the access pattern changes over time. Treaps are ideally suited for self-organization with the most common entries at the top of the heap and a rapid binary search pattern. Most probes and results are all located at the top of the tree allowing them all to be located in one or two cache lines. * Also, small dictionaries may be made more dense, perhaps filling all eight cells to take the maximum advantage of two cache lines. Strategy Pattern ---------------- Consider allowing the user to set the tunable parameters or to select a particular search method. Since some dictionary use cases have known sizes and access patterns, the user may be able to provide useful hints. 1) For example, if membership testing or lookups dominate runtime and memory is not at a premium, the user may benefit from setting the maximum load ratio at 5% or 10% instead of the usual 66.7%. This will sharply curtail the number of collisions. 2) Dictionary creation time can be shortened in cases where the ultimate size of the dictionary is known in advance. The dictionary can be pre-sized so that no resize operations are required during creation. Not only does this save resizes, but the key insertion will go more quickly because the first half of the keys will be inserted into a more sparse environment than before. The preconditions for this strategy arise whenever a dictionary is created from a key or item sequence of known length. 3) If the key space is large and the access pattern is known to be random, then search strategies exploiting cache locality can be fruitful. The preconditions for this strategy arise in simulations and numerical analysis. 4) If the keys are fixed and the access pattern strongly favors some of the keys, then the entries can be stored contiguously and accessed with a linear search or treap. This exploits knowledge of the data, cache locality, and a simplified search routine. It also eliminates the need to test for dummy entries on each probe. The preconditions for this strategy arise in symbol tables and in the builtin dictionary. From fdrake@users.sourceforge.net Fri May 2 21:18:04 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 May 2003 13:18:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv14534 Modified Files: l2hinit.perl Log Message: - add link relationships to some of the links in the navigation panels - implement custom_REL_hook() so LaTeX2HTML uses currently recommended link types; those work fine with tools like the Mozilla Site Navigation Bar Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** l2hinit.perl 2 May 2003 18:21:22 -0000 1.70 --- l2hinit.perl 2 May 2003 20:18:01 -0000 1.71 *************** *** 100,113 **** $CUSTOM_BUTTONS = ''; ! sub make_nav_sectref($$) { ! my($label, $title) = @_; if ($title) { if ($title =~ /\<[aA] /) { ! $title =~ s/\<[aA] /$title"; } ! return "$label: $title\n"; } return ''; --- 100,113 ---- $CUSTOM_BUTTONS = ''; ! sub make_nav_sectref($$$) { ! my($label, $linktype, $title) = @_; if ($title) { if ($title =~ /\<[aA] /) { ! $title =~ s/\<[aA] /$title"; } ! return "$label:\n$title\n"; } return ''; *************** *** 176,182 **** . "\n\n" # textual navigation ! . make_nav_sectref("Previous", $PREVIOUS_TITLE) ! . make_nav_sectref("Up", $UP_TITLE) ! . make_nav_sectref("Next", $NEXT_TITLE) ); # remove these; they are unnecessary and cause errors from validation --- 176,182 ---- . "\n\n" # textual navigation ! . make_nav_sectref("Previous", "prev", $PREVIOUS_TITLE) ! . make_nav_sectref("Up", "parent", $UP_TITLE) ! . make_nav_sectref("Next", "next", $NEXT_TITLE) ); # remove these; they are unnecessary and cause errors from validation *************** *** 581,584 **** --- 581,593 ---- %declarations); + + # This is used to map the link rel attributes LaTeX2HTML uses to those + # currently recommended by the W3C. + sub custom_REL_hook { + my($rel,$junk) = @_; + return 'parent' if $rel eq 'up'; + return 'prev' if $rel eq 'previous'; + return $rel; + } # This is added to get rid of the long comment that follows the From rhettinger@users.sourceforge.net Fri May 2 21:24:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 13:24:59 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.753,1.754 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17775 Modified Files: NEWS Log Message: Note itertools.islice() bugfix. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.753 retrieving revision 1.754 diff -C2 -d -r1.753 -r1.754 *** NEWS 29 Apr 2003 21:07:16 -0000 1.753 --- NEWS 2 May 2003 20:24:56 -0000 1.754 *************** *** 16,19 **** --- 16,22 ---- ----------------- + - itertools.islice() now accepts stop=None as documented. + Fixes SF bug #730685. + Library ------- From jackjansen@users.sourceforge.net Fri May 2 21:27:45 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 02 May 2003 13:27:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv19010 Modified Files: pimp.py Log Message: CWI moved websites around without me knowing it, and together with a bug in urllib2 this caused pimp to stop working. Fixed the URL to make it work again. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pimp.py 22 Apr 2003 13:56:19 -0000 1.18 --- pimp.py 2 May 2003 20:27:40 -0000 1.19 *************** *** 44,48 **** DEFAULT_BUILDDIR='/tmp' DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() ! DEFAULT_PIMPDATABASE="http://www.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform() def _cmd(output, dir, *cmditems): --- 44,48 ---- DEFAULT_BUILDDIR='/tmp' DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() ! DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform() def _cmd(output, dir, *cmditems): From fdrake@users.sourceforge.net Fri May 2 21:30:21 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 May 2003 13:30:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv20854 Modified Files: l2hinit.perl Log Message: add link types for the remaining links in the navigation panels Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** l2hinit.perl 2 May 2003 20:18:01 -0000 1.71 --- l2hinit.perl 2 May 2003 20:30:18 -0000 1.72 *************** *** 142,151 **** } ! sub use_my_icon($) { ! my $s = $_[0]; if ($s =~ /\/) { my $r = get_my_icon($1); $s =~ s/\/$r/; } return $s; } --- 142,152 ---- } ! sub use_my_icon($$) { ! my($s,$rel) = @_; if ($s =~ /\/) { my $r = get_my_icon($1); $s =~ s/\/$r/; } + $s =~ s/<[aA] / Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv22160 Modified Files: pep-0001.txt Log Message: add proactive review power for BDFL; add a description of acceptance criteria; and take some credit ;-) Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** pep-0001.txt 8 Nov 2002 04:48:16 -0000 1.40 --- pep-0001.txt 2 May 2003 21:34:44 -0000 1.41 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: Barry A. Warsaw, Jeremy Hylton Status: Active Type: Informational --- 3,7 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Barry A. Warsaw, Jeremy Hylton, David Goodger Status: Active Type: Informational *************** *** 111,115 **** editor that it is ready for review. PEPs are reviewed by the BDFL and his chosen consultants, who may accept or reject a PEP or send ! it back to the author(s) for revision. Once a PEP has been accepted, the reference implementation must be --- 111,130 ---- editor that it is ready for review. PEPs are reviewed by the BDFL and his chosen consultants, who may accept or reject a PEP or send ! it back to the author(s) for revision. For a PEP that is ! pre-determined to be acceptable (e.g., it is an obvious win as-is ! and/or its implementation has already been checked in) the BDFL ! may also initiate a PEP review, first notifying the PEP author(s) ! and giving them a chance to make revisions. ! ! For a PEP to be accepted it must meet certain minimum criteria. ! It must be a clear and complete description of the proposed ! enhancement. The enhancement must represent a net improvement. ! The proposed implementation, if applicable, must be solid and must ! not complicate the interpreter unduly. Finally, a proposed ! enhancement must be "pythonic" in order to be accepted by the ! BDFL. (However, "pythonic" is an imprecise term; it may be ! defined as whatever is acceptable to the BDFL. This logic is ! intentionally circular.) See PEP 2 [10] for standard library ! module acceptance criteria. Once a PEP has been accepted, the reference implementation must be *************** *** 383,386 **** --- 398,404 ---- [9] http://docutils.sourceforge.net/ + + [10] PEP 2, Procedure for Adding New Modules, Faassen + http://www.python.org/peps/pep-0002.html From rhettinger@users.sourceforge.net Fri May 2 23:38:09 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 15:38:09 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26154 Modified Files: test_itertools.py Log Message: Add StopIteration tests. Simplify test_main(). Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_itertools.py 2 May 2003 19:44:20 -0000 1.8 --- test_itertools.py 2 May 2003 22:38:07 -0000 1.9 *************** *** 107,110 **** --- 107,132 ---- self.assertEqual(list(dropwhile(underten, data)), [20, 2, 4, 6, 8]) + def test_StopIteration(self): + class StopNow: + """Test support class . Emulates an empty iterable.""" + def __iter__(self): + return self + def next(self): + raise StopIteration + + for f in (chain, cycle, izip): + self.assertRaises(StopIteration, f([]).next) + self.assertRaises(StopIteration, f(StopNow()).next) + + self.assertRaises(StopIteration, islice([], None).next) + self.assertRaises(StopIteration, islice(StopNow(), None).next) + + self.assertRaises(StopIteration, repeat(None, 0).next) + + for f in (ifilter, ifilterfalse, imap, takewhile, dropwhile, starmap): + self.assertRaises(StopIteration, f(lambda x:x, []).next) + self.assertRaises(StopIteration, f(lambda x:x, StopNow()).next) + + libreftest = """ Doctest for examples in the library reference, libitertools.tex *************** *** 227,241 **** def test_main(verbose=None): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestBasicOps)) ! test_support.run_suite(suite) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): ! counts = [] ! for i in xrange(5): ! test_support.run_suite(suite) ! counts.append(sys.gettotalrefcount()-i) print counts --- 249,261 ---- def test_main(verbose=None): ! test_support.run_unittest(TestBasicOps) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): ! counts = [None] * 5 ! for i in xrange(len(counts)): ! test_support.run_unittest(TestBasicOps) ! counts[i] = sys.gettotalrefcount() print counts From rhettinger@users.sourceforge.net Fri May 2 23:45:02 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 15:45:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_random.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31341 Modified Files: test_random.py Log Message: Simplify ref count test. Index: test_random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_random.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_random.py 21 Feb 2003 01:41:36 -0000 1.9 --- test_random.py 2 May 2003 22:44:59 -0000 1.10 *************** *** 284,291 **** import sys if verbose and hasattr(sys, "gettotalrefcount"): ! counts = [] ! for i in xrange(5): test_support.run_suite(suite) ! counts.append(sys.gettotalrefcount()-i) print counts --- 284,291 ---- import sys if verbose and hasattr(sys, "gettotalrefcount"): ! counts = [None] * 5 ! for i in xrange(len(counts)): test_support.run_suite(suite) ! counts[i] = sys.gettotalrefcount() print counts From jhylton@users.sourceforge.net Fri May 2 23:48:18 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 02 May 2003 15:48:18 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv464/decimal Log Message: Directory /cvsroot/python/python/nondist/sandbox/decimal added to the repository From eprice@users.sourceforge.net Fri May 2 23:50:11 2003 From: eprice@users.sourceforge.net (eprice@users.sourceforge.net) Date: Fri, 02 May 2003 15:50:11 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv1450 Added Files: Decimal.py Log Message: Initial checkin of a floating point decimal arithmetic package. --- NEW FILE: Decimal.py --- # Class Decimal, version 0.7.0 # Written by Eric Price # Based on code written by Aahz (aahz@pobox.com) # Currently under BSD-style license (copyright 2003) """ This is a stab at a decimal arithmetic module based on the decimal arithmetic ANSI standard X3.274-1996. Most of the information used to create this module was helpfully provided by Mike Cowlishaw's work at http://www2.hursley.ibm.com/decimal/ The rest comes from Tim Peters's FixedPoint.py, particularly the string conversion routine and general Pythonic practices. In the current form of Decimal(), precision is finite but unbounded, with the exception of division and square roots. Here are some simple test cases that show how to use Decimal. There is a separate full-blown test harness (run Test(testdatadir).test()) [...2868 lines suppressed...] def change_precision(self, prec): self.context.prec = prec def change_rounding_method(self, rounding): self.context.rounding = rounding def change_min_exponent(self, exp): self.context.Emin = exp def change_max_exponent(self, exp): self.context.Emax = exp def change_clamp(self, clamp): self.context.clamp = clamp def _test(): t = Test('./') t.test() if __name__ == '__main__': _test() From jhylton@users.sourceforge.net Fri May 2 23:51:28 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 02 May 2003 15:51:28 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal/tests - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal/tests In directory sc8-pr-cvs1:/tmp/cvs-serv2480/tests Log Message: Directory /cvsroot/python/python/nondist/sandbox/decimal/tests added to the repository From goodger@users.sourceforge.net Fri May 2 23:53:34 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 02 May 2003 15:53:34 -0700 Subject: [Python-checkins] python/nondist/peps pep-0315.txt,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv3935 Added Files: pep-0315.txt Log Message: "Enhanced While Loop", by W Isaac Carroll --- NEW FILE: pep-0315.txt --- PEP: 315 Title: Enhanced While Loop Version: $Revision: 1.1 $ Last-Modified: $Date: 2003/05/02 22:53:32 $ Author: W Isaac Carroll Status: Draft Type: Standards Track Content-Type: text/plain Created: 25-Apr-2003 Python-Version: 2.4 Post-History: Abstract This PEP proposes adding an optional "do" clause to the beginning of the while loop to make loop code clearer and reduce errors caused by code duplication. Motivation It is often necessary for some code to be executed before each evaluation of the while loop condition. This code is often duplicated outside the loop, as setup code that executes once before entering the loop: while : The problem is that duplicated code can be a source of errors if one instance is changed but the other is not. Also, the purpose of the second instance of the setup code is not clear because it comes at the end of the loop. It is possible to prevent code duplication by moving the loop condition into a helper function, or an if statement in the loop body. However, separating the loop condition from the while keyword makes the behavior of the loop less clear: def helper(args): return while helper(args): This last form has the additional drawback of requiring the loop's else clause to be added to the body of the if statement, further obscuring the loop's behavior: while True: if not : break This PEP proposes to solve these problems by adding an optional clause to the while loop, which allows the setup code to be expressed in a natural way: do: while : This keeps the loop condition with the while keyword where it belongs, and does not require code to be duplicated. Syntax The syntax of the while statement while_stmt : "while" expression ":" suite ["else" ":" suite] is extended as follows: while_stmt : ["do" ":" suite] "while" expression ":" suite ["else" ":" suite] Semantics of break and continue In the do-while loop the break statement will behave the same as in the standard while loop: It will immediately terminate the loop without evaluating the loop condition or executing the else clause. A continue statement in the do-while loop will behave somewhat differently than in the standard while loop. Instead of jumping back to the loop condition, it will jump to the beginning of the first suite of the loop. This is to ensure that the setup code has a chance to do its job before the condition is evaluated. Future Statement Because of the new keyword "do", the statement from __future__ import do_while will initially be required to use the do-while form. Implementation The first implementation of this PEP can compile the do-while loop as an infinite loop with a test that exits the loop. Copyright This document is placed in the public domain. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 75 End: From goodger@users.sourceforge.net Fri May 2 23:53:57 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Fri, 02 May 2003 15:53:57 -0700 Subject: [Python-checkins] python/nondist/peps pep-0000.txt,1.239,1.240 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4217 Modified Files: pep-0000.txt Log Message: added PEP 315; updated Index: pep-0000.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0000.txt,v retrieving revision 1.239 retrieving revision 1.240 diff -C2 -d -r1.239 -r1.240 *** pep-0000.txt 21 Apr 2003 15:25:14 -0000 1.239 --- pep-0000.txt 2 May 2003 22:53:55 -0000 1.240 *************** *** 31,35 **** I 0 Index of Python Enhancement Proposals Goodger, Warsaw ! I 1 PEP Guidelines Warsaw, Hylton I 2 Procedure for Adding New Modules Faassen I 3 Guidelines for Handling Bug Reports Hylton --- 31,35 ---- I 0 Index of Python Enhancement Proposals Goodger, Warsaw ! I 1 PEP Guidelines Warsaw, Hylton, Goodger I 2 Procedure for Adding New Modules Faassen I 3 Guidelines for Handling Bug Reports Hylton *************** *** 116,119 **** --- 116,120 ---- S 313 Adding Roman Numeral Literals to Python Meyer S 314 Metadata for Python Software Packages v1.1 Kuchling + S 315 Enhanced While Loop Carroll S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 188,193 **** num title owner --- ----- ----- ! I 0 Index of Python Enhancement Proposals Warsaw ! I 1 PEP Guidelines Warsaw, Hylton I 2 Procedure for Adding New Modules Faassen I 3 Guidelines for Handling Bug Reports Hylton --- 189,194 ---- num title owner --- ----- ----- ! I 0 Index of Python Enhancement Proposals Goodger, Warsaw ! I 1 PEP Guidelines Warsaw, Hylton, Goodger I 2 Procedure for Adding New Modules Faassen I 3 Guidelines for Handling Bug Reports Hylton *************** *** 322,325 **** --- 323,327 ---- S 313 Adding Roman Numeral Literals to Python Meyer S 314 Metadata for Python Software Packages v1.1 Kuchling + S 315 Enhanced While Loop Carroll SR 666 Reject Foolish Indentation Creighton S 754 IEEE 754 Floating Point Special Values Warnes *************** *** 348,351 **** --- 350,354 ---- Baxter, Anthony anthony@interlink.com.au Bellman, Thomas bellman+pep-divmod@lysator.liu.se + Carroll, W Isaac icarroll@pobox.com Cole, Dave djc@object-craft.com.au Craig, Christopher python-pep@ccraig.org From rhettinger@users.sourceforge.net Sat May 3 00:01:26 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 16:01:26 -0700 Subject: [Python-checkins] python/nondist/sandbox/itertools NEWS,1.1,NONE itertools.c,1.21,NONE libitertools.tex,1.20,NONE setup.py,1.1,NONE test_itertools.py,1.13,NONE todo.txt,1.16,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/itertools In directory sc8-pr-cvs1:/tmp/cvs-serv8623/itertools Removed Files: NEWS itertools.c libitertools.tex setup.py test_itertools.py todo.txt Log Message: Clean out sandbox. --- NEWS DELETED --- --- itertools.c DELETED --- --- libitertools.tex DELETED --- --- setup.py DELETED --- --- test_itertools.py DELETED --- --- todo.txt DELETED --- From jhylton@users.sourceforge.net Sat May 3 00:07:38 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 02 May 2003 16:07:38 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal/tests trim.decTest,NONE,1.1 testall.decTest,NONE,1.1 subtract.decTest,NONE,1.1 squareroot.decTest,NONE,1.1 rounding.decTest,NONE,1.1 rescale.decTest,NONE,1.1 remainderNear.decTest,NONE,1.1 remainder.decTest,NONE,1.1 randoms.decTest,NONE,1.1 randomBound32.decTest,NONE,1.1 power.decTest,NONE,1.1 plus.decTest,NONE,1.1 normalize.decTest,NONE,1.1 multiply.decTest,NONE,1.1 minus.decTest,NONE,1.1 min.decTest,NONE,1.1 max.decTest,NONE,1.1 integer.decTest,NONE,1.1 inexact.decTest,NONE,1.1 divideint.decTest,NONE,1.1 divide.decTest,NONE,1.1 decimal64.decTest,NONE,1.1 compare.decTest,NONE,1.1 clamp.decTest,NONE,1.1 base.decTest,NONE,1.1 add.decTest,NONE,1.1 abs.decTest,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal/tests In directory sc8-pr-cvs1:/tmp/cvs-serv11296/tests Added Files: trim.decTest testall.decTest subtract.decTest squareroot.decTest rounding.decTest rescale.decTest remainderNear.decTest remainder.decTest randoms.decTest randomBound32.decTest power.decTest plus.decTest normalize.decTest multiply.decTest minus.decTest min.decTest max.decTest integer.decTest inexact.decTest divideint.decTest divide.decTest decimal64.decTest compare.decTest clamp.decTest base.decTest add.decTest abs.decTest Log Message: Add tests code from IBM web page, http://www2.hursley.ibm.com/decimal/ --- NEW FILE: trim.decTest --- ------------------------------------------------------------------------ -- trim.decTest -- remove insignificant trailing zeros -- -- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 trmx001 trim '1' -> '1' trmx002 trim '-1' -> '-1' trmx003 trim '1.00' -> '1' trmx004 trim '-1.00' -> '-1' trmx005 trim '0' -> '0' trmx006 trim '0.00' -> '0' trmx007 trim '00.0' -> '0' trmx008 trim '00.00' -> '0' trmx009 trim '00' -> '0' trmx010 trim '-2' -> '-2' trmx011 trim '2' -> '2' trmx012 trim '-2.00' -> '-2' trmx013 trim '2.00' -> '2' trmx014 trim '-0' -> '-0' trmx015 trim '-0.00' -> '-0' trmx016 trim '-00.0' -> '-0' trmx017 trim '-00.00' -> '-0' trmx018 trim '-00' -> '-0' trmx019 trim '0E+5' -> '0' trmx020 trim '-0E+1' -> '-0' trmx030 trim '+0.1' -> '0.1' trmx031 trim '-0.1' -> '-0.1' trmx032 trim '+0.01' -> '0.01' trmx033 trim '-0.01' -> '-0.01' trmx034 trim '+0.001' -> '0.001' trmx035 trim '-0.001' -> '-0.001' trmx036 trim '+0.000001' -> '0.000001' trmx037 trim '-0.000001' -> '-0.000001' trmx038 trim '+0.000000000001' -> '1E-12' trmx039 trim '-0.000000000001' -> '-1E-12' trmx041 trim 1.1 -> 1.1 trmx042 trim 1.10 -> 1.1 trmx043 trim 1.100 -> 1.1 trmx044 trim 1.110 -> 1.11 trmx045 trim -1.1 -> -1.1 trmx046 trim -1.10 -> -1.1 trmx047 trim -1.100 -> -1.1 trmx048 trim -1.110 -> -1.11 trmx049 trim 9.9 -> 9.9 trmx050 trim 9.90 -> 9.9 trmx051 trim 9.900 -> 9.9 trmx052 trim 9.990 -> 9.99 trmx053 trim -9.9 -> -9.9 trmx054 trim -9.90 -> -9.9 trmx055 trim -9.900 -> -9.9 trmx056 trim -9.990 -> -9.99 -- some insignificant trailing fractional zeros trmx060 trim 10.0 -> 10 trmx061 trim 10.00 -> 10 trmx062 trim 100.0 -> 100 trmx063 trim 100.00 -> 100 trmx064 trim 1.1000E+3 -> 1100 trmx065 trim 1.10000E+3 -> 1100 trmx066 trim -10.0 -> -10 trmx067 trim -10.00 -> -10 trmx068 trim -100.0 -> -100 trmx069 trim -100.00 -> -100 trmx070 trim -1.1000E+3 -> -1100 trmx071 trim -1.10000E+3 -> -1100 -- some insignificant trailing zeros with positive exponent trmx080 trim 10E+1 -> 1E+2 trmx081 trim 100E+1 -> 1E+3 trmx082 trim 1.0E+2 -> 1E+2 trmx083 trim 1.0E+3 -> 1E+3 trmx084 trim 1.1E+3 -> 1.1E+3 trmx085 trim 1.00E+3 -> 1E+3 trmx086 trim 1.10E+3 -> 1.1E+3 trmx087 trim -10E+1 -> -1E+2 trmx088 trim -100E+1 -> -1E+3 trmx089 trim -1.0E+2 -> -1E+2 trmx090 trim -1.0E+3 -> -1E+3 trmx091 trim -1.1E+3 -> -1.1E+3 trmx092 trim -1.00E+3 -> -1E+3 trmx093 trim -1.10E+3 -> -1.1E+3 -- some significant trailing zeros trmx100 trim 11 -> 11 trmx101 trim 10 -> 10 trmx102 trim 10. -> 10 trmx103 trim 1.1E+1 -> 11 trmx104 trim 1.0E+1 -> 10 trmx105 trim 1.10E+2 -> 110 trmx106 trim 1.00E+2 -> 100 trmx107 trim 1.100E+3 -> 1100 trmx108 trim 1.000E+3 -> 1000 trmx109 trim 1.000000E+6 -> 1000000 trmx110 trim -11 -> -11 trmx111 trim -10 -> -10 trmx112 trim -10. -> -10 trmx113 trim -1.1E+1 -> -11 trmx114 trim -1.0E+1 -> -10 trmx115 trim -1.10E+2 -> -110 trmx116 trim -1.00E+2 -> -100 trmx117 trim -1.100E+3 -> -1100 trmx118 trim -1.000E+3 -> -1000 trmx119 trim -1.00000E+5 -> -100000 trmx120 trim -1.000000E+6 -> -1000000 -- examples from decArith trmx140 trim '2.1' -> '2.1' trmx141 trim '-2.0' -> '-2' trmx142 trim '1.200' -> '1.2' trmx143 trim '-120' -> '-120' trmx144 trim '120.00' -> '120' trmx145 trim '0.00' -> '0' -- utilities pass through specials without raising exceptions trmx320 trim 'Inf' -> 'Infinity' trmx321 trim '-Inf' -> '-Infinity' trmx322 trim NaN -> NaN trmx323 trim sNaN -> sNaN -- Null test trmx900 trim # -> NaN Invalid_operation --- NEW FILE: testall.decTest --- ------------------------------------------------------------------------ -- testall.decTest -- run all general decimal arithmetic testcases -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- core tests (using Extended: 1) -------------------------------------- dectest: base dectest: abs dectest: add dectest: clamp dectest: compare dectest: divide dectest: divideint dectest: inexact dectest: integer dectest: max dectest: min dectest: minus dectest: multiply dectest: normalize dectest: plus dectest: power dectest: randoms dectest: remainder dectest: remaindernear dectest: rescale dectest: rounding dectest: squareroot dectest: subtract dectest: trim -- The next are for the Strawman 4d concrete representations dectest: decimal32 dectest: decimal64 dectest: decimal128 -- General 31->33-digit boundary tests dectest: randomBound32 --- NEW FILE: subtract.decTest --- ------------------------------------------------------------------------ -- subtract.decTest -- decimal subtraction -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- [first group are 'quick confidence check'] subx001 subtract 0 0 -> '0' subx002 subtract 1 1 -> '0' subx003 subtract 1 2 -> '-1' subx004 subtract 2 1 -> '1' subx005 subtract 2 2 -> '0' subx006 subtract 3 2 -> '1' subx007 subtract 2 3 -> '-1' subx011 subtract -0 0 -> '-0' subx012 subtract -1 1 -> '-2' subx013 subtract -1 2 -> '-3' subx014 subtract -2 1 -> '-3' subx015 subtract -2 2 -> '-4' subx016 subtract -3 2 -> '-5' subx017 subtract -2 3 -> '-5' subx021 subtract 0 -0 -> '0' subx022 subtract 1 -1 -> '2' subx023 subtract 1 -2 -> '3' subx024 subtract 2 -1 -> '3' subx025 subtract 2 -2 -> '4' subx026 subtract 3 -2 -> '5' subx027 subtract 2 -3 -> '5' subx030 subtract 11 1 -> 10 subx031 subtract 10 1 -> 9 subx032 subtract 9 1 -> 8 subx033 subtract 1 1 -> 0 subx034 subtract 0 1 -> -1 subx035 subtract -1 1 -> -2 subx036 subtract -9 1 -> -10 subx037 subtract -10 1 -> -11 subx038 subtract -11 1 -> -12 subx040 subtract '5.75' '3.3' -> '2.45' subx041 subtract '5' '-3' -> '8' subx042 subtract '-5' '-3' -> '-2' subx043 subtract '-7' '2.5' -> '-9.5' subx044 subtract '0.7' '0.3' -> '0.4' subx045 subtract '1.3' '0.3' -> '1.0' subx046 subtract '1.25' '1.25' -> '0.00' subx050 subtract '1.23456789' '1.00000000' -> '0.23456789' subx051 subtract '1.23456789' '1.00000089' -> '0.23456700' subx052 subtract '0.5555555559' '0.0000000001' -> '0.555555556' Inexact Rounded subx053 subtract '0.5555555559' '0.0000000005' -> '0.555555555' Inexact Rounded subx054 subtract '0.4444444444' '0.1111111111' -> '0.333333333' Inexact Rounded subx055 subtract '1.0000000000' '0.00000001' -> '0.999999990' Rounded subx056 subtract '0.4444444444999' '0' -> '0.444444444' Inexact Rounded subx057 subtract '0.4444444445000' '0' -> '0.444444445' Inexact Rounded subx060 subtract '70' '10000e+9' -> '-1.00000000E+13' Inexact Rounded subx061 subtract '700' '10000e+9' -> '-1.00000000E+13' Inexact Rounded subx062 subtract '7000' '10000e+9' -> '-9.99999999E+12' Inexact Rounded subx063 subtract '70000' '10000e+9' -> '-9.99999993E+12' Rounded subx064 subtract '700000' '10000e+9' -> '-9.99999930E+12' Rounded -- symmetry: subx065 subtract '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded subx066 subtract '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded subx067 subtract '10000e+9' '7000' -> '9.99999999E+12' Inexact Rounded subx068 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded subx069 subtract '10000e+9' '700000' -> '9.99999930E+12' Rounded -- change precision subx080 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded precision: 6 subx081 subtract '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded precision: 9 -- some of the next group are really constructor tests subx090 subtract '00.0' '0.0' -> '0.0' subx091 subtract '00.0' '0.00' -> '0.00' subx092 subtract '0.00' '00.0' -> '0.00' subx093 subtract '00.0' '0.00' -> '0.00' subx094 subtract '0.00' '00.0' -> '0.00' subx095 subtract '3' '.3' -> '2.7' subx096 subtract '3.' '.3' -> '2.7' subx097 subtract '3.0' '.3' -> '2.7' subx098 subtract '3.00' '.3' -> '2.70' subx099 subtract '3' '3' -> '0' subx100 subtract '3' '+3' -> '0' subx101 subtract '3' '-3' -> '6' subx102 subtract '3' '0.3' -> '2.7' subx103 subtract '3.' '0.3' -> '2.7' subx104 subtract '3.0' '0.3' -> '2.7' subx105 subtract '3.00' '0.3' -> '2.70' subx106 subtract '3' '3.0' -> '0.0' subx107 subtract '3' '+3.0' -> '0.0' subx108 subtract '3' '-3.0' -> '6.0' -- the above all from add; massaged and extended. Now some new ones... -- [particularly important for comparisons] -- NB: -xE-8 below were non-exponents pre-ANSI X3-274, and -1E-7 or 0E-7 -- with input rounding. subx120 subtract '10.23456784' '10.23456789' -> '-5E-8' subx121 subtract '10.23456785' '10.23456789' -> '-4E-8' subx122 subtract '10.23456786' '10.23456789' -> '-3E-8' subx123 subtract '10.23456787' '10.23456789' -> '-2E-8' subx124 subtract '10.23456788' '10.23456789' -> '-1E-8' subx125 subtract '10.23456789' '10.23456789' -> '0E-8' subx126 subtract '10.23456790' '10.23456789' -> '1E-8' subx127 subtract '10.23456791' '10.23456789' -> '2E-8' subx128 subtract '10.23456792' '10.23456789' -> '3E-8' subx129 subtract '10.23456793' '10.23456789' -> '4E-8' subx130 subtract '10.23456794' '10.23456789' -> '5E-8' subx131 subtract '10.23456781' '10.23456786' -> '-5E-8' subx132 subtract '10.23456782' '10.23456786' -> '-4E-8' subx133 subtract '10.23456783' '10.23456786' -> '-3E-8' subx134 subtract '10.23456784' '10.23456786' -> '-2E-8' subx135 subtract '10.23456785' '10.23456786' -> '-1E-8' subx136 subtract '10.23456786' '10.23456786' -> '0E-8' subx137 subtract '10.23456787' '10.23456786' -> '1E-8' subx138 subtract '10.23456788' '10.23456786' -> '2E-8' subx139 subtract '10.23456789' '10.23456786' -> '3E-8' subx140 subtract '10.23456790' '10.23456786' -> '4E-8' subx141 subtract '10.23456791' '10.23456786' -> '5E-8' subx142 subtract '1' '0.999999999' -> '1E-9' subx143 subtract '0.999999999' '1' -> '-1E-9' subx144 subtract '-10.23456780' '-10.23456786' -> '6E-8' subx145 subtract '-10.23456790' '-10.23456786' -> '-4E-8' subx146 subtract '-10.23456791' '-10.23456786' -> '-5E-8' precision: 3 subx150 subtract '12345678900000' '9999999999999' -> 2.35E+12 Inexact Rounded subx151 subtract '9999999999999' '12345678900000' -> -2.35E+12 Inexact Rounded precision: 6 subx152 subtract '12345678900000' '9999999999999' -> 2.34568E+12 Inexact Rounded subx153 subtract '9999999999999' '12345678900000' -> -2.34568E+12 Inexact Rounded precision: 9 subx154 subtract '12345678900000' '9999999999999' -> 2.34567890E+12 Inexact Rounded subx155 subtract '9999999999999' '12345678900000' -> -2.34567890E+12 Inexact Rounded precision: 12 subx156 subtract '12345678900000' '9999999999999' -> 2.34567890000E+12 Inexact Rounded subx157 subtract '9999999999999' '12345678900000' -> -2.34567890000E+12 Inexact Rounded precision: 15 subx158 subtract '12345678900000' '9999999999999' -> 2345678900001 subx159 subtract '9999999999999' '12345678900000' -> -2345678900001 precision: 9 -- additional scaled arithmetic tests [0.97 problem] subx160 subtract '0' '.1' -> '-0.1' subx161 subtract '00' '.97983' -> '-0.97983' subx162 subtract '0' '.9' -> '-0.9' subx163 subtract '0' '0.102' -> '-0.102' subx164 subtract '0' '.4' -> '-0.4' subx165 subtract '0' '.307' -> '-0.307' subx166 subtract '0' '.43822' -> '-0.43822' subx167 subtract '0' '.911' -> '-0.911' subx168 subtract '.0' '.02' -> '-0.02' subx169 subtract '00' '.392' -> '-0.392' subx170 subtract '0' '.26' -> '-0.26' subx171 subtract '0' '0.51' -> '-0.51' subx172 subtract '0' '.2234' -> '-0.2234' subx173 subtract '0' '.2' -> '-0.2' subx174 subtract '.0' '.0008' -> '-0.0008' -- 0. on left subx180 subtract '0.0' '-.1' -> '0.1' subx181 subtract '0.00' '-.97983' -> '0.97983' subx182 subtract '0.0' '-.9' -> '0.9' subx183 subtract '0.0' '-0.102' -> '0.102' subx184 subtract '0.0' '-.4' -> '0.4' subx185 subtract '0.0' '-.307' -> '0.307' subx186 subtract '0.0' '-.43822' -> '0.43822' subx187 subtract '0.0' '-.911' -> '0.911' subx188 subtract '0.0' '-.02' -> '0.02' subx189 subtract '0.00' '-.392' -> '0.392' subx190 subtract '0.0' '-.26' -> '0.26' subx191 subtract '0.0' '-0.51' -> '0.51' subx192 subtract '0.0' '-.2234' -> '0.2234' subx193 subtract '0.0' '-.2' -> '0.2' subx194 subtract '0.0' '-.0008' -> '0.0008' -- negatives of same subx200 subtract '0' '-.1' -> '0.1' subx201 subtract '00' '-.97983' -> '0.97983' subx202 subtract '0' '-.9' -> '0.9' subx203 subtract '0' '-0.102' -> '0.102' subx204 subtract '0' '-.4' -> '0.4' subx205 subtract '0' '-.307' -> '0.307' subx206 subtract '0' '-.43822' -> '0.43822' subx207 subtract '0' '-.911' -> '0.911' subx208 subtract '.0' '-.02' -> '0.02' subx209 subtract '00' '-.392' -> '0.392' subx210 subtract '0' '-.26' -> '0.26' subx211 subtract '0' '-0.51' -> '0.51' subx212 subtract '0' '-.2234' -> '0.2234' subx213 subtract '0' '-.2' -> '0.2' subx214 subtract '.0' '-.0008' -> '0.0008' -- more fixed, LHS swaps [really the same as testcases under add] subx220 subtract '-56267E-12' 0 -> '-5.6267E-8' subx221 subtract '-56267E-11' 0 -> '-5.6267E-7' subx222 subtract '-56267E-10' 0 -> '-0.0000056267' subx223 subtract '-56267E-9' 0 -> '-0.000056267' subx224 subtract '-56267E-8' 0 -> '-0.00056267' subx225 subtract '-56267E-7' 0 -> '-0.0056267' subx226 subtract '-56267E-6' 0 -> '-0.056267' subx227 subtract '-56267E-5' 0 -> '-0.56267' subx228 subtract '-56267E-2' 0 -> '-562.67' subx229 subtract '-56267E-1' 0 -> '-5626.7' subx230 subtract '-56267E-0' 0 -> '-56267' -- symmetry ... subx240 subtract 0 '-56267E-12' -> '5.6267E-8' subx241 subtract 0 '-56267E-11' -> '5.6267E-7' subx242 subtract 0 '-56267E-10' -> '0.0000056267' subx243 subtract 0 '-56267E-9' -> '0.000056267' subx244 subtract 0 '-56267E-8' -> '0.00056267' subx245 subtract 0 '-56267E-7' -> '0.0056267' subx246 subtract 0 '-56267E-6' -> '0.056267' subx247 subtract 0 '-56267E-5' -> '0.56267' subx248 subtract 0 '-56267E-2' -> '562.67' subx249 subtract 0 '-56267E-1' -> '5626.7' subx250 subtract 0 '-56267E-0' -> '56267' -- now some more from the 'new' add precision: 9 subx301 subtract '1.23456789' '1.00000000' -> '0.23456789' subx302 subtract '1.23456789' '1.00000011' -> '0.23456778' subx311 subtract '0.4444444444' '0.5555555555' -> '-0.111111111' Inexact Rounded subx312 subtract '0.4444444440' '0.5555555555' -> '-0.111111112' Inexact Rounded subx313 subtract '0.4444444444' '0.5555555550' -> '-0.111111111' Inexact Rounded subx314 subtract '0.44444444449' '0' -> '0.444444444' Inexact Rounded subx315 subtract '0.444444444499' '0' -> '0.444444444' Inexact Rounded subx316 subtract '0.4444444444999' '0' -> '0.444444444' Inexact Rounded subx317 subtract '0.4444444445000' '0' -> '0.444444445' Inexact Rounded subx318 subtract '0.4444444445001' '0' -> '0.444444445' Inexact Rounded subx319 subtract '0.444444444501' '0' -> '0.444444445' Inexact Rounded subx320 subtract '0.44444444451' '0' -> '0.444444445' Inexact Rounded -- some carrying effects subx321 subtract '0.9998' '0.0000' -> '0.9998' subx322 subtract '0.9998' '0.0001' -> '0.9997' subx323 subtract '0.9998' '0.0002' -> '0.9996' subx324 subtract '0.9998' '0.0003' -> '0.9995' subx325 subtract '0.9998' '-0.0000' -> '0.9998' subx326 subtract '0.9998' '-0.0001' -> '0.9999' subx327 subtract '0.9998' '-0.0002' -> '1.0000' subx328 subtract '0.9998' '-0.0003' -> '1.0001' subx330 subtract '70' '10000e+9' -> '-1.00000000E+13' Inexact Rounded subx331 subtract '700' '10000e+9' -> '-1.00000000E+13' Inexact Rounded subx332 subtract '7000' '10000e+9' -> '-9.99999999E+12' Inexact Rounded subx333 subtract '70000' '10000e+9' -> '-9.99999993E+12' Rounded subx334 subtract '700000' '10000e+9' -> '-9.99999930E+12' Rounded subx335 subtract '7000000' '10000e+9' -> '-9.99999300E+12' Rounded -- symmetry: subx340 subtract '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded subx341 subtract '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded subx342 subtract '10000e+9' '7000' -> '9.99999999E+12' Inexact Rounded subx343 subtract '10000e+9' '70000' -> '9.99999993E+12' Rounded subx344 subtract '10000e+9' '700000' -> '9.99999930E+12' Rounded subx345 subtract '10000e+9' '7000000' -> '9.99999300E+12' Rounded -- same, higher precision precision: 15 subx346 subtract '10000e+9' '7' -> '9999999999993' subx347 subtract '10000e+9' '70' -> '9999999999930' subx348 subtract '10000e+9' '700' -> '9999999999300' subx349 subtract '10000e+9' '7000' -> '9999999993000' subx350 subtract '10000e+9' '70000' -> '9999999930000' subx351 subtract '10000e+9' '700000' -> '9999999300000' subx352 subtract '7' '10000e+9' -> '-9999999999993' subx353 subtract '70' '10000e+9' -> '-9999999999930' subx354 subtract '700' '10000e+9' -> '-9999999999300' subx355 subtract '7000' '10000e+9' -> '-9999999993000' subx356 subtract '70000' '10000e+9' -> '-9999999930000' subx357 subtract '700000' '10000e+9' -> '-9999999300000' -- zero preservation precision: 6 subx360 subtract '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded subx361 subtract 1 '0.0001' -> '0.9999' subx362 subtract 1 '0.00001' -> '0.99999' subx363 subtract 1 '0.000001' -> '0.999999' subx364 subtract 1 '0.0000001' -> '1.00000' Inexact Rounded subx365 subtract 1 '0.00000001' -> '1.00000' Inexact Rounded -- some funny zeros [in case of bad signum] subx370 subtract 1 0 -> 1 subx371 subtract 1 0. -> 1 subx372 subtract 1 .0 -> 1.0 subx373 subtract 1 0.0 -> 1.0 subx374 subtract 0 1 -> -1 subx375 subtract 0. 1 -> -1 subx376 subtract .0 1 -> -1.0 subx377 subtract 0.0 1 -> -1.0 precision: 9 -- leading 0 digit before round subx910 subtract -103519362 -51897955.3 -> -51621406.7 subx911 subtract 159579.444 89827.5229 -> 69751.9211 subx920 subtract 333.123456 33.1234566 -> 299.999999 Inexact Rounded subx921 subtract 333.123456 33.1234565 -> 300.000000 Inexact Rounded subx922 subtract 133.123456 33.1234565 -> 99.9999995 subx923 subtract 133.123456 33.1234564 -> 99.9999996 subx924 subtract 133.123456 33.1234540 -> 100.000002 Rounded subx925 subtract 133.123456 43.1234560 -> 90.0000000 subx926 subtract 133.123456 43.1234561 -> 89.9999999 subx927 subtract 133.123456 43.1234566 -> 89.9999994 subx928 subtract 101.123456 91.1234566 -> 9.9999994 subx929 subtract 101.123456 99.1234566 -> 1.9999994 -- more of the same; probe for cluster boundary problems precision: 1 subx930 subtract 11 2 -> 9 precision: 2 subx932 subtract 101 2 -> 99 precision: 3 subx934 subtract 101 2.1 -> 98.9 subx935 subtract 101 92.01 -> 8.99 precision: 4 subx936 subtract 101 2.01 -> 98.99 subx937 subtract 101 92.01 -> 8.99 subx938 subtract 101 92.006 -> 8.994 precision: 5 subx939 subtract 101 2.001 -> 98.999 subx940 subtract 101 92.001 -> 8.999 subx941 subtract 101 92.0006 -> 8.9994 precision: 6 subx942 subtract 101 2.0001 -> 98.9999 subx943 subtract 101 92.0001 -> 8.9999 subx944 subtract 101 92.00006 -> 8.99994 precision: 7 subx945 subtract 101 2.00001 -> 98.99999 subx946 subtract 101 92.00001 -> 8.99999 subx947 subtract 101 92.000006 -> 8.999994 precision: 8 subx948 subtract 101 2.000001 -> 98.999999 subx949 subtract 101 92.000001 -> 8.999999 subx950 subtract 101 92.0000006 -> 8.9999994 precision: 9 subx951 subtract 101 2.0000001 -> 98.9999999 subx952 subtract 101 92.0000001 -> 8.9999999 subx953 subtract 101 92.00000006 -> 8.99999994 precision: 9 -- more LHS swaps [were fixed] subx390 subtract '-56267E-10' 0 -> '-0.0000056267' subx391 subtract '-56267E-6' 0 -> '-0.056267' subx392 subtract '-56267E-5' 0 -> '-0.56267' subx393 subtract '-56267E-4' 0 -> '-5.6267' subx394 subtract '-56267E-3' 0 -> '-56.267' subx395 subtract '-56267E-2' 0 -> '-562.67' subx396 subtract '-56267E-1' 0 -> '-5626.7' subx397 subtract '-56267E-0' 0 -> '-56267' subx398 subtract '-5E-10' 0 -> '-5E-10' subx399 subtract '-5E-7' 0 -> '-5E-7' subx400 subtract '-5E-6' 0 -> '-0.000005' subx401 subtract '-5E-5' 0 -> '-0.00005' subx402 subtract '-5E-4' 0 -> '-0.0005' subx403 subtract '-5E-1' 0 -> '-0.5' subx404 subtract '-5E0' 0 -> '-5' subx405 subtract '-5E1' 0 -> '-50' subx406 subtract '-5E5' 0 -> '-500000' subx407 subtract '-5E8' 0 -> '-500000000' subx408 subtract '-5E9' 0 -> '-5.00000000E+9' Rounded subx409 subtract '-5E10' 0 -> '-5.00000000E+10' Rounded subx410 subtract '-5E11' 0 -> '-5.00000000E+11' Rounded subx411 subtract '-5E100' 0 -> '-5.00000000E+100' Rounded -- more RHS swaps [were fixed] subx420 subtract 0 '-56267E-10' -> '0.0000056267' subx421 subtract 0 '-56267E-6' -> '0.056267' subx422 subtract 0 '-56267E-5' -> '0.56267' subx423 subtract 0 '-56267E-4' -> '5.6267' subx424 subtract 0 '-56267E-3' -> '56.267' subx425 subtract 0 '-56267E-2' -> '562.67' subx426 subtract 0 '-56267E-1' -> '5626.7' subx427 subtract 0 '-56267E-0' -> '56267' subx428 subtract 0 '-5E-10' -> '5E-10' subx429 subtract 0 '-5E-7' -> '5E-7' subx430 subtract 0 '-5E-6' -> '0.000005' subx431 subtract 0 '-5E-5' -> '0.00005' subx432 subtract 0 '-5E-4' -> '0.0005' subx433 subtract 0 '-5E-1' -> '0.5' subx434 subtract 0 '-5E0' -> '5' subx435 subtract 0 '-5E1' -> '50' subx436 subtract 0 '-5E5' -> '500000' subx437 subtract 0 '-5E8' -> '500000000' subx438 subtract 0 '-5E9' -> '5.00000000E+9' Rounded subx439 subtract 0 '-5E10' -> '5.00000000E+10' Rounded subx440 subtract 0 '-5E11' -> '5.00000000E+11' Rounded subx441 subtract 0 '-5E100' -> '5.00000000E+100' Rounded -- try borderline precision, with carries, etc. precision: 15 subx461 subtract '1E+12' '1' -> '999999999999' subx462 subtract '1E+12' '-1.11' -> '1000000000001.11' subx463 subtract '1.11' '-1E+12' -> '1000000000001.11' subx464 subtract '-1' '-1E+12' -> '999999999999' subx465 subtract '7E+12' '1' -> '6999999999999' subx466 subtract '7E+12' '-1.11' -> '7000000000001.11' subx467 subtract '1.11' '-7E+12' -> '7000000000001.11' subx468 subtract '-1' '-7E+12' -> '6999999999999' -- 123456789012345 123456789012345 1 23456789012345 subx470 subtract '0.444444444444444' '-0.555555555555563' -> '1.00000000000001' Inexact Rounded subx471 subtract '0.444444444444444' '-0.555555555555562' -> '1.00000000000001' Inexact Rounded subx472 subtract '0.444444444444444' '-0.555555555555561' -> '1.00000000000001' Inexact Rounded subx473 subtract '0.444444444444444' '-0.555555555555560' -> '1.00000000000000' Inexact Rounded subx474 subtract '0.444444444444444' '-0.555555555555559' -> '1.00000000000000' Inexact Rounded subx475 subtract '0.444444444444444' '-0.555555555555558' -> '1.00000000000000' Inexact Rounded subx476 subtract '0.444444444444444' '-0.555555555555557' -> '1.00000000000000' Inexact Rounded subx477 subtract '0.444444444444444' '-0.555555555555556' -> '1.00000000000000' Rounded subx478 subtract '0.444444444444444' '-0.555555555555555' -> '0.999999999999999' subx479 subtract '0.444444444444444' '-0.555555555555554' -> '0.999999999999998' subx480 subtract '0.444444444444444' '-0.555555555555553' -> '0.999999999999997' subx481 subtract '0.444444444444444' '-0.555555555555552' -> '0.999999999999996' subx482 subtract '0.444444444444444' '-0.555555555555551' -> '0.999999999999995' subx483 subtract '0.444444444444444' '-0.555555555555550' -> '0.999999999999994' -- and some more, including residue effects and different roundings precision: 9 rounding: half_up subx500 subtract '123456789' 0 -> '123456789' subx501 subtract '123456789' 0.000000001 -> '123456789' Inexact Rounded subx502 subtract '123456789' 0.000001 -> '123456789' Inexact Rounded subx503 subtract '123456789' 0.1 -> '123456789' Inexact Rounded subx504 subtract '123456789' 0.4 -> '123456789' Inexact Rounded subx505 subtract '123456789' 0.49 -> '123456789' Inexact Rounded subx506 subtract '123456789' 0.499999 -> '123456789' Inexact Rounded subx507 subtract '123456789' 0.499999999 -> '123456789' Inexact Rounded subx508 subtract '123456789' 0.5 -> '123456789' Inexact Rounded subx509 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded subx510 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded subx511 subtract '123456789' 0.51 -> '123456788' Inexact Rounded subx512 subtract '123456789' 0.6 -> '123456788' Inexact Rounded subx513 subtract '123456789' 0.9 -> '123456788' Inexact Rounded subx514 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded subx515 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded subx516 subtract '123456789' 1 -> '123456788' subx517 subtract '123456789' 1.000000001 -> '123456788' Inexact Rounded subx518 subtract '123456789' 1.00001 -> '123456788' Inexact Rounded subx519 subtract '123456789' 1.1 -> '123456788' Inexact Rounded rounding: half_even subx520 subtract '123456789' 0 -> '123456789' subx521 subtract '123456789' 0.000000001 -> '123456789' Inexact Rounded subx522 subtract '123456789' 0.000001 -> '123456789' Inexact Rounded subx523 subtract '123456789' 0.1 -> '123456789' Inexact Rounded subx524 subtract '123456789' 0.4 -> '123456789' Inexact Rounded subx525 subtract '123456789' 0.49 -> '123456789' Inexact Rounded subx526 subtract '123456789' 0.499999 -> '123456789' Inexact Rounded subx527 subtract '123456789' 0.499999999 -> '123456789' Inexact Rounded subx528 subtract '123456789' 0.5 -> '123456788' Inexact Rounded subx529 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded subx530 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded subx531 subtract '123456789' 0.51 -> '123456788' Inexact Rounded subx532 subtract '123456789' 0.6 -> '123456788' Inexact Rounded subx533 subtract '123456789' 0.9 -> '123456788' Inexact Rounded subx534 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded subx535 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded subx536 subtract '123456789' 1 -> '123456788' subx537 subtract '123456789' 1.00000001 -> '123456788' Inexact Rounded subx538 subtract '123456789' 1.00001 -> '123456788' Inexact Rounded subx539 subtract '123456789' 1.1 -> '123456788' Inexact Rounded -- critical few with even bottom digit... subx540 subtract '123456788' 0.499999999 -> '123456788' Inexact Rounded subx541 subtract '123456788' 0.5 -> '123456788' Inexact Rounded subx542 subtract '123456788' 0.500000001 -> '123456787' Inexact Rounded rounding: down subx550 subtract '123456789' 0 -> '123456789' subx551 subtract '123456789' 0.000000001 -> '123456788' Inexact Rounded subx552 subtract '123456789' 0.000001 -> '123456788' Inexact Rounded subx553 subtract '123456789' 0.1 -> '123456788' Inexact Rounded subx554 subtract '123456789' 0.4 -> '123456788' Inexact Rounded subx555 subtract '123456789' 0.49 -> '123456788' Inexact Rounded subx556 subtract '123456789' 0.499999 -> '123456788' Inexact Rounded subx557 subtract '123456789' 0.499999999 -> '123456788' Inexact Rounded subx558 subtract '123456789' 0.5 -> '123456788' Inexact Rounded subx559 subtract '123456789' 0.500000001 -> '123456788' Inexact Rounded subx560 subtract '123456789' 0.500001 -> '123456788' Inexact Rounded subx561 subtract '123456789' 0.51 -> '123456788' Inexact Rounded subx562 subtract '123456789' 0.6 -> '123456788' Inexact Rounded subx563 subtract '123456789' 0.9 -> '123456788' Inexact Rounded subx564 subtract '123456789' 0.99999 -> '123456788' Inexact Rounded subx565 subtract '123456789' 0.999999999 -> '123456788' Inexact Rounded subx566 subtract '123456789' 1 -> '123456788' subx567 subtract '123456789' 1.00000001 -> '123456787' Inexact Rounded subx568 subtract '123456789' 1.00001 -> '123456787' Inexact Rounded subx569 subtract '123456789' 1.1 -> '123456787' Inexact Rounded -- symmetry... rounding: half_up subx600 subtract 0 '123456789' -> '-123456789' subx601 subtract 0.000000001 '123456789' -> '-123456789' Inexact Rounded subx602 subtract 0.000001 '123456789' -> '-123456789' Inexact Rounded subx603 subtract 0.1 '123456789' -> '-123456789' Inexact Rounded subx604 subtract 0.4 '123456789' -> '-123456789' Inexact Rounded subx605 subtract 0.49 '123456789' -> '-123456789' Inexact Rounded subx606 subtract 0.499999 '123456789' -> '-123456789' Inexact Rounded subx607 subtract 0.499999999 '123456789' -> '-123456789' Inexact Rounded subx608 subtract 0.5 '123456789' -> '-123456789' Inexact Rounded subx609 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded subx610 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded subx611 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded subx612 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded subx613 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded subx614 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded subx615 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded subx616 subtract 1 '123456789' -> '-123456788' subx617 subtract 1.000000001 '123456789' -> '-123456788' Inexact Rounded subx618 subtract 1.00001 '123456789' -> '-123456788' Inexact Rounded subx619 subtract 1.1 '123456789' -> '-123456788' Inexact Rounded rounding: half_even subx620 subtract 0 '123456789' -> '-123456789' subx621 subtract 0.000000001 '123456789' -> '-123456789' Inexact Rounded subx622 subtract 0.000001 '123456789' -> '-123456789' Inexact Rounded subx623 subtract 0.1 '123456789' -> '-123456789' Inexact Rounded subx624 subtract 0.4 '123456789' -> '-123456789' Inexact Rounded subx625 subtract 0.49 '123456789' -> '-123456789' Inexact Rounded subx626 subtract 0.499999 '123456789' -> '-123456789' Inexact Rounded subx627 subtract 0.499999999 '123456789' -> '-123456789' Inexact Rounded subx628 subtract 0.5 '123456789' -> '-123456788' Inexact Rounded subx629 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded subx630 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded subx631 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded subx632 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded subx633 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded subx634 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded subx635 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded subx636 subtract 1 '123456789' -> '-123456788' subx637 subtract 1.00000001 '123456789' -> '-123456788' Inexact Rounded subx638 subtract 1.00001 '123456789' -> '-123456788' Inexact Rounded subx639 subtract 1.1 '123456789' -> '-123456788' Inexact Rounded -- critical few with even bottom digit... subx640 subtract 0.499999999 '123456788' -> '-123456788' Inexact Rounded subx641 subtract 0.5 '123456788' -> '-123456788' Inexact Rounded subx642 subtract 0.500000001 '123456788' -> '-123456787' Inexact Rounded rounding: down subx650 subtract 0 '123456789' -> '-123456789' subx651 subtract 0.000000001 '123456789' -> '-123456788' Inexact Rounded subx652 subtract 0.000001 '123456789' -> '-123456788' Inexact Rounded subx653 subtract 0.1 '123456789' -> '-123456788' Inexact Rounded subx654 subtract 0.4 '123456789' -> '-123456788' Inexact Rounded subx655 subtract 0.49 '123456789' -> '-123456788' Inexact Rounded subx656 subtract 0.499999 '123456789' -> '-123456788' Inexact Rounded subx657 subtract 0.499999999 '123456789' -> '-123456788' Inexact Rounded subx658 subtract 0.5 '123456789' -> '-123456788' Inexact Rounded subx659 subtract 0.500000001 '123456789' -> '-123456788' Inexact Rounded subx660 subtract 0.500001 '123456789' -> '-123456788' Inexact Rounded subx661 subtract 0.51 '123456789' -> '-123456788' Inexact Rounded subx662 subtract 0.6 '123456789' -> '-123456788' Inexact Rounded subx663 subtract 0.9 '123456789' -> '-123456788' Inexact Rounded subx664 subtract 0.99999 '123456789' -> '-123456788' Inexact Rounded subx665 subtract 0.999999999 '123456789' -> '-123456788' Inexact Rounded subx666 subtract 1 '123456789' -> '-123456788' subx667 subtract 1.00000001 '123456789' -> '-123456787' Inexact Rounded subx668 subtract 1.00001 '123456789' -> '-123456787' Inexact Rounded subx669 subtract 1.1 '123456789' -> '-123456787' Inexact Rounded -- lots of leading zeros in intermediate result, and showing effects of -- input rounding would have affected the following precision: 9 rounding: half_up subx670 subtract '123456789' '123456788.1' -> 0.9 subx671 subtract '123456789' '123456788.9' -> 0.1 subx672 subtract '123456789' '123456789.1' -> -0.1 subx673 subtract '123456789' '123456789.5' -> -0.5 subx674 subtract '123456789' '123456789.9' -> -0.9 rounding: half_even subx680 subtract '123456789' '123456788.1' -> 0.9 subx681 subtract '123456789' '123456788.9' -> 0.1 subx682 subtract '123456789' '123456789.1' -> -0.1 subx683 subtract '123456789' '123456789.5' -> -0.5 subx684 subtract '123456789' '123456789.9' -> -0.9 subx685 subtract '123456788' '123456787.1' -> 0.9 subx686 subtract '123456788' '123456787.9' -> 0.1 subx687 subtract '123456788' '123456788.1' -> -0.1 subx688 subtract '123456788' '123456788.5' -> -0.5 subx689 subtract '123456788' '123456788.9' -> -0.9 rounding: down subx690 subtract '123456789' '123456788.1' -> 0.9 subx691 subtract '123456789' '123456788.9' -> 0.1 subx692 subtract '123456789' '123456789.1' -> -0.1 subx693 subtract '123456789' '123456789.5' -> -0.5 subx694 subtract '123456789' '123456789.9' -> -0.9 -- input preparation tests rounding: half_up precision: 3 subx700 subtract '12345678900000' -9999999999999 -> '2.23E+13' Inexact Rounded subx701 subtract '9999999999999' -12345678900000 -> '2.23E+13' Inexact Rounded subx702 subtract '12E+3' '-3456' -> '1.55E+4' Inexact Rounded subx703 subtract '12E+3' '-3446' -> '1.54E+4' Inexact Rounded subx704 subtract '12E+3' '-3454' -> '1.55E+4' Inexact Rounded subx705 subtract '12E+3' '-3444' -> '1.54E+4' Inexact Rounded subx706 subtract '3456' '-12E+3' -> '1.55E+4' Inexact Rounded subx707 subtract '3446' '-12E+3' -> '1.54E+4' Inexact Rounded subx708 subtract '3454' '-12E+3' -> '1.55E+4' Inexact Rounded subx709 subtract '3444' '-12E+3' -> '1.54E+4' Inexact Rounded -- overflow and underflow tests [subnormals now possible] maxexponent: 999999999 minexponent: -999999999 precision: 9 rounding: down subx710 subtract 1E+999999999 -9E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded subx711 subtract 9E+999999999 -1E+999999999 -> 9.99999999E+999999999 Overflow Inexact Rounded rounding: half_up subx712 subtract 1E+999999999 -9E+999999999 -> Infinity Overflow Inexact Rounded subx713 subtract 9E+999999999 -1E+999999999 -> Infinity Overflow Inexact Rounded subx714 subtract -1.1E-999999999 -1E-999999999 -> -1E-1000000000 Subnormal subx715 subtract 1E-999999999 +1.1e-999999999 -> -1E-1000000000 Subnormal subx716 subtract -1E+999999999 +9E+999999999 -> -Infinity Overflow Inexact Rounded subx717 subtract -9E+999999999 +1E+999999999 -> -Infinity Overflow Inexact Rounded subx718 subtract +1.1E-999999999 +1E-999999999 -> 1E-1000000000 Subnormal subx719 subtract -1E-999999999 -1.1e-999999999 -> 1E-1000000000 Subnormal precision: 3 subx720 subtract 1 9.999E+999999999 -> -Infinity Inexact Overflow Rounded subx721 subtract 1 -9.999E+999999999 -> Infinity Inexact Overflow Rounded subx722 subtract 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded subx723 subtract -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded subx724 subtract 1 9.999E+999999999 -> -Infinity Inexact Overflow Rounded subx725 subtract 1 -9.999E+999999999 -> Infinity Inexact Overflow Rounded subx726 subtract 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded subx727 subtract -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded -- [more below] -- long operand checks maxexponent: 999 minexponent: -999 precision: 9 sub731 subtract 12345678000 0 -> 1.23456780E+10 Rounded sub732 subtract 0 12345678000 -> -1.23456780E+10 Rounded sub733 subtract 1234567800 0 -> 1.23456780E+9 Rounded sub734 subtract 0 1234567800 -> -1.23456780E+9 Rounded sub735 subtract 1234567890 0 -> 1.23456789E+9 Rounded sub736 subtract 0 1234567890 -> -1.23456789E+9 Rounded sub737 subtract 1234567891 0 -> 1.23456789E+9 Inexact Rounded sub738 subtract 0 1234567891 -> -1.23456789E+9 Inexact Rounded sub739 subtract 12345678901 0 -> 1.23456789E+10 Inexact Rounded sub740 subtract 0 12345678901 -> -1.23456789E+10 Inexact Rounded sub741 subtract 1234567896 0 -> 1.23456790E+9 Inexact Rounded sub742 subtract 0 1234567896 -> -1.23456790E+9 Inexact Rounded precision: 15 sub751 subtract 12345678000 0 -> 12345678000 sub752 subtract 0 12345678000 -> -12345678000 sub753 subtract 1234567800 0 -> 1234567800 sub754 subtract 0 1234567800 -> -1234567800 sub755 subtract 1234567890 0 -> 1234567890 sub756 subtract 0 1234567890 -> -1234567890 sub757 subtract 1234567891 0 -> 1234567891 sub758 subtract 0 1234567891 -> -1234567891 sub759 subtract 12345678901 0 -> 12345678901 sub760 subtract 0 12345678901 -> -12345678901 sub761 subtract 1234567896 0 -> 1234567896 sub762 subtract 0 1234567896 -> -1234567896 -- Specials subx780 subtract -Inf Inf -> -Infinity subx781 subtract -Inf 1000 -> -Infinity subx782 subtract -Inf 1 -> -Infinity subx783 subtract -Inf -0 -> -Infinity subx784 subtract -Inf -1 -> -Infinity subx785 subtract -Inf -1000 -> -Infinity subx787 subtract -1000 Inf -> -Infinity subx788 subtract -Inf Inf -> -Infinity subx789 subtract -1 Inf -> -Infinity subx790 subtract 0 Inf -> -Infinity subx791 subtract 1 Inf -> -Infinity subx792 subtract 1000 Inf -> -Infinity subx800 subtract Inf Inf -> NaN Invalid_operation subx801 subtract Inf 1000 -> Infinity subx802 subtract Inf 1 -> Infinity subx803 subtract Inf 0 -> Infinity subx804 subtract Inf -0 -> Infinity subx805 subtract Inf -1 -> Infinity subx806 subtract Inf -1000 -> Infinity subx807 subtract Inf -Inf -> Infinity subx808 subtract -1000 -Inf -> Infinity subx809 subtract -Inf -Inf -> NaN Invalid_operation subx810 subtract -1 -Inf -> Infinity subx811 subtract -0 -Inf -> Infinity subx812 subtract 0 -Inf -> Infinity subx813 subtract 1 -Inf -> Infinity subx814 subtract 1000 -Inf -> Infinity subx815 subtract Inf -Inf -> Infinity subx821 subtract NaN Inf -> NaN subx822 subtract NaN 1000 -> NaN subx823 subtract NaN 1 -> NaN subx824 subtract NaN 0 -> NaN subx825 subtract NaN -0 -> NaN subx826 subtract NaN -1 -> NaN subx827 subtract NaN -1000 -> NaN subx828 subtract NaN -Inf -> NaN subx829 subtract NaN NaN -> NaN subx830 subtract -Inf NaN -> NaN subx831 subtract -1000 NaN -> NaN subx832 subtract -1 NaN -> NaN subx833 subtract -0 NaN -> NaN subx834 subtract 0 NaN -> NaN subx835 subtract 1 NaN -> NaN subx836 subtract 1000 NaN -> NaN subx837 subtract Inf NaN -> NaN subx841 subtract sNaN Inf -> NaN Invalid_operation subx842 subtract sNaN 1000 -> NaN Invalid_operation subx843 subtract sNaN 1 -> NaN Invalid_operation subx844 subtract sNaN 0 -> NaN Invalid_operation subx845 subtract sNaN -0 -> NaN Invalid_operation subx846 subtract sNaN -1 -> NaN Invalid_operation subx847 subtract sNaN -1000 -> NaN Invalid_operation subx848 subtract sNaN NaN -> NaN Invalid_operation subx849 subtract sNaN sNaN -> NaN Invalid_operation subx850 subtract NaN sNaN -> NaN Invalid_operation subx851 subtract -Inf sNaN -> NaN Invalid_operation subx852 subtract -1000 sNaN -> NaN Invalid_operation subx853 subtract -1 sNaN -> NaN Invalid_operation subx854 subtract -0 sNaN -> NaN Invalid_operation subx855 subtract 0 sNaN -> NaN Invalid_operation subx856 subtract 1 sNaN -> NaN Invalid_operation subx857 subtract 1000 sNaN -> NaN Invalid_operation subx858 subtract Inf sNaN -> NaN Invalid_operation subx859 subtract NaN sNaN -> NaN Invalid_operation -- subnormals and underflows precision: 3 maxexponent: 999 minexponent: -999 subx1010 subtract 0 1.00E-999 -> -1.00E-999 subx1011 subtract 0 0.1E-999 -> -1E-1000 Subnormal subx1012 subtract 0 0.10E-999 -> -1.0E-1000 Subnormal subx1013 subtract 0 0.100E-999 -> -1.0E-1000 Subnormal Rounded subx1014 subtract 0 0.01E-999 -> -1E-1001 Subnormal -- next is rounded to Emin subx1015 subtract 0 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow subx1016 subtract 0 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow subx1017 subtract 0 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow subx1018 subtract 0 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow subx1019 subtract 0 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow subx1020 subtract 0 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow subx1030 subtract 0 -1.00E-999 -> 1.00E-999 subx1031 subtract 0 -0.1E-999 -> 1E-1000 Subnormal subx1032 subtract 0 -0.10E-999 -> 1.0E-1000 Subnormal subx1033 subtract 0 -0.100E-999 -> 1.0E-1000 Subnormal Rounded subx1034 subtract 0 -0.01E-999 -> 1E-1001 Subnormal -- next is rounded to Emin subx1035 subtract 0 -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow subx1036 subtract 0 -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow subx1037 subtract 0 -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow subx1038 subtract 0 -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow subx1039 subtract 0 -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow subx1040 subtract 0 -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -- some non-zero subnormal subtracts -- subx1056 is a tricky case rounding: half_up subx1050 subtract 1.00E-999 0.1E-999 -> 9.0E-1000 Subnormal subx1051 subtract 0.1E-999 0.1E-999 -> 0E-1000 subx1052 subtract 0.10E-999 0.1E-999 -> 0E-1001 subx1053 subtract 0.100E-999 0.1E-999 -> 0E-1001 Clamped subx1054 subtract 0.01E-999 0.1E-999 -> -9E-1001 Subnormal subx1055 subtract 0.999E-999 0.1E-999 -> 9.0E-1000 Inexact Rounded Subnormal Underflow subx1056 subtract 0.099E-999 0.1E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow subx1057 subtract 0.009E-999 0.1E-999 -> -9E-1001 Inexact Rounded Subnormal Underflow subx1058 subtract 0.001E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow subx1059 subtract 0.0009E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow subx1060 subtract 0.0001E-999 0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -- check for double-rounded subnormals precision: 5 maxexponent: 79 minexponent: -79 subx1101 subtract 0 1.52444E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow subx1102 subtract 0 1.52445E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow subx1103 subtract 0 1.52446E-80 -> -1.524E-80 Inexact Rounded Subnormal Underflow subx1104 subtract 1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow subx1105 subtract 1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow subx1106 subtract 1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow subx1111 subtract 1.2345678E-80 1.2345671E-80 -> 0E-83 Inexact Rounded Subnormal Underflow subx1112 subtract 1.2345678E-80 1.2345618E-80 -> 0E-83 Inexact Rounded Subnormal Underflow subx1113 subtract 1.2345678E-80 1.2345178E-80 -> 0E-83 Inexact Rounded Subnormal Underflow subx1114 subtract 1.2345678E-80 1.2341678E-80 -> 0E-83 Inexact Rounded Subnormal Underflow subx1115 subtract 1.2345678E-80 1.2315678E-80 -> 3E-83 Rounded Subnormal subx1116 subtract 1.2345678E-80 1.2145678E-80 -> 2.0E-82 Rounded Subnormal subx1117 subtract 1.2345678E-80 1.1345678E-80 -> 1.00E-81 Rounded Subnormal subx1118 subtract 1.2345678E-80 0.2345678E-80 -> 1.000E-80 Rounded Subnormal -- Null tests subx9990 subtract 10 # -> NaN Invalid_operation subx9991 subtract # 10 -> NaN Invalid_operation --- NEW FILE: squareroot.decTest --- ------------------------------------------------------------------------ -- squareroot.decTest -- decimal square root -- -- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ [...2891 lines suppressed...] precision: 13 -- Etiny=-21 sqtx808 squareroot 1E-21 -> 3.1622776602E-11 Underflow Subnormal Inexact Rounded sqtx809 squareroot 10E-21 -> 1E-10 Subnormal Rounded precision: 14 -- Etiny=-22 sqtx810 squareroot 1E-21 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded sqtx811 squareroot 10E-22 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded sqtx812 squareroot 1E-22 -> 1E-11 Subnormal -- Exact Subnormal case -- special values maxexponent: 999 minexponent: -999 sqtx820 squareroot Inf -> Infinity sqtx821 squareroot -Inf -> NaN Invalid_operation sqtx822 squareroot NaN -> NaN sqtx823 squareroot sNaN -> NaN Invalid_operation -- Null test sqtx900 squareroot # -> NaN Invalid_operation --- NEW FILE: rounding.decTest --- ------------------------------------------------------------------------ -- rounding.decTest -- decimal rounding modes testcases -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ [...1040 lines suppressed...] rmex401 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded rounding: half_down rmex402 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded rmex403 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded rounding: half_even rmex404 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded rmex405 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded rounding: floor rmex406 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded rmex407 multiply 9.999E+999999999 10 -> 9.99999999E+999999999 Overflow Inexact Rounded rounding: ceiling rmex408 multiply -9.999E+999999999 10 -> -9.99999999E+999999999 Overflow Inexact Rounded rmex409 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded rounding: up rmex410 multiply -9.999E+999999999 10 -> -Infinity Overflow Inexact Rounded rmex411 multiply 9.999E+999999999 10 -> Infinity Overflow Inexact Rounded rounding: down rmex412 multiply -9.999E+999999999 10 -> -9.99999999E+999999999 Overflow Inexact Rounded rmex413 multiply 9.999E+999999999 10 -> 9.99999999E+999999999 Overflow Inexact Rounded --- NEW FILE: rescale.decTest --- ------------------------------------------------------------------------ -- rescale.decTest -- decimal rescale operation -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks (as base, above) resx001 rescale 0 0 -> 0 resx002 rescale 1 0 -> 1 resx003 rescale 0.1 +2 -> 0E+2 Inexact Rounded resx005 rescale 0.1 +1 -> 0E+1 Inexact Rounded resx006 rescale 0.1 0 -> 0 Inexact Rounded resx007 rescale 0.1 -1 -> 0.1 resx008 rescale 0.1 -2 -> 0.10 resx009 rescale 0.1 -3 -> 0.100 resx010 rescale 0.9 +2 -> 0E+2 Inexact Rounded resx011 rescale 0.9 +1 -> 0E+1 Inexact Rounded resx012 rescale 0.9 +0 -> 1 Inexact Rounded resx013 rescale 0.9 -1 -> 0.9 resx014 rescale 0.9 -2 -> 0.90 resx015 rescale 0.9 -3 -> 0.900 -- negatives resx021 rescale -0 0 -> -0 resx022 rescale -1 0 -> -1 resx023 rescale -0.1 +2 -> -0E+2 Inexact Rounded resx025 rescale -0.1 +1 -> -0E+1 Inexact Rounded resx026 rescale -0.1 0 -> -0 Inexact Rounded resx027 rescale -0.1 -1 -> -0.1 resx028 rescale -0.1 -2 -> -0.10 resx029 rescale -0.1 -3 -> -0.100 resx030 rescale -0.9 +2 -> -0E+2 Inexact Rounded resx031 rescale -0.9 +1 -> -0E+1 Inexact Rounded resx032 rescale -0.9 +0 -> -1 Inexact Rounded resx033 rescale -0.9 -1 -> -0.9 resx034 rescale -0.9 -2 -> -0.90 resx035 rescale -0.9 -3 -> -0.900 resx036 rescale -0.5 +2 -> -0E+2 Inexact Rounded resx037 rescale -0.5 +1 -> -0E+1 Inexact Rounded resx038 rescale -0.5 +0 -> -1 Inexact Rounded resx039 rescale -0.5 -1 -> -0.5 resx040 rescale -0.5 -2 -> -0.50 resx041 rescale -0.5 -3 -> -0.500 resx042 rescale -0.9 +2 -> -0E+2 Inexact Rounded resx043 rescale -0.9 +1 -> -0E+1 Inexact Rounded resx044 rescale -0.9 +0 -> -1 Inexact Rounded resx045 rescale -0.9 -1 -> -0.9 resx046 rescale -0.9 -2 -> -0.90 resx047 rescale -0.9 -3 -> -0.900 -- examples from Specification resx060 rescale 2.17 -3 -> 2.170 resx061 rescale 2.17 -2 -> 2.17 resx062 rescale 2.17 -1 -> 2.2 Inexact Rounded resx063 rescale 2.17 0 -> 2 Inexact Rounded resx064 rescale 2.17 +1 -> 0E+1 Inexact Rounded resx065 rescale 2 Inf -> NaN Invalid_operation resx066 rescale -0.1 0 -> -0 Inexact Rounded resx067 rescale -0 5 -> -0E+5 resx068 rescale +35236450.6 -2 -> Infinity Overflow Inexact Rounded resx069 rescale -35236450.6 -2 -> -Infinity Overflow Inexact Rounded resx070 rescale 217 -1 -> 217.0 resx071 rescale 217 0 -> 217 resx072 rescale 217 +1 -> 2.2E+2 Inexact Rounded resx073 rescale 217 +2 -> 2E+2 Inexact Rounded -- general tests .. resx089 rescale 12 +4 -> 0E+4 Inexact Rounded resx090 rescale 12 +3 -> 0E+3 Inexact Rounded resx091 rescale 12 +2 -> 0E+2 Inexact Rounded resx092 rescale 12 +1 -> 1E+1 Inexact Rounded resx093 rescale 1.2345 -2 -> 1.23 Inexact Rounded resx094 rescale 1.2355 -2 -> 1.24 Inexact Rounded resx095 rescale 1.2345 -6 -> 1.234500 resx096 rescale 9.9999 -2 -> 10.00 Inexact Rounded resx097 rescale 0.0001 -2 -> 0.00 Inexact Rounded resx098 rescale 0.001 -2 -> 0.00 Inexact Rounded resx099 rescale 0.009 -2 -> 0.01 Inexact Rounded resx100 rescale 92 +2 -> 1E+2 Inexact Rounded resx101 rescale -1 0 -> -1 resx102 rescale -1 -1 -> -1.0 resx103 rescale -1 -2 -> -1.00 resx104 rescale 0 0 -> 0 resx105 rescale 0 -1 -> 0.0 resx106 rescale 0 -2 -> 0.00 resx107 rescale 0.00 0 -> 0 resx108 rescale 0 +1 -> 0E+1 resx109 rescale 0 +2 -> 0E+2 resx110 rescale +1 0 -> 1 resx111 rescale +1 -1 -> 1.0 resx112 rescale +1 -2 -> 1.00 resx120 rescale 1.04 -3 -> 1.040 resx121 rescale 1.04 -2 -> 1.04 resx122 rescale 1.04 -1 -> 1.0 Inexact Rounded resx123 rescale 1.04 0 -> 1 Inexact Rounded resx124 rescale 1.05 -3 -> 1.050 resx125 rescale 1.05 -2 -> 1.05 resx126 rescale 1.05 -1 -> 1.1 Inexact Rounded resx127 rescale 1.05 0 -> 1 Inexact Rounded resx128 rescale 1.05 -3 -> 1.050 resx129 rescale 1.05 -2 -> 1.05 resx130 rescale 1.05 -1 -> 1.1 Inexact Rounded resx131 rescale 1.05 0 -> 1 Inexact Rounded resx132 rescale 1.06 -3 -> 1.060 resx133 rescale 1.06 -2 -> 1.06 resx134 rescale 1.06 -1 -> 1.1 Inexact Rounded resx135 rescale 1.06 0 -> 1 Inexact Rounded resx140 rescale -10 -2 -> -10.00 resx141 rescale +1 -2 -> 1.00 resx142 rescale +10 -2 -> 10.00 resx143 rescale 1E+10 -2 -> Infinity Overflow Inexact Rounded resx144 rescale 1E-10 -2 -> 0.00 Inexact Rounded resx145 rescale 1E-3 -2 -> 0.00 Inexact Rounded resx146 rescale 1E-2 -2 -> 0.01 resx147 rescale 1E-1 -2 -> 0.10 resx148 rescale 0E-10 -2 -> 0.00 resx150 rescale 1.0600 -5 -> 1.06000 resx151 rescale 1.0600 -4 -> 1.0600 resx152 rescale 1.0600 -3 -> 1.060 Rounded resx153 rescale 1.0600 -2 -> 1.06 Rounded resx154 rescale 1.0600 -1 -> 1.1 Inexact Rounded resx155 rescale 1.0600 0 -> 1 Inexact Rounded -- +ve exponents .. resx201 rescale -1 +0 -> -1 resx202 rescale -1 +1 -> -0E+1 Inexact Rounded resx203 rescale -1 +2 -> -0E+2 Inexact Rounded resx204 rescale 0 +0 -> 0 resx205 rescale 0 +1 -> 0E+1 resx206 rescale 0 +2 -> 0E+2 resx207 rescale +1 +0 -> 1 resx208 rescale +1 +1 -> 0E+1 Inexact Rounded resx209 rescale +1 +2 -> 0E+2 Inexact Rounded resx220 rescale 1.04 +3 -> 0E+3 Inexact Rounded resx221 rescale 1.04 +2 -> 0E+2 Inexact Rounded resx222 rescale 1.04 +1 -> 0E+1 Inexact Rounded resx223 rescale 1.04 +0 -> 1 Inexact Rounded resx224 rescale 1.05 +3 -> 0E+3 Inexact Rounded resx225 rescale 1.05 +2 -> 0E+2 Inexact Rounded resx226 rescale 1.05 +1 -> 0E+1 Inexact Rounded resx227 rescale 1.05 +0 -> 1 Inexact Rounded resx228 rescale 1.05 +3 -> 0E+3 Inexact Rounded resx229 rescale 1.05 +2 -> 0E+2 Inexact Rounded resx230 rescale 1.05 +1 -> 0E+1 Inexact Rounded resx231 rescale 1.05 +0 -> 1 Inexact Rounded resx232 rescale 1.06 +3 -> 0E+3 Inexact Rounded resx233 rescale 1.06 +2 -> 0E+2 Inexact Rounded resx234 rescale 1.06 +1 -> 0E+1 Inexact Rounded resx235 rescale 1.06 +0 -> 1 Inexact Rounded resx240 rescale -10 +1 -> -1E+1 Rounded resx241 rescale +1 +1 -> 0E+1 Inexact Rounded resx242 rescale +10 +1 -> 1E+1 Rounded resx243 rescale 1E+1 +1 -> 1E+1 -- underneath this is E+1 resx244 rescale 1E+2 +1 -> 1.0E+2 -- underneath this is E+1 resx245 rescale 1E+3 +1 -> 1.00E+3 -- underneath this is E+1 resx246 rescale 1E+4 +1 -> 1.000E+4 -- underneath this is E+1 resx247 rescale 1E+5 +1 -> 1.0000E+5 -- underneath this is E+1 resx248 rescale 1E+6 +1 -> 1.00000E+6 -- underneath this is E+1 resx249 rescale 1E+7 +1 -> 1.000000E+7 -- underneath this is E+1 resx250 rescale 1E+8 +1 -> 1.0000000E+8 -- underneath this is E+1 resx251 rescale 1E+9 +1 -> 1.00000000E+9 -- underneath this is E+1 -- next one tries to add 9 zeros resx252 rescale 1E+10 +1 -> Infinity Overflow Inexact Rounded resx253 rescale 1E-10 +1 -> 0E+1 Inexact Rounded resx254 rescale 1E-2 +1 -> 0E+1 Inexact Rounded resx255 rescale 0E-10 +1 -> 0E+1 resx256 rescale -0E-10 +1 -> -0E+1 resx257 rescale -0E-1 +1 -> -0E+1 resx258 rescale -0 +1 -> -0E+1 resx259 rescale -0E+1 +1 -> -0E+1 resx260 rescale -10 +2 -> -0E+2 Inexact Rounded resx261 rescale +1 +2 -> 0E+2 Inexact Rounded resx262 rescale +10 +2 -> 0E+2 Inexact Rounded resx263 rescale 1E+1 +2 -> 0E+2 Inexact Rounded resx264 rescale 1E+2 +2 -> 1E+2 resx265 rescale 1E+3 +2 -> 1.0E+3 resx266 rescale 1E+4 +2 -> 1.00E+4 resx267 rescale 1E+5 +2 -> 1.000E+5 resx268 rescale 1E+6 +2 -> 1.0000E+6 resx269 rescale 1E+7 +2 -> 1.00000E+7 resx270 rescale 1E+8 +2 -> 1.000000E+8 resx271 rescale 1E+9 +2 -> 1.0000000E+9 resx272 rescale 1E+10 +2 -> 1.00000000E+10 resx273 rescale 1E-10 +2 -> 0E+2 Inexact Rounded resx274 rescale 1E-2 +2 -> 0E+2 Inexact Rounded resx275 rescale 0E-10 +2 -> 0E+2 resx280 rescale -10 +3 -> -0E+3 Inexact Rounded resx281 rescale +1 +3 -> 0E+3 Inexact Rounded resx282 rescale +10 +3 -> 0E+3 Inexact Rounded resx283 rescale 1E+1 +3 -> 0E+3 Inexact Rounded resx284 rescale 1E+2 +3 -> 0E+3 Inexact Rounded resx285 rescale 1E+3 +3 -> 1E+3 resx286 rescale 1E+4 +3 -> 1.0E+4 resx287 rescale 1E+5 +3 -> 1.00E+5 resx288 rescale 1E+6 +3 -> 1.000E+6 resx289 rescale 1E+7 +3 -> 1.0000E+7 resx290 rescale 1E+8 +3 -> 1.00000E+8 resx291 rescale 1E+9 +3 -> 1.000000E+9 resx292 rescale 1E+10 +3 -> 1.0000000E+10 resx293 rescale 1E-10 +3 -> 0E+3 Inexact Rounded resx294 rescale 1E-2 +3 -> 0E+3 Inexact Rounded resx295 rescale 0E-10 +3 -> 0E+3 -- round up from below [sign wrong in JIT compiler once] resx300 rescale 0.0078 -5 -> 0.00780 resx301 rescale 0.0078 -4 -> 0.0078 resx302 rescale 0.0078 -3 -> 0.008 Inexact Rounded resx303 rescale 0.0078 -2 -> 0.01 Inexact Rounded resx304 rescale 0.0078 -1 -> 0.0 Inexact Rounded resx305 rescale 0.0078 0 -> 0 Inexact Rounded resx306 rescale 0.0078 +1 -> 0E+1 Inexact Rounded resx307 rescale 0.0078 +2 -> 0E+2 Inexact Rounded resx310 rescale -0.0078 -5 -> -0.00780 resx311 rescale -0.0078 -4 -> -0.0078 resx312 rescale -0.0078 -3 -> -0.008 Inexact Rounded resx313 rescale -0.0078 -2 -> -0.01 Inexact Rounded resx314 rescale -0.0078 -1 -> -0.0 Inexact Rounded resx315 rescale -0.0078 0 -> -0 Inexact Rounded resx316 rescale -0.0078 +1 -> -0E+1 Inexact Rounded resx317 rescale -0.0078 +2 -> -0E+2 Inexact Rounded resx320 rescale 0.078 -5 -> 0.07800 resx321 rescale 0.078 -4 -> 0.0780 resx322 rescale 0.078 -3 -> 0.078 resx323 rescale 0.078 -2 -> 0.08 Inexact Rounded resx324 rescale 0.078 -1 -> 0.1 Inexact Rounded resx325 rescale 0.078 0 -> 0 Inexact Rounded resx326 rescale 0.078 +1 -> 0E+1 Inexact Rounded resx327 rescale 0.078 +2 -> 0E+2 Inexact Rounded resx330 rescale -0.078 -5 -> -0.07800 resx331 rescale -0.078 -4 -> -0.0780 resx332 rescale -0.078 -3 -> -0.078 resx333 rescale -0.078 -2 -> -0.08 Inexact Rounded resx334 rescale -0.078 -1 -> -0.1 Inexact Rounded resx335 rescale -0.078 0 -> -0 Inexact Rounded resx336 rescale -0.078 +1 -> -0E+1 Inexact Rounded resx337 rescale -0.078 +2 -> -0E+2 Inexact Rounded resx340 rescale 0.78 -5 -> 0.78000 resx341 rescale 0.78 -4 -> 0.7800 resx342 rescale 0.78 -3 -> 0.780 resx343 rescale 0.78 -2 -> 0.78 resx344 rescale 0.78 -1 -> 0.8 Inexact Rounded resx345 rescale 0.78 0 -> 1 Inexact Rounded resx346 rescale 0.78 +1 -> 0E+1 Inexact Rounded resx347 rescale 0.78 +2 -> 0E+2 Inexact Rounded resx350 rescale -0.78 -5 -> -0.78000 resx351 rescale -0.78 -4 -> -0.7800 resx352 rescale -0.78 -3 -> -0.780 resx353 rescale -0.78 -2 -> -0.78 resx354 rescale -0.78 -1 -> -0.8 Inexact Rounded resx355 rescale -0.78 0 -> -1 Inexact Rounded resx356 rescale -0.78 +1 -> -0E+1 Inexact Rounded resx357 rescale -0.78 +2 -> -0E+2 Inexact Rounded resx360 rescale 7.8 -5 -> 7.80000 resx361 rescale 7.8 -4 -> 7.8000 resx362 rescale 7.8 -3 -> 7.800 resx363 rescale 7.8 -2 -> 7.80 resx364 rescale 7.8 -1 -> 7.8 resx365 rescale 7.8 0 -> 8 Inexact Rounded resx366 rescale 7.8 +1 -> 1E+1 Inexact Rounded resx367 rescale 7.8 +2 -> 0E+2 Inexact Rounded resx368 rescale 7.8 +3 -> 0E+3 Inexact Rounded resx370 rescale -7.8 -5 -> -7.80000 resx371 rescale -7.8 -4 -> -7.8000 resx372 rescale -7.8 -3 -> -7.800 resx373 rescale -7.8 -2 -> -7.80 resx374 rescale -7.8 -1 -> -7.8 resx375 rescale -7.8 0 -> -8 Inexact Rounded resx376 rescale -7.8 +1 -> -1E+1 Inexact Rounded resx377 rescale -7.8 +2 -> -0E+2 Inexact Rounded resx378 rescale -7.8 +3 -> -0E+3 Inexact Rounded -- some individuals precision: 9 resx380 rescale 352364.506 -2 -> 352364.51 Inexact Rounded resx381 rescale 3523645.06 -2 -> 3523645.06 resx382 rescale 35236450.6 -2 -> Infinity Overflow Inexact Rounded resx383 rescale 352364506 -2 -> Infinity Overflow Inexact Rounded resx384 rescale -352364.506 -2 -> -352364.51 Inexact Rounded resx385 rescale -3523645.06 -2 -> -3523645.06 resx386 rescale -35236450.6 -2 -> -Infinity Overflow Inexact Rounded resx387 rescale -352364506 -2 -> -Infinity Overflow Inexact Rounded -- some 9999 round-up cases resx400 rescale 9.999 -5 -> 9.99900 resx401 rescale 9.999 -4 -> 9.9990 resx402 rescale 9.999 -3 -> 9.999 resx403 rescale 9.999 -2 -> 10.00 Inexact Rounded resx404 rescale 9.999 -1 -> 10.0 Inexact Rounded resx405 rescale 9.999 0 -> 10 Inexact Rounded resx406 rescale 9.999 1 -> 1E+1 Inexact Rounded resx407 rescale 9.999 2 -> 0E+2 Inexact Rounded resx410 rescale 0.999 -5 -> 0.99900 resx411 rescale 0.999 -4 -> 0.9990 resx412 rescale 0.999 -3 -> 0.999 resx413 rescale 0.999 -2 -> 1.00 Inexact Rounded resx414 rescale 0.999 -1 -> 1.0 Inexact Rounded resx415 rescale 0.999 0 -> 1 Inexact Rounded resx416 rescale 0.999 1 -> 0E+1 Inexact Rounded resx420 rescale 0.0999 -5 -> 0.09990 resx421 rescale 0.0999 -4 -> 0.0999 resx422 rescale 0.0999 -3 -> 0.100 Inexact Rounded resx423 rescale 0.0999 -2 -> 0.10 Inexact Rounded resx424 rescale 0.0999 -1 -> 0.1 Inexact Rounded resx425 rescale 0.0999 0 -> 0 Inexact Rounded resx426 rescale 0.0999 1 -> 0E+1 Inexact Rounded resx430 rescale 0.00999 -5 -> 0.00999 resx431 rescale 0.00999 -4 -> 0.0100 Inexact Rounded resx432 rescale 0.00999 -3 -> 0.010 Inexact Rounded resx433 rescale 0.00999 -2 -> 0.01 Inexact Rounded resx434 rescale 0.00999 -1 -> 0.0 Inexact Rounded resx435 rescale 0.00999 0 -> 0 Inexact Rounded resx436 rescale 0.00999 1 -> 0E+1 Inexact Rounded resx440 rescale 0.000999 -5 -> 0.00100 Inexact Rounded resx441 rescale 0.000999 -4 -> 0.0010 Inexact Rounded resx442 rescale 0.000999 -3 -> 0.001 Inexact Rounded resx443 rescale 0.000999 -2 -> 0.00 Inexact Rounded resx444 rescale 0.000999 -1 -> 0.0 Inexact Rounded resx445 rescale 0.000999 0 -> 0 Inexact Rounded resx446 rescale 0.000999 1 -> 0E+1 Inexact Rounded precision: 8 resx449 rescale 9.999E-15 -23 -> Infinity Inexact Rounded Overflow resx450 rescale 9.999E-15 -22 -> 9.9990000E-15 resx451 rescale 9.999E-15 -21 -> 9.999000E-15 resx452 rescale 9.999E-15 -20 -> 9.99900E-15 resx453 rescale 9.999E-15 -19 -> 9.9990E-15 resx454 rescale 9.999E-15 -18 -> 9.999E-15 resx455 rescale 9.999E-15 -17 -> 1.000E-14 Inexact Rounded resx456 rescale 9.999E-15 -16 -> 1.00E-14 Inexact Rounded resx457 rescale 9.999E-15 -15 -> 1.0E-14 Inexact Rounded resx458 rescale 9.999E-15 -14 -> 1E-14 Inexact Rounded resx459 rescale 9.999E-15 -13 -> 0E-13 Inexact Rounded resx460 rescale 9.999E-15 -12 -> 0E-12 Inexact Rounded resx461 rescale 9.999E-15 -11 -> 0E-11 Inexact Rounded resx462 rescale 9.999E-15 -10 -> 0E-10 Inexact Rounded resx463 rescale 9.999E-15 -9 -> 0E-9 Inexact Rounded resx464 rescale 9.999E-15 -8 -> 0E-8 Inexact Rounded resx465 rescale 9.999E-15 -7 -> 0E-7 Inexact Rounded resx466 rescale 9.999E-15 -6 -> 0.000000 Inexact Rounded resx467 rescale 9.999E-15 -5 -> 0.00000 Inexact Rounded resx468 rescale 9.999E-15 -4 -> 0.0000 Inexact Rounded resx469 rescale 9.999E-15 -3 -> 0.000 Inexact Rounded resx470 rescale 9.999E-15 -2 -> 0.00 Inexact Rounded resx471 rescale 9.999E-15 -1 -> 0.0 Inexact Rounded resx472 rescale 9.999E-15 0 -> 0 Inexact Rounded resx473 rescale 9.999E-15 1 -> 0E+1 Inexact Rounded -- long operand checks [rhs checks removed] maxexponent: 999 minexponent: -999 precision: 9 resx481 rescale 12345678000 +3 -> 1.2345678E+10 Rounded resx482 rescale 1234567800 +1 -> 1.23456780E+9 Rounded resx483 rescale 1234567890 +1 -> 1.23456789E+9 Rounded resx484 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded resx485 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded resx486 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded -- a potential double-round resx487 rescale 1234.987643 -4 -> 1234.9876 Inexact Rounded resx488 rescale 1234.987647 -4 -> 1234.9876 Inexact Rounded precision: 15 resx491 rescale 12345678000 +3 -> 1.2345678E+10 Rounded resx492 rescale 1234567800 +1 -> 1.23456780E+9 Rounded resx493 rescale 1234567890 +1 -> 1.23456789E+9 Rounded resx494 rescale 1234567891 +1 -> 1.23456789E+9 Inexact Rounded resx495 rescale 12345678901 +2 -> 1.23456789E+10 Inexact Rounded resx496 rescale 1234567896 +1 -> 1.23456790E+9 Inexact Rounded resx497 rescale 1234.987643 -4 -> 1234.9876 Inexact Rounded resx498 rescale 1234.987647 -4 -> 1234.9876 Inexact Rounded -- Zeros resx500 rescale 0 1 -> 0E+1 resx501 rescale 0 0 -> 0 resx502 rescale 0 -1 -> 0.0 resx503 rescale 0.0 -1 -> 0.0 resx504 rescale 0.0 0 -> 0 resx505 rescale 0.0 +1 -> 0E+1 resx506 rescale 0E+1 -1 -> 0.0 resx507 rescale 0E+1 0 -> 0 resx508 rescale 0E+1 +1 -> 0E+1 resx509 rescale -0 1 -> -0E+1 resx510 rescale -0 0 -> -0 resx511 rescale -0 -1 -> -0.0 resx512 rescale -0.0 -1 -> -0.0 resx513 rescale -0.0 0 -> -0 resx514 rescale -0.0 +1 -> -0E+1 resx515 rescale -0E+1 -1 -> -0.0 resx516 rescale -0E+1 0 -> -0 resx517 rescale -0E+1 +1 -> -0E+1 -- Suspicious RHS values maxexponent: 999999999 minexponent: -999999999 precision: 15 resx521 rescale 1.234 999999E+3 -> 0E+999999000 Inexact Rounded resx522 rescale 123.456 999999E+3 -> 0E+999999000 Inexact Rounded resx523 rescale 1.234 999999999 -> 0E+999999999 Inexact Rounded resx524 rescale 123.456 999999999 -> 0E+999999999 Inexact Rounded resx525 rescale 123.456 1000000000 -> NaN Invalid_operation resx526 rescale 123.456 12345678903 -> NaN Invalid_operation -- next four are "won't fit" overflows resx527 rescale 1.234 -999999E+3 -> Infinity Overflow Inexact Rounded resx528 rescale 123.456 -999999E+3 -> Infinity Overflow Inexact Rounded resx529 rescale 1.234 -999999999 -> Infinity Overflow Inexact Rounded resx530 rescale 123.456 -999999999 -> Infinity Overflow Inexact Rounded resx531 rescale 123.456 -1000000014 -> NaN Invalid_operation resx532 rescale 123.456 -12345678903 -> NaN Invalid_operation maxexponent: 999 minexponent: -999 precision: 15 resx540 rescale 1.234E+999 999 -> 1E+999 Inexact Rounded resx541 rescale 1.234E+998 999 -> 0E+999 Inexact Rounded resx542 rescale 1.234 999 -> 0E+999 Inexact Rounded resx543 rescale 1.234 1000 -> NaN Invalid_operation resx544 rescale 1.234 5000 -> NaN Invalid_operation resx545 rescale 0 -999 -> 0E-999 -- next two are "won't fit" overflows resx546 rescale 1.234 -999 -> Infinity Overflow Inexact Rounded resx547 rescale 1.234 -1000 -> Infinity Overflow Inexact Rounded resx548 rescale 1.234 -5000 -> NaN Invalid_operation -- [more below] -- fractional RHS, some good and some bad precision: 9 resx549 rescale 222 +2.0 -> 2E+2 Inexact Rounded resx550 rescale 222 +2.00000000 -> 2E+2 Inexact Rounded resx551 rescale 222 +2.00100000000 -> NaN Invalid_operation resx552 rescale 222 +2.000001 -> NaN Invalid_operation resx553 rescale 222 +2.000000001 -> NaN Invalid_operation resx554 rescale 222 +2.0000000001 -> NaN Invalid_operation resx555 rescale 222 +2.00000000001 -> NaN Invalid_operation resx556 rescale 222 +2.99999999999 -> NaN Invalid_operation resx557 rescale 222 -2.00000000 -> 222.00 resx558 rescale 222 -2.00100000000 -> NaN Invalid_operation resx559 rescale 222 -2.0000001000 -> NaN Invalid_operation resx560 rescale 222 -2.00000000001 -> NaN Invalid_operation resx561 rescale 222 -2.99999999999 -> NaN Invalid_operation -- Specials resx580 rescale Inf -Inf -> NaN Invalid_operation resx581 rescale Inf -1000 -> Infinity resx582 rescale Inf -1 -> Infinity resx583 rescale Inf 0 -> Infinity resx584 rescale Inf 1 -> Infinity resx585 rescale Inf 1000 -> Infinity resx586 rescale Inf Inf -> NaN Invalid_operation resx587 rescale -1000 Inf -> NaN Invalid_operation resx588 rescale -Inf Inf -> NaN Invalid_operation resx589 rescale -1 Inf -> NaN Invalid_operation resx590 rescale 0 Inf -> NaN Invalid_operation resx591 rescale 1 Inf -> NaN Invalid_operation resx592 rescale 1000 Inf -> NaN Invalid_operation resx593 rescale Inf Inf -> NaN Invalid_operation resx594 rescale Inf -0 -> Infinity resx595 rescale -0 Inf -> NaN Invalid_operation resx600 rescale -Inf -Inf -> NaN Invalid_operation resx601 rescale -Inf -1000 -> -Infinity resx602 rescale -Inf -1 -> -Infinity resx603 rescale -Inf 0 -> -Infinity resx604 rescale -Inf 1 -> -Infinity resx605 rescale -Inf 1000 -> -Infinity resx606 rescale -Inf Inf -> NaN Invalid_operation resx607 rescale -1000 Inf -> NaN Invalid_operation resx608 rescale -Inf -Inf -> NaN Invalid_operation resx609 rescale -1 -Inf -> NaN Invalid_operation resx610 rescale 0 -Inf -> NaN Invalid_operation resx611 rescale 1 -Inf -> NaN Invalid_operation resx612 rescale 1000 -Inf -> NaN Invalid_operation resx613 rescale Inf -Inf -> NaN Invalid_operation resx614 rescale -Inf -0 -> -Infinity resx615 rescale -0 -Inf -> NaN Invalid_operation resx621 rescale NaN -Inf -> NaN Invalid_operation resx622 rescale NaN -1000 -> NaN resx623 rescale NaN -1 -> NaN resx624 rescale NaN 0 -> NaN resx625 rescale NaN 1 -> NaN resx626 rescale NaN 1000 -> NaN resx627 rescale NaN Inf -> NaN Invalid_operation resx628 rescale NaN NaN -> NaN resx629 rescale -Inf NaN -> NaN resx630 rescale -1000 NaN -> NaN resx631 rescale -1 NaN -> NaN resx632 rescale 0 NaN -> NaN resx633 rescale 1 NaN -> NaN resx634 rescale 1000 NaN -> NaN resx635 rescale Inf NaN -> NaN resx636 rescale NaN -0 -> NaN resx637 rescale -0 NaN -> NaN resx641 rescale sNaN -Inf -> NaN Invalid_operation resx642 rescale sNaN -1000 -> NaN Invalid_operation resx643 rescale sNaN -1 -> NaN Invalid_operation resx644 rescale sNaN 0 -> NaN Invalid_operation resx645 rescale sNaN 1 -> NaN Invalid_operation resx646 rescale sNaN 1000 -> NaN Invalid_operation resx647 rescale sNaN NaN -> NaN Invalid_operation resx648 rescale sNaN sNaN -> NaN Invalid_operation resx649 rescale NaN sNaN -> NaN Invalid_operation resx650 rescale -Inf sNaN -> NaN Invalid_operation resx651 rescale -1000 sNaN -> NaN Invalid_operation resx652 rescale -1 sNaN -> NaN Invalid_operation resx653 rescale 0 sNaN -> NaN Invalid_operation resx654 rescale 1 sNaN -> NaN Invalid_operation resx655 rescale 1000 sNaN -> NaN Invalid_operation resx656 rescale Inf sNaN -> NaN Invalid_operation resx657 rescale NaN sNaN -> NaN Invalid_operation resx658 rescale sNaN -0 -> NaN Invalid_operation resx659 rescale -0 sNaN -> NaN Invalid_operation -- subnormals and underflow precision: 4 maxexponent: 999 minexponent: -999 resx710 rescale 1.00E-999 -999 -> 1E-999 Rounded resx711 rescale 0.1E-999 -1000 -> 1E-1000 Subnormal resx712 rescale 0.10E-999 -1000 -> 1E-1000 Subnormal Rounded resx713 rescale 0.100E-999 -1000 -> 1E-1000 Subnormal Rounded resx714 rescale 0.01E-999 -1001 -> 1E-1001 Subnormal -- next is rounded to Emin resx715 rescale 0.999E-999 -999 -> 1E-999 Inexact Rounded resx716 rescale 0.099E-999 -1000 -> 1E-1000 Inexact Rounded Subnormal Underflow resx717 rescale 0.009E-999 -1001 -> 1E-1001 Inexact Rounded Subnormal Underflow resx718 rescale 0.001E-999 -1001 -> 0E-1001 Inexact Rounded resx719 rescale 0.0009E-999 -1001 -> 0E-1001 Inexact Rounded resx720 rescale 0.0001E-999 -1001 -> 0E-1001 Inexact Rounded resx730 rescale -1.00E-999 -999 -> -1E-999 Rounded resx731 rescale -0.1E-999 -999 -> -0E-999 Rounded Inexact resx732 rescale -0.10E-999 -999 -> -0E-999 Rounded Inexact resx733 rescale -0.100E-999 -999 -> -0E-999 Rounded Inexact resx734 rescale -0.01E-999 -999 -> -0E-999 Inexact Rounded -- next is rounded to Emin resx735 rescale -0.999E-999 -999 -> -1E-999 Inexact Rounded resx736 rescale -0.099E-999 -999 -> -0E-999 Inexact Rounded resx737 rescale -0.009E-999 -999 -> -0E-999 Inexact Rounded resx738 rescale -0.001E-999 -999 -> -0E-999 Inexact Rounded resx739 rescale -0.0001E-999 -999 -> -0E-999 Inexact Rounded resx740 rescale -1.00E-999 -1000 -> -1.0E-999 Rounded resx741 rescale -0.1E-999 -1000 -> -1E-1000 Subnormal resx742 rescale -0.10E-999 -1000 -> -1E-1000 Subnormal Rounded resx743 rescale -0.100E-999 -1000 -> -1E-1000 Subnormal Rounded resx744 rescale -0.01E-999 -1000 -> -0E-1000 Inexact Rounded -- next is rounded to Emin resx745 rescale -0.999E-999 -1000 -> -1.0E-999 Inexact Rounded resx746 rescale -0.099E-999 -1000 -> -1E-1000 Inexact Rounded Subnormal Underflow resx747 rescale -0.009E-999 -1000 -> -0E-1000 Inexact Rounded resx748 rescale -0.001E-999 -1000 -> -0E-1000 Inexact Rounded resx749 rescale -0.0001E-999 -1000 -> -0E-1000 Inexact Rounded resx750 rescale -1.00E-999 -1001 -> -1.00E-999 resx751 rescale -0.1E-999 -1001 -> -1.0E-1000 Subnormal resx752 rescale -0.10E-999 -1001 -> -1.0E-1000 Subnormal resx753 rescale -0.100E-999 -1001 -> -1.0E-1000 Subnormal Rounded resx754 rescale -0.01E-999 -1001 -> -1E-1001 Subnormal -- next is rounded to Emin resx755 rescale -0.999E-999 -1001 -> -1.00E-999 Inexact Rounded resx756 rescale -0.099E-999 -1001 -> -1.0E-1000 Inexact Rounded Subnormal Underflow resx757 rescale -0.009E-999 -1001 -> -1E-1001 Inexact Rounded Subnormal Underflow resx758 rescale -0.001E-999 -1001 -> -0E-1001 Inexact Rounded resx759 rescale -0.0001E-999 -1001 -> -0E-1001 Inexact Rounded resx760 rescale -1.00E-999 -1002 -> -1.000E-999 resx761 rescale -0.1E-999 -1002 -> -1.00E-1000 Subnormal resx762 rescale -0.10E-999 -1002 -> -1.00E-1000 Subnormal resx763 rescale -0.100E-999 -1002 -> -1.00E-1000 Subnormal resx764 rescale -0.01E-999 -1002 -> -1.0E-1001 Subnormal resx765 rescale -0.999E-999 -1002 -> -9.99E-1000 Subnormal resx766 rescale -0.099E-999 -1002 -> -9.9E-1001 Subnormal resx767 rescale -0.009E-999 -1002 -> -9E-1002 Subnormal resx768 rescale -0.001E-999 -1002 -> -1E-1002 Subnormal resx769 rescale -0.0001E-999 -1002 -> -0E-1002 Inexact Rounded -- rhs must be no less than Etiny resx770 rescale -1.00E-999 -1003 -> NaN Invalid_operation resx771 rescale -0.1E-999 -1003 -> NaN Invalid_operation resx772 rescale -0.10E-999 -1003 -> NaN Invalid_operation resx773 rescale -0.100E-999 -1003 -> NaN Invalid_operation resx774 rescale -0.01E-999 -1003 -> NaN Invalid_operation resx775 rescale -0.999E-999 -1003 -> NaN Invalid_operation resx776 rescale -0.099E-999 -1003 -> NaN Invalid_operation resx777 rescale -0.009E-999 -1003 -> NaN Invalid_operation resx778 rescale -0.001E-999 -1003 -> NaN Invalid_operation resx779 rescale -0.0001E-999 -1003 -> NaN Invalid_operation precision: 9 maxExponent: 999999999 minexponent: -999999999 -- getInt worries resx801 rescale 0 1000000000 -> NaN Invalid_operation resx802 rescale 0 -1000000000 -> 0E-1000000000 resx803 rescale 0 2000000000 -> NaN Invalid_operation resx804 rescale 0 -2000000000 -> NaN Invalid_operation resx805 rescale 0 3000000000 -> NaN Invalid_operation resx806 rescale 0 -3000000000 -> NaN Invalid_operation resx807 rescale 0 4000000000 -> NaN Invalid_operation resx808 rescale 0 -4000000000 -> NaN Invalid_operation resx809 rescale 0 5000000000 -> NaN Invalid_operation resx810 rescale 0 -5000000000 -> NaN Invalid_operation resx811 rescale 0 6000000000 -> NaN Invalid_operation resx812 rescale 0 -6000000000 -> NaN Invalid_operation resx813 rescale 0 7000000000 -> NaN Invalid_operation resx814 rescale 0 -7000000000 -> NaN Invalid_operation resx815 rescale 0 8000000000 -> NaN Invalid_operation resx816 rescale 0 -8000000000 -> NaN Invalid_operation resx817 rescale 0 9000000000 -> NaN Invalid_operation resx818 rescale 0 -9000000000 -> NaN Invalid_operation resx819 rescale 0 9999999999 -> NaN Invalid_operation resx820 rescale 0 -9999999999 -> NaN Invalid_operation resx821 rescale 0 10000000000 -> NaN Invalid_operation resx822 rescale 0 -10000000000 -> NaN Invalid_operation resx831 rescale 1 0E-1 -> 1 resx832 rescale 1 0E-2 -> 1 resx833 rescale 1 0E-3 -> 1 resx834 rescale 1 0E-4 -> 1 resx835 rescale 1 0E-100 -> 1 resx836 rescale 1 0E-100000 -> 1 resx837 rescale 1 0E+100 -> 1 resx838 rescale 1 0E+100000 -> 1 resx841 rescale 0 5E-1000000 -> NaN Invalid_operation resx842 rescale 0 5E-1000000 -> NaN Invalid_operation resx843 rescale 0 999999999 -> 0E+999999999 resx844 rescale 0 1000000000 -> NaN Invalid_operation resx845 rescale 0 -999999999 -> 0E-999999999 resx846 rescale 0 -1000000000 -> 0E-1000000000 resx847 rescale 0 -1000000001 -> 0E-1000000001 resx848 rescale 0 -1000000002 -> 0E-1000000002 resx849 rescale 0 -1000000003 -> 0E-1000000003 resx850 rescale 0 -1000000004 -> 0E-1000000004 resx851 rescale 0 -1000000005 -> 0E-1000000005 resx852 rescale 0 -1000000006 -> 0E-1000000006 resx853 rescale 0 -1000000007 -> 0E-1000000007 resx854 rescale 0 -1000000008 -> NaN Invalid_operation resx861 rescale 1 +2147483649 -> NaN Invalid_operation resx862 rescale 1 +2147483648 -> NaN Invalid_operation resx863 rescale 1 +2147483647 -> NaN Invalid_operation resx864 rescale 1 -2147483647 -> NaN Invalid_operation resx865 rescale 1 -2147483648 -> NaN Invalid_operation resx866 rescale 1 -2147483649 -> NaN Invalid_operation -- Null tests res900 rescale 10 # -> NaN Invalid_operation res901 rescale # 10 -> NaN Invalid_operation --- NEW FILE: remainderNear.decTest --- ------------------------------------------------------------------------ -- remainderNear.decTest -- decimal remainder-near (IEEE remainder) -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 rmnx001 remaindernear 1 1 -> 0 rmnx002 remaindernear 2 1 -> 0 rmnx003 remaindernear 1 2 -> 1 rmnx004 remaindernear 2 2 -> 0 rmnx005 remaindernear 0 1 -> 0 rmnx006 remaindernear 0 2 -> 0 rmnx007 remaindernear 1 3 -> 1 rmnx008 remaindernear 2 3 -> -1 rmnx009 remaindernear 3 3 -> 0 rmnx010 remaindernear 2.4 1 -> 0.4 rmnx011 remaindernear 2.4 -1 -> 0.4 rmnx012 remaindernear -2.4 1 -> -0.4 rmnx013 remaindernear -2.4 -1 -> -0.4 rmnx014 remaindernear 2.40 1 -> 0.40 rmnx015 remaindernear 2.400 1 -> 0.400 rmnx016 remaindernear 2.4 2 -> 0.4 rmnx017 remaindernear 2.400 2 -> 0.400 rmnx018 remaindernear 2. 2 -> 0 rmnx019 remaindernear 20 20 -> 0 rmnx020 remaindernear 187 187 -> 0 rmnx021 remaindernear 5 2 -> 1 rmnx022 remaindernear 5 2.0 -> 1.0 rmnx023 remaindernear 5 2.000 -> 1.000 rmnx024 remaindernear 5 0.200 -> 0 rmnx025 remaindernear 5 0.200 -> 0 rmnx030 remaindernear 1 2 -> 1 rmnx031 remaindernear 1 4 -> 1 rmnx032 remaindernear 1 8 -> 1 rmnx033 remaindernear 1 16 -> 1 rmnx034 remaindernear 1 32 -> 1 rmnx035 remaindernear 1 64 -> 1 rmnx040 remaindernear 1 -2 -> 1 rmnx041 remaindernear 1 -4 -> 1 rmnx042 remaindernear 1 -8 -> 1 rmnx043 remaindernear 1 -16 -> 1 rmnx044 remaindernear 1 -32 -> 1 rmnx045 remaindernear 1 -64 -> 1 rmnx050 remaindernear -1 2 -> -1 rmnx051 remaindernear -1 4 -> -1 rmnx052 remaindernear -1 8 -> -1 rmnx053 remaindernear -1 16 -> -1 rmnx054 remaindernear -1 32 -> -1 rmnx055 remaindernear -1 64 -> -1 rmnx060 remaindernear -1 -2 -> -1 rmnx061 remaindernear -1 -4 -> -1 rmnx062 remaindernear -1 -8 -> -1 rmnx063 remaindernear -1 -16 -> -1 rmnx064 remaindernear -1 -32 -> -1 rmnx065 remaindernear -1 -64 -> -1 rmnx066 remaindernear 999999997 1 -> 0 rmnx067 remaindernear 999999997.4 1 -> 0.4 rmnx068 remaindernear 999999997.5 1 -> -0.5 rmnx069 remaindernear 999999997.9 1 -> -0.1 rmnx070 remaindernear 999999997.999 1 -> -0.001 rmnx071 remaindernear 999999998 1 -> 0 rmnx072 remaindernear 999999998.4 1 -> 0.4 rmnx073 remaindernear 999999998.5 1 -> 0.5 rmnx074 remaindernear 999999998.9 1 -> -0.1 rmnx075 remaindernear 999999998.999 1 -> -0.001 rmnx076 remaindernear 999999999 1 -> 0 rmnx077 remaindernear 999999999.4 1 -> 0.4 rmnx078 remaindernear 999999999.5 1 -> NaN Division_impossible rmnx079 remaindernear 999999999.9 1 -> NaN Division_impossible rmnx080 remaindernear 999999999.999 1 -> NaN Division_impossible precision: 6 rmnx081 remaindernear 999999999 1 -> NaN Division_impossible rmnx082 remaindernear 99999999 1 -> NaN Division_impossible rmnx083 remaindernear 9999999 1 -> NaN Division_impossible rmnx084 remaindernear 999999 1 -> 0 rmnx085 remaindernear 99999 1 -> 0 rmnx086 remaindernear 9999 1 -> 0 rmnx087 remaindernear 999 1 -> 0 rmnx088 remaindernear 99 1 -> 0 rmnx089 remaindernear 9 1 -> 0 precision: 9 rmnx090 remaindernear 0. 1 -> 0 rmnx091 remaindernear .0 1 -> 0.0 rmnx092 remaindernear 0.00 1 -> 0.00 rmnx093 remaindernear 0.00E+9 1 -> 0 rmnx094 remaindernear 0.0000E-50 1 -> 0E-54 -- Various flavours of remaindernear by 0 precision: 9 maxexponent: 999999999 minexponent: -999999999 rmnx101 remaindernear 0 0 -> NaN Division_undefined rmnx102 remaindernear 0 -0 -> NaN Division_undefined rmnx103 remaindernear -0 0 -> NaN Division_undefined rmnx104 remaindernear -0 -0 -> NaN Division_undefined rmnx105 remaindernear 0.0E5 0 -> NaN Division_undefined rmnx106 remaindernear 0.000 0 -> NaN Division_undefined -- [Some think this next group should be Division_by_zero exception, -- but IEEE 854 is explicit that it is Invalid operation .. for -- remaindernear-near, anyway] rmnx107 remaindernear 0.0001 0 -> NaN Invalid_operation rmnx108 remaindernear 0.01 0 -> NaN Invalid_operation rmnx109 remaindernear 0.1 0 -> NaN Invalid_operation rmnx110 remaindernear 1 0 -> NaN Invalid_operation rmnx111 remaindernear 1 0.0 -> NaN Invalid_operation rmnx112 remaindernear 10 0.0 -> NaN Invalid_operation rmnx113 remaindernear 1E+100 0.0 -> NaN Invalid_operation rmnx114 remaindernear 1E+1000 0 -> NaN Invalid_operation rmnx115 remaindernear 0.0001 -0 -> NaN Invalid_operation rmnx116 remaindernear 0.01 -0 -> NaN Invalid_operation rmnx119 remaindernear 0.1 -0 -> NaN Invalid_operation rmnx120 remaindernear 1 -0 -> NaN Invalid_operation rmnx121 remaindernear 1 -0.0 -> NaN Invalid_operation rmnx122 remaindernear 10 -0.0 -> NaN Invalid_operation rmnx123 remaindernear 1E+100 -0.0 -> NaN Invalid_operation rmnx124 remaindernear 1E+1000 -0 -> NaN Invalid_operation -- and zeros on left rmnx130 remaindernear 0 1 -> 0 rmnx131 remaindernear 0 -1 -> 0 rmnx132 remaindernear 0.0 1 -> 0.0 rmnx133 remaindernear 0.0 -1 -> 0.0 rmnx134 remaindernear -0 1 -> -0 rmnx135 remaindernear -0 -1 -> -0 rmnx136 remaindernear -0.0 1 -> -0.0 rmnx137 remaindernear -0.0 -1 -> -0.0 -- 0.5ers rmmx143 remaindernear 0.5 2 -> 0.5 rmmx144 remaindernear 0.5 2.1 -> 0.5 rmmx145 remaindernear 0.5 2.01 -> 0.5 rmmx146 remaindernear 0.5 2.001 -> 0.5 rmmx147 remaindernear 0.50 2 -> 0.50 rmmx148 remaindernear 0.50 2.01 -> 0.50 rmmx149 remaindernear 0.50 2.001 -> 0.50 -- some differences from remainder rmnx150 remaindernear 0.4 1.020 -> 0.4 rmnx151 remaindernear 0.50 1.020 -> 0.50 rmnx152 remaindernear 0.51 1.020 -> 0.51 rmnx153 remaindernear 0.52 1.020 -> -0.500 rmnx154 remaindernear 0.6 1.020 -> -0.420 rmnx155 remaindernear 0.49 1 -> 0.49 rmnx156 remaindernear 0.50 1 -> 0.50 rmnx157 remaindernear 1.50 1 -> -0.50 rmnx158 remaindernear 2.50 1 -> 0.50 rmnx159 remaindernear 9.50 1 -> -0.50 rmnx160 remaindernear 0.51 1 -> -0.49 -- the nasty division-by-1 cases rmnx161 remaindernear 0.4 1 -> 0.4 rmnx162 remaindernear 0.45 1 -> 0.45 rmnx163 remaindernear 0.455 1 -> 0.455 rmnx164 remaindernear 0.4555 1 -> 0.4555 rmnx165 remaindernear 0.45555 1 -> 0.45555 rmnx166 remaindernear 0.455555 1 -> 0.455555 rmnx167 remaindernear 0.4555555 1 -> 0.4555555 rmnx168 remaindernear 0.45555555 1 -> 0.45555555 rmnx169 remaindernear 0.455555555 1 -> 0.455555555 -- with spill... rmnx171 remaindernear 0.5 1 -> 0.5 rmnx172 remaindernear 0.55 1 -> -0.45 rmnx173 remaindernear 0.555 1 -> -0.445 rmnx174 remaindernear 0.5555 1 -> -0.4445 rmnx175 remaindernear 0.55555 1 -> -0.44445 rmnx176 remaindernear 0.555555 1 -> -0.444445 rmnx177 remaindernear 0.5555555 1 -> -0.4444445 rmnx178 remaindernear 0.55555555 1 -> -0.44444445 rmnx179 remaindernear 0.555555555 1 -> -0.444444445 -- progression rmnx180 remaindernear 1 1 -> 0 rmnx181 remaindernear 1 2 -> 1 rmnx182 remaindernear 1 3 -> 1 rmnx183 remaindernear 1 4 -> 1 rmnx184 remaindernear 1 5 -> 1 rmnx185 remaindernear 1 6 -> 1 rmnx186 remaindernear 1 7 -> 1 rmnx187 remaindernear 1 8 -> 1 rmnx188 remaindernear 1 9 -> 1 rmnx189 remaindernear 1 10 -> 1 rmnx190 remaindernear 1 1 -> 0 rmnx191 remaindernear 2 1 -> 0 rmnx192 remaindernear 3 1 -> 0 rmnx193 remaindernear 4 1 -> 0 rmnx194 remaindernear 5 1 -> 0 rmnx195 remaindernear 6 1 -> 0 rmnx196 remaindernear 7 1 -> 0 rmnx197 remaindernear 8 1 -> 0 rmnx198 remaindernear 9 1 -> 0 rmnx199 remaindernear 10 1 -> 0 -- Various flavours of remaindernear by 0 maxexponent: 999999999 minexponent: -999999999 rmnx201 remaindernear 0 0 -> NaN Division_undefined rmnx202 remaindernear 0.0E5 0 -> NaN Division_undefined rmnx203 remaindernear 0.000 0 -> NaN Division_undefined rmnx204 remaindernear 0.0001 0 -> NaN Invalid_operation rmnx205 remaindernear 0.01 0 -> NaN Invalid_operation rmnx206 remaindernear 0.1 0 -> NaN Invalid_operation rmnx207 remaindernear 1 0 -> NaN Invalid_operation rmnx208 remaindernear 1 0.0 -> NaN Invalid_operation rmnx209 remaindernear 10 0.0 -> NaN Invalid_operation rmnx210 remaindernear 1E+100 0.0 -> NaN Invalid_operation rmnx211 remaindernear 1E+1000 0 -> NaN Invalid_operation -- tests from the extended specification rmnx221 remaindernear 2.1 3 -> -0.9 rmnx222 remaindernear 10 6 -> -2 rmnx223 remaindernear 10 3 -> 1 rmnx224 remaindernear -10 3 -> -1 rmnx225 remaindernear 10.2 1 -> 0.2 rmnx226 remaindernear 10 0.3 -> 0.1 rmnx227 remaindernear 3.6 1.3 -> -0.3 -- some differences from remainder rmnx231 remaindernear 0.4 1.020 -> 0.4 rmnx232 remaindernear 0.50 1.020 -> 0.50 rmnx233 remaindernear 0.51 1.020 -> 0.51 rmnx234 remaindernear 0.52 1.020 -> -0.500 rmnx235 remaindernear 0.6 1.020 -> -0.420 -- test some cases that are close to exponent overflow maxexponent: 999999999 minexponent: -999999999 rmnx270 remaindernear 1 1e999999999 -> 1 rmnx271 remaindernear 1 0.9e999999999 -> 1 rmnx272 remaindernear 1 0.99e999999999 -> 1 rmnx273 remaindernear 1 0.999999999e999999999 -> 1 rmnx274 remaindernear 9e999999999 1 -> NaN Division_impossible rmnx275 remaindernear 9.9e999999999 1 -> NaN Division_impossible rmnx276 remaindernear 9.99e999999999 1 -> NaN Division_impossible rmnx277 remaindernear 9.99999999e999999999 1 -> NaN Division_impossible rmnx280 remaindernear 0.1 9e-999999999 -> NaN Division_impossible rmnx281 remaindernear 0.1 99e-999999999 -> NaN Division_impossible rmnx282 remaindernear 0.1 999e-999999999 -> NaN Division_impossible rmnx283 remaindernear 0.1 9e-999999998 -> NaN Division_impossible rmnx284 remaindernear 0.1 99e-999999998 -> NaN Division_impossible rmnx285 remaindernear 0.1 999e-999999998 -> NaN Division_impossible rmnx286 remaindernear 0.1 999e-999999997 -> NaN Division_impossible rmnx287 remaindernear 0.1 9999e-999999997 -> NaN Division_impossible rmnx288 remaindernear 0.1 99999e-999999997 -> NaN Division_impossible -- rmnx3xx are from DiagBigDecimal rmnx301 remaindernear 1 3 -> 1 rmnx302 remaindernear 5 5 -> 0 rmnx303 remaindernear 13 10 -> 3 rmnx304 remaindernear 13 50 -> 13 rmnx305 remaindernear 13 100 -> 13 rmnx306 remaindernear 13 1000 -> 13 rmnx307 remaindernear .13 1 -> 0.13 rmnx308 remaindernear 0.133 1 -> 0.133 rmnx309 remaindernear 0.1033 1 -> 0.1033 rmnx310 remaindernear 1.033 1 -> 0.033 rmnx311 remaindernear 10.33 1 -> 0.33 rmnx312 remaindernear 10.33 10 -> 0.33 rmnx313 remaindernear 103.3 1 -> 0.3 rmnx314 remaindernear 133 10 -> 3 rmnx315 remaindernear 1033 10 -> 3 rmnx316 remaindernear 1033 50 -> -17 rmnx317 remaindernear 101.0 3 -> -1.0 rmnx318 remaindernear 102.0 3 -> 0 rmnx319 remaindernear 103.0 3 -> 1.0 rmnx320 remaindernear 2.40 1 -> 0.40 rmnx321 remaindernear 2.400 1 -> 0.400 rmnx322 remaindernear 2.4 1 -> 0.4 rmnx323 remaindernear 2.4 2 -> 0.4 rmnx324 remaindernear 2.400 2 -> 0.400 rmnx325 remaindernear 1 0.3 -> 0.1 rmnx326 remaindernear 1 0.30 -> 0.10 rmnx327 remaindernear 1 0.300 -> 0.100 rmnx328 remaindernear 1 0.3000 -> 0.1000 rmnx329 remaindernear 1.0 0.3 -> 0.1 rmnx330 remaindernear 1.00 0.3 -> 0.10 rmnx331 remaindernear 1.000 0.3 -> 0.100 rmnx332 remaindernear 1.0000 0.3 -> 0.1000 rmnx333 remaindernear 0.5 2 -> 0.5 rmnx334 remaindernear 0.5 2.1 -> 0.5 rmnx335 remaindernear 0.5 2.01 -> 0.5 rmnx336 remaindernear 0.5 2.001 -> 0.5 rmnx337 remaindernear 0.50 2 -> 0.50 rmnx338 remaindernear 0.50 2.01 -> 0.50 rmnx339 remaindernear 0.50 2.001 -> 0.50 rmnx340 remaindernear 0.5 0.5000001 -> -1E-7 rmnx341 remaindernear 0.5 0.50000001 -> -1E-8 rmnx342 remaindernear 0.5 0.500000001 -> -1E-9 rmnx343 remaindernear 0.5 0.5000000001 -> -1E-10 rmnx344 remaindernear 0.5 0.50000000001 -> -1E-11 rmnx345 remaindernear 0.5 0.4999999 -> 1E-7 rmnx346 remaindernear 0.5 0.49999999 -> 1E-8 rmnx347 remaindernear 0.5 0.499999999 -> 1E-9 rmnx348 remaindernear 0.5 0.4999999999 -> 1E-10 rmnx349 remaindernear 0.5 0.49999999999 -> 1E-11 rmnx350 remaindernear 0.03 7 -> 0.03 rmnx351 remaindernear 5 2 -> 1 rmnx352 remaindernear 4.1 2 -> 0.1 rmnx353 remaindernear 4.01 2 -> 0.01 rmnx354 remaindernear 4.001 2 -> 0.001 rmnx355 remaindernear 4.0001 2 -> 0.0001 rmnx356 remaindernear 4.00001 2 -> 0.00001 rmnx357 remaindernear 4.000001 2 -> 0.000001 rmnx358 remaindernear 4.0000001 2 -> 1E-7 rmnx360 remaindernear 1.2 0.7345 -> -0.2690 rmnx361 remaindernear 0.8 12 -> 0.8 rmnx362 remaindernear 0.8 0.2 -> 0 rmnx363 remaindernear 0.8 0.3 -> -0.1 rmnx364 remaindernear 0.800 12 -> 0.800 rmnx365 remaindernear 0.800 1.7 -> 0.800 rmnx366 remaindernear 2.400 2 -> 0.400 precision: 6 rmnx371 remaindernear 2.400 2 -> 0.400 precision: 3 rmnx372 remaindernear 12345678900000 12e+12 -> 3.46E+11 Inexact Rounded precision: 5 rmnx381 remaindernear 12345 1 -> 0 rmnx382 remaindernear 12345 1.0001 -> -0.2344 rmnx383 remaindernear 12345 1.001 -> -0.333 rmnx384 remaindernear 12345 1.01 -> -0.23 rmnx385 remaindernear 12345 1.1 -> -0.3 rmnx386 remaindernear 12355 4 -> -1 rmnx387 remaindernear 12345 4 -> 1 rmnx388 remaindernear 12355 4.0001 -> -1.3089 rmnx389 remaindernear 12345 4.0001 -> 0.6914 rmnx390 remaindernear 12345 4.9 -> 1.9 rmnx391 remaindernear 12345 4.99 -> -0.26 rmnx392 remaindernear 12345 4.999 -> 2.469 rmnx393 remaindernear 12345 4.9999 -> 0.2469 rmnx394 remaindernear 12345 5 -> 0 rmnx395 remaindernear 12345 5.0001 -> -0.2469 rmnx396 remaindernear 12345 5.001 -> -2.469 rmnx397 remaindernear 12345 5.01 -> 0.36 rmnx398 remaindernear 12345 5.1 -> -2.1 precision: 9 -- some nasty division-by-1 cases [some similar above] rmnx401 remaindernear 0.4 1 -> 0.4 rmnx402 remaindernear 0.45 1 -> 0.45 rmnx403 remaindernear 0.455 1 -> 0.455 rmnx404 remaindernear 0.4555 1 -> 0.4555 rmnx405 remaindernear 0.45555 1 -> 0.45555 rmnx406 remaindernear 0.455555 1 -> 0.455555 rmnx407 remaindernear 0.4555555 1 -> 0.4555555 rmnx408 remaindernear 0.45555555 1 -> 0.45555555 rmnx409 remaindernear 0.455555555 1 -> 0.455555555 -- some tricky LHSs rmnx420 remaindernear 99999999.999999999 1E+8 -> -1E-9 rmnx421 remaindernear 999999999.999999999 1E+9 -> -1E-9 precision: 9 rmnx430 remaindernear 0.455555555 1 -> 0.455555555 precision: 8 rmnx431 remaindernear 0.455555555 1 -> 0.45555556 Inexact Rounded precision: 7 rmnx432 remaindernear 0.455555555 1 -> 0.4555556 Inexact Rounded precision: 6 rmnx433 remaindernear 0.455555555 1 -> 0.455556 Inexact Rounded precision: 5 rmnx434 remaindernear 0.455555555 1 -> 0.45556 Inexact Rounded precision: 4 rmnx435 remaindernear 0.455555555 1 -> 0.4556 Inexact Rounded precision: 3 rmnx436 remaindernear 0.455555555 1 -> 0.456 Inexact Rounded precision: 2 rmnx437 remaindernear 0.455555555 1 -> 0.46 Inexact Rounded precision: 1 rmnx438 remaindernear 0.455555555 1 -> 0.5 Inexact Rounded -- early tests; from text descriptions precision: 9 rmnx601 remaindernear 10 6 -> -2 rmnx602 remaindernear -10 6 -> 2 rmnx603 remaindernear 11 3 -> -1 rmnx604 remaindernear 11 5 -> 1 rmnx605 remaindernear 7.7 8 -> -0.3 rmnx606 remaindernear 31.5 3 -> 1.5 -- i=10 rmnx607 remaindernear 34.5 3 -> -1.5 -- i=11 -- Specials rmnx680 remaindernear Inf -Inf -> NaN Invalid_operation rmnx681 remaindernear Inf -1000 -> NaN Invalid_operation rmnx682 remaindernear Inf -1 -> NaN Invalid_operation rmnx683 remaindernear Inf 0 -> NaN Invalid_operation rmnx684 remaindernear Inf -0 -> NaN Invalid_operation rmnx685 remaindernear Inf 1 -> NaN Invalid_operation rmnx686 remaindernear Inf 1000 -> NaN Invalid_operation rmnx687 remaindernear Inf Inf -> NaN Invalid_operation rmnx688 remaindernear -1000 Inf -> -1000 rmnx689 remaindernear -Inf Inf -> NaN Invalid_operation rmnx691 remaindernear -1 Inf -> -1 rmnx692 remaindernear 0 Inf -> 0 rmnx693 remaindernear -0 Inf -> -0 rmnx694 remaindernear 1 Inf -> 1 rmnx695 remaindernear 1000 Inf -> 1000 rmnx696 remaindernear Inf Inf -> NaN Invalid_operation rmnx700 remaindernear -Inf -Inf -> NaN Invalid_operation rmnx701 remaindernear -Inf -1000 -> NaN Invalid_operation rmnx702 remaindernear -Inf -1 -> NaN Invalid_operation rmnx703 remaindernear -Inf -0 -> NaN Invalid_operation rmnx704 remaindernear -Inf 0 -> NaN Invalid_operation rmnx705 remaindernear -Inf 1 -> NaN Invalid_operation rmnx706 remaindernear -Inf 1000 -> NaN Invalid_operation rmnx707 remaindernear -Inf Inf -> NaN Invalid_operation rmnx708 remaindernear -Inf -Inf -> NaN Invalid_operation rmnx709 remaindernear -1000 Inf -> -1000 rmnx710 remaindernear -1 -Inf -> -1 rmnx711 remaindernear -0 -Inf -> -0 rmnx712 remaindernear 0 -Inf -> 0 rmnx713 remaindernear 1 -Inf -> 1 rmnx714 remaindernear 1000 -Inf -> 1000 rmnx715 remaindernear Inf -Inf -> NaN Invalid_operation rmnx721 remaindernear NaN -Inf -> NaN rmnx722 remaindernear NaN -1000 -> NaN rmnx723 remaindernear NaN -1 -> NaN rmnx724 remaindernear NaN -0 -> NaN rmnx725 remaindernear NaN 0 -> NaN rmnx726 remaindernear NaN 1 -> NaN rmnx727 remaindernear NaN 1000 -> NaN rmnx728 remaindernear NaN Inf -> NaN rmnx729 remaindernear NaN NaN -> NaN rmnx730 remaindernear -Inf NaN -> NaN rmnx731 remaindernear -1000 NaN -> NaN rmnx732 remaindernear -1 NaN -> NaN rmnx733 remaindernear -0 NaN -> NaN rmnx734 remaindernear 0 NaN -> NaN rmnx735 remaindernear 1 NaN -> NaN rmnx736 remaindernear 1000 NaN -> NaN rmnx737 remaindernear Inf NaN -> NaN rmnx741 remaindernear sNaN -Inf -> NaN Invalid_operation rmnx742 remaindernear sNaN -1000 -> NaN Invalid_operation rmnx743 remaindernear sNaN -1 -> NaN Invalid_operation rmnx744 remaindernear sNaN -0 -> NaN Invalid_operation rmnx745 remaindernear sNaN 0 -> NaN Invalid_operation rmnx746 remaindernear sNaN 1 -> NaN Invalid_operation rmnx747 remaindernear sNaN 1000 -> NaN Invalid_operation rmnx749 remaindernear sNaN NaN -> NaN Invalid_operation rmnx750 remaindernear sNaN sNaN -> NaN Invalid_operation rmnx751 remaindernear NaN sNaN -> NaN Invalid_operation rmnx752 remaindernear -Inf sNaN -> NaN Invalid_operation rmnx753 remaindernear -1000 sNaN -> NaN Invalid_operation rmnx754 remaindernear -1 sNaN -> NaN Invalid_operation rmnx755 remaindernear -0 sNaN -> NaN Invalid_operation rmnx756 remaindernear 0 sNaN -> NaN Invalid_operation rmnx757 remaindernear 1 sNaN -> NaN Invalid_operation rmnx758 remaindernear 1000 sNaN -> NaN Invalid_operation rmnx759 remaindernear Inf sNaN -> NaN Invalid_operation rmnx760 remaindernear NaN sNaN -> NaN Invalid_operation -- test some cases that are close to exponent overflow maxexponent: 999999999 minexponent: -999999999 rmnx770 remaindernear 1 1e999999999 -> 1 rmnx771 remaindernear 1 0.9e999999999 -> 1 rmnx772 remaindernear 1 0.99e999999999 -> 1 rmnx773 remaindernear 1 0.999999999e999999999 -> 1 rmnx774 remaindernear 9e999999999 1 -> NaN Division_impossible rmnx775 remaindernear 9.9e999999999 1 -> NaN Division_impossible rmnx776 remaindernear 9.99e999999999 1 -> NaN Division_impossible rmnx777 remaindernear 9.99999999e999999999 1 -> NaN Division_impossible -- overflow and underflow tests [from divide] precision: 9 maxexponent: 999999999 minexponent: -999999999 rmnx780 remaindernear +1.23456789012345E-0 9E+999999999 -> 1.23456789 Inexact Rounded rmnx781 remaindernear 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible rmnx782 remaindernear +0.100 9E+999999999 -> 0.100 rmnx783 remaindernear 9E-999999999 +9.100 -> 9E-999999999 rmnx785 remaindernear -1.23456789012345E-0 9E+999999999 -> -1.23456789 Inexact Rounded rmnx786 remaindernear 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible rmnx787 remaindernear -0.100 9E+999999999 -> -0.100 rmnx788 remaindernear 9E-999999999 -9.100 -> 9E-999999999 -- long operands checks maxexponent: 999 minexponent: -999 precision: 9 rmnx801 remaindernear 12345678000 100 -> 0 rmnx802 remaindernear 1 12345678000 -> 1 rmnx803 remaindernear 1234567800 10 -> 0 rmnx804 remaindernear 1 1234567800 -> 1 rmnx805 remaindernear 1234567890 10 -> 0 rmnx806 remaindernear 1 1234567890 -> 1 rmnx807 remaindernear 1234567891 10 -> 1 rmnx808 remaindernear 1 1234567891 -> 1 rmnx809 remaindernear 12345678901 100 -> 1 rmnx810 remaindernear 1 12345678901 -> 1 rmnx811 remaindernear 1234567896 10 -> -4 rmnx812 remaindernear 1 1234567896 -> 1 precision: 15 rmnx841 remaindernear 12345678000 100 -> 0 rmnx842 remaindernear 1 12345678000 -> 1 rmnx843 remaindernear 1234567800 10 -> 0 rmnx844 remaindernear 1 1234567800 -> 1 rmnx845 remaindernear 1234567890 10 -> 0 rmnx846 remaindernear 1 1234567890 -> 1 rmnx847 remaindernear 1234567891 10 -> 1 rmnx848 remaindernear 1 1234567891 -> 1 rmnx849 remaindernear 12345678901 100 -> 1 rmnx850 remaindernear 1 12345678901 -> 1 rmnx851 remaindernear 1234567896 10 -> -4 rmnx852 remaindernear 1 1234567896 -> 1 -- Null tests rmnx900 remaindernear 10 # -> NaN Invalid_operation rmnx901 remaindernear # 10 -> NaN Invalid_operation --- NEW FILE: remainder.decTest --- ------------------------------------------------------------------------ -- remainder.decTest -- decimal remainder -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks (as base, above) remx001 remainder 1 1 -> 0 remx002 remainder 2 1 -> 0 remx003 remainder 1 2 -> 1 remx004 remainder 2 2 -> 0 remx005 remainder 0 1 -> 0 remx006 remainder 0 2 -> 0 remx007 remainder 1 3 -> 1 remx008 remainder 2 3 -> 2 remx009 remainder 3 3 -> 0 remx010 remainder 2.4 1 -> 0.4 remx011 remainder 2.4 -1 -> 0.4 remx012 remainder -2.4 1 -> -0.4 remx013 remainder -2.4 -1 -> -0.4 remx014 remainder 2.40 1 -> 0.40 remx015 remainder 2.400 1 -> 0.400 remx016 remainder 2.4 2 -> 0.4 remx017 remainder 2.400 2 -> 0.400 remx018 remainder 2. 2 -> 0 remx019 remainder 20 20 -> 0 remx020 remainder 187 187 -> 0 remx021 remainder 5 2 -> 1 remx022 remainder 5 2.0 -> 1.0 remx023 remainder 5 2.000 -> 1.000 remx024 remainder 5 0.200 -> 0 remx025 remainder 5 0.200 -> 0 remx030 remainder 1 2 -> 1 remx031 remainder 1 4 -> 1 remx032 remainder 1 8 -> 1 remx033 remainder 1 16 -> 1 remx034 remainder 1 32 -> 1 remx035 remainder 1 64 -> 1 remx040 remainder 1 -2 -> 1 remx041 remainder 1 -4 -> 1 remx042 remainder 1 -8 -> 1 remx043 remainder 1 -16 -> 1 remx044 remainder 1 -32 -> 1 remx045 remainder 1 -64 -> 1 remx050 remainder -1 2 -> -1 remx051 remainder -1 4 -> -1 remx052 remainder -1 8 -> -1 remx053 remainder -1 16 -> -1 remx054 remainder -1 32 -> -1 remx055 remainder -1 64 -> -1 remx060 remainder -1 -2 -> -1 remx061 remainder -1 -4 -> -1 remx062 remainder -1 -8 -> -1 remx063 remainder -1 -16 -> -1 remx064 remainder -1 -32 -> -1 remx065 remainder -1 -64 -> -1 remx066 remainder 999999999 1 -> 0 remx067 remainder 999999999.4 1 -> 0.4 remx068 remainder 999999999.5 1 -> 0.5 remx069 remainder 999999999.9 1 -> 0.9 remx070 remainder 999999999.999 1 -> 0.999 precision: 6 remx071 remainder 999999999 1 -> NaN Division_impossible remx072 remainder 99999999 1 -> NaN Division_impossible remx073 remainder 9999999 1 -> NaN Division_impossible remx074 remainder 999999 1 -> 0 remx075 remainder 99999 1 -> 0 remx076 remainder 9999 1 -> 0 remx077 remainder 999 1 -> 0 remx078 remainder 99 1 -> 0 remx079 remainder 9 1 -> 0 precision: 9 remx080 remainder 0. 1 -> 0 remx081 remainder .0 1 -> 0.0 remx082 remainder 0.00 1 -> 0.00 remx083 remainder 0.00E+9 1 -> 0 remx084 remainder 0.00E+3 1 -> 0 remx085 remainder 0.00E+2 1 -> 0 remx086 remainder 0.00E+1 1 -> 0.0 remx087 remainder 0.00E+0 1 -> 0.00 remx088 remainder 0.00E-0 1 -> 0.00 remx089 remainder 0.00E-1 1 -> 0.000 remx090 remainder 0.00E-2 1 -> 0.0000 remx091 remainder 0.00E-3 1 -> 0.00000 remx092 remainder 0.00E-4 1 -> 0.000000 remx093 remainder 0.00E-5 1 -> 0E-7 remx094 remainder 0.00E-6 1 -> 0E-8 remx095 remainder 0.0000E-50 1 -> 0E-54 -- Various flavours of remainder by 0 precision: 9 maxexponent: 999999999 minexponent: -999999999 remx101 remainder 0 0 -> NaN Division_undefined remx102 remainder 0 -0 -> NaN Division_undefined remx103 remainder -0 0 -> NaN Division_undefined remx104 remainder -0 -0 -> NaN Division_undefined remx105 remainder 0.0E5 0 -> NaN Division_undefined remx106 remainder 0.000 0 -> NaN Division_undefined -- [Some think this next group should be Division_by_zero exception, but -- IEEE 854 is explicit that it is Invalid operation .. for -- remainder-near, anyway] remx107 remainder 0.0001 0 -> NaN Invalid_operation remx108 remainder 0.01 0 -> NaN Invalid_operation remx109 remainder 0.1 0 -> NaN Invalid_operation remx110 remainder 1 0 -> NaN Invalid_operation remx111 remainder 1 0.0 -> NaN Invalid_operation remx112 remainder 10 0.0 -> NaN Invalid_operation remx113 remainder 1E+100 0.0 -> NaN Invalid_operation remx114 remainder 1E+1000 0 -> NaN Invalid_operation remx115 remainder 0.0001 -0 -> NaN Invalid_operation remx116 remainder 0.01 -0 -> NaN Invalid_operation remx119 remainder 0.1 -0 -> NaN Invalid_operation remx120 remainder 1 -0 -> NaN Invalid_operation remx121 remainder 1 -0.0 -> NaN Invalid_operation remx122 remainder 10 -0.0 -> NaN Invalid_operation remx123 remainder 1E+100 -0.0 -> NaN Invalid_operation remx124 remainder 1E+1000 -0 -> NaN Invalid_operation -- and zeros on left remx130 remainder 0 1 -> 0 remx131 remainder 0 -1 -> 0 remx132 remainder 0.0 1 -> 0.0 remx133 remainder 0.0 -1 -> 0.0 remx134 remainder -0 1 -> -0 remx135 remainder -0 -1 -> -0 remx136 remainder -0.0 1 -> -0.0 remx137 remainder -0.0 -1 -> -0.0 -- 0.5ers remx143 remainder 0.5 2 -> 0.5 remx144 remainder 0.5 2.1 -> 0.5 remx145 remainder 0.5 2.01 -> 0.5 remx146 remainder 0.5 2.001 -> 0.5 remx147 remainder 0.50 2 -> 0.50 remx148 remainder 0.50 2.01 -> 0.50 remx149 remainder 0.50 2.001 -> 0.50 -- steadies remx150 remainder 1 1 -> 0 remx151 remainder 1 2 -> 1 remx152 remainder 1 3 -> 1 remx153 remainder 1 4 -> 1 remx154 remainder 1 5 -> 1 remx155 remainder 1 6 -> 1 remx156 remainder 1 7 -> 1 remx157 remainder 1 8 -> 1 remx158 remainder 1 9 -> 1 remx159 remainder 1 10 -> 1 remx160 remainder 1 1 -> 0 remx161 remainder 2 1 -> 0 remx162 remainder 3 1 -> 0 remx163 remainder 4 1 -> 0 remx164 remainder 5 1 -> 0 remx165 remainder 6 1 -> 0 remx166 remainder 7 1 -> 0 remx167 remainder 8 1 -> 0 remx168 remainder 9 1 -> 0 remx169 remainder 10 1 -> 0 -- some differences from remainderNear remx171 remainder 0.4 1.020 -> 0.4 remx172 remainder 0.50 1.020 -> 0.50 remx173 remainder 0.51 1.020 -> 0.51 remx174 remainder 0.52 1.020 -> 0.52 remx175 remainder 0.6 1.020 -> 0.6 -- More flavours of remainder by 0 maxexponent: 999999999 minexponent: -999999999 remx201 remainder 0 0 -> NaN Division_undefined remx202 remainder 0.0E5 0 -> NaN Division_undefined remx203 remainder 0.000 0 -> NaN Division_undefined remx204 remainder 0.0001 0 -> NaN Invalid_operation remx205 remainder 0.01 0 -> NaN Invalid_operation remx206 remainder 0.1 0 -> NaN Invalid_operation remx207 remainder 1 0 -> NaN Invalid_operation remx208 remainder 1 0.0 -> NaN Invalid_operation remx209 remainder 10 0.0 -> NaN Invalid_operation remx210 remainder 1E+100 0.0 -> NaN Invalid_operation remx211 remainder 1E+1000 0 -> NaN Invalid_operation -- some differences from remainderNear remx231 remainder 0.4 1.020 -> 0.4 remx232 remainder 0.50 1.020 -> 0.50 remx233 remainder 0.51 1.020 -> 0.51 remx234 remainder 0.52 1.020 -> 0.52 remx235 remainder 0.6 1.020 -> 0.6 -- test some cases that are close to exponent overflow maxexponent: 999999999 minexponent: -999999999 remx270 remainder 1 1e999999999 -> 1 remx271 remainder 1 0.9e999999999 -> 1 remx272 remainder 1 0.99e999999999 -> 1 remx273 remainder 1 0.999999999e999999999 -> 1 remx274 remainder 9e999999999 1 -> NaN Division_impossible remx275 remainder 9.9e999999999 1 -> NaN Division_impossible remx276 remainder 9.99e999999999 1 -> NaN Division_impossible remx277 remainder 9.99999999e999999999 1 -> NaN Division_impossible remx280 remainder 0.1 9e-999999999 -> NaN Division_impossible remx281 remainder 0.1 99e-999999999 -> NaN Division_impossible remx282 remainder 0.1 999e-999999999 -> NaN Division_impossible remx283 remainder 0.1 9e-999999998 -> NaN Division_impossible remx284 remainder 0.1 99e-999999998 -> NaN Division_impossible remx285 remainder 0.1 999e-999999998 -> NaN Division_impossible remx286 remainder 0.1 999e-999999997 -> NaN Division_impossible remx287 remainder 0.1 9999e-999999997 -> NaN Division_impossible remx288 remainder 0.1 99999e-999999997 -> NaN Division_impossible -- remx3xx are from DiagBigDecimal remx301 remainder 1 3 -> 1 remx302 remainder 5 5 -> 0 remx303 remainder 13 10 -> 3 remx304 remainder 13 50 -> 13 remx305 remainder 13 100 -> 13 remx306 remainder 13 1000 -> 13 remx307 remainder .13 1 -> 0.13 remx308 remainder 0.133 1 -> 0.133 remx309 remainder 0.1033 1 -> 0.1033 remx310 remainder 1.033 1 -> 0.033 remx311 remainder 10.33 1 -> 0.33 remx312 remainder 10.33 10 -> 0.33 remx313 remainder 103.3 1 -> 0.3 remx314 remainder 133 10 -> 3 remx315 remainder 1033 10 -> 3 remx316 remainder 1033 50 -> 33 remx317 remainder 101.0 3 -> 2.0 remx318 remainder 102.0 3 -> 0 remx319 remainder 103.0 3 -> 1.0 remx320 remainder 2.40 1 -> 0.40 remx321 remainder 2.400 1 -> 0.400 remx322 remainder 2.4 1 -> 0.4 remx323 remainder 2.4 2 -> 0.4 remx324 remainder 2.400 2 -> 0.400 remx325 remainder 1 0.3 -> 0.1 remx326 remainder 1 0.30 -> 0.10 remx327 remainder 1 0.300 -> 0.100 remx328 remainder 1 0.3000 -> 0.1000 remx329 remainder 1.0 0.3 -> 0.1 remx330 remainder 1.00 0.3 -> 0.10 remx331 remainder 1.000 0.3 -> 0.100 remx332 remainder 1.0000 0.3 -> 0.1000 remx333 remainder 0.5 2 -> 0.5 remx334 remainder 0.5 2.1 -> 0.5 remx335 remainder 0.5 2.01 -> 0.5 remx336 remainder 0.5 2.001 -> 0.5 remx337 remainder 0.50 2 -> 0.50 remx338 remainder 0.50 2.01 -> 0.50 remx339 remainder 0.50 2.001 -> 0.50 remx340 remainder 0.5 0.5000001 -> 0.5 remx341 remainder 0.5 0.50000001 -> 0.5 remx342 remainder 0.5 0.500000001 -> 0.5 remx343 remainder 0.5 0.5000000001 -> 0.5 remx344 remainder 0.5 0.50000000001 -> 0.5 remx345 remainder 0.5 0.4999999 -> 1E-7 remx346 remainder 0.5 0.49999999 -> 1E-8 remx347 remainder 0.5 0.499999999 -> 1E-9 remx348 remainder 0.5 0.4999999999 -> 1E-10 remx349 remainder 0.5 0.49999999999 -> 1E-11 remx350 remainder 0.5 0.499999999999 -> 1E-12 remx351 remainder 0.03 7 -> 0.03 remx352 remainder 5 2 -> 1 remx353 remainder 4.1 2 -> 0.1 remx354 remainder 4.01 2 -> 0.01 remx355 remainder 4.001 2 -> 0.001 remx356 remainder 4.0001 2 -> 0.0001 remx357 remainder 4.00001 2 -> 0.00001 remx358 remainder 4.000001 2 -> 0.000001 remx359 remainder 4.0000001 2 -> 1E-7 remx360 remainder 1.2 0.7345 -> 0.4655 remx361 remainder 0.8 12 -> 0.8 remx362 remainder 0.8 0.2 -> 0 remx363 remainder 0.8 0.3 -> 0.2 remx364 remainder 0.800 12 -> 0.800 remx365 remainder 0.800 1.7 -> 0.800 remx366 remainder 2.400 2 -> 0.400 precision: 6 remx371 remainder 2.400 2 -> 0.400 precision: 3 -- long operand case remx372 remainder 12345678900000 12e+12 -> 3.46E+11 Inexact Rounded precision: 5 remx381 remainder 12345 1 -> 0 remx382 remainder 12345 1.0001 -> 0.7657 remx383 remainder 12345 1.001 -> 0.668 remx384 remainder 12345 1.01 -> 0.78 remx385 remainder 12345 1.1 -> 0.8 remx386 remainder 12355 4 -> 3 remx387 remainder 12345 4 -> 1 remx388 remainder 12355 4.0001 -> 2.6912 remx389 remainder 12345 4.0001 -> 0.6914 remx390 remainder 12345 4.9 -> 1.9 remx391 remainder 12345 4.99 -> 4.73 remx392 remainder 12345 4.999 -> 2.469 remx393 remainder 12345 4.9999 -> 0.2469 remx394 remainder 12345 5 -> 0 remx395 remainder 12345 5.0001 -> 4.7532 remx396 remainder 12345 5.001 -> 2.532 remx397 remainder 12345 5.01 -> 0.36 remx398 remainder 12345 5.1 -> 3.0 precision: 9 -- the nasty division-by-1 cases remx401 remainder 0.5 1 -> 0.5 remx402 remainder 0.55 1 -> 0.55 remx403 remainder 0.555 1 -> 0.555 remx404 remainder 0.5555 1 -> 0.5555 remx405 remainder 0.55555 1 -> 0.55555 remx406 remainder 0.555555 1 -> 0.555555 remx407 remainder 0.5555555 1 -> 0.5555555 remx408 remainder 0.55555555 1 -> 0.55555555 remx409 remainder 0.555555555 1 -> 0.555555555 -- Specials remx680 remainder Inf -Inf -> NaN Invalid_operation remx681 remainder Inf -1000 -> NaN Invalid_operation remx682 remainder Inf -1 -> NaN Invalid_operation remx683 remainder Inf 0 -> NaN Invalid_operation remx684 remainder Inf -0 -> NaN Invalid_operation remx685 remainder Inf 1 -> NaN Invalid_operation remx686 remainder Inf 1000 -> NaN Invalid_operation remx687 remainder Inf Inf -> NaN Invalid_operation remx688 remainder -1000 Inf -> -1000 remx689 remainder -Inf Inf -> NaN Invalid_operation remx691 remainder -1 Inf -> -1 remx692 remainder 0 Inf -> 0 remx693 remainder -0 Inf -> -0 remx694 remainder 1 Inf -> 1 remx695 remainder 1000 Inf -> 1000 remx696 remainder Inf Inf -> NaN Invalid_operation remx700 remainder -Inf -Inf -> NaN Invalid_operation remx701 remainder -Inf -1000 -> NaN Invalid_operation remx702 remainder -Inf -1 -> NaN Invalid_operation remx703 remainder -Inf -0 -> NaN Invalid_operation remx704 remainder -Inf 0 -> NaN Invalid_operation remx705 remainder -Inf 1 -> NaN Invalid_operation remx706 remainder -Inf 1000 -> NaN Invalid_operation remx707 remainder -Inf Inf -> NaN Invalid_operation remx708 remainder -Inf -Inf -> NaN Invalid_operation remx709 remainder -1000 Inf -> -1000 remx710 remainder -1 -Inf -> -1 remx711 remainder -0 -Inf -> -0 remx712 remainder 0 -Inf -> 0 remx713 remainder 1 -Inf -> 1 remx714 remainder 1000 -Inf -> 1000 remx715 remainder Inf -Inf -> NaN Invalid_operation remx721 remainder NaN -Inf -> NaN remx722 remainder NaN -1000 -> NaN remx723 remainder NaN -1 -> NaN remx724 remainder NaN -0 -> NaN remx725 remainder NaN 0 -> NaN remx726 remainder NaN 1 -> NaN remx727 remainder NaN 1000 -> NaN remx728 remainder NaN Inf -> NaN remx729 remainder NaN NaN -> NaN remx730 remainder -Inf NaN -> NaN remx731 remainder -1000 NaN -> NaN remx732 remainder -1 NaN -> NaN remx733 remainder -0 NaN -> NaN remx734 remainder 0 NaN -> NaN remx735 remainder 1 NaN -> NaN remx736 remainder 1000 NaN -> NaN remx737 remainder Inf NaN -> NaN remx741 remainder sNaN -Inf -> NaN Invalid_operation remx742 remainder sNaN -1000 -> NaN Invalid_operation remx743 remainder sNaN -1 -> NaN Invalid_operation remx744 remainder sNaN -0 -> NaN Invalid_operation remx745 remainder sNaN 0 -> NaN Invalid_operation remx746 remainder sNaN 1 -> NaN Invalid_operation remx747 remainder sNaN 1000 -> NaN Invalid_operation remx749 remainder sNaN NaN -> NaN Invalid_operation remx750 remainder sNaN sNaN -> NaN Invalid_operation remx751 remainder NaN sNaN -> NaN Invalid_operation remx752 remainder -Inf sNaN -> NaN Invalid_operation remx753 remainder -1000 sNaN -> NaN Invalid_operation remx754 remainder -1 sNaN -> NaN Invalid_operation remx755 remainder -0 sNaN -> NaN Invalid_operation remx756 remainder 0 sNaN -> NaN Invalid_operation remx757 remainder 1 sNaN -> NaN Invalid_operation remx758 remainder 1000 sNaN -> NaN Invalid_operation remx759 remainder Inf sNaN -> NaN Invalid_operation remx760 remainder NaN sNaN -> NaN Invalid_operation -- test some cases that are close to exponent overflow maxexponent: 999999999 minexponent: -999999999 remx770 remainder 1 1e999999999 -> 1 remx771 remainder 1 0.9e999999999 -> 1 remx772 remainder 1 0.99e999999999 -> 1 remx773 remainder 1 0.999999999e999999999 -> 1 remx774 remainder 9e999999999 1 -> NaN Division_impossible remx775 remainder 9.9e999999999 1 -> NaN Division_impossible remx776 remainder 9.99e999999999 1 -> NaN Division_impossible remx777 remainder 9.99999999e999999999 1 -> NaN Division_impossible -- long operand checks maxexponent: 999 minexponent: -999 precision: 9 remx801 remainder 12345678000 100 -> 0 remx802 remainder 1 12345678000 -> 1 remx803 remainder 1234567800 10 -> 0 remx804 remainder 1 1234567800 -> 1 remx805 remainder 1234567890 10 -> 0 remx806 remainder 1 1234567890 -> 1 remx807 remainder 1234567891 10 -> 1 remx808 remainder 1 1234567891 -> 1 remx809 remainder 12345678901 100 -> 1 remx810 remainder 1 12345678901 -> 1 remx811 remainder 1234567896 10 -> 6 remx812 remainder 1 1234567896 -> 1 precision: 15 remx821 remainder 12345678000 100 -> 0 remx822 remainder 1 12345678000 -> 1 remx823 remainder 1234567800 10 -> 0 remx824 remainder 1 1234567800 -> 1 remx825 remainder 1234567890 10 -> 0 remx826 remainder 1 1234567890 -> 1 remx827 remainder 1234567891 10 -> 1 remx828 remainder 1 1234567891 -> 1 remx829 remainder 12345678901 100 -> 1 remx830 remainder 1 12345678901 -> 1 remx831 remainder 1234567896 10 -> 6 remx832 remainder 1 1234567896 -> 1 -- worries from divideint precision: 8 dvix660 remainder 100000000.0 1 -> NaN Division_impossible dvix661 remainder 100000000.4 1 -> NaN Division_impossible dvix662 remainder 100000000.5 1 -> NaN Division_impossible dvix663 remainder 100000000.9 1 -> NaN Division_impossible dvix664 remainder 100000000.999 1 -> NaN Division_impossible precision: 6 dvix690 remainder 100000003 5 -> NaN Division_impossible dvix691 remainder 10000003 5 -> NaN Division_impossible dvix692 remainder 1000003 5 -> 3 dvix693 remainder 100003 5 -> 3 dvix694 remainder 10003 5 -> 3 dvix695 remainder 1003 5 -> 3 dvix696 remainder 103 5 -> 3 dvix697 remainder 13 5 -> 3 dvix698 remainder 1 5 -> 1 -- overflow and underflow tests [from divide] precision: 9 maxexponent: 999999999 minexponent: -999999999 remx890 remainder +1.23456789012345E-0 9E+999999999 -> 1.23456789 Inexact Rounded remx891 remainder 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible remx892 remainder +0.100 9E+999999999 -> 0.100 remx893 remainder 9E-999999999 +9.100 -> 9E-999999999 remx895 remainder -1.23456789012345E-0 9E+999999999 -> -1.23456789 Inexact Rounded remx896 remainder 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible remx897 remainder -0.100 9E+999999999 -> -0.100 remx898 remainder 9E-999999999 -9.100 -> 9E-999999999 -- Null tests rem900 remainder 10 # -> NaN Invalid_operation rem901 remainder # 10 -> NaN Invalid_operation --- NEW FILE: randoms.decTest --- ------------------------------------------------------------------------ -- randoms.decTest -- decimal random testcases -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ [...3990 lines suppressed...] xmul498 multiply -7.27403536 -481469656E-835183700 -> 3.50222730E-835183691 Inexact Rounded xpow498 power -7.27403536 -5 -> -0.0000491046885 Inexact Rounded xrem498 remainder -7.27403536 -481469656E-835183700 -> NaN Division_impossible xsub498 subtract -7.27403536 -481469656E-835183700 -> -7.27403536 Inexact Rounded xadd499 add -6157.74292 -94075286.2E+92555877 -> -9.40752862E+92555884 Inexact Rounded xcom499 compare -6157.74292 -94075286.2E+92555877 -> 1 xdiv499 divide -6157.74292 -94075286.2E+92555877 -> 6.54554790E-92555882 Inexact Rounded xdvi499 divideint -6157.74292 -94075286.2E+92555877 -> 0 xmul499 multiply -6157.74292 -94075286.2E+92555877 -> 5.79291428E+92555888 Inexact Rounded xpow499 power -6157.74292 -9 -> -7.85608218E-35 Inexact Rounded xrem499 remainder -6157.74292 -94075286.2E+92555877 -> -6157.74292 xsub499 subtract -6157.74292 -94075286.2E+92555877 -> 9.40752862E+92555884 Inexact Rounded xadd500 add -525445087.E+231529167 188227460 -> -5.25445087E+231529175 Inexact Rounded xcom500 compare -525445087.E+231529167 188227460 -> -1 xdiv500 divide -525445087.E+231529167 188227460 -> -2.79154321E+231529167 Inexact Rounded xdvi500 divideint -525445087.E+231529167 188227460 -> NaN Division_impossible xmul500 multiply -525445087.E+231529167 188227460 -> -9.89031941E+231529183 Inexact Rounded xpow500 power -525445087.E+231529167 188227460 -> Infinity Overflow Inexact Rounded xrem500 remainder -525445087.E+231529167 188227460 -> NaN Division_impossible xsub500 subtract -525445087.E+231529167 188227460 -> -5.25445087E+231529175 Inexact Rounded --- NEW FILE: randomBound32.decTest --- ------------------------------------------------------------------------ -- randomBound32.decTest -- decimal testcases -- boundaries near 32 -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ [...2404 lines suppressed...] mulx3498 multiply 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> -6.16714847260980448099292763939423E-733 Inexact Rounded powx3498 power 91936087917435.5974889495278215874 -7 -> 1.80134899939035708719659065082630E-98 Inexact Rounded remx3498 remainder 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> NaN Division_impossible subx3498 subtract 91936087917435.5974889495278215874 -67080823344.8903392584327136082486E-757 -> 91936087917435.5974889495278215874 Inexact Rounded addx3499 add -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -7.34564225185285561365214172598110E-597 Inexact Rounded comx3499 compare -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -1 divx3499 divide -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -1.78342822299163842247184303878022E+159 Inexact Rounded dvix3499 divideint -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> NaN Division_impossible mulx3499 multiply -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -3.02554705575380338274126867655676E-1352 Inexact Rounded powx3499 power -07345.6422518528556136521417259811E-600 4 -> 2.91151541552217582082937236255996E-2385 Inexact Rounded remx3499 remainder -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> NaN Division_impossible subx3499 subtract -07345.6422518528556136521417259811E-600 41188325.7041362608934957584583381E-763 -> -7.34564225185285561365214172598110E-597 Inexact Rounded addx3500 add -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> 6.16988426425908872398170896375634E+401 Inexact Rounded comx3500 compare -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -1 divx3500 divide -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -4.10511306357337753351655511866170E-394 Inexact Rounded dvix3500 divideint -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -0 mulx3500 multiply -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -1.56271275924409657991913620522315E+410 Inexact Rounded powx3500 power -253280724.939458021588167965038184 6 -> 2.64005420221406808782284459794424E+50 Inexact Rounded remx3500 remainder -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -253280724.939458021588167965038184 subx3500 subtract -253280724.939458021588167965038184 616988.426425908872398170896375634E+396 -> -6.16988426425908872398170896375634E+401 Inexact Rounded --- NEW FILE: power.decTest --- ---------------------------------------------------------------------- -- power.decTest -- decimal exponentiation -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of testcases tests raising numbers to an integer power only. -- If arbitrary powers were supported, 1 ulp differences would be -- permitted. extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- base checks. Note 0**0 is an error. powx001 power '0' '0' -> NaN Invalid_operation powx002 power '0' '1' -> '0' powx003 power '0' '2' -> '0' powx004 power '1' '0' -> '1' powx005 power '1' '1' -> '1' powx006 power '1' '2' -> '1' powx010 power '2' '0' -> '1' powx011 power '2' '1' -> '2' powx012 power '2' '2' -> '4' powx013 power '2' '3' -> '8' powx014 power '2' '4' -> '16' powx015 power '2' '5' -> '32' powx016 power '2' '6' -> '64' powx017 power '2' '7' -> '128' powx018 power '2' '8' -> '256' powx019 power '2' '9' -> '512' powx020 power '2' '10' -> '1024' powx021 power '2' '11' -> '2048' powx022 power '2' '12' -> '4096' powx023 power '2' '15' -> '32768' powx024 power '2' '16' -> '65536' powx025 power '2' '31' -> '2.14748365E+9' Inexact Rounded -- NB 0 not stripped in next powx026 power '2' '32' -> '4.29496730E+9' Inexact Rounded precision: 10 powx027 power '2' '31' -> '2147483648' powx028 power '2' '32' -> '4294967296' precision: 9 powx030 power '3' '2' -> 9 powx031 power '4' '2' -> 16 powx032 power '5' '2' -> 25 powx033 power '6' '2' -> 36 powx034 power '7' '2' -> 49 powx035 power '8' '2' -> 64 powx036 power '9' '2' -> 81 powx037 power '10' '2' -> 100 powx038 power '11' '2' -> 121 powx039 power '12' '2' -> 144 powx040 power '3' '3' -> 27 powx041 power '4' '3' -> 64 powx042 power '5' '3' -> 125 powx043 power '6' '3' -> 216 powx044 power '7' '3' -> 343 powx050 power '10' '0' -> 1 powx051 power '10' '1' -> 10 powx052 power '10' '2' -> 100 powx053 power '10' '3' -> 1000 powx054 power '10' '4' -> 10000 powx055 power '10' '5' -> 100000 powx056 power '10' '6' -> 1000000 powx057 power '10' '7' -> 10000000 powx058 power '10' '8' -> 100000000 powx059 power '10' '9' -> 1.00000000E+9 Rounded powx060 power '10' '22' -> 1.00000000E+22 Rounded powx061 power '10' '77' -> 1.00000000E+77 Rounded powx062 power '10' '99' -> 1.00000000E+99 Rounded maxexponent: 999999999 minexponent: -999999999 powx063 power '10' '999999999' -> '1.00000000E+999999999' Rounded powx064 power '10' '999999998' -> '1.00000000E+999999998' Rounded powx065 power '10' '999999997' -> '1.00000000E+999999997' Rounded powx066 power '10' '333333333' -> '1.00000000E+333333333' Rounded powx070 power '0.3' '0' -> '1' powx071 power '0.3' '1' -> '0.3' powx072 power '0.3' '1.00' -> '0.3' powx073 power '0.3' '2.00' -> '0.09' powx074 power '0.3' '2.000000000' -> '0.09' powx075 power '6.0' '1' -> '6.0' -- NB zeros not stripped powx076 power '6.0' '2' -> '36.00' -- .. powx077 power '-3' '2' -> '9' -- from NetRexx book powx078 power '4' '3' -> '64' -- .. (sort of) powx080 power 0.1 0 -> 1 powx081 power 0.1 1 -> 0.1 powx082 power 0.1 2 -> 0.01 powx083 power 0.1 3 -> 0.001 powx084 power 0.1 4 -> 0.0001 powx085 power 0.1 5 -> 0.00001 powx086 power 0.1 6 -> 0.000001 powx087 power 0.1 7 -> 1E-7 powx088 power 0.1 8 -> 1E-8 powx089 power 0.1 9 -> 1E-9 powx090 power 101 2 -> 10201 powx091 power 101 3 -> 1030301 powx092 power 101 4 -> 104060401 powx093 power 101 5 -> 1.05101005E+10 Inexact Rounded powx094 power 101 6 -> 1.06152015E+12 Inexact Rounded powx095 power 101 7 -> 1.07213535E+14 Inexact Rounded -- negative powers powx101 power '2' '-1' -> 0.5 powx102 power '2' '-2' -> 0.25 powx103 power '2' '-4' -> 0.0625 powx104 power '2' '-8' -> 0.00390625 powx105 power '2' '-16' -> 0.0000152587891 Inexact Rounded powx106 power '2' '-32' -> 2.32830644E-10 Inexact Rounded powx108 power '2' '-64' -> 5.42101086E-20 Inexact Rounded powx110 power '10' '-8' -> 1E-8 powx111 power '10' '-7' -> 1E-7 powx112 power '10' '-6' -> 0.000001 powx113 power '10' '-5' -> 0.00001 powx114 power '10' '-4' -> 0.0001 powx115 power '10' '-3' -> 0.001 powx116 power '10' '-2' -> 0.01 powx117 power '10' '-1' -> 0.1 powx118 power '10' '-333333333' -> 1E-333333333 powx119 power '10' '-999999998' -> 1E-999999998 powx120 power '10' '-999999999' -> 1E-999999999 powx121 power '10' '-77' -> '1E-77' powx122 power '10' '-22' -> '1E-22' powx123 power '2' '-1' -> '0.5' powx124 power '2' '-2' -> '0.25' powx125 power '2' '-4' -> '0.0625' powx126 power '0' '-1' -> Infinity Division_by_zero powx127 power '0' '-2' -> Infinity Division_by_zero powx128 power -0 '-1' -> -Infinity Division_by_zero powx129 power -0 '-2' -> Infinity Division_by_zero -- out-of-range edge cases powx181 power '7' '999999998' -> 2.10892313E+845098038 Inexact Rounded powx182 power '7' '999999999' -> 1.47624619E+845098039 Inexact Rounded powx183 power '7' '1000000000' -> NaN Invalid_operation powx184 power '7' '1000000001' -> NaN Invalid_operation powx185 power '7' '10000000000' -> NaN Invalid_operation powx186 power '7' '-1000000001' -> NaN Invalid_operation powx187 power '7' '-1000000000' -> NaN Invalid_operation powx189 power '7' '-999999999' -> 6.77393787E-845098040 Inexact Rounded powx190 power '7' '-999999998' -> 4.74175651E-845098039 Inexact Rounded -- some baddies [more below] powx191 power '2' '2.000001' -> NaN Invalid_operation powx192 power '2' '2.00000000' -> 4 powx193 power '2' '2.000000001' -> NaN Invalid_operation powx194 power '2' '2.0000000001' -> NaN Invalid_operation -- "0.5" tests from original Rexx diagnostics [loop unrolled] powx200 power 0.5 0 -> 1 powx201 power 0.5 1 -> 0.5 powx202 power 0.5 2 -> 0.25 powx203 power 0.5 3 -> 0.125 powx204 power 0.5 4 -> 0.0625 powx205 power 0.5 5 -> 0.03125 powx206 power 0.5 6 -> 0.015625 powx207 power 0.5 7 -> 0.0078125 powx208 power 0.5 8 -> 0.00390625 powx209 power 0.5 9 -> 0.001953125 powx210 power 0.5 10 -> 0.0009765625 -- A (rare) case where the last digit is not within 0.5 ULP precision: 9 powx215 power "-21971575.0E+31454441" "-7" -> "-4.04549503E-220181139" Inexact Rounded precision: 20 powx216 power "-21971575.0E+31454441" "-7" -> "-4.0454950249324891788E-220181139" Inexact Rounded -- The Vienna case. Checks both setup and 1/acc working precision -- Modified 1998.12.14 as RHS no longer rounded before use (must fit) -- Modified 1990.02.04 as LHS is now rounded (instead of truncated to guard) -- '123456789E+10' -- lhs .. rounded to 1.23E+18 -- '-1.23000e+2' -- rhs .. [was: -1.23455e+2, rounds to -123] -- Modified 2002.10.06 -- finally, no input rounding -- With input rounding, result would be 8.74E-2226 precision: 3 powx219 power '123456789E+10' '-1.23000e+2' -> '5.54E-2226' Inexact Rounded -- whole number checks precision: 9 powx221 power 1 1234 -> 1 precision: 4 powx222 power 1 1234 -> 1 precision: 3 powx223 power 1 1234 -> 1 powx224 power 1 12.34e+2 -> 1 powx225 power 1 12.3 -> NaN Invalid_operation powx226 power 1 12.0 -> 1 powx227 power 1 1.01 -> NaN Invalid_operation powx228 power 2 1.00 -> 2 powx229 power 2 2.00 -> 4 precision: 9 powx230 power 1 1.0001 -> NaN Invalid_operation powx231 power 1 1.0000001 -> NaN Invalid_operation powx232 power 1 1.0000000001 -> NaN Invalid_operation powx233 power 1 1.0000000000001 -> NaN Invalid_operation precision: 5 powx234 power 1 1.0001 -> NaN Invalid_operation powx235 power 1 1.0000001 -> NaN Invalid_operation powx236 power 1 1.0000000001 -> NaN Invalid_operation powx237 power 1 1.0000000000001 -> NaN Invalid_operation powx238 power 1 1.0000000000001 -> NaN Invalid_operation maxexponent: 999999999 minexponent: -999999999 powx239 power 1 5.67E-987654321 -> NaN Invalid_operation powx240 power 1 100000000 -> 1 powx241 power 1 999999998 -> 1 powx242 power 1 999999999 -> 1 powx243 power 1 1000000000 -> NaN Invalid_operation powx244 power 1 9999999999 -> NaN Invalid_operation -- Checks for 'Too much precision needed' -- For x^12, digits+elength+1 = digits+3 precision: 999999999 powx249 add 1 1 -> 2 -- check basic operation at this precision powx250 power 2 12 -> Infinity Overflow precision: 999999998 powx251 power 2 12 -> Infinity Overflow precision: 999999997 powx252 power 2 12 -> Infinity Overflow precision: 999999996 powx253 power 2 12 -> 4096 precision: 999999995 powx254 power 2 12 -> 4096 -- overflow and underflow tests maxexponent: 999999999 minexponent: -999999999 precision: 9 powx280 power 9 999999999 -> 3.05550054E+954242508 Inexact Rounded powx281 power 10 999999999 -> 1.00000000E+999999999 Rounded powx282 power 10.0001 999999999 -> Infinity Overflow Inexact Rounded powx283 power 10.1 999999999 -> Infinity Overflow Inexact Rounded powx284 power 11 999999999 -> Infinity Overflow Inexact Rounded powx285 power 12 999999999 -> Infinity Overflow Inexact Rounded powx286 power 999 999999999 -> Infinity Overflow Inexact Rounded powx287 power 999999 999999999 -> Infinity Overflow Inexact Rounded powx288 power 999999999 999999999 -> Infinity Overflow Inexact Rounded powx289 power 9.9E999999999 999999999 -> Infinity Overflow Inexact Rounded powx290 power 0.5 999999999 -> 4.33559594E-301029996 Inexact Rounded powx291 power 0.1 999999999 -> 1E-999999999 -- unrounded powx292 power 0.09 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx293 power 0.05 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx294 power 0.01 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx295 power 0.0001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx297 power 0.0000001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx298 power 0.0000000001 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx299 power 1E-999999999 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx310 power -9 999999999 -> -3.05550054E+954242508 Inexact Rounded powx311 power -10 999999999 -> -1.00000000E+999999999 Rounded powx312 power -10.0001 999999999 -> -Infinity Overflow Inexact Rounded powx313 power -10.1 999999999 -> -Infinity Overflow Inexact Rounded powx314 power -11 999999999 -> -Infinity Overflow Inexact Rounded powx315 power -12 999999999 -> -Infinity Overflow Inexact Rounded powx316 power -999 999999999 -> -Infinity Overflow Inexact Rounded powx317 power -999999 999999999 -> -Infinity Overflow Inexact Rounded powx318 power -999999999 999999999 -> -Infinity Overflow Inexact Rounded powx319 power -9.9E999999999 999999999 -> -Infinity Overflow Inexact Rounded powx320 power -0.5 999999999 -> -4.33559594E-301029996 Inexact Rounded powx321 power -0.1 999999999 -> -1E-999999999 powx322 power -0.09 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx323 power -0.05 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx324 power -0.01 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx325 power -0.0001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx327 power -0.0000001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx328 power -0.0000000001 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx329 power -1E-999999999 999999999 -> -0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -- note no trim of next result powx330 power -9 999999998 -> 3.39500060E+954242507 Inexact Rounded powx331 power -10 999999998 -> 1.00000000E+999999998 Rounded powx332 power -10.0001 999999998 -> Infinity Overflow Inexact Rounded powx333 power -10.1 999999998 -> Infinity Overflow Inexact Rounded powx334 power -11 999999998 -> Infinity Overflow Inexact Rounded powx335 power -12 999999998 -> Infinity Overflow Inexact Rounded powx336 power -999 999999998 -> Infinity Overflow Inexact Rounded powx337 power -999999 999999998 -> Infinity Overflow Inexact Rounded powx338 power -999999999 999999998 -> Infinity Overflow Inexact Rounded powx339 power -9.9E999999999 999999998 -> Infinity Overflow Inexact Rounded powx340 power -0.5 999999998 -> 8.67119187E-301029996 Inexact Rounded powx341 power -0.1 999999998 -> 1E-999999998 -- NB exact unrounded powx342 power -0.09 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx343 power -0.05 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx344 power -0.01 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx345 power -0.0001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx347 power -0.0000001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx348 power -0.0000000001 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx349 power -1E-999999999 999999998 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -- some subnormals precision: 9 -- [precision is 9, so smallest exponent is -1000000007 powx350 power 1e-1 500000000 -> 1E-500000000 powx351 power 1e-2 999999999 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped powx352 power 1e-2 500000000 -> 1E-1000000000 Subnormal powx353 power 1e-2 500000001 -> 1E-1000000002 Subnormal powx354 power 1e-2 500000002 -> 1E-1000000004 Subnormal powx355 power 1e-2 500000003 -> 1E-1000000006 Subnormal powx356 power 1e-2 500000004 -> 0E-1000000007 Underflow Subnormal Inexact Rounded powx360 power 0.010001 500000000 -> 4.34941988E-999978287 Inexact Rounded powx361 power 0.010000001 500000000 -> 5.18469257E-999999979 Inexact Rounded powx362 power 0.010000001 500000001 -> 5.18469309E-999999981 Inexact Rounded powx363 power 0.0100000009 500000000 -> 3.49342003E-999999981 Inexact Rounded powx364 power 0.0100000001 500000000 -> 1.48413155E-999999998 Inexact Rounded powx365 power 0.01 500000000 -> 1E-1000000000 Subnormal powx366 power 0.0099999999 500000000 -> 6.7379E-1000000003 Underflow Subnormal Inexact Rounded powx367 power 0.0099999998 500000000 -> 4.54E-1000000005 Underflow Subnormal Inexact Rounded powx368 power 0.0099999997 500000000 -> 3E-1000000007 Underflow Subnormal Inexact Rounded powx369 power 0.0099999996 500000000 -> 0E-1000000007 Underflow Subnormal Inexact Rounded powx370 power 0.009 500000000 -> 0E-1000000007 Underflow Subnormal Inexact Rounded Clamped -- 1/subnormal -> overflow powx371 power 1e-1 -500000000 -> 1E+500000000 powx372 power 1e-2 -999999999 -> Infinity Overflow Inexact Rounded powx373 power 1e-2 -500000000 -> Infinity Overflow Inexact Rounded powx374 power 1e-2 -500000001 -> Infinity Overflow Inexact Rounded powx375 power 1e-2 -500000002 -> Infinity Overflow Inexact Rounded powx376 power 1e-2 -500000003 -> Infinity Overflow Inexact Rounded powx377 power 1e-2 -500000004 -> Infinity Overflow Inexact Rounded powx381 power 0.010001 -500000000 -> 2.29915719E+999978286 Inexact Rounded powx382 power 0.010000001 -500000000 -> 1.92875467E+999999978 Inexact Rounded powx383 power 0.010000001 -500000001 -> 1.92875448E+999999980 Inexact Rounded powx384 power 0.0100000009 -500000000 -> 2.86252438E+999999980 Inexact Rounded powx385 power 0.0100000001 -500000000 -> 6.73794717E+999999997 Inexact Rounded powx386 power 0.01 -500000000 -> Infinity Overflow Inexact Rounded powx387 power 0.009999 -500000000 -> Infinity Overflow Inexact Rounded -- negative power giving subnormal powx388 power 100.000001 -500000000 -> 6.7379E-1000000003 Underflow Subnormal Inexact Rounded -- some more edge cases precision: 15 maxExponent: 999 minexponent: -999 powx391 power 0.1 999 -> 1E-999 powx392 power 0.099 999 -> 4.360732062E-1004 Underflow Subnormal Inexact Rounded powx393 power 0.098 999 -> 1.71731E-1008 Underflow Subnormal Inexact Rounded powx394 power 0.097 999 -> 6E-1013 Underflow Subnormal Inexact Rounded powx395 power 0.096 999 -> 0E-1013 Underflow Subnormal Inexact Rounded powx396 power 0.01 999 -> 0E-1013 Underflow Subnormal Inexact Rounded Clamped -- multiply tests are here to aid checking and test for consistent handling -- of underflow precision: 5 maxexponent: 999 minexponent: -999 -- squares mulx400 multiply 1E-502 1e-502 -> 0E-1003 Subnormal Inexact Underflow Rounded mulx401 multiply 1E-501 1e-501 -> 1E-1002 Subnormal mulx402 multiply 2E-501 2e-501 -> 4E-1002 Subnormal mulx403 multiply 4E-501 4e-501 -> 1.6E-1001 Subnormal mulx404 multiply 10E-501 10e-501 -> 1.00E-1000 Subnormal mulx405 multiply 30E-501 30e-501 -> 9.00E-1000 Subnormal mulx406 multiply 40E-501 40e-501 -> 1.600E-999 powx400 power 1E-502 2 -> 0E-1003 Underflow Subnormal Inexact Rounded powx401 power 1E-501 2 -> 1E-1002 Subnormal powx402 power 2E-501 2 -> 4E-1002 Subnormal powx403 power 4E-501 2 -> 1.6E-1001 Subnormal powx404 power 10E-501 2 -> 1.00E-1000 Subnormal powx405 power 30E-501 2 -> 9.00E-1000 Subnormal powx406 power 40E-501 2 -> 1.600E-999 -- cubes mulx410 multiply 1E-670 1e-335 -> 0E-1003 Underflow Subnormal Inexact Rounded mulx411 multiply 1E-668 1e-334 -> 1E-1002 Subnormal mulx412 multiply 4E-668 2e-334 -> 8E-1002 Subnormal mulx413 multiply 9E-668 3e-334 -> 2.7E-1001 Subnormal mulx414 multiply 16E-668 4e-334 -> 6.4E-1001 Subnormal mulx415 multiply 25E-668 5e-334 -> 1.25E-1000 Subnormal mulx416 multiply 10E-668 100e-334 -> 1.000E-999 powx410 power 1E-335 3 -> 0E-1003 Underflow Subnormal Inexact Rounded powx411 power 1E-334 3 -> 1E-1002 Subnormal powx412 power 2E-334 3 -> 8E-1002 Subnormal powx413 power 3E-334 3 -> 2.7E-1001 Subnormal powx414 power 4E-334 3 -> 6.4E-1001 Subnormal powx415 power 5E-334 3 -> 1.25E-1000 Subnormal powx416 power 10E-334 3 -> 1.000E-999 -- negative powers, testing subnormals precision: 5 maxExponent: 999 minexponent: -999 powx421 power 2.5E-501 -2 -> Infinity Overflow Inexact Rounded powx422 power 2.5E-500 -2 -> 1.6E+999 powx423 power 2.5E+499 -2 -> 1.6E-999 powx424 power 2.5E+500 -2 -> 1.6E-1001 Subnormal powx425 power 2.5E+501 -2 -> 2E-1003 Underflow Subnormal Inexact Rounded powx426 power 2.5E+502 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded powx427 power 0.25E+499 -2 -> 1.6E-997 powx428 power 0.25E+500 -2 -> 1.6E-999 powx429 power 0.25E+501 -2 -> 1.6E-1001 Subnormal powx430 power 0.25E+502 -2 -> 2E-1003 Underflow Subnormal Inexact Rounded powx431 power 0.25E+503 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded powx432 power 0.04E+499 -2 -> 6.25E-996 powx433 power 0.04E+500 -2 -> 6.25E-998 powx434 power 0.04E+501 -2 -> 6.25E-1000 Subnormal powx435 power 0.04E+502 -2 -> 6.3E-1002 Underflow Subnormal Inexact Rounded powx436 power 0.04E+503 -2 -> 1E-1003 Underflow Subnormal Inexact Rounded powx437 power 0.04E+504 -2 -> 0E-1003 Underflow Subnormal Inexact Rounded powx441 power 0.04E+334 -3 -> 1.5625E-998 powx442 power 0.04E+335 -3 -> 1.56E-1001 Underflow Subnormal Inexact Rounded powx443 power 0.04E+336 -3 -> 0E-1003 Underflow Subnormal Inexact Rounded powx444 power 0.25E+333 -3 -> 6.4E-998 powx445 power 0.25E+334 -3 -> 6.4E-1001 Subnormal powx446 power 0.25E+335 -3 -> 1E-1003 Underflow Subnormal Inexact Rounded powx447 power 0.25E+336 -3 -> 0E-1003 Underflow Subnormal Inexact Rounded Clamped -- check sign for cubes and a few squares powx448 power -0.04E+334 -3 -> -1.5625E-998 powx449 power -0.04E+335 -3 -> -1.56E-1001 Underflow Subnormal Inexact Rounded powx450 power -0.04E+336 -3 -> -0E-1003 Underflow Subnormal Inexact Rounded powx451 power -0.25E+333 -3 -> -6.4E-998 powx452 power -0.25E+334 -3 -> -6.4E-1001 Subnormal powx453 power -0.25E+335 -3 -> -1E-1003 Underflow Subnormal Inexact Rounded powx454 power -0.25E+336 -3 -> -0E-1003 Underflow Subnormal Inexact Rounded Clamped powx455 power -0.04E+499 -2 -> 6.25E-996 powx456 power -0.04E+500 -2 -> 6.25E-998 powx457 power -0.04E+501 -2 -> 6.25E-1000 Subnormal powx458 power -0.04E+502 -2 -> 6.3E-1002 Underflow Subnormal Inexact Rounded -- test -0s precision: 9 powx560 power 0 0 -> NaN Invalid_operation powx561 power 0 -0 -> NaN Invalid_operation powx562 power -0 0 -> NaN Invalid_operation powx563 power -0 -0 -> NaN Invalid_operation powx564 power 1 0 -> 1 powx565 power 1 -0 -> 1 powx566 power -1 0 -> 1 powx567 power -1 -0 -> 1 powx568 power 0 1 -> 0 powx569 power 0 -1 -> Infinity Division_by_zero powx570 power -0 1 -> -0 powx571 power -0 -1 -> -Infinity Division_by_zero powx572 power 0 2 -> 0 powx573 power 0 -2 -> Infinity Division_by_zero powx574 power -0 2 -> 0 powx575 power -0 -2 -> Infinity Division_by_zero powx576 power 0 3 -> 0 powx577 power 0 -3 -> Infinity Division_by_zero powx578 power -0 3 -> -0 powx579 power -0 -3 -> -Infinity Division_by_zero -- Specials powx580 power Inf -Inf -> NaN Invalid_operation powx581 power Inf -1000 -> 0 powx582 power Inf -1 -> 0 powx583 power Inf -0 -> 1 powx584 power Inf 0 -> 1 powx585 power Inf 1 -> Infinity powx586 power Inf 1000 -> Infinity powx587 power Inf Inf -> NaN Invalid_operation powx588 power -1000 Inf -> NaN Invalid_operation powx589 power -Inf Inf -> NaN Invalid_operation powx590 power -1 Inf -> NaN Invalid_operation powx591 power -0 Inf -> NaN Invalid_operation powx592 power 0 Inf -> NaN Invalid_operation powx593 power 1 Inf -> NaN Invalid_operation powx594 power 1000 Inf -> NaN Invalid_operation powx595 power Inf Inf -> NaN Invalid_operation powx600 power -Inf -Inf -> NaN Invalid_operation powx601 power -Inf -1000 -> 0 powx602 power -Inf -1 -> -0 powx603 power -Inf -0 -> 1 powx604 power -Inf 0 -> 1 powx605 power -Inf 1 -> -Infinity powx606 power -Inf 1000 -> Infinity powx607 power -Inf Inf -> NaN Invalid_operation powx608 power -1000 Inf -> NaN Invalid_operation powx609 power -Inf -Inf -> NaN Invalid_operation powx610 power -1 -Inf -> NaN Invalid_operation powx611 power -0 -Inf -> NaN Invalid_operation powx612 power 0 -Inf -> NaN Invalid_operation powx613 power 1 -Inf -> NaN Invalid_operation powx614 power 1000 -Inf -> NaN Invalid_operation powx615 power Inf -Inf -> NaN Invalid_operation powx621 power NaN -Inf -> NaN Invalid_operation powx622 power NaN -1000 -> NaN powx623 power NaN -1 -> NaN powx624 power NaN -0 -> NaN powx625 power NaN 0 -> NaN powx626 power NaN 1 -> NaN powx627 power NaN 1000 -> NaN powx628 power NaN Inf -> NaN Invalid_operation powx629 power NaN NaN -> NaN powx630 power -Inf NaN -> NaN powx631 power -1000 NaN -> NaN powx632 power -1 NaN -> NaN powx633 power -0 NaN -> NaN powx634 power 0 NaN -> NaN powx635 power 1 NaN -> NaN powx636 power 1000 NaN -> NaN powx637 power Inf NaN -> NaN powx641 power sNaN -Inf -> NaN Invalid_operation powx642 power sNaN -1000 -> NaN Invalid_operation powx643 power sNaN -1 -> NaN Invalid_operation powx644 power sNaN -0 -> NaN Invalid_operation powx645 power sNaN 0 -> NaN Invalid_operation powx646 power sNaN 1 -> NaN Invalid_operation powx647 power sNaN 1000 -> NaN Invalid_operation powx648 power sNaN NaN -> NaN Invalid_operation powx649 power sNaN sNaN -> NaN Invalid_operation powx650 power NaN sNaN -> NaN Invalid_operation powx651 power -Inf sNaN -> NaN Invalid_operation powx652 power -1000 sNaN -> NaN Invalid_operation powx653 power -1 sNaN -> NaN Invalid_operation powx654 power -0 sNaN -> NaN Invalid_operation powx655 power 0 sNaN -> NaN Invalid_operation powx656 power 1 sNaN -> NaN Invalid_operation powx657 power 1000 sNaN -> NaN Invalid_operation powx658 power Inf sNaN -> NaN Invalid_operation powx659 power NaN sNaN -> NaN Invalid_operation -- Examples from extended specification powx660 power Inf -2 -> 0 powx661 power Inf -1 -> 0 powx662 power Inf 0 -> 1 powx663 power Inf 1 -> Infinity powx664 power Inf 2 -> Infinity powx665 power -Inf -2 -> 0 powx666 power -Inf -1 -> -0 powx667 power -Inf 0 -> 1 powx668 power -Inf 1 -> -Infinity powx669 power -Inf 2 -> Infinity powx670 power 0 0 -> NaN Invalid_operation -- long operand and RHS range checks maxexponent: 999 minexponent: -999 precision: 9 powx701 power 12345678000 1 -> 1.23456780E+10 Rounded powx702 power 1234567800 1 -> 1.23456780E+9 Rounded powx703 power 1234567890 1 -> 1.23456789E+9 Rounded powx704 power 1234567891 1 -> 1.23456789E+9 Inexact Rounded powx705 power 12345678901 1 -> 1.23456789E+10 Inexact Rounded powx706 power 1234567896 1 -> 1.23456790E+9 Inexact Rounded powx707 power 1 12345678000 -> NaN Invalid_operation powx708 power 1 1234567800 -> NaN Invalid_operation powx709 power 1 1234567890 -> NaN Invalid_operation powx710 power 1 11234567891 -> NaN Invalid_operation powx711 power 1 12345678901 -> NaN Invalid_operation powx712 power 1 1234567896 -> NaN Invalid_operation powx713 power 1 -1234567896 -> NaN Invalid_operation powx714 power 1 1000000000 -> NaN Invalid_operation powx715 power 1 -1000000000 -> NaN Invalid_operation precision: 15 -- still checking powx741 power 12345678000 1 -> 12345678000 powx742 power 1234567800 1 -> 1234567800 powx743 power 1234567890 1 -> 1234567890 powx744 power 1234567891 1 -> 1234567891 powx745 power 12345678901 1 -> 12345678901 powx746 power 1234567896 1 -> 1234567896 powx747 power 1 12345678000 -> NaN Invalid_operation powx748 power 1 -1234567896 -> NaN Invalid_operation powx749 power 1 1000000000 -> NaN Invalid_operation powx740 power 1 -1000000000 -> NaN Invalid_operation -- check for double-rounded subnormals precision: 5 maxexponent: 79 minexponent: -79 powx750 power 1.2347E-40 2 -> 1.524E-80 Inexact Rounded Subnormal Underflow -- Null tests powx900 power 1 # -> NaN Invalid_operation powx901 power # 1 -> NaN Invalid_operation --- NEW FILE: plus.decTest --- ------------------------------------------------------------------------ -- plus.decTest -- decimal monadic addition -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of tests primarily tests the existence of the operator. -- Addition and rounding, and most overflows, are tested elsewhere. extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 plux001 plus '1' -> '1' plux002 plus '-1' -> '-1' plux003 plus '1.00' -> '1.00' plux004 plus '-1.00' -> '-1.00' plux005 plus '0' -> '0' plux006 plus '0.00' -> '0.00' plux007 plus '00.0' -> '0.0' plux008 plus '00.00' -> '0.00' plux009 plus '00' -> '0' plux010 plus '-2' -> '-2' plux011 plus '2' -> '2' plux012 plus '-2.00' -> '-2.00' plux013 plus '2.00' -> '2.00' plux014 plus '-0' -> '0' plux015 plus '-0.00' -> '0.00' plux016 plus '-00.0' -> '0.0' plux017 plus '-00.00' -> '0.00' plux018 plus '-00' -> '0' plux020 plus '-2000000' -> '-2000000' plux021 plus '2000000' -> '2000000' precision: 7 plux022 plus '-2000000' -> '-2000000' plux023 plus '2000000' -> '2000000' precision: 6 plux024 plus '-2000000' -> '-2.00000E+6' Rounded plux025 plus '2000000' -> '2.00000E+6' Rounded precision: 3 plux026 plus '-2000000' -> '-2.00E+6' Rounded plux027 plus '2000000' -> '2.00E+6' Rounded -- more fixed, potential LHS swaps if done by add 0 precision: 9 plux060 plus '56267E-10' -> '0.0000056267' plux061 plus '56267E-5' -> '0.56267' plux062 plus '56267E-2' -> '562.67' plux063 plus '56267E-1' -> '5626.7' plux065 plus '56267E-0' -> '56267' plux066 plus '56267E+0' -> '56267' plux067 plus '56267E+1' -> '5.6267E+5' plux068 plus '56267E+2' -> '5.6267E+6' plux069 plus '56267E+3' -> '5.6267E+7' plux070 plus '56267E+4' -> '5.6267E+8' plux071 plus '56267E+5' -> '5.6267E+9' plux072 plus '56267E+6' -> '5.6267E+10' plux080 plus '-56267E-10' -> '-0.0000056267' plux081 plus '-56267E-5' -> '-0.56267' plux082 plus '-56267E-2' -> '-562.67' plux083 plus '-56267E-1' -> '-5626.7' plux085 plus '-56267E-0' -> '-56267' plux086 plus '-56267E+0' -> '-56267' plux087 plus '-56267E+1' -> '-5.6267E+5' plux088 plus '-56267E+2' -> '-5.6267E+6' plux089 plus '-56267E+3' -> '-5.6267E+7' plux090 plus '-56267E+4' -> '-5.6267E+8' plux091 plus '-56267E+5' -> '-5.6267E+9' plux092 plus '-56267E+6' -> '-5.6267E+10' -- "lhs" zeros in plus and minus have exponent = operand plux120 plus '-0E3' -> '0E+3' plux121 plus '-0E2' -> '0E+2' plux122 plus '-0E1' -> '0E+1' plux123 plus '-0E0' -> '0' plux124 plus '+0E0' -> '0' plux125 plus '+0E1' -> '0E+1' plux126 plus '+0E2' -> '0E+2' plux127 plus '+0E3' -> '0E+3' plux130 plus '-5E3' -> '-5E+3' plux131 plus '-5E8' -> '-5E+8' plux132 plus '-5E13' -> '-5E+13' plux133 plus '-5E18' -> '-5E+18' plux134 plus '+5E3' -> '5E+3' plux135 plus '+5E8' -> '5E+8' plux136 plus '+5E13' -> '5E+13' plux137 plus '+5E18' -> '5E+18' -- specials plux150 plus 'Inf' -> 'Infinity' plux151 plus '-Inf' -> '-Infinity' plux152 plus NaN -> NaN plux153 plus sNaN -> NaN Invalid_operation -- overflow tests maxexponent: 999999999 minexponent: -999999999 precision: 3 plux160 plus 9.999E+999999999 -> Infinity Inexact Overflow Rounded plux161 plus -9.999E+999999999 -> -Infinity Inexact Overflow Rounded -- subnormals and underflow precision: 3 maxexponent: 999 minexponent: -999 plux210 plus 1.00E-999 -> 1.00E-999 plux211 plus 0.1E-999 -> 1E-1000 Subnormal plux212 plus 0.10E-999 -> 1.0E-1000 Subnormal plux213 plus 0.100E-999 -> 1.0E-1000 Subnormal Rounded plux214 plus 0.01E-999 -> 1E-1001 Subnormal -- next is rounded to Emin plux215 plus 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow plux216 plus 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow plux217 plus 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow plux218 plus 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow plux219 plus 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow plux220 plus 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow plux230 plus -1.00E-999 -> -1.00E-999 plux231 plus -0.1E-999 -> -1E-1000 Subnormal plux232 plus -0.10E-999 -> -1.0E-1000 Subnormal plux233 plus -0.100E-999 -> -1.0E-1000 Subnormal Rounded plux234 plus -0.01E-999 -> -1E-1001 Subnormal -- next is rounded to Emin plux235 plus -0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow plux236 plus -0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow plux237 plus -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow plux238 plus -0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow plux239 plus -0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow plux240 plus -0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow -- long operand checks maxexponent: 999 minexponent: -999 precision: 9 plux301 plus 12345678000 -> 1.23456780E+10 Rounded plux302 plus 1234567800 -> 1.23456780E+9 Rounded plux303 plus 1234567890 -> 1.23456789E+9 Rounded plux304 plus 1234567891 -> 1.23456789E+9 Inexact Rounded plux305 plus 12345678901 -> 1.23456789E+10 Inexact Rounded plux306 plus 1234567896 -> 1.23456790E+9 Inexact Rounded -- still checking precision: 15 plux321 plus 12345678000 -> 12345678000 plux322 plus 1234567800 -> 1234567800 plux323 plus 1234567890 -> 1234567890 plux324 plus 1234567891 -> 1234567891 plux325 plus 12345678901 -> 12345678901 plux326 plus 1234567896 -> 1234567896 precision: 9 -- Null tests plu900 plus # -> NaN Invalid_operation --- NEW FILE: normalize.decTest --- ------------------------------------------------------------------------ -- normalize.decTest -- remove trailing zeros -- -- Copyright (c) IBM Corporation, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 nrmx001 normalize '1' -> '1' nrmx002 normalize '-1' -> '-1' nrmx003 normalize '1.00' -> '1' nrmx004 normalize '-1.00' -> '-1' nrmx005 normalize '0' -> '0' nrmx006 normalize '0.00' -> '0' nrmx007 normalize '00.0' -> '0' nrmx008 normalize '00.00' -> '0' nrmx009 normalize '00' -> '0' nrmx010 normalize '0E+1' -> '0' nrmx011 normalize '0E+5' -> '0' nrmx012 normalize '-2' -> '-2' nrmx013 normalize '2' -> '2' nrmx014 normalize '-2.00' -> '-2' nrmx015 normalize '2.00' -> '2' nrmx016 normalize '-0' -> '-0' nrmx017 normalize '-0.00' -> '-0' nrmx018 normalize '-00.0' -> '-0' nrmx019 normalize '-00.00' -> '-0' nrmx020 normalize '-00' -> '-0' nrmx021 normalize '-0E+5' -> '-0' nrmx022 normalize '-0E+1' -> '-0' nrmx030 normalize '+0.1' -> '0.1' nrmx031 normalize '-0.1' -> '-0.1' nrmx032 normalize '+0.01' -> '0.01' nrmx033 normalize '-0.01' -> '-0.01' nrmx034 normalize '+0.001' -> '0.001' nrmx035 normalize '-0.001' -> '-0.001' nrmx036 normalize '+0.000001' -> '0.000001' nrmx037 normalize '-0.000001' -> '-0.000001' nrmx038 normalize '+0.000000000001' -> '1E-12' nrmx039 normalize '-0.000000000001' -> '-1E-12' nrmx041 normalize 1.1 -> 1.1 nrmx042 normalize 1.10 -> 1.1 nrmx043 normalize 1.100 -> 1.1 nrmx044 normalize 1.110 -> 1.11 nrmx045 normalize -1.1 -> -1.1 nrmx046 normalize -1.10 -> -1.1 nrmx047 normalize -1.100 -> -1.1 nrmx048 normalize -1.110 -> -1.11 nrmx049 normalize 9.9 -> 9.9 nrmx050 normalize 9.90 -> 9.9 nrmx051 normalize 9.900 -> 9.9 nrmx052 normalize 9.990 -> 9.99 nrmx053 normalize -9.9 -> -9.9 nrmx054 normalize -9.90 -> -9.9 nrmx055 normalize -9.900 -> -9.9 nrmx056 normalize -9.990 -> -9.99 -- some trailing fractional zeros with zeros in units nrmx060 normalize 10.0 -> 1E+1 nrmx061 normalize 10.00 -> 1E+1 nrmx062 normalize 100.0 -> 1E+2 nrmx063 normalize 100.00 -> 1E+2 nrmx064 normalize 1.1000E+3 -> 1.1E+3 nrmx065 normalize 1.10000E+3 -> 1.1E+3 nrmx066 normalize -10.0 -> -1E+1 nrmx067 normalize -10.00 -> -1E+1 nrmx068 normalize -100.0 -> -1E+2 nrmx069 normalize -100.00 -> -1E+2 nrmx070 normalize -1.1000E+3 -> -1.1E+3 nrmx071 normalize -1.10000E+3 -> -1.1E+3 -- some insignificant trailing zeros with positive exponent nrmx080 normalize 10E+1 -> 1E+2 nrmx081 normalize 100E+1 -> 1E+3 nrmx082 normalize 1.0E+2 -> 1E+2 nrmx083 normalize 1.0E+3 -> 1E+3 nrmx084 normalize 1.1E+3 -> 1.1E+3 nrmx085 normalize 1.00E+3 -> 1E+3 nrmx086 normalize 1.10E+3 -> 1.1E+3 nrmx087 normalize -10E+1 -> -1E+2 nrmx088 normalize -100E+1 -> -1E+3 nrmx089 normalize -1.0E+2 -> -1E+2 nrmx090 normalize -1.0E+3 -> -1E+3 nrmx091 normalize -1.1E+3 -> -1.1E+3 nrmx092 normalize -1.00E+3 -> -1E+3 nrmx093 normalize -1.10E+3 -> -1.1E+3 -- some significant trailing zeros, were we to be trimming nrmx100 normalize 11 -> 11 nrmx101 normalize 10 -> 1E+1 nrmx102 normalize 10. -> 1E+1 nrmx103 normalize 1.1E+1 -> 11 nrmx104 normalize 1.0E+1 -> 1E+1 nrmx105 normalize 1.10E+2 -> 1.1E+2 nrmx106 normalize 1.00E+2 -> 1E+2 nrmx107 normalize 1.100E+3 -> 1.1E+3 nrmx108 normalize 1.000E+3 -> 1E+3 nrmx109 normalize 1.000000E+6 -> 1E+6 nrmx110 normalize -11 -> -11 nrmx111 normalize -10 -> -1E+1 nrmx112 normalize -10. -> -1E+1 nrmx113 normalize -1.1E+1 -> -11 nrmx114 normalize -1.0E+1 -> -1E+1 nrmx115 normalize -1.10E+2 -> -1.1E+2 nrmx116 normalize -1.00E+2 -> -1E+2 nrmx117 normalize -1.100E+3 -> -1.1E+3 nrmx118 normalize -1.000E+3 -> -1E+3 nrmx119 normalize -1.00000E+5 -> -1E+5 nrmx120 normalize -1.000000E+6 -> -1E+6 nrmx121 normalize -10.00000E+6 -> -1E+7 nrmx122 normalize -100.0000E+6 -> -1E+8 nrmx123 normalize -1000.000E+6 -> -1E+9 nrmx124 normalize -10000.00E+6 -> -1E+10 nrmx125 normalize -100000.0E+6 -> -1E+11 nrmx126 normalize -1000000.E+6 -> -1E+12 -- examples from decArith nrmx140 normalize '2.1' -> '2.1' nrmx141 normalize '-2.0' -> '-2' nrmx142 normalize '1.200' -> '1.2' nrmx143 normalize '-120' -> '-1.2E+2' nrmx144 normalize '120.00' -> '1.2E+2' nrmx145 normalize '0.00' -> '0' -- overflow tests maxexponent: 999999999 minexponent: -999999999 precision: 3 nrmx160 normalize 9.999E+999999999 -> Infinity Inexact Overflow Rounded nrmx161 normalize -9.999E+999999999 -> -Infinity Inexact Overflow Rounded -- subnormals and underflow precision: 3 maxexponent: 999 minexponent: -999 nrmx210 normalize 1.00E-999 -> 1E-999 nrmx211 normalize 0.1E-999 -> 1E-1000 Subnormal nrmx212 normalize 0.10E-999 -> 1E-1000 Subnormal nrmx213 normalize 0.100E-999 -> 1E-1000 Subnormal Rounded nrmx214 normalize 0.01E-999 -> 1E-1001 Subnormal -- next is rounded to Emin nrmx215 normalize 0.999E-999 -> 1E-999 Inexact Rounded Subnormal Underflow nrmx216 normalize 0.099E-999 -> 1E-1000 Inexact Rounded Subnormal Underflow nrmx217 normalize 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow nrmx218 normalize 0.001E-999 -> 0 Inexact Rounded Subnormal Underflow nrmx219 normalize 0.0009E-999 -> 0 Inexact Rounded Subnormal Underflow nrmx220 normalize 0.0001E-999 -> 0 Inexact Rounded Subnormal Underflow nrmx230 normalize -1.00E-999 -> -1E-999 nrmx231 normalize -0.1E-999 -> -1E-1000 Subnormal nrmx232 normalize -0.10E-999 -> -1E-1000 Subnormal nrmx233 normalize -0.100E-999 -> -1E-1000 Subnormal Rounded nrmx234 normalize -0.01E-999 -> -1E-1001 Subnormal -- next is rounded to Emin nrmx235 normalize -0.999E-999 -> -1E-999 Inexact Rounded Subnormal Underflow nrmx236 normalize -0.099E-999 -> -1E-1000 Inexact Rounded Subnormal Underflow nrmx237 normalize -0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow nrmx238 normalize -0.001E-999 -> -0 Inexact Rounded Subnormal Underflow nrmx239 normalize -0.0009E-999 -> -0 Inexact Rounded Subnormal Underflow nrmx240 normalize -0.0001E-999 -> -0 Inexact Rounded Subnormal Underflow -- more reshaping precision: 9 nrmx260 normalize '56260E-10' -> '0.000005626' nrmx261 normalize '56260E-5' -> '0.5626' nrmx262 normalize '56260E-2' -> '562.6' nrmx263 normalize '56260E-1' -> '5626' nrmx265 normalize '56260E-0' -> '5.626E+4' nrmx266 normalize '56260E+0' -> '5.626E+4' nrmx267 normalize '56260E+1' -> '5.626E+5' nrmx268 normalize '56260E+2' -> '5.626E+6' nrmx269 normalize '56260E+3' -> '5.626E+7' nrmx270 normalize '56260E+4' -> '5.626E+8' nrmx271 normalize '56260E+5' -> '5.626E+9' nrmx272 normalize '56260E+6' -> '5.626E+10' nrmx280 normalize '-56260E-10' -> '-0.000005626' nrmx281 normalize '-56260E-5' -> '-0.5626' nrmx282 normalize '-56260E-2' -> '-562.6' nrmx283 normalize '-56260E-1' -> '-5626' nrmx285 normalize '-56260E-0' -> '-5.626E+4' nrmx286 normalize '-56260E+0' -> '-5.626E+4' nrmx287 normalize '-56260E+1' -> '-5.626E+5' nrmx288 normalize '-56260E+2' -> '-5.626E+6' nrmx289 normalize '-56260E+3' -> '-5.626E+7' nrmx290 normalize '-56260E+4' -> '-5.626E+8' nrmx291 normalize '-56260E+5' -> '-5.626E+9' nrmx292 normalize '-56260E+6' -> '-5.626E+10' -- specials nrmx820 normalize 'Inf' -> 'Infinity' nrmx821 normalize '-Inf' -> '-Infinity' nrmx822 normalize NaN -> NaN nrmx823 normalize sNaN -> NaN Invalid_operation -- Null test nrmx900 normalize # -> NaN Invalid_operation --- NEW FILE: multiply.decTest --- ------------------------------------------------------------------------ -- multiply.decTest -- decimal multiplication -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks (as base, above) mulx000 multiply 2 2 -> 4 mulx001 multiply 2 3 -> 6 mulx002 multiply 5 1 -> 5 mulx003 multiply 5 2 -> 10 mulx004 multiply 1.20 2 -> 2.40 mulx005 multiply 1.20 0 -> 0.00 mulx006 multiply 1.20 -2 -> -2.40 mulx007 multiply -1.20 2 -> -2.40 mulx008 multiply -1.20 0 -> -0.00 mulx009 multiply -1.20 -2 -> 2.40 mulx010 multiply 5.09 7.1 -> 36.139 mulx011 multiply 2.5 4 -> 10.0 mulx012 multiply 2.50 4 -> 10.00 mulx013 multiply 1.23456789 1.00000000 -> 1.23456789 Rounded mulx014 multiply 9.999999999 9.999999999 -> 100.000000 Inexact Rounded mulx015 multiply 2.50 4 -> 10.00 precision: 6 mulx016 multiply 2.50 4 -> 10.00 mulx017 multiply 9.999999999 9.999999999 -> 100.000 Inexact Rounded -- 1999.12.21: next one is a edge case if intermediate longs are used precision: 15 mulx019 multiply 999999999999 9765625 -> 9.76562499999023E+18 Inexact Rounded precision: 30 mulx160 multiply 999999999999 9765625 -> 9765624999990234375 precision: 9 ----- -- zeros, etc. mulx020 multiply 0 0 -> 0 mulx021 multiply 0 -0 -> -0 mulx022 multiply -0 0 -> -0 mulx023 multiply -0 -0 -> 0 mulx030 multiply 5.00 1E-3 -> 0.00500 mulx031 multiply 00.00 0.000 -> 0.00000 mulx032 multiply 00.00 0E-3 -> 0.00000 -- rhs is 0 mulx033 multiply 0E-3 00.00 -> 0.00000 -- lhs is 0 mulx034 multiply -5.00 1E-3 -> -0.00500 mulx035 multiply -00.00 0.000 -> -0.00000 mulx036 multiply -00.00 0E-3 -> -0.00000 -- rhs is 0 mulx037 multiply -0E-3 00.00 -> -0.00000 -- lhs is 0 mulx038 multiply 5.00 -1E-3 -> -0.00500 mulx039 multiply 00.00 -0.000 -> -0.00000 mulx040 multiply 00.00 -0E-3 -> -0.00000 -- rhs is 0 mulx041 multiply 0E-3 -00.00 -> -0.00000 -- lhs is 0 mulx042 multiply -5.00 -1E-3 -> 0.00500 mulx043 multiply -00.00 -0.000 -> 0.00000 mulx044 multiply -00.00 -0E-3 -> 0.00000 -- rhs is 0 mulx045 multiply -0E-3 -00.00 -> 0.00000 -- lhs is 0 -- examples from decarith mulx050 multiply 1.20 3 -> 3.60 mulx051 multiply 7 3 -> 21 mulx052 multiply 0.9 0.8 -> 0.72 mulx053 multiply 0.9 -0 -> -0.0 mulx054 multiply 654321 654321 -> 4.28135971E+11 Inexact Rounded mulx060 multiply 123.45 1e7 -> 1.2345E+9 mulx061 multiply 123.45 1e8 -> 1.2345E+10 mulx062 multiply 123.45 1e+9 -> 1.2345E+11 mulx063 multiply 123.45 1e10 -> 1.2345E+12 mulx064 multiply 123.45 1e11 -> 1.2345E+13 mulx065 multiply 123.45 1e12 -> 1.2345E+14 mulx066 multiply 123.45 1e13 -> 1.2345E+15 -- test some intermediate lengths precision: 9 mulx080 multiply 0.1 123456789 -> 12345678.9 mulx081 multiply 0.1 1234567891 -> 123456789 Inexact Rounded mulx082 multiply 0.1 12345678912 -> 1.23456789E+9 Inexact Rounded mulx083 multiply 0.1 12345678912345 -> 1.23456789E+12 Inexact Rounded mulx084 multiply 0.1 123456789 -> 12345678.9 precision: 8 mulx085 multiply 0.1 12345678912 -> 1.2345679E+9 Inexact Rounded mulx086 multiply 0.1 12345678912345 -> 1.2345679E+12 Inexact Rounded precision: 7 mulx087 multiply 0.1 12345678912 -> 1.234568E+9 Inexact Rounded mulx088 multiply 0.1 12345678912345 -> 1.234568E+12 Inexact Rounded precision: 9 mulx090 multiply 123456789 0.1 -> 12345678.9 mulx091 multiply 1234567891 0.1 -> 123456789 Inexact Rounded mulx092 multiply 12345678912 0.1 -> 1.23456789E+9 Inexact Rounded mulx093 multiply 12345678912345 0.1 -> 1.23456789E+12 Inexact Rounded mulx094 multiply 123456789 0.1 -> 12345678.9 precision: 8 mulx095 multiply 12345678912 0.1 -> 1.2345679E+9 Inexact Rounded mulx096 multiply 12345678912345 0.1 -> 1.2345679E+12 Inexact Rounded precision: 7 mulx097 multiply 12345678912 0.1 -> 1.234568E+9 Inexact Rounded mulx098 multiply 12345678912345 0.1 -> 1.234568E+12 Inexact Rounded -- test some more edge cases and carries maxexponent: 9999 minexponent: -9999 precision: 33 mulx101 multiply 9 9 -> 81 mulx102 multiply 9 90 -> 810 mulx103 multiply 9 900 -> 8100 mulx104 multiply 9 9000 -> 81000 mulx105 multiply 9 90000 -> 810000 mulx106 multiply 9 900000 -> 8100000 mulx107 multiply 9 9000000 -> 81000000 mulx108 multiply 9 90000000 -> 810000000 mulx109 multiply 9 900000000 -> 8100000000 mulx110 multiply 9 9000000000 -> 81000000000 mulx111 multiply 9 90000000000 -> 810000000000 mulx112 multiply 9 900000000000 -> 8100000000000 mulx113 multiply 9 9000000000000 -> 81000000000000 mulx114 multiply 9 90000000000000 -> 810000000000000 mulx115 multiply 9 900000000000000 -> 8100000000000000 mulx116 multiply 9 9000000000000000 -> 81000000000000000 mulx117 multiply 9 90000000000000000 -> 810000000000000000 mulx118 multiply 9 900000000000000000 -> 8100000000000000000 mulx119 multiply 9 9000000000000000000 -> 81000000000000000000 mulx120 multiply 9 90000000000000000000 -> 810000000000000000000 mulx121 multiply 9 900000000000000000000 -> 8100000000000000000000 mulx122 multiply 9 9000000000000000000000 -> 81000000000000000000000 mulx123 multiply 9 90000000000000000000000 -> 810000000000000000000000 -- test some more edge cases without carries mulx131 multiply 3 3 -> 9 mulx132 multiply 3 30 -> 90 mulx133 multiply 3 300 -> 900 mulx134 multiply 3 3000 -> 9000 mulx135 multiply 3 30000 -> 90000 mulx136 multiply 3 300000 -> 900000 mulx137 multiply 3 3000000 -> 9000000 mulx138 multiply 3 30000000 -> 90000000 mulx139 multiply 3 300000000 -> 900000000 mulx140 multiply 3 3000000000 -> 9000000000 mulx141 multiply 3 30000000000 -> 90000000000 mulx142 multiply 3 300000000000 -> 900000000000 mulx143 multiply 3 3000000000000 -> 9000000000000 mulx144 multiply 3 30000000000000 -> 90000000000000 mulx145 multiply 3 300000000000000 -> 900000000000000 mulx146 multiply 3 3000000000000000 -> 9000000000000000 mulx147 multiply 3 30000000000000000 -> 90000000000000000 mulx148 multiply 3 300000000000000000 -> 900000000000000000 mulx149 multiply 3 3000000000000000000 -> 9000000000000000000 mulx150 multiply 3 30000000000000000000 -> 90000000000000000000 mulx151 multiply 3 300000000000000000000 -> 900000000000000000000 mulx152 multiply 3 3000000000000000000000 -> 9000000000000000000000 mulx153 multiply 3 30000000000000000000000 -> 90000000000000000000000 maxexponent: 999999999 minexponent: -999999999 precision: 9 -- test some cases that are close to exponent overflow/underflow mulx170 multiply 1 9e999999999 -> 9E+999999999 mulx171 multiply 1 9.9e999999999 -> 9.9E+999999999 mulx172 multiply 1 9.99e999999999 -> 9.99E+999999999 mulx173 multiply 9e999999999 1 -> 9E+999999999 mulx174 multiply 9.9e999999999 1 -> 9.9E+999999999 mulx176 multiply 9.99e999999999 1 -> 9.99E+999999999 mulx177 multiply 1 9.99999999e999999999 -> 9.99999999E+999999999 mulx178 multiply 9.99999999e999999999 1 -> 9.99999999E+999999999 mulx180 multiply 0.1 9e-999999998 -> 9E-999999999 mulx181 multiply 0.1 99e-999999998 -> 9.9E-999999998 mulx182 multiply 0.1 999e-999999998 -> 9.99E-999999997 mulx183 multiply 0.1 9e-999999998 -> 9E-999999999 mulx184 multiply 0.1 99e-999999998 -> 9.9E-999999998 mulx185 multiply 0.1 999e-999999998 -> 9.99E-999999997 mulx186 multiply 0.1 999e-999999997 -> 9.99E-999999996 mulx187 multiply 0.1 9999e-999999997 -> 9.999E-999999995 mulx188 multiply 0.1 99999e-999999997 -> 9.9999E-999999994 mulx190 multiply 1 9e-999999998 -> 9E-999999998 mulx191 multiply 1 99e-999999998 -> 9.9E-999999997 mulx192 multiply 1 999e-999999998 -> 9.99E-999999996 mulx193 multiply 9e-999999998 1 -> 9E-999999998 mulx194 multiply 99e-999999998 1 -> 9.9E-999999997 mulx195 multiply 999e-999999998 1 -> 9.99E-999999996 mulx196 multiply 1e-599999999 1e-400000000 -> 1E-999999999 mulx197 multiply 1e-600000000 1e-399999999 -> 1E-999999999 mulx198 multiply 1.2e-599999999 1.2e-400000000 -> 1.44E-999999999 mulx199 multiply 1.2e-600000000 1.2e-399999999 -> 1.44E-999999999 mulx201 multiply 1e599999999 1e400000000 -> 1E+999999999 mulx202 multiply 1e600000000 1e399999999 -> 1E+999999999 mulx203 multiply 1.2e599999999 1.2e400000000 -> 1.44E+999999999 mulx204 multiply 1.2e600000000 1.2e399999999 -> 1.44E+999999999 -- long operand triangle precision: 33 mulx246 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671916511992830 Inexact Rounded precision: 32 mulx247 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651199283 Inexact Rounded precision: 31 mulx248 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719165119928 Inexact Rounded precision: 30 mulx249 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671916511993 Inexact Rounded precision: 29 mulx250 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651199 Inexact Rounded precision: 28 mulx251 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719165120 Inexact Rounded precision: 27 mulx252 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671916512 Inexact Rounded precision: 26 mulx253 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967191651 Inexact Rounded precision: 25 mulx254 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719165 Inexact Rounded precision: 24 mulx255 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369671917 Inexact Rounded precision: 23 mulx256 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967192 Inexact Rounded precision: 22 mulx257 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933696719 Inexact Rounded precision: 21 mulx258 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193369672 Inexact Rounded precision: 20 mulx259 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119336967 Inexact Rounded precision: 19 mulx260 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011933697 Inexact Rounded precision: 18 mulx261 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193370 Inexact Rounded precision: 17 mulx262 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119337 Inexact Rounded precision: 16 mulx263 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908011934 Inexact Rounded precision: 15 mulx264 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801193 Inexact Rounded precision: 14 mulx265 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080119 Inexact Rounded precision: 13 mulx266 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908012 Inexact Rounded precision: 12 mulx267 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.290801 Inexact Rounded precision: 11 mulx268 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29080 Inexact Rounded precision: 10 mulx269 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.2908 Inexact Rounded precision: 9 mulx270 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.291 Inexact Rounded precision: 8 mulx271 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.29 Inexact Rounded precision: 7 mulx272 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433.3 Inexact Rounded precision: 6 mulx273 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 145433 Inexact Rounded precision: 5 mulx274 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.4543E+5 Inexact Rounded precision: 4 mulx275 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.454E+5 Inexact Rounded precision: 3 mulx276 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.45E+5 Inexact Rounded precision: 2 mulx277 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1.5E+5 Inexact Rounded precision: 1 mulx278 multiply 30269.587755640502150977251770554 4.8046009735990873395936309640543 -> 1E+5 Inexact Rounded -- tryzeros cases precision: 7 rounding: half_up maxExponent: 92 minexponent: -92 mulx504 multiply 0E-60 1000E-60 -> 0E-98 Clamped mulx505 multiply 100E+60 0E+60 -> 0E+92 Clamped -- mixed with zeros maxexponent: 999999999 minexponent: -999999999 precision: 9 mulx541 multiply 0 -1 -> -0 mulx542 multiply -0 -1 -> 0 mulx543 multiply 0 1 -> 0 mulx544 multiply -0 1 -> -0 mulx545 multiply -1 0 -> -0 mulx546 multiply -1 -0 -> 0 mulx547 multiply 1 0 -> 0 mulx548 multiply 1 -0 -> -0 mulx551 multiply 0.0 -1 -> -0.0 mulx552 multiply -0.0 -1 -> 0.0 mulx553 multiply 0.0 1 -> 0.0 mulx554 multiply -0.0 1 -> -0.0 mulx555 multiply -1.0 0 -> -0.0 mulx556 multiply -1.0 -0 -> 0.0 mulx557 multiply 1.0 0 -> 0.0 mulx558 multiply 1.0 -0 -> -0.0 mulx561 multiply 0 -1.0 -> -0.0 mulx562 multiply -0 -1.0 -> 0.0 mulx563 multiply 0 1.0 -> 0.0 mulx564 multiply -0 1.0 -> -0.0 mulx565 multiply -1 0.0 -> -0.0 mulx566 multiply -1 -0.0 -> 0.0 mulx567 multiply 1 0.0 -> 0.0 mulx568 multiply 1 -0.0 -> -0.0 mulx571 multiply 0.0 -1.0 -> -0.00 mulx572 multiply -0.0 -1.0 -> 0.00 mulx573 multiply 0.0 1.0 -> 0.00 mulx574 multiply -0.0 1.0 -> -0.00 mulx575 multiply -1.0 0.0 -> -0.00 mulx576 multiply -1.0 -0.0 -> 0.00 mulx577 multiply 1.0 0.0 -> 0.00 mulx578 multiply 1.0 -0.0 -> -0.00 -- Specials mulx580 multiply Inf -Inf -> -Infinity mulx581 multiply Inf -1000 -> -Infinity mulx582 multiply Inf -1 -> -Infinity mulx583 multiply Inf -0 -> NaN Invalid_operation mulx584 multiply Inf 0 -> NaN Invalid_operation mulx585 multiply Inf 1 -> Infinity mulx586 multiply Inf 1000 -> Infinity mulx587 multiply Inf Inf -> Infinity mulx588 multiply -1000 Inf -> -Infinity mulx589 multiply -Inf Inf -> -Infinity mulx590 multiply -1 Inf -> -Infinity mulx591 multiply -0 Inf -> NaN Invalid_operation mulx592 multiply 0 Inf -> NaN Invalid_operation mulx593 multiply 1 Inf -> Infinity mulx594 multiply 1000 Inf -> Infinity mulx595 multiply Inf Inf -> Infinity mulx600 multiply -Inf -Inf -> Infinity mulx601 multiply -Inf -1000 -> Infinity mulx602 multiply -Inf -1 -> Infinity mulx603 multiply -Inf -0 -> NaN Invalid_operation mulx604 multiply -Inf 0 -> NaN Invalid_operation mulx605 multiply -Inf 1 -> -Infinity mulx606 multiply -Inf 1000 -> -Infinity mulx607 multiply -Inf Inf -> -Infinity mulx608 multiply -1000 Inf -> -Infinity mulx609 multiply -Inf -Inf -> Infinity mulx610 multiply -1 -Inf -> Infinity mulx611 multiply -0 -Inf -> NaN Invalid_operation mulx612 multiply 0 -Inf -> NaN Invalid_operation mulx613 multiply 1 -Inf -> -Infinity mulx614 multiply 1000 -Inf -> -Infinity mulx615 multiply Inf -Inf -> -Infinity mulx621 multiply NaN -Inf -> NaN mulx622 multiply NaN -1000 -> NaN mulx623 multiply NaN -1 -> NaN mulx624 multiply NaN -0 -> NaN mulx625 multiply NaN 0 -> NaN mulx626 multiply NaN 1 -> NaN mulx627 multiply NaN 1000 -> NaN mulx628 multiply NaN Inf -> NaN mulx629 multiply NaN NaN -> NaN mulx630 multiply -Inf NaN -> NaN mulx631 multiply -1000 NaN -> NaN mulx632 multiply -1 NaN -> NaN mulx633 multiply -0 NaN -> NaN mulx634 multiply 0 NaN -> NaN mulx635 multiply 1 NaN -> NaN mulx636 multiply 1000 NaN -> NaN mulx637 multiply Inf NaN -> NaN mulx641 multiply sNaN -Inf -> NaN Invalid_operation mulx642 multiply sNaN -1000 -> NaN Invalid_operation mulx643 multiply sNaN -1 -> NaN Invalid_operation mulx644 multiply sNaN -0 -> NaN Invalid_operation mulx645 multiply sNaN 0 -> NaN Invalid_operation mulx646 multiply sNaN 1 -> NaN Invalid_operation mulx647 multiply sNaN 1000 -> NaN Invalid_operation mulx648 multiply sNaN NaN -> NaN Invalid_operation mulx649 multiply sNaN sNaN -> NaN Invalid_operation mulx650 multiply NaN sNaN -> NaN Invalid_operation mulx651 multiply -Inf sNaN -> NaN Invalid_operation mulx652 multiply -1000 sNaN -> NaN Invalid_operation mulx653 multiply -1 sNaN -> NaN Invalid_operation mulx654 multiply -0 sNaN -> NaN Invalid_operation mulx655 multiply 0 sNaN -> NaN Invalid_operation mulx656 multiply 1 sNaN -> NaN Invalid_operation mulx657 multiply 1000 sNaN -> NaN Invalid_operation mulx658 multiply Inf sNaN -> NaN Invalid_operation mulx659 multiply NaN sNaN -> NaN Invalid_operation -- overflow and underflow tests .. note subnormal results maxexponent: 999999999 minexponent: -999999999 mulx730 multiply +1.23456789012345E-0 9E+999999999 -> Infinity Inexact Overflow Rounded mulx731 multiply 9E+999999999 +1.23456789012345E-0 -> Infinity Inexact Overflow Rounded mulx732 multiply +0.100 9E-999999999 -> 9.00E-1000000000 Subnormal mulx733 multiply 9E-999999999 +0.100 -> 9.00E-1000000000 Subnormal mulx735 multiply -1.23456789012345E-0 9E+999999999 -> -Infinity Inexact Overflow Rounded mulx736 multiply 9E+999999999 -1.23456789012345E-0 -> -Infinity Inexact Overflow Rounded mulx737 multiply -0.100 9E-999999999 -> -9.00E-1000000000 Subnormal mulx738 multiply 9E-999999999 -0.100 -> -9.00E-1000000000 Subnormal mulx739 multiply 1e-599999999 1e-400000001 -> 1E-1000000000 Subnormal mulx740 multiply 1e-599999999 1e-400000000 -> 1E-999999999 mulx741 multiply 1e-600000000 1e-400000000 -> 1E-1000000000 Subnormal mulx742 multiply 9e-999999998 0.01 -> 9E-1000000000 Subnormal mulx743 multiply 9e-999999998 0.1 -> 9E-999999999 mulx744 multiply 0.01 9e-999999998 -> 9E-1000000000 Subnormal mulx745 multiply 1e599999999 1e400000001 -> Infinity Overflow Inexact Rounded mulx746 multiply 1e599999999 1e400000000 -> 1E+999999999 mulx747 multiply 1e600000000 1e400000000 -> Infinity Overflow Inexact Rounded mulx748 multiply 9e999999998 100 -> Infinity Overflow Inexact Rounded mulx749 multiply 9e999999998 10 -> 9.0E+999999999 mulx750 multiply 100 9e999999998 -> Infinity Overflow Inexact Rounded -- signs mulx751 multiply 1e+777777777 1e+411111111 -> Infinity Overflow Inexact Rounded mulx752 multiply 1e+777777777 -1e+411111111 -> -Infinity Overflow Inexact Rounded mulx753 multiply -1e+777777777 1e+411111111 -> -Infinity Overflow Inexact Rounded mulx754 multiply -1e+777777777 -1e+411111111 -> Infinity Overflow Inexact Rounded mulx755 multiply 1e-777777777 1e-411111111 -> 0E-1000000007 Underflow Subnormal Inexact Rounded mulx756 multiply 1e-777777777 -1e-411111111 -> -0E-1000000007 Underflow Subnormal Inexact Rounded mulx757 multiply -1e-777777777 1e-411111111 -> -0E-1000000007 Underflow Subnormal Inexact Rounded mulx758 multiply -1e-777777777 -1e-411111111 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -- 'subnormal' boundary (all hard underflow or overflow in base arithemtic) precision: 9 mulx760 multiply 1e-600000000 1e-400000001 -> 1E-1000000001 Subnormal mulx761 multiply 1e-600000000 1e-400000002 -> 1E-1000000002 Subnormal mulx762 multiply 1e-600000000 1e-400000003 -> 1E-1000000003 Subnormal mulx763 multiply 1e-600000000 1e-400000004 -> 1E-1000000004 Subnormal mulx764 multiply 1e-600000000 1e-400000005 -> 1E-1000000005 Subnormal mulx765 multiply 1e-600000000 1e-400000006 -> 1E-1000000006 Subnormal mulx766 multiply 1e-600000000 1e-400000007 -> 1E-1000000007 Subnormal mulx767 multiply 1e-600000000 1e-400000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded mulx768 multiply 1e-600000000 1e-400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded mulx769 multiply 1e-600000000 1e-400000010 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -- [no equivalent of 'subnormal' for overflow] mulx770 multiply 1e+600000000 1e+400000001 -> Infinity Overflow Inexact Rounded mulx771 multiply 1e+600000000 1e+400000002 -> Infinity Overflow Inexact Rounded mulx772 multiply 1e+600000000 1e+400000003 -> Infinity Overflow Inexact Rounded mulx773 multiply 1e+600000000 1e+400000004 -> Infinity Overflow Inexact Rounded mulx774 multiply 1e+600000000 1e+400000005 -> Infinity Overflow Inexact Rounded mulx775 multiply 1e+600000000 1e+400000006 -> Infinity Overflow Inexact Rounded mulx776 multiply 1e+600000000 1e+400000007 -> Infinity Overflow Inexact Rounded mulx777 multiply 1e+600000000 1e+400000008 -> Infinity Overflow Inexact Rounded mulx778 multiply 1e+600000000 1e+400000009 -> Infinity Overflow Inexact Rounded mulx779 multiply 1e+600000000 1e+400000010 -> Infinity Overflow Inexact Rounded -- 'subnormal' test edge condition at higher precisions precision: 99 mulx780 multiply 1e-600000000 1e-400000007 -> 1E-1000000007 Subnormal mulx781 multiply 1e-600000000 1e-400000008 -> 1E-1000000008 Subnormal mulx782 multiply 1e-600000000 1e-400000097 -> 1E-1000000097 Subnormal mulx783 multiply 1e-600000000 1e-400000098 -> 0E-1000000097 Underflow Subnormal Inexact Rounded precision: 999 mulx784 multiply 1e-600000000 1e-400000997 -> 1E-1000000997 Subnormal mulx785 multiply 1e-600000000 1e-400000998 -> 0E-1000000997 Underflow Subnormal Inexact Rounded -- following testcases [through mulx800] not yet run against code precision: 9999 mulx786 multiply 1e-600000000 1e-400009997 -> 1E-1000009997 Subnormal mulx787 multiply 1e-600000000 1e-400009998 -> 0E-1000009997 Underflow Subnormal Inexact Rounded precision: 99999 mulx788 multiply 1e-600000000 1e-400099997 -> 1E-1000099997 Subnormal mulx789 multiply 1e-600000000 1e-400099998 -> 0E-1000099997 Underflow Subnormal Inexact Rounded precision: 999999 mulx790 multiply 1e-600000000 1e-400999997 -> 1E-1000999997 Subnormal mulx791 multiply 1e-600000000 1e-400999998 -> 0E-1000999997 Underflow Subnormal Inexact Rounded precision: 9999999 mulx792 multiply 1e-600000000 1e-409999997 -> 1E-1009999997 Subnormal mulx793 multiply 1e-600000000 1e-409999998 -> 0E-1009999997 Underflow Subnormal Inexact Rounded precision: 99999999 mulx794 multiply 1e-600000000 1e-499999997 -> 1E-1099999997 Subnormal mulx795 multiply 1e-600000000 1e-499999998 -> 0E-1099999997 Underflow Subnormal Inexact Rounded precision: 999999999 mulx796 multiply 1e-999999999 1e-999999997 -> 1E-1999999996 Subnormal mulx797 multiply 1e-999999999 1e-999999998 -> 1E-1999999997 Subnormal mulx798 multiply 1e-999999999 1e-999999999 -> 0E-1999999997 Underflow Subnormal Inexact Rounded mulx799 multiply 1e-600000000 1e-400000007 -> 1E-1000000007 Subnormal mulx800 multiply 1e-600000000 1e-400000008 -> 1E-1000000008 Subnormal -- test subnormals rounding precision: 5 maxExponent: 999 minexponent: -999 rounding: half_even mulx801 multiply 1.0000E-999 1 -> 1.0000E-999 mulx802 multiply 1.000E-999 1e-1 -> 1.000E-1000 Subnormal mulx803 multiply 1.00E-999 1e-2 -> 1.00E-1001 Subnormal mulx804 multiply 1.0E-999 1e-3 -> 1.0E-1002 Subnormal mulx805 multiply 1.0E-999 1e-4 -> 1E-1003 Subnormal Rounded mulx806 multiply 1.3E-999 1e-4 -> 1E-1003 Underflow Subnormal Inexact Rounded mulx807 multiply 1.5E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx808 multiply 1.7E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx809 multiply 2.3E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx810 multiply 2.5E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx811 multiply 2.7E-999 1e-4 -> 3E-1003 Underflow Subnormal Inexact Rounded mulx812 multiply 1.49E-999 1e-4 -> 1E-1003 Underflow Subnormal Inexact Rounded mulx813 multiply 1.50E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx814 multiply 1.51E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx815 multiply 2.49E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx816 multiply 2.50E-999 1e-4 -> 2E-1003 Underflow Subnormal Inexact Rounded mulx817 multiply 2.51E-999 1e-4 -> 3E-1003 Underflow Subnormal Inexact Rounded mulx818 multiply 1E-999 1e-4 -> 1E-1003 Subnormal mulx819 multiply 3E-999 1e-5 -> 0E-1003 Underflow Subnormal Inexact Rounded mulx820 multiply 5E-999 1e-5 -> 0E-1003 Underflow Subnormal Inexact Rounded mulx821 multiply 7E-999 1e-5 -> 1E-1003 Underflow Subnormal Inexact Rounded mulx822 multiply 9E-999 1e-5 -> 1E-1003 Underflow Subnormal Inexact Rounded mulx823 multiply 9.9E-999 1e-5 -> 1E-1003 Underflow Subnormal Inexact Rounded mulx824 multiply 1E-999 -1e-4 -> -1E-1003 Subnormal mulx825 multiply 3E-999 -1e-5 -> -0E-1003 Underflow Subnormal Inexact Rounded mulx826 multiply -5E-999 1e-5 -> -0E-1003 Underflow Subnormal Inexact Rounded mulx827 multiply 7E-999 -1e-5 -> -1E-1003 Underflow Subnormal Inexact Rounded mulx828 multiply -9E-999 1e-5 -> -1E-1003 Underflow Subnormal Inexact Rounded mulx829 multiply 9.9E-999 -1e-5 -> -1E-1003 Underflow Subnormal Inexact Rounded mulx830 multiply 3.0E-999 -1e-5 -> -0E-1003 Underflow Subnormal Inexact Rounded mulx831 multiply 1.0E-501 1e-501 -> 1.0E-1002 Subnormal mulx832 multiply 2.0E-501 2e-501 -> 4.0E-1002 Subnormal mulx833 multiply 4.0E-501 4e-501 -> 1.60E-1001 Subnormal mulx834 multiply 10.0E-501 10e-501 -> 1.000E-1000 Subnormal mulx835 multiply 30.0E-501 30e-501 -> 9.000E-1000 Subnormal mulx836 multiply 40.0E-501 40e-501 -> 1.6000E-999 -- squares mulx840 multiply 1E-502 1e-502 -> 0E-1003 Underflow Subnormal Inexact Rounded mulx841 multiply 1E-501 1e-501 -> 1E-1002 Subnormal mulx842 multiply 2E-501 2e-501 -> 4E-1002 Subnormal mulx843 multiply 4E-501 4e-501 -> 1.6E-1001 Subnormal mulx844 multiply 10E-501 10e-501 -> 1.00E-1000 Subnormal mulx845 multiply 30E-501 30e-501 -> 9.00E-1000 Subnormal mulx846 multiply 40E-501 40e-501 -> 1.600E-999 -- cubes mulx850 multiply 1E-670 1e-335 -> 0E-1003 Underflow Subnormal Inexact Rounded mulx851 multiply 1E-668 1e-334 -> 1E-1002 Subnormal mulx852 multiply 4E-668 2e-334 -> 8E-1002 Subnormal mulx853 multiply 9E-668 3e-334 -> 2.7E-1001 Subnormal mulx854 multiply 16E-668 4e-334 -> 6.4E-1001 Subnormal mulx855 multiply 25E-668 5e-334 -> 1.25E-1000 Subnormal mulx856 multiply 10E-668 100e-334 -> 1.000E-999 -- test from 0.099 ** 999 at 15 digits precision: 19 mulx860 multiply 6636851557994578716E-520 6636851557994578716E-520 -> 4.40477986028551E-1003 Underflow Subnormal Inexact Rounded -- Long operand overflow may be a different path precision: 3 maxExponent: 999999999 minexponent: -999999999 mulx870 multiply 1 9.999E+999999999 -> Infinity Inexact Overflow Rounded mulx871 multiply 1 -9.999E+999999999 -> -Infinity Inexact Overflow Rounded mulx872 multiply 9.999E+999999999 1 -> Infinity Inexact Overflow Rounded mulx873 multiply -9.999E+999999999 1 -> -Infinity Inexact Overflow Rounded -- check for double-rounded subnormals precision: 5 maxexponent: 79 minexponent: -79 mulx881 multiply 1.2347E-40 1.2347E-40 -> 1.524E-80 Inexact Rounded Subnormal Underflow mulx882 multiply 1.234E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow mulx883 multiply 1.23E-40 1.23E-40 -> 1.513E-80 Inexact Rounded Subnormal Underflow mulx884 multiply 1.2E-40 1.2E-40 -> 1.44E-80 Subnormal mulx885 multiply 1.2E-40 1.2E-41 -> 1.44E-81 Subnormal mulx886 multiply 1.2E-40 1.2E-42 -> 1.4E-82 Subnormal Inexact Rounded Underflow mulx887 multiply 1.2E-40 1.3E-42 -> 1.6E-82 Subnormal Inexact Rounded Underflow mulx888 multiply 1.3E-40 1.3E-42 -> 1.7E-82 Subnormal Inexact Rounded Underflow mulx891 multiply 1.2345E-39 1.234E-40 -> 1.5234E-79 Inexact Rounded mulx892 multiply 1.23456E-39 1.234E-40 -> 1.5234E-79 Inexact Rounded mulx893 multiply 1.2345E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow mulx894 multiply 1.23456E-40 1.234E-40 -> 1.523E-80 Inexact Rounded Subnormal Underflow mulx895 multiply 1.2345E-41 1.234E-40 -> 1.52E-81 Inexact Rounded Subnormal Underflow mulx896 multiply 1.23456E-41 1.234E-40 -> 1.52E-81 Inexact Rounded Subnormal Underflow -- Null tests mulx900 multiply 10 # -> NaN Invalid_operation mulx901 multiply # 10 -> NaN Invalid_operation --- NEW FILE: minus.decTest --- ------------------------------------------------------------------------ -- minus.decTest -- decimal negation -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of tests primarily tests the existence of the operator. -- Subtraction, rounding, and more overflows are tested elsewhere. extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 minx001 minus '1' -> '-1' minx002 minus '-1' -> '1' minx003 minus '1.00' -> '-1.00' minx004 minus '-1.00' -> '1.00' minx005 minus '0' -> '0' minx006 minus '0.00' -> '0.00' minx007 minus '00.0' -> '0.0' minx008 minus '00.00' -> '0.00' minx009 minus '00' -> '0' minx010 minus '-2' -> '2' minx011 minus '2' -> '-2' minx012 minus '-2.00' -> '2.00' minx013 minus '2.00' -> '-2.00' minx014 minus '-0' -> '0' minx015 minus '-0.00' -> '0.00' minx016 minus '-00.0' -> '0.0' minx017 minus '-00.00' -> '0.00' minx018 minus '-00' -> '0' -- "lhs" zeros in plus and minus have exponent = operand minx020 minus '-0E3' -> '0E+3' minx021 minus '-0E2' -> '0E+2' minx022 minus '-0E1' -> '0E+1' minx023 minus '-0E0' -> '0' minx024 minus '+0E0' -> '0' minx025 minus '+0E1' -> '0E+1' minx026 minus '+0E2' -> '0E+2' minx027 minus '+0E3' -> '0E+3' minx030 minus '-5E3' -> '5E+3' minx031 minus '-5E8' -> '5E+8' minx032 minus '-5E13' -> '5E+13' minx033 minus '-5E18' -> '5E+18' minx034 minus '+5E3' -> '-5E+3' minx035 minus '+5E8' -> '-5E+8' minx036 minus '+5E13' -> '-5E+13' minx037 minus '+5E18' -> '-5E+18' minx050 minus '-2000000' -> '2000000' minx051 minus '2000000' -> '-2000000' precision: 7 minx052 minus '-2000000' -> '2000000' minx053 minus '2000000' -> '-2000000' precision: 6 minx054 minus '-2000000' -> '2.00000E+6' Rounded minx055 minus '2000000' -> '-2.00000E+6' Rounded precision: 3 minx056 minus '-2000000' -> '2.00E+6' Rounded minx057 minus '2000000' -> '-2.00E+6' Rounded -- more fixed, potential LHS swaps/overlays if done by 0 subtract x precision: 9 minx060 minus '56267E-10' -> '-0.0000056267' minx061 minus '56267E-5' -> '-0.56267' minx062 minus '56267E-2' -> '-562.67' minx063 minus '56267E-1' -> '-5626.7' minx065 minus '56267E-0' -> '-56267' minx066 minus '56267E+0' -> '-56267' minx067 minus '56267E+1' -> '-5.6267E+5' minx068 minus '56267E+2' -> '-5.6267E+6' minx069 minus '56267E+3' -> '-5.6267E+7' minx070 minus '56267E+4' -> '-5.6267E+8' minx071 minus '56267E+5' -> '-5.6267E+9' minx072 minus '56267E+6' -> '-5.6267E+10' minx080 minus '-56267E-10' -> '0.0000056267' minx081 minus '-56267E-5' -> '0.56267' minx082 minus '-56267E-2' -> '562.67' minx083 minus '-56267E-1' -> '5626.7' minx085 minus '-56267E-0' -> '56267' minx086 minus '-56267E+0' -> '56267' minx087 minus '-56267E+1' -> '5.6267E+5' minx088 minus '-56267E+2' -> '5.6267E+6' minx089 minus '-56267E+3' -> '5.6267E+7' minx090 minus '-56267E+4' -> '5.6267E+8' minx091 minus '-56267E+5' -> '5.6267E+9' minx092 minus '-56267E+6' -> '5.6267E+10' -- overflow tests maxexponent: 999999999 minexponent: -999999999 precision: 3 minx100 minus 9.999E+999999999 -> -Infinity Inexact Overflow Rounded minx101 minus -9.999E+999999999 -> Infinity Inexact Overflow Rounded -- subnormals and underflow precision: 3 maxexponent: 999 minexponent: -999 minx110 minus 1.00E-999 -> -1.00E-999 minx111 minus 0.1E-999 -> -1E-1000 Subnormal minx112 minus 0.10E-999 -> -1.0E-1000 Subnormal minx113 minus 0.100E-999 -> -1.0E-1000 Subnormal Rounded minx114 minus 0.01E-999 -> -1E-1001 Subnormal -- next is rounded to Emin minx115 minus 0.999E-999 -> -1.00E-999 Inexact Rounded Subnormal Underflow minx116 minus 0.099E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow minx117 minus 0.009E-999 -> -1E-1001 Inexact Rounded Subnormal Underflow minx118 minus 0.001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow minx119 minus 0.0009E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow minx120 minus 0.0001E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow minx130 minus -1.00E-999 -> 1.00E-999 minx131 minus -0.1E-999 -> 1E-1000 Subnormal minx132 minus -0.10E-999 -> 1.0E-1000 Subnormal minx133 minus -0.100E-999 -> 1.0E-1000 Subnormal Rounded minx134 minus -0.01E-999 -> 1E-1001 Subnormal -- next is rounded to Emin minx135 minus -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow minx136 minus -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow minx137 minus -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow minx138 minus -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow minx139 minus -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow minx140 minus -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -- long operand checks maxexponent: 999 minexponent: -999 precision: 9 minx301 minus 12345678000 -> -1.23456780E+10 Rounded minx302 minus 1234567800 -> -1.23456780E+9 Rounded minx303 minus 1234567890 -> -1.23456789E+9 Rounded minx304 minus 1234567891 -> -1.23456789E+9 Inexact Rounded minx305 minus 12345678901 -> -1.23456789E+10 Inexact Rounded minx306 minus 1234567896 -> -1.23456790E+9 Inexact Rounded precision: 15 -- still checking minx321 minus 12345678000 -> -12345678000 minx322 minus 1234567800 -> -1234567800 minx323 minus 1234567890 -> -1234567890 minx324 minus 1234567891 -> -1234567891 minx325 minus 12345678901 -> -12345678901 minx326 minus 1234567896 -> -1234567896 -- specials minx420 minus 'Inf' -> '-Infinity' minx421 minus '-Inf' -> 'Infinity' minx422 minus NaN -> NaN minx423 minus sNaN -> NaN Invalid_operation -- Null tests minx900 minus # -> NaN Invalid_operation --- NEW FILE: min.decTest --- ------------------------------------------------------------------------ -- min.decTest -- decimal minimum -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- we assume that base comparison is tested in compare.decTest, so -- these mainly cover special cases and rounding extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks mnmx001 min -2 -2 -> -2 mnmx002 min -2 -1 -> -2 mnmx003 min -2 0 -> -2 mnmx004 min -2 1 -> -2 mnmx005 min -2 2 -> -2 mnmx006 min -1 -2 -> -2 mnmx007 min -1 -1 -> -1 mnmx008 min -1 0 -> -1 mnmx009 min -1 1 -> -1 mnmx010 min -1 2 -> -1 mnmx011 min 0 -2 -> -2 mnmx012 min 0 -1 -> -1 mnmx013 min 0 0 -> 0 mnmx014 min 0 1 -> 0 mnmx015 min 0 2 -> 0 mnmx016 min 1 -2 -> -2 mnmx017 min 1 -1 -> -1 mnmx018 min 1 0 -> 0 mnmx019 min 1 1 -> 1 mnmx020 min 1 2 -> 1 mnmx021 min 2 -2 -> -2 mnmx022 min 2 -1 -> -1 mnmx023 min 2 0 -> 0 mnmx025 min 2 1 -> 1 mnmx026 min 2 2 -> 2 -- extended zeros mnmx030 min 0 0 -> 0 mnmx031 min 0 -0 -> 0 mnmx032 min 0 -0.0 -> 0 mnmx033 min 0 0.0 -> 0 mnmx034 min -0 0 -> -0 mnmx035 min -0 -0 -> -0 mnmx036 min -0 -0.0 -> -0 mnmx037 min -0 0.0 -> -0 mnmx038 min 0.0 0 -> 0.0 mnmx039 min 0.0 -0 -> 0.0 mnmx040 min 0.0 -0.0 -> 0.0 mnmx041 min 0.0 0.0 -> 0.0 mnmx042 min -0.0 0 -> -0.0 mnmx043 min -0.0 -0 -> -0.0 mnmx044 min -0.0 -0.0 -> -0.0 mnmx045 min -0.0 0.0 -> -0.0 mnmx046 min -0E1 0E2 -> -0E+1 mnmx047 min 0E2 0E1 -> 0E+2 mnmx048 min 0E1 0E2 -> 0E+1 mnmx049 min -0E3 -0E2 -> -0E+3 -- Specials precision: 9 mnmx090 min Inf -Inf -> -Infinity mnmx091 min Inf -1000 -> -1000 mnmx092 min Inf -1 -> -1 mnmx093 min Inf -0 -> -0 mnmx094 min Inf 0 -> 0 mnmx095 min Inf 1 -> 1 mnmx096 min Inf 1000 -> 1000 mnmx097 min Inf Inf -> Infinity mnmx098 min -1000 Inf -> -1000 mnmx099 min -Inf Inf -> -Infinity mnmx100 min -1 Inf -> -1 mnmx101 min -0 Inf -> -0 mnmx102 min 0 Inf -> 0 mnmx103 min 1 Inf -> 1 mnmx104 min 1000 Inf -> 1000 mnmx105 min Inf Inf -> Infinity mnmx120 min -Inf -Inf -> -Infinity mnmx121 min -Inf -1000 -> -Infinity mnmx122 min -Inf -1 -> -Infinity mnmx123 min -Inf -0 -> -Infinity mnmx124 min -Inf 0 -> -Infinity mnmx125 min -Inf 1 -> -Infinity mnmx126 min -Inf 1000 -> -Infinity mnmx127 min -Inf Inf -> -Infinity mnmx128 min -Inf -Inf -> -Infinity mnmx129 min -1000 -Inf -> -Infinity mnmx130 min -1 -Inf -> -Infinity mnmx131 min -0 -Inf -> -Infinity mnmx132 min 0 -Inf -> -Infinity mnmx133 min 1 -Inf -> -Infinity mnmx134 min 1000 -Inf -> -Infinity mnmx135 min Inf -Inf -> -Infinity mnmx141 min NaN -Inf -> NaN mnmx142 min NaN -1000 -> NaN mnmx143 min NaN -1 -> NaN mnmx144 min NaN -0 -> NaN mnmx145 min NaN 0 -> NaN mnmx146 min NaN 1 -> NaN mnmx147 min NaN 1000 -> NaN mnmx148 min NaN Inf -> NaN mnmx149 min NaN NaN -> NaN mnmx150 min -Inf NaN -> NaN mnmx151 min -1000 NaN -> NaN mnmx152 min -1 NaN -> NaN mnmx153 min -0 NaN -> NaN mnmx154 min 0 NaN -> NaN mnmx155 min 1 NaN -> NaN mnmx156 min 1000 NaN -> NaN mnmx157 min Inf NaN -> NaN mnmx161 min sNaN -Inf -> NaN Invalid_operation mnmx162 min sNaN -1000 -> NaN Invalid_operation mnmx163 min sNaN -1 -> NaN Invalid_operation mnmx164 min sNaN -0 -> NaN Invalid_operation mnmx165 min sNaN 0 -> NaN Invalid_operation mnmx166 min sNaN 1 -> NaN Invalid_operation mnmx167 min sNaN 1000 -> NaN Invalid_operation mnmx168 min sNaN NaN -> NaN Invalid_operation mnmx169 min sNaN sNaN -> NaN Invalid_operation mnmx170 min NaN sNaN -> NaN Invalid_operation mnmx171 min -Inf sNaN -> NaN Invalid_operation mnmx172 min -1000 sNaN -> NaN Invalid_operation mnmx173 min -1 sNaN -> NaN Invalid_operation mnmx174 min -0 sNaN -> NaN Invalid_operation mnmx175 min 0 sNaN -> NaN Invalid_operation mnmx176 min 1 sNaN -> NaN Invalid_operation mnmx177 min 1000 sNaN -> NaN Invalid_operation mnmx178 min Inf sNaN -> NaN Invalid_operation mnmx179 min NaN sNaN -> NaN Invalid_operation -- from examples mnmx180 min '3' '2' -> '2' mnmx181 min '-10' '3' -> '-10' mnmx182 min '1.0' '1' -> '1.0' mnmx183 min '1' '1.0' -> '1' -- rounding checks -- chosen is rounded, or not maxExponent: 999 minexponent: -999 precision: 9 mnmx201 min -12345678000 1 -> -1.23456780E+10 Rounded mnmx202 min 1 -12345678000 -> -1.23456780E+10 Rounded mnmx203 min -1234567800 1 -> -1.23456780E+9 Rounded mnmx204 min 1 -1234567800 -> -1.23456780E+9 Rounded mnmx205 min -1234567890 1 -> -1.23456789E+9 Rounded mnmx206 min 1 -1234567890 -> -1.23456789E+9 Rounded mnmx207 min -1234567891 1 -> -1.23456789E+9 Inexact Rounded mnmx208 min 1 -1234567891 -> -1.23456789E+9 Inexact Rounded mnmx209 min -12345678901 1 -> -1.23456789E+10 Inexact Rounded mnmx210 min 1 -12345678901 -> -1.23456789E+10 Inexact Rounded mnmx211 min -1234567896 1 -> -1.23456790E+9 Inexact Rounded mnmx212 min 1 -1234567896 -> -1.23456790E+9 Inexact Rounded mnmx213 min 1234567891 1 -> 1 mnmx214 min 1 1234567891 -> 1 mnmx215 min 12345678901 1 -> 1 mnmx216 min 1 12345678901 -> 1 mnmx217 min 1234567896 1 -> 1 mnmx218 min 1 1234567896 -> 1 precision: 15 mnmx221 min -12345678000 1 -> -12345678000 mnmx222 min 1 -12345678000 -> -12345678000 mnmx223 min -1234567800 1 -> -1234567800 mnmx224 min 1 -1234567800 -> -1234567800 mnmx225 min -1234567890 1 -> -1234567890 mnmx226 min 1 -1234567890 -> -1234567890 mnmx227 min -1234567891 1 -> -1234567891 mnmx228 min 1 -1234567891 -> -1234567891 mnmx229 min -12345678901 1 -> -12345678901 mnmx230 min 1 -12345678901 -> -12345678901 mnmx231 min -1234567896 1 -> -1234567896 mnmx232 min 1 -1234567896 -> -1234567896 mnmx233 min 1234567891 1 -> 1 mnmx234 min 1 1234567891 -> 1 mnmx235 min 12345678901 1 -> 1 mnmx236 min 1 12345678901 -> 1 mnmx237 min 1234567896 1 -> 1 mnmx238 min 1 1234567896 -> 1 -- overflow and underflow tests .. subnormal results [inputs] now allowed maxExponent: 999999999 minexponent: -999999999 mnmx330 min -1.23456789012345E-0 -9E+999999999 -> -9E+999999999 mnmx331 min -9E+999999999 -1.23456789012345E-0 -> -9E+999999999 mnmx332 min -0.100 -9E-999999999 -> -0.100 mnmx333 min -9E-999999999 -0.100 -> -0.100 mnmx335 min +1.23456789012345E-0 -9E+999999999 -> -9E+999999999 mnmx336 min -9E+999999999 1.23456789012345E-0 -> -9E+999999999 mnmx337 min +0.100 -9E-999999999 -> -9E-999999999 mnmx338 min -9E-999999999 0.100 -> -9E-999999999 mnmx339 min -1e-599999999 -1e-400000001 -> -1E-400000001 mnmx340 min -1e-599999999 -1e-400000000 -> -1E-400000000 mnmx341 min -1e-600000000 -1e-400000000 -> -1E-400000000 mnmx342 min -9e-999999998 -0.01 -> -0.01 mnmx343 min -9e-999999998 -0.1 -> -0.1 mnmx344 min -0.01 -9e-999999998 -> -0.01 mnmx345 min -1e599999999 -1e400000001 -> -1E+599999999 mnmx346 min -1e599999999 -1e400000000 -> -1E+599999999 mnmx347 min -1e600000000 -1e400000000 -> -1E+600000000 mnmx348 min -9e999999998 -100 -> -9E+999999998 mnmx349 min -9e999999998 -10 -> -9E+999999998 mnmx350 min -100 -9e999999998 -> -9E+999999998 -- signs mnmx351 min -1e+777777777 -1e+411111111 -> -1E+777777777 mnmx352 min -1e+777777777 +1e+411111111 -> -1E+777777777 mnmx353 min +1e+777777777 -1e+411111111 -> -1E+411111111 mnmx354 min +1e+777777777 +1e+411111111 -> 1E+411111111 mnmx355 min -1e-777777777 -1e-411111111 -> -1E-411111111 mnmx356 min -1e-777777777 +1e-411111111 -> -1E-777777777 mnmx357 min +1e-777777777 -1e-411111111 -> -1E-411111111 mnmx358 min +1e-777777777 +1e-411111111 -> 1E-777777777 -- overflow tests maxexponent: 999999999 minexponent: -999999999 precision: 3 mnmx400 min 9.999E+999999999 0 -> 0 mnmx401 min -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded -- subnormals and underflow precision: 3 maxexponent: 999 minexponent: -999 mnmx410 min 1.00E-999 0 -> 0 mnmx411 min 0.1E-999 0 -> 0 mnmx412 min 0.10E-999 0 -> 0 mnmx413 min 0.100E-999 0 -> 0 mnmx414 min 0.01E-999 0 -> 0 mnmx415 min 0.999E-999 0 -> 0 mnmx416 min 0.099E-999 0 -> 0 mnmx417 min 0.009E-999 0 -> 0 mnmx418 min 0.001E-999 0 -> 0 mnmx419 min 0.0009E-999 0 -> 0 mnmx420 min 0.0001E-999 0 -> 0 mnmx430 min -1.00E-999 0 -> -1.00E-999 mnmx431 min -0.1E-999 0 -> -1E-1000 Subnormal mnmx432 min -0.10E-999 0 -> -1.0E-1000 Subnormal mnmx433 min -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded mnmx434 min -0.01E-999 0 -> -1E-1001 Subnormal -- next is rounded to Emin mnmx435 min -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow mnmx436 min -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow mnmx437 min -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow mnmx438 min -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow mnmx439 min -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow mnmx440 min -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow -- Null tests mnm900 min 10 # -> NaN Invalid_operation mnm901 min # 10 -> NaN Invalid_operation --- NEW FILE: max.decTest --- ------------------------------------------------------------------------ -- max.decTest -- decimal maximum -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- we assume that base comparison is tested in compare.decTest, so -- these mainly cover special cases and rounding extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks maxx001 max -2 -2 -> -2 maxx002 max -2 -1 -> -1 maxx003 max -2 0 -> 0 maxx004 max -2 1 -> 1 maxx005 max -2 2 -> 2 maxx006 max -1 -2 -> -1 maxx007 max -1 -1 -> -1 maxx008 max -1 0 -> 0 maxx009 max -1 1 -> 1 maxx010 max -1 2 -> 2 maxx011 max 0 -2 -> 0 maxx012 max 0 -1 -> 0 maxx013 max 0 0 -> 0 maxx014 max 0 1 -> 1 maxx015 max 0 2 -> 2 maxx016 max 1 -2 -> 1 maxx017 max 1 -1 -> 1 maxx018 max 1 0 -> 1 maxx019 max 1 1 -> 1 maxx020 max 1 2 -> 2 maxx021 max 2 -2 -> 2 maxx022 max 2 -1 -> 2 maxx023 max 2 0 -> 2 maxx025 max 2 1 -> 2 maxx026 max 2 2 -> 2 -- extended zeros maxx030 max 0 0 -> 0 maxx031 max 0 -0 -> 0 maxx032 max 0 -0.0 -> 0 maxx033 max 0 0.0 -> 0 maxx034 max -0 0 -> -0 -- note: -0 = 0 maxx035 max -0 -0 -> -0 maxx036 max -0 -0.0 -> -0 maxx037 max -0 0.0 -> -0 maxx038 max 0.0 0 -> 0.0 maxx039 max 0.0 -0 -> 0.0 maxx040 max 0.0 -0.0 -> 0.0 maxx041 max 0.0 0.0 -> 0.0 maxx042 max -0.0 0 -> -0.0 maxx043 max -0.0 -0 -> -0.0 maxx044 max -0.0 -0.0 -> -0.0 maxx045 max -0.0 0.0 -> -0.0 maxx046 max -0E1 0E2 -> -0E+1 maxx047 max 0E2 0E1 -> 0E+2 maxx048 max 0E1 0E2 -> 0E+1 maxx049 max -0E3 -0E2 -> -0E+3 -- Specials precision: 9 maxx090 max Inf -Inf -> Infinity maxx091 max Inf -1000 -> Infinity maxx092 max Inf -1 -> Infinity maxx093 max Inf -0 -> Infinity maxx094 max Inf 0 -> Infinity maxx095 max Inf 1 -> Infinity maxx096 max Inf 1000 -> Infinity maxx097 max Inf Inf -> Infinity maxx098 max -1000 Inf -> Infinity maxx099 max -Inf Inf -> Infinity maxx100 max -1 Inf -> Infinity maxx101 max -0 Inf -> Infinity maxx102 max 0 Inf -> Infinity maxx103 max 1 Inf -> Infinity maxx104 max 1000 Inf -> Infinity maxx105 max Inf Inf -> Infinity maxx120 max -Inf -Inf -> -Infinity maxx121 max -Inf -1000 -> -1000 maxx122 max -Inf -1 -> -1 maxx123 max -Inf -0 -> -0 maxx124 max -Inf 0 -> 0 maxx125 max -Inf 1 -> 1 maxx126 max -Inf 1000 -> 1000 maxx127 max -Inf Inf -> Infinity maxx128 max -Inf -Inf -> -Infinity maxx129 max -1000 -Inf -> -1000 maxx130 max -1 -Inf -> -1 maxx131 max -0 -Inf -> -0 maxx132 max 0 -Inf -> 0 maxx133 max 1 -Inf -> 1 maxx134 max 1000 -Inf -> 1000 maxx135 max Inf -Inf -> Infinity maxx141 max NaN -Inf -> NaN maxx142 max NaN -1000 -> NaN maxx143 max NaN -1 -> NaN maxx144 max NaN -0 -> NaN maxx145 max NaN 0 -> NaN maxx146 max NaN 1 -> NaN maxx147 max NaN 1000 -> NaN maxx148 max NaN Inf -> NaN maxx149 max NaN NaN -> NaN maxx150 max -Inf NaN -> NaN maxx151 max -1000 NaN -> NaN maxx152 max -1 NaN -> NaN maxx153 max -0 NaN -> NaN maxx154 max 0 NaN -> NaN maxx155 max 1 NaN -> NaN maxx156 max 1000 NaN -> NaN maxx157 max Inf NaN -> NaN maxx161 max sNaN -Inf -> NaN Invalid_operation maxx162 max sNaN -1000 -> NaN Invalid_operation maxx163 max sNaN -1 -> NaN Invalid_operation maxx164 max sNaN -0 -> NaN Invalid_operation maxx165 max sNaN 0 -> NaN Invalid_operation maxx166 max sNaN 1 -> NaN Invalid_operation maxx167 max sNaN 1000 -> NaN Invalid_operation maxx168 max sNaN NaN -> NaN Invalid_operation maxx169 max sNaN sNaN -> NaN Invalid_operation maxx170 max NaN sNaN -> NaN Invalid_operation maxx171 max -Inf sNaN -> NaN Invalid_operation maxx172 max -1000 sNaN -> NaN Invalid_operation maxx173 max -1 sNaN -> NaN Invalid_operation maxx174 max -0 sNaN -> NaN Invalid_operation maxx175 max 0 sNaN -> NaN Invalid_operation maxx176 max 1 sNaN -> NaN Invalid_operation maxx177 max 1000 sNaN -> NaN Invalid_operation maxx178 max Inf sNaN -> NaN Invalid_operation maxx179 max NaN sNaN -> NaN Invalid_operation -- from examples maxx180 max '3' '2' -> '3' maxx181 max '-10' '3' -> '3' maxx182 max '1.0' '1' -> '1.0' maxx183 max '1' '1.0' -> '1' -- rounding checks maxexponent: 999 minexponent: -999 precision: 9 maxx201 max 12345678000 1 -> 1.23456780E+10 Rounded maxx202 max 1 12345678000 -> 1.23456780E+10 Rounded maxx203 max 1234567800 1 -> 1.23456780E+9 Rounded maxx204 max 1 1234567800 -> 1.23456780E+9 Rounded maxx205 max 1234567890 1 -> 1.23456789E+9 Rounded maxx206 max 1 1234567890 -> 1.23456789E+9 Rounded maxx207 max 1234567891 1 -> 1.23456789E+9 Inexact Rounded maxx208 max 1 1234567891 -> 1.23456789E+9 Inexact Rounded maxx209 max 12345678901 1 -> 1.23456789E+10 Inexact Rounded maxx210 max 1 12345678901 -> 1.23456789E+10 Inexact Rounded maxx211 max 1234567896 1 -> 1.23456790E+9 Inexact Rounded maxx212 max 1 1234567896 -> 1.23456790E+9 Inexact Rounded maxx213 max -1234567891 1 -> 1 maxx214 max 1 -1234567891 -> 1 maxx215 max -12345678901 1 -> 1 maxx216 max 1 -12345678901 -> 1 maxx217 max -1234567896 1 -> 1 maxx218 max 1 -1234567896 -> 1 precision: 15 maxx221 max 12345678000 1 -> 12345678000 maxx222 max 1 12345678000 -> 12345678000 maxx223 max 1234567800 1 -> 1234567800 maxx224 max 1 1234567800 -> 1234567800 maxx225 max 1234567890 1 -> 1234567890 maxx226 max 1 1234567890 -> 1234567890 maxx227 max 1234567891 1 -> 1234567891 maxx228 max 1 1234567891 -> 1234567891 maxx229 max 12345678901 1 -> 12345678901 maxx230 max 1 12345678901 -> 12345678901 maxx231 max 1234567896 1 -> 1234567896 maxx232 max 1 1234567896 -> 1234567896 maxx233 max -1234567891 1 -> 1 maxx234 max 1 -1234567891 -> 1 maxx235 max -12345678901 1 -> 1 maxx236 max 1 -12345678901 -> 1 maxx237 max -1234567896 1 -> 1 maxx238 max 1 -1234567896 -> 1 -- overflow and underflow tests ... maxExponent: 999999999 minexponent: -999999999 maxx330 max +1.23456789012345E-0 9E+999999999 -> 9E+999999999 maxx331 max 9E+999999999 +1.23456789012345E-0 -> 9E+999999999 maxx332 max +0.100 9E-999999999 -> 0.100 maxx333 max 9E-999999999 +0.100 -> 0.100 maxx335 max -1.23456789012345E-0 9E+999999999 -> 9E+999999999 maxx336 max 9E+999999999 -1.23456789012345E-0 -> 9E+999999999 maxx337 max -0.100 9E-999999999 -> 9E-999999999 maxx338 max 9E-999999999 -0.100 -> 9E-999999999 maxx339 max 1e-599999999 1e-400000001 -> 1E-400000001 maxx340 max 1e-599999999 1e-400000000 -> 1E-400000000 maxx341 max 1e-600000000 1e-400000000 -> 1E-400000000 maxx342 max 9e-999999998 0.01 -> 0.01 maxx343 max 9e-999999998 0.1 -> 0.1 maxx344 max 0.01 9e-999999998 -> 0.01 maxx345 max 1e599999999 1e400000001 -> 1E+599999999 maxx346 max 1e599999999 1e400000000 -> 1E+599999999 maxx347 max 1e600000000 1e400000000 -> 1E+600000000 maxx348 max 9e999999998 100 -> 9E+999999998 maxx349 max 9e999999998 10 -> 9E+999999998 maxx350 max 100 9e999999998 -> 9E+999999998 -- signs maxx351 max 1e+777777777 1e+411111111 -> 1E+777777777 maxx352 max 1e+777777777 -1e+411111111 -> 1E+777777777 maxx353 max -1e+777777777 1e+411111111 -> 1E+411111111 maxx354 max -1e+777777777 -1e+411111111 -> -1E+411111111 maxx355 max 1e-777777777 1e-411111111 -> 1E-411111111 maxx356 max 1e-777777777 -1e-411111111 -> 1E-777777777 maxx357 max -1e-777777777 1e-411111111 -> 1E-411111111 maxx358 max -1e-777777777 -1e-411111111 -> -1E-777777777 -- overflow tests maxexponent: 999999999 minexponent: -999999999 precision: 3 maxx400 max 9.999E+999999999 0 -> Infinity Inexact Overflow Rounded maxx401 max -9.999E+999999999 0 -> 0 -- subnormals and underflow precision: 3 maxexponent: 999 minexponent: -999 maxx410 max 1.00E-999 0 -> 1.00E-999 maxx411 max 0.1E-999 0 -> 1E-1000 Subnormal maxx412 max 0.10E-999 0 -> 1.0E-1000 Subnormal maxx413 max 0.100E-999 0 -> 1.0E-1000 Subnormal Rounded maxx414 max 0.01E-999 0 -> 1E-1001 Subnormal -- next is rounded to Emin maxx415 max 0.999E-999 0 -> 1.00E-999 Inexact Rounded Subnormal Underflow maxx416 max 0.099E-999 0 -> 1.0E-1000 Inexact Rounded Subnormal Underflow maxx417 max 0.009E-999 0 -> 1E-1001 Inexact Rounded Subnormal Underflow maxx418 max 0.001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow maxx419 max 0.0009E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow maxx420 max 0.0001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow maxx430 max -1.00E-999 0 -> 0 maxx431 max -0.1E-999 0 -> 0 maxx432 max -0.10E-999 0 -> 0 maxx433 max -0.100E-999 0 -> 0 maxx434 max -0.01E-999 0 -> 0 maxx435 max -0.999E-999 0 -> 0 maxx436 max -0.099E-999 0 -> 0 maxx437 max -0.009E-999 0 -> 0 maxx438 max -0.001E-999 0 -> 0 maxx439 max -0.0009E-999 0 -> 0 maxx440 max -0.0001E-999 0 -> 0 -- Null tests maxx900 max 10 # -> NaN Invalid_operation maxx901 max # 10 -> NaN Invalid_operation --- NEW FILE: integer.decTest --- ------------------------------------------------------------------------ -- integer.decTest -- round decimal to integer -- -- Copyright (c) IBM Corporation, 2001, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of tests tests the extended specification 'round-to-integer' -- operation (from IEEE 854). All non-zero results are defined as -- being those from either plus or rescale, so those are assumed to have -- been tested. extended: 1 precision: 9 rounding: half_up maxExponent: 999 minExponent: -999 intx001 integer 0 -> 0 intx002 integer 0.0 -> 0 intx003 integer 0.1 -> 0 Rounded Inexact intx004 integer 0.2 -> 0 Rounded Inexact intx005 integer 0.3 -> 0 Rounded Inexact intx006 integer 0.4 -> 0 Rounded Inexact intx007 integer 0.5 -> 1 Rounded Inexact intx008 integer 0.6 -> 1 Rounded Inexact intx009 integer 0.7 -> 1 Rounded Inexact intx010 integer 0.8 -> 1 Rounded Inexact intx011 integer 0.9 -> 1 Rounded Inexact intx012 integer 1 -> 1 intx013 integer 1.0 -> 1 Rounded intx014 integer 1.1 -> 1 Rounded Inexact intx015 integer 1.2 -> 1 Rounded Inexact intx016 integer 1.3 -> 1 Rounded Inexact intx017 integer 1.4 -> 1 Rounded Inexact intx018 integer 1.5 -> 2 Rounded Inexact intx019 integer 1.6 -> 2 Rounded Inexact intx020 integer 1.7 -> 2 Rounded Inexact intx021 integer 1.8 -> 2 Rounded Inexact intx022 integer 1.9 -> 2 Rounded Inexact -- negatives intx031 integer -0 -> -0 intx032 integer -0.0 -> -0 intx033 integer -0.1 -> -0 Rounded Inexact intx034 integer -0.2 -> -0 Rounded Inexact intx035 integer -0.3 -> -0 Rounded Inexact intx036 integer -0.4 -> -0 Rounded Inexact intx037 integer -0.5 -> -1 Rounded Inexact intx038 integer -0.6 -> -1 Rounded Inexact intx039 integer -0.7 -> -1 Rounded Inexact intx040 integer -0.8 -> -1 Rounded Inexact intx041 integer -0.9 -> -1 Rounded Inexact intx042 integer -1 -> -1 intx043 integer -1.0 -> -1 Rounded intx044 integer -1.1 -> -1 Rounded Inexact intx045 integer -1.2 -> -1 Rounded Inexact intx046 integer -1.3 -> -1 Rounded Inexact intx047 integer -1.4 -> -1 Rounded Inexact intx048 integer -1.5 -> -2 Rounded Inexact intx049 integer -1.6 -> -2 Rounded Inexact intx050 integer -1.7 -> -2 Rounded Inexact intx051 integer -1.8 -> -2 Rounded Inexact intx052 integer -1.9 -> -2 Rounded Inexact -- numbers around precision precision: 9 intx060 integer '56267E-10' -> '0' Inexact Rounded intx061 integer '56267E-5' -> '1' Inexact Rounded intx062 integer '56267E-2' -> '563' Inexact Rounded intx063 integer '56267E-1' -> '5627' Inexact Rounded intx065 integer '56267E-0' -> '56267' intx066 integer '56267E+0' -> '56267' intx067 integer '56267E+1' -> '562670' intx068 integer '56267E+2' -> '5626700' intx069 integer '56267E+3' -> '56267000' intx070 integer '56267E+4' -> '562670000' intx071 integer '56267E+5' -> Infinity Overflow Inexact Rounded intx072 integer '56267E+6' -> Infinity Overflow Inexact Rounded intx080 integer '-56267E-10' -> '-0' Inexact Rounded intx081 integer '-56267E-5' -> '-1' Inexact Rounded intx082 integer '-56267E-2' -> '-563' Inexact Rounded intx083 integer '-56267E-1' -> '-5627' Inexact Rounded intx085 integer '-56267E-0' -> '-56267' intx086 integer '-56267E+0' -> '-56267' intx087 integer '-56267E+1' -> '-562670' intx088 integer '-56267E+2' -> '-5626700' intx089 integer '-56267E+3' -> '-56267000' intx090 integer '-56267E+4' -> '-562670000' intx091 integer '-56267E+5' -> -Infinity Overflow Inexact Rounded intx092 integer '-56267E+6' -> -Infinity Overflow Inexact Rounded -- specials and zeros intx120 integer 'Inf' -> 'Infinity' intx121 integer '-Inf' -> '-Infinity' intx122 integer NaN -> NaN intx123 integer sNaN -> NaN Invalid_operation intx124 integer 0 -> 0 intx125 integer -0 -> -0 intx126 integer 0.000 -> 0 intx127 integer 0.00 -> 0 intx128 integer 0.0 -> 0 intx129 integer 0 -> 0 intx130 integer 0E-3 -> 0 intx131 integer 0E-2 -> 0 intx132 integer 0E-1 -> 0 intx133 integer 0E-0 -> 0 intx134 integer 0E+1 -> 0 intx135 integer 0E+2 -> 0 intx136 integer 0E+3 -> 0 intx137 integer 0E+4 -> 0 intx138 integer 0E+5 -> 0 intx139 integer -0.000 -> -0 intx140 integer -0.00 -> -0 intx141 integer -0.0 -> -0 intx142 integer -0 -> -0 intx143 integer -0E-3 -> -0 intx144 integer -0E-2 -> -0 intx145 integer -0E-1 -> -0 intx146 integer -0E-0 -> -0 intx147 integer -0E+1 -> -0 intx148 integer -0E+2 -> -0 intx149 integer -0E+3 -> -0 intx150 integer -0E+4 -> -0 intx151 integer -0E+5 -> -0 -- examples rounding: half_up precision: 9 intx200 integer 2.1 -> 2 Rounded Inexact intx201 integer 100 -> 100 intx202 integer 100.0 -> 100 Rounded intx203 integer 101.5 -> 102 Rounded Inexact intx204 integer -101.5 -> -102 Rounded Inexact intx205 integer 10E+5 -> 1000000 --- NEW FILE: inexact.decTest --- ------------------------------------------------------------------------ -- inexact.decTest -- decimal inexact and rounded edge cases -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 inx001 add 1 1 -> 2 inx002 add 123456789 0 -> 123456789 inx003 add 123456789 0.0 -> 123456789 Rounded inx004 add 123456789 0.00 -> 123456789 Rounded inx005 add 123456789 1 -> 123456790 inx006 add 123456789 0.1 -> 123456789 Inexact Rounded inx007 add 123456789 0.01 -> 123456789 Inexact Rounded inx008 add 123456789 0.001 -> 123456789 Inexact Rounded inx009 add 123456789 0.000001 -> 123456789 Inexact Rounded inx010 add 123456789 0.000000001 -> 123456789 Inexact Rounded inx011 add 123456789 0.000000000001 -> 123456789 Inexact Rounded inx012 add 123456789 0.9 -> 123456790 Inexact Rounded inx013 add 123456789 0.09 -> 123456789 Inexact Rounded inx014 add 123456789 0.009 -> 123456789 Inexact Rounded inx015 add 123456789 0.000009 -> 123456789 Inexact Rounded inx016 add 123456789 0.000000009 -> 123456789 Inexact Rounded inx017 add 123456789 0.000000000009 -> 123456789 Inexact Rounded inx021 add 1 -1 -> 0 inx022 add 123456789 -0 -> 123456789 inx023 add 123456789 -0.0 -> 123456789 Rounded inx024 add 123456789 -0.00 -> 123456789 Rounded inx025 add 123456789 -1 -> 123456788 inx026 add 123456789 -0.1 -> 123456789 Inexact Rounded inx027 add 123456789 -0.01 -> 123456789 Inexact Rounded inx028 add 123456789 -0.001 -> 123456789 Inexact Rounded inx029 add 123456789 -0.000001 -> 123456789 Inexact Rounded inx030 add 123456789 -0.000000001 -> 123456789 Inexact Rounded inx031 add 123456789 -0.000000000001 -> 123456789 Inexact Rounded inx032 add 123456789 -0.9 -> 123456788 Inexact Rounded inx033 add 123456789 -0.09 -> 123456789 Inexact Rounded inx034 add 123456789 -0.009 -> 123456789 Inexact Rounded inx035 add 123456789 -0.000009 -> 123456789 Inexact Rounded inx036 add 123456789 -0.000000009 -> 123456789 Inexact Rounded inx037 add 123456789 -0.000000000009 -> 123456789 Inexact Rounded inx042 add 0 123456789 -> 123456789 inx043 add 0.0 123456789 -> 123456789 Rounded inx044 add 0.00 123456789 -> 123456789 Rounded inx045 add 1 123456789 -> 123456790 inx046 add 0.1 123456789 -> 123456789 Inexact Rounded inx047 add 0.01 123456789 -> 123456789 Inexact Rounded inx048 add 0.001 123456789 -> 123456789 Inexact Rounded inx049 add 0.000001 123456789 -> 123456789 Inexact Rounded inx050 add 0.000000001 123456789 -> 123456789 Inexact Rounded inx051 add 0.000000000001 123456789 -> 123456789 Inexact Rounded inx052 add 0.9 123456789 -> 123456790 Inexact Rounded inx053 add 0.09 123456789 -> 123456789 Inexact Rounded inx054 add 0.009 123456789 -> 123456789 Inexact Rounded inx055 add 0.000009 123456789 -> 123456789 Inexact Rounded inx056 add 0.000000009 123456789 -> 123456789 Inexact Rounded inx057 add 0.000000000009 123456789 -> 123456789 Inexact Rounded inx062 add -0 123456789 -> 123456789 inx063 add -0.0 123456789 -> 123456789 Rounded inx064 add -0.00 123456789 -> 123456789 Rounded inx065 add -1 123456789 -> 123456788 inx066 add -0.1 123456789 -> 123456789 Inexact Rounded inx067 add -0.01 123456789 -> 123456789 Inexact Rounded inx068 add -0.001 123456789 -> 123456789 Inexact Rounded inx069 add -0.000001 123456789 -> 123456789 Inexact Rounded inx070 add -0.000000001 123456789 -> 123456789 Inexact Rounded inx071 add -0.000000000001 123456789 -> 123456789 Inexact Rounded inx072 add -0.9 123456789 -> 123456788 Inexact Rounded inx073 add -0.09 123456789 -> 123456789 Inexact Rounded inx074 add -0.009 123456789 -> 123456789 Inexact Rounded inx075 add -0.000009 123456789 -> 123456789 Inexact Rounded inx076 add -0.000000009 123456789 -> 123456789 Inexact Rounded inx077 add -0.000000000009 123456789 -> 123456789 Inexact Rounded -- some boundaries inx081 add 999999999 0 -> 999999999 inx082 add 0.999999999 0.000000000 -> 0.999999999 inx083 add 999999999 1 -> 1.00000000E+9 Rounded inx084 add 0.999999999 0.000000001 -> 1.00000000 Rounded inx085 add 999999999 2 -> 1.00000000E+9 Inexact Rounded inx086 add 0.999999999 0.000000002 -> 1.00000000 Inexact Rounded inx087 add 999999999 3 -> 1.00000000E+9 Inexact Rounded inx089 add 0.999999999 0.000000003 -> 1.00000000 Inexact Rounded -- minus, plus, and subtract all assumed to work like add. -- multiply precision: 8 inx101 multiply 1000 1000 -> 1000000 inx102 multiply 9000 9000 -> 81000000 inx103 multiply 9999 9999 -> 99980001 inx104 multiply 1000 10000 -> 10000000 inx105 multiply 10000 10000 -> 1.0000000E+8 Rounded inx106 multiply 10001 10000 -> 1.0001000E+8 Rounded inx107 multiply 10001 10001 -> 1.0002000E+8 Inexact Rounded inx108 multiply 10101 10001 -> 1.0102010E+8 Inexact Rounded inx109 multiply 10001 10101 -> 1.0102010E+8 Inexact Rounded -- divide precision: 4 inx201 divide 1000 1000 -> 1 inx202 divide 1000 1 -> 1000 inx203 divide 1000 2 -> 500 inx204 divide 1000 3 -> 333.3 Inexact Rounded inx205 divide 1000 4 -> 250 inx206 divide 1000 5 -> 200 inx207 divide 1000 6 -> 166.7 Inexact Rounded inx208 divide 1000 7 -> 142.9 Inexact Rounded inx209 divide 1000 8 -> 125 inx210 divide 1000 9 -> 111.1 Inexact Rounded inx211 divide 1000 10 -> 100 inx220 divide 1 1 -> 1 inx221 divide 1 2 -> 0.5 inx222 divide 1 4 -> 0.25 inx223 divide 1 8 -> 0.125 inx224 divide 1 16 -> 0.0625 inx225 divide 1 32 -> 0.03125 inx226 divide 1 64 -> 0.01563 Inexact Rounded inx227 divide 1 128 -> 0.007813 Inexact Rounded precision: 5 inx230 divide 1 1 -> 1 inx231 divide 1 2 -> 0.5 inx232 divide 1 4 -> 0.25 inx233 divide 1 8 -> 0.125 inx234 divide 1 16 -> 0.0625 inx235 divide 1 32 -> 0.03125 inx236 divide 1 64 -> 0.015625 inx237 divide 1 128 -> 0.0078125 precision: 3 inx240 divide 1 1 -> 1 inx241 divide 1 2 -> 0.5 inx242 divide 1 4 -> 0.25 inx243 divide 1 8 -> 0.125 inx244 divide 1 16 -> 0.0625 inx245 divide 1 32 -> 0.0313 Inexact Rounded inx246 divide 1 64 -> 0.0156 Inexact Rounded inx247 divide 1 128 -> 0.00781 Inexact Rounded precision: 2 inx250 divide 1 1 -> 1 inx251 divide 1 2 -> 0.5 inx252 divide 1 4 -> 0.25 inx253 divide 1 8 -> 0.13 Inexact Rounded inx254 divide 1 16 -> 0.063 Inexact Rounded inx255 divide 1 32 -> 0.031 Inexact Rounded inx256 divide 1 64 -> 0.016 Inexact Rounded inx257 divide 1 128 -> 0.0078 Inexact Rounded precision: 1 inx260 divide 1 1 -> 1 inx261 divide 1 2 -> 0.5 inx262 divide 1 4 -> 0.3 Inexact Rounded inx263 divide 1 8 -> 0.1 Inexact Rounded inx264 divide 1 16 -> 0.06 Inexact Rounded inx265 divide 1 32 -> 0.03 Inexact Rounded inx266 divide 1 64 -> 0.02 Inexact Rounded inx267 divide 1 128 -> 0.008 Inexact Rounded -- power precision: 4 inx301 power 0.5 2 -> 0.25 inx302 power 0.5 4 -> 0.0625 inx303 power 0.5 8 -> 0.003906 Inexact Rounded inx304 power 0.5 16 -> 0.00001526 Inexact Rounded inx305 power 0.5 32 -> 2.328E-10 Inexact Rounded -- compare, divideInteger, and remainder are always exact -- rescale precision: 4 inx401 rescale 0 0 -> 0 inx402 rescale 1 0 -> 1 inx403 rescale 0.1 +2 -> 0E+2 Inexact Rounded inx404 rescale 0.1 +1 -> 0E+1 Inexact Rounded inx405 rescale 0.1 0 -> 0 Inexact Rounded inx406 rescale 0.1 -1 -> 0.1 inx407 rescale 0.1 -2 -> 0.10 -- long operands cause rounding too precision: 9 inx801 plus 123456789 -> 123456789 inx802 plus 1234567890 -> 1.23456789E+9 Rounded inx803 plus 1234567891 -> 1.23456789E+9 Inexact Rounded inx804 plus 1234567892 -> 1.23456789E+9 Inexact Rounded inx805 plus 1234567899 -> 1.23456790E+9 Inexact Rounded inx806 plus 1234567900 -> 1.23456790E+9 Rounded --- NEW FILE: divideint.decTest --- ------------------------------------------------------------------------ -- divideint.decTest -- decimal integer division -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 dvix001 divideint 1 1 -> 1 dvix002 divideint 2 1 -> 2 dvix003 divideint 1 2 -> 0 dvix004 divideint 2 2 -> 1 dvix005 divideint 0 1 -> 0 dvix006 divideint 0 2 -> 0 dvix007 divideint 1 3 -> 0 dvix008 divideint 2 3 -> 0 dvix009 divideint 3 3 -> 1 dvix010 divideint 2.4 1 -> 2 dvix011 divideint 2.4 -1 -> -2 dvix012 divideint -2.4 1 -> -2 dvix013 divideint -2.4 -1 -> 2 dvix014 divideint 2.40 1 -> 2 dvix015 divideint 2.400 1 -> 2 dvix016 divideint 2.4 2 -> 1 dvix017 divideint 2.400 2 -> 1 dvix018 divideint 2. 2 -> 1 dvix019 divideint 20 20 -> 1 dvix020 divideint 187 187 -> 1 dvix021 divideint 5 2 -> 2 dvix022 divideint 5 2.0 -> 2 dvix023 divideint 5 2.000 -> 2 dvix024 divideint 5 0.200 -> 25 dvix025 divideint 5 0.200 -> 25 dvix030 divideint 1 2 -> 0 dvix031 divideint 1 4 -> 0 dvix032 divideint 1 8 -> 0 dvix033 divideint 1 16 -> 0 dvix034 divideint 1 32 -> 0 dvix035 divideint 1 64 -> 0 dvix040 divideint 1 -2 -> -0 dvix041 divideint 1 -4 -> -0 dvix042 divideint 1 -8 -> -0 dvix043 divideint 1 -16 -> -0 dvix044 divideint 1 -32 -> -0 dvix045 divideint 1 -64 -> -0 dvix050 divideint -1 2 -> -0 dvix051 divideint -1 4 -> -0 dvix052 divideint -1 8 -> -0 dvix053 divideint -1 16 -> -0 dvix054 divideint -1 32 -> -0 dvix055 divideint -1 64 -> -0 dvix060 divideint -1 -2 -> 0 dvix061 divideint -1 -4 -> 0 dvix062 divideint -1 -8 -> 0 dvix063 divideint -1 -16 -> 0 dvix064 divideint -1 -32 -> 0 dvix065 divideint -1 -64 -> 0 -- similar with powers of ten dvix160 divideint 1 1 -> 1 dvix161 divideint 1 10 -> 0 dvix162 divideint 1 100 -> 0 dvix163 divideint 1 1000 -> 0 dvix164 divideint 1 10000 -> 0 dvix165 divideint 1 100000 -> 0 dvix166 divideint 1 1000000 -> 0 dvix167 divideint 1 10000000 -> 0 dvix168 divideint 1 100000000 -> 0 dvix170 divideint 1 -1 -> -1 dvix171 divideint 1 -10 -> -0 dvix172 divideint 1 -100 -> -0 dvix173 divideint 1 -1000 -> -0 dvix174 divideint 1 -10000 -> -0 dvix175 divideint 1 -100000 -> -0 dvix176 divideint 1 -1000000 -> -0 dvix177 divideint 1 -10000000 -> -0 dvix178 divideint 1 -100000000 -> -0 dvix180 divideint -1 1 -> -1 dvix181 divideint -1 10 -> -0 dvix182 divideint -1 100 -> -0 dvix183 divideint -1 1000 -> -0 dvix184 divideint -1 10000 -> -0 dvix185 divideint -1 100000 -> -0 dvix186 divideint -1 1000000 -> -0 dvix187 divideint -1 10000000 -> -0 dvix188 divideint -1 100000000 -> -0 dvix190 divideint -1 -1 -> 1 dvix191 divideint -1 -10 -> 0 dvix192 divideint -1 -100 -> 0 dvix193 divideint -1 -1000 -> 0 dvix194 divideint -1 -10000 -> 0 dvix195 divideint -1 -100000 -> 0 dvix196 divideint -1 -1000000 -> 0 dvix197 divideint -1 -10000000 -> 0 dvix198 divideint -1 -100000000 -> 0 -- some long operand cases here dvix070 divideint 999999999 1 -> 999999999 dvix071 divideint 999999999.4 1 -> 999999999 dvix072 divideint 999999999.5 1 -> 999999999 dvix073 divideint 999999999.9 1 -> 999999999 dvix074 divideint 999999999.999 1 -> 999999999 precision: 6 dvix080 divideint 999999999 1 -> NaN Division_impossible dvix081 divideint 99999999 1 -> NaN Division_impossible dvix082 divideint 9999999 1 -> NaN Division_impossible dvix083 divideint 999999 1 -> 999999 dvix084 divideint 99999 1 -> 99999 dvix085 divideint 9999 1 -> 9999 dvix086 divideint 999 1 -> 999 dvix087 divideint 99 1 -> 99 dvix088 divideint 9 1 -> 9 precision: 9 dvix090 divideint 0. 1 -> 0 dvix091 divideint .0 1 -> 0 dvix092 divideint 0.00 1 -> 0 dvix093 divideint 0.00E+9 1 -> 0 dvix094 divideint 0.0000E-50 1 -> 0 dvix100 divideint 1 1 -> 1 dvix101 divideint 1 2 -> 0 dvix102 divideint 1 3 -> 0 dvix103 divideint 1 4 -> 0 dvix104 divideint 1 5 -> 0 dvix105 divideint 1 6 -> 0 dvix106 divideint 1 7 -> 0 dvix107 divideint 1 8 -> 0 dvix108 divideint 1 9 -> 0 dvix109 divideint 1 10 -> 0 dvix110 divideint 1 1 -> 1 dvix111 divideint 2 1 -> 2 dvix112 divideint 3 1 -> 3 dvix113 divideint 4 1 -> 4 dvix114 divideint 5 1 -> 5 dvix115 divideint 6 1 -> 6 dvix116 divideint 7 1 -> 7 dvix117 divideint 8 1 -> 8 dvix118 divideint 9 1 -> 9 dvix119 divideint 10 1 -> 10 -- from DiagBigDecimal dvix131 divideint 101.3 1 -> 101 dvix132 divideint 101.0 1 -> 101 dvix133 divideint 101.3 3 -> 33 dvix134 divideint 101.0 3 -> 33 dvix135 divideint 2.4 1 -> 2 dvix136 divideint 2.400 1 -> 2 dvix137 divideint 18 18 -> 1 dvix138 divideint 1120 1000 -> 1 dvix139 divideint 2.4 2 -> 1 dvix140 divideint 2.400 2 -> 1 dvix141 divideint 0.5 2.000 -> 0 dvix142 divideint 8.005 7 -> 1 dvix143 divideint 5 2 -> 2 dvix144 divideint 0 2 -> 0 dvix145 divideint 0.00 2 -> 0 -- Others dvix150 divideint 12345 4.999 -> 2469 dvix151 divideint 12345 4.99 -> 2473 dvix152 divideint 12345 4.9 -> 2519 dvix153 divideint 12345 5 -> 2469 dvix154 divideint 12345 5.1 -> 2420 dvix155 divideint 12345 5.01 -> 2464 dvix156 divideint 12345 5.001 -> 2468 dvix157 divideint 101 7.6 -> 13 -- Various flavours of divideint by 0 maxexponent: 999999999 minexponent: -999999999 dvix201 divideint 0 0 -> NaN Division_undefined dvix202 divideint 0.0E5 0 -> NaN Division_undefined dvix203 divideint 0.000 0 -> NaN Division_undefined dvix204 divideint 0.0001 0 -> Infinity Division_by_zero dvix205 divideint 0.01 0 -> Infinity Division_by_zero dvix206 divideint 0.1 0 -> Infinity Division_by_zero dvix207 divideint 1 0 -> Infinity Division_by_zero dvix208 divideint 1 0.0 -> Infinity Division_by_zero dvix209 divideint 10 0.0 -> Infinity Division_by_zero dvix210 divideint 1E+100 0.0 -> Infinity Division_by_zero dvix211 divideint 1E+1000 0 -> Infinity Division_by_zero dvix214 divideint -0.0001 0 -> -Infinity Division_by_zero dvix215 divideint -0.01 0 -> -Infinity Division_by_zero dvix216 divideint -0.1 0 -> -Infinity Division_by_zero dvix217 divideint -1 0 -> -Infinity Division_by_zero dvix218 divideint -1 0.0 -> -Infinity Division_by_zero dvix219 divideint -10 0.0 -> -Infinity Division_by_zero dvix220 divideint -1E+100 0.0 -> -Infinity Division_by_zero dvix221 divideint -1E+1000 0 -> -Infinity Division_by_zero -- test some cases that are close to exponent overflow maxexponent: 999999999 minexponent: -999999999 dvix270 divideint 1 1e999999999 -> 0 dvix271 divideint 1 0.9e999999999 -> 0 dvix272 divideint 1 0.99e999999999 -> 0 dvix273 divideint 1 0.999999999e999999999 -> 0 dvix274 divideint 9e999999999 1 -> NaN Division_impossible dvix275 divideint 9.9e999999999 1 -> NaN Division_impossible dvix276 divideint 9.99e999999999 1 -> NaN Division_impossible dvix277 divideint 9.99999999e999999999 1 -> NaN Division_impossible dvix280 divideint 0.1 9e-999999999 -> NaN Division_impossible dvix281 divideint 0.1 99e-999999999 -> NaN Division_impossible dvix282 divideint 0.1 999e-999999999 -> NaN Division_impossible dvix283 divideint 0.1 9e-999999998 -> NaN Division_impossible dvix284 divideint 0.1 99e-999999998 -> NaN Division_impossible dvix285 divideint 0.1 999e-999999998 -> NaN Division_impossible dvix286 divideint 0.1 999e-999999997 -> NaN Division_impossible dvix287 divideint 0.1 9999e-999999997 -> NaN Division_impossible dvix288 divideint 0.1 99999e-999999997 -> NaN Division_impossible -- overflow and underflow tests [from divide] maxexponent: 999999999 minexponent: -999999999 dvix330 divideint +1.23456789012345E-0 9E+999999999 -> 0 dvix331 divideint 9E+999999999 +0.23456789012345E-0 -> NaN Division_impossible dvix332 divideint +0.100 9E+999999999 -> 0 dvix333 divideint 9E-999999999 +9.100 -> 0 dvix335 divideint -1.23456789012345E-0 9E+999999999 -> -0 dvix336 divideint 9E+999999999 -0.83456789012345E-0 -> NaN Division_impossible dvix337 divideint -0.100 9E+999999999 -> -0 dvix338 divideint 9E-999999999 -9.100 -> -0 -- long operand checks maxexponent: 999 minexponent: -999 precision: 9 dvix401 divideint 12345678000 100 -> 123456780 dvix402 divideint 1 12345678000 -> 0 dvix403 divideint 1234567800 10 -> 123456780 dvix404 divideint 1 1234567800 -> 0 dvix405 divideint 1234567890 10 -> 123456789 dvix406 divideint 1 1234567890 -> 0 dvix407 divideint 1234567891 10 -> 123456789 dvix408 divideint 1 1234567891 -> 0 dvix409 divideint 12345678901 100 -> 123456789 dvix410 divideint 1 12345678901 -> 0 dvix411 divideint 1234567896 10 -> 123456789 dvix412 divideint 1 1234567896 -> 0 dvix413 divideint 12345678948 100 -> 123456789 dvix414 divideint 12345678949 100 -> 123456789 dvix415 divideint 12345678950 100 -> 123456789 dvix416 divideint 12345678951 100 -> 123456789 dvix417 divideint 12345678999 100 -> 123456789 precision: 15 dvix441 divideint 12345678000 1 -> 12345678000 dvix442 divideint 1 12345678000 -> 0 dvix443 divideint 1234567800 1 -> 1234567800 dvix444 divideint 1 1234567800 -> 0 dvix445 divideint 1234567890 1 -> 1234567890 dvix446 divideint 1 1234567890 -> 0 dvix447 divideint 1234567891 1 -> 1234567891 dvix448 divideint 1 1234567891 -> 0 dvix449 divideint 12345678901 1 -> 12345678901 dvix450 divideint 1 12345678901 -> 0 dvix451 divideint 1234567896 1 -> 1234567896 dvix452 divideint 1 1234567896 -> 0 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- more zeros, etc. dvix531 divideint 5.00 1E-3 -> 5000 dvix532 divideint 00.00 0.000 -> NaN Division_undefined dvix533 divideint 00.00 0E-3 -> NaN Division_undefined dvix534 divideint 0 -0 -> NaN Division_undefined dvix535 divideint -0 0 -> NaN Division_undefined dvix536 divideint -0 -0 -> NaN Division_undefined dvix541 divideint 0 -1 -> -0 dvix542 divideint -0 -1 -> 0 dvix543 divideint 0 1 -> 0 dvix544 divideint -0 1 -> -0 dvix545 divideint -1 0 -> -Infinity Division_by_zero dvix546 divideint -1 -0 -> Infinity Division_by_zero dvix547 divideint 1 0 -> Infinity Division_by_zero dvix548 divideint 1 -0 -> -Infinity Division_by_zero dvix551 divideint 0.0 -1 -> -0 dvix552 divideint -0.0 -1 -> 0 dvix553 divideint 0.0 1 -> 0 dvix554 divideint -0.0 1 -> -0 dvix555 divideint -1.0 0 -> -Infinity Division_by_zero dvix556 divideint -1.0 -0 -> Infinity Division_by_zero dvix557 divideint 1.0 0 -> Infinity Division_by_zero dvix558 divideint 1.0 -0 -> -Infinity Division_by_zero dvix561 divideint 0 -1.0 -> -0 dvix562 divideint -0 -1.0 -> 0 dvix563 divideint 0 1.0 -> 0 dvix564 divideint -0 1.0 -> -0 dvix565 divideint -1 0.0 -> -Infinity Division_by_zero dvix566 divideint -1 -0.0 -> Infinity Division_by_zero dvix567 divideint 1 0.0 -> Infinity Division_by_zero dvix568 divideint 1 -0.0 -> -Infinity Division_by_zero dvix571 divideint 0.0 -1.0 -> -0 dvix572 divideint -0.0 -1.0 -> 0 dvix573 divideint 0.0 1.0 -> 0 dvix574 divideint -0.0 1.0 -> -0 dvix575 divideint -1.0 0.0 -> -Infinity Division_by_zero dvix576 divideint -1.0 -0.0 -> Infinity Division_by_zero dvix577 divideint 1.0 0.0 -> Infinity Division_by_zero dvix578 divideint 1.0 -0.0 -> -Infinity Division_by_zero -- Specials dvix580 divideint Inf -Inf -> NaN Invalid_operation dvix581 divideint Inf -1000 -> -Infinity dvix582 divideint Inf -1 -> -Infinity dvix583 divideint Inf -0 -> -Infinity Division_by_zero dvix584 divideint Inf 0 -> Infinity Division_by_zero dvix585 divideint Inf 1 -> Infinity dvix586 divideint Inf 1000 -> Infinity dvix587 divideint Inf Inf -> NaN Invalid_operation dvix588 divideint -1000 Inf -> -0 dvix589 divideint -Inf Inf -> NaN Invalid_operation dvix590 divideint -1 Inf -> -0 dvix591 divideint -0 Inf -> -0 dvix592 divideint 0 Inf -> 0 dvix593 divideint 1 Inf -> 0 dvix594 divideint 1000 Inf -> 0 dvix595 divideint Inf Inf -> NaN Invalid_operation dvix600 divideint -Inf -Inf -> NaN Invalid_operation dvix601 divideint -Inf -1000 -> Infinity dvix602 divideint -Inf -1 -> Infinity dvix603 divideint -Inf -0 -> Infinity Division_by_zero dvix604 divideint -Inf 0 -> -Infinity Division_by_zero dvix605 divideint -Inf 1 -> -Infinity dvix606 divideint -Inf 1000 -> -Infinity dvix607 divideint -Inf Inf -> NaN Invalid_operation dvix608 divideint -1000 Inf -> -0 dvix609 divideint -Inf -Inf -> NaN Invalid_operation dvix610 divideint -1 -Inf -> 0 dvix611 divideint -0 -Inf -> 0 dvix612 divideint 0 -Inf -> -0 dvix613 divideint 1 -Inf -> -0 dvix614 divideint 1000 -Inf -> -0 dvix615 divideint Inf -Inf -> NaN Invalid_operation dvix621 divideint NaN -Inf -> NaN dvix622 divideint NaN -1000 -> NaN dvix623 divideint NaN -1 -> NaN dvix624 divideint NaN -0 -> NaN dvix625 divideint NaN 0 -> NaN dvix626 divideint NaN 1 -> NaN dvix627 divideint NaN 1000 -> NaN dvix628 divideint NaN Inf -> NaN dvix629 divideint NaN NaN -> NaN dvix630 divideint -Inf NaN -> NaN dvix631 divideint -1000 NaN -> NaN dvix632 divideint -1 NaN -> NaN dvix633 divideint -0 NaN -> NaN dvix634 divideint 0 NaN -> NaN dvix635 divideint 1 NaN -> NaN dvix636 divideint 1000 NaN -> NaN dvix637 divideint Inf NaN -> NaN dvix641 divideint sNaN -Inf -> NaN Invalid_operation dvix642 divideint sNaN -1000 -> NaN Invalid_operation dvix643 divideint sNaN -1 -> NaN Invalid_operation dvix644 divideint sNaN -0 -> NaN Invalid_operation dvix645 divideint sNaN 0 -> NaN Invalid_operation dvix646 divideint sNaN 1 -> NaN Invalid_operation dvix647 divideint sNaN 1000 -> NaN Invalid_operation dvix648 divideint sNaN NaN -> NaN Invalid_operation dvix649 divideint sNaN sNaN -> NaN Invalid_operation dvix650 divideint NaN sNaN -> NaN Invalid_operation dvix651 divideint -Inf sNaN -> NaN Invalid_operation dvix652 divideint -1000 sNaN -> NaN Invalid_operation dvix653 divideint -1 sNaN -> NaN Invalid_operation dvix654 divideint -0 sNaN -> NaN Invalid_operation dvix655 divideint 0 sNaN -> NaN Invalid_operation dvix656 divideint 1 sNaN -> NaN Invalid_operation dvix657 divideint 1000 sNaN -> NaN Invalid_operation dvix658 divideint Inf sNaN -> NaN Invalid_operation dvix659 divideint NaN sNaN -> NaN Invalid_operation -- some long operand cases again precision: 8 dvix660 divideint 100000001 1 -> NaN Division_impossible dvix661 divideint 100000000.4 1 -> NaN Division_impossible dvix662 divideint 100000000.5 1 -> NaN Division_impossible dvix663 divideint 100000000.9 1 -> NaN Division_impossible dvix664 divideint 100000000.999 1 -> NaN Division_impossible precision: 6 dvix690 divideint 100000000 1 -> NaN Division_impossible dvix691 divideint 10000000 1 -> NaN Division_impossible dvix692 divideint 1000000 1 -> NaN Division_impossible dvix693 divideint 100000 1 -> 100000 dvix694 divideint 10000 1 -> 10000 dvix695 divideint 1000 1 -> 1000 dvix696 divideint 100 1 -> 100 dvix697 divideint 10 1 -> 10 dvix698 divideint 1 1 -> 1 precision: 9 maxexponent: 999999999 minexponent: -999999999 dvix672 divideint 1 0.99e999999999 -> 0 dvix673 divideint 1 0.999999999e999999999 -> 0 dvix674 divideint 9e999999999 1 -> NaN Division_impossible dvix675 divideint 9.9e999999999 1 -> NaN Division_impossible dvix676 divideint 9.99e999999999 1 -> NaN Division_impossible dvix677 divideint 9.99999999e999999999 1 -> NaN Division_impossible dvix680 divideint 0.1 9e-999999999 -> NaN Division_impossible dvix681 divideint 0.1 99e-999999999 -> NaN Division_impossible dvix682 divideint 0.1 999e-999999999 -> NaN Division_impossible dvix683 divideint 0.1 9e-999999998 -> NaN Division_impossible dvix684 divideint 0.1 99e-999999998 -> NaN Division_impossible dvix685 divideint 0.1 999e-999999998 -> NaN Division_impossible dvix686 divideint 0.1 999e-999999997 -> NaN Division_impossible dvix687 divideint 0.1 9999e-999999997 -> NaN Division_impossible dvix688 divideint 0.1 99999e-999999997 -> NaN Division_impossible -- Null tests dvix900 divideint 10 # -> NaN Invalid_operation dvix901 divideint # 10 -> NaN Invalid_operation --- NEW FILE: divide.decTest --- ------------------------------------------------------------------------ -- divide.decTest -- decimal division -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks divx001 divide 1 1 -> 1 divx002 divide 2 1 -> 2 divx003 divide 1 2 -> 0.5 divx004 divide 2 2 -> 1 divx005 divide 0 1 -> 0 divx006 divide 0 2 -> 0 divx007 divide 1 3 -> 0.333333333 Inexact Rounded divx008 divide 2 3 -> 0.666666667 Inexact Rounded divx009 divide 3 3 -> 1 divx010 divide 2.4 1 -> 2.4 divx011 divide 2.4 -1 -> -2.4 divx012 divide -2.4 1 -> -2.4 divx013 divide -2.4 -1 -> 2.4 divx014 divide 2.40 1 -> 2.40 divx015 divide 2.400 1 -> 2.400 divx016 divide 2.4 2 -> 1.2 divx017 divide 2.400 2 -> 1.200 divx018 divide 2. 2 -> 1 divx019 divide 20 20 -> 1 divx020 divide 187 187 -> 1 divx021 divide 5 2 -> 2.5 divx022 divide 5 2.0 -> 2.5 divx023 divide 5 2.000 -> 2.5 divx024 divide 5 0.20 -> 25 divx025 divide 5 0.200 -> 25 divx026 divide 10 1 -> 10 divx027 divide 100 1 -> 100 divx028 divide 1000 1 -> 1000 divx029 divide 1000 100 -> 10 divx030 divide 1 2 -> 0.5 divx031 divide 1 4 -> 0.25 divx032 divide 1 8 -> 0.125 divx033 divide 1 16 -> 0.0625 divx034 divide 1 32 -> 0.03125 divx035 divide 1 64 -> 0.015625 divx040 divide 1 -2 -> -0.5 divx041 divide 1 -4 -> -0.25 divx042 divide 1 -8 -> -0.125 divx043 divide 1 -16 -> -0.0625 divx044 divide 1 -32 -> -0.03125 divx045 divide 1 -64 -> -0.015625 divx050 divide -1 2 -> -0.5 divx051 divide -1 4 -> -0.25 divx052 divide -1 8 -> -0.125 divx053 divide -1 16 -> -0.0625 divx054 divide -1 32 -> -0.03125 divx055 divide -1 64 -> -0.015625 divx060 divide -1 -2 -> 0.5 divx061 divide -1 -4 -> 0.25 divx062 divide -1 -8 -> 0.125 divx063 divide -1 -16 -> 0.0625 divx064 divide -1 -32 -> 0.03125 divx065 divide -1 -64 -> 0.015625 divx070 divide 999999999 1 -> 999999999 divx071 divide 999999999.4 1 -> 999999999 Inexact Rounded divx072 divide 999999999.5 1 -> 1.00000000E+9 Inexact Rounded divx073 divide 999999999.9 1 -> 1.00000000E+9 Inexact Rounded divx074 divide 999999999.999 1 -> 1.00000000E+9 Inexact Rounded precision: 6 divx080 divide 999999999 1 -> 1.00000E+9 Inexact Rounded divx081 divide 99999999 1 -> 1.00000E+8 Inexact Rounded divx082 divide 9999999 1 -> 1.00000E+7 Inexact Rounded divx083 divide 999999 1 -> 999999 divx084 divide 99999 1 -> 99999 divx085 divide 9999 1 -> 9999 divx086 divide 999 1 -> 999 divx087 divide 99 1 -> 99 divx088 divide 9 1 -> 9 precision: 9 divx090 divide 0. 1 -> 0 divx091 divide .0 1 -> 0.0 divx092 divide 0.00 1 -> 0.00 divx093 divide 0.00E+9 1 -> 0E+7 divx094 divide 0.0000E-50 1 -> 0E-54 divx095 divide 1 1E-8 -> 1E+8 divx096 divide 1 1E-9 -> 1E+9 divx097 divide 1 1E-10 -> 1E+10 divx098 divide 1 1E-11 -> 1E+11 divx099 divide 1 1E-12 -> 1E+12 divx100 divide 1 1 -> 1 divx101 divide 1 2 -> 0.5 divx102 divide 1 3 -> 0.333333333 Inexact Rounded divx103 divide 1 4 -> 0.25 divx104 divide 1 5 -> 0.2 divx105 divide 1 6 -> 0.166666667 Inexact Rounded divx106 divide 1 7 -> 0.142857143 Inexact Rounded divx107 divide 1 8 -> 0.125 divx108 divide 1 9 -> 0.111111111 Inexact Rounded divx109 divide 1 10 -> 0.1 divx110 divide 1 1 -> 1 divx111 divide 2 1 -> 2 divx112 divide 3 1 -> 3 divx113 divide 4 1 -> 4 divx114 divide 5 1 -> 5 divx115 divide 6 1 -> 6 divx116 divide 7 1 -> 7 divx117 divide 8 1 -> 8 divx118 divide 9 1 -> 9 divx119 divide 10 1 -> 10 divx130 divide 12345 4.999 -> 2469.49390 Inexact Rounded divx131 divide 12345 4.99 -> 2473.94790 Inexact Rounded divx132 divide 12345 4.9 -> 2519.38776 Inexact Rounded divx133 divide 12345 5 -> 2469 divx134 divide 12345 5.1 -> 2420.58824 Inexact Rounded divx135 divide 12345 5.01 -> 2464.07186 Inexact Rounded divx136 divide 12345 5.001 -> 2468.50630 Inexact Rounded precision: 9 maxexponent: 999999999 minexponent: -999999999 -- test possibly imprecise results divx220 divide 391 597 -> 0.654941374 Inexact Rounded divx221 divide 391 -597 -> -0.654941374 Inexact Rounded divx222 divide -391 597 -> -0.654941374 Inexact Rounded divx223 divide -391 -597 -> 0.654941374 Inexact Rounded -- test some cases that are close to exponent overflow maxexponent: 999999999 minexponent: -999999999 divx270 divide 1 1e999999999 -> 1E-999999999 divx271 divide 1 0.9e999999999 -> 1.11111111E-999999999 Inexact Rounded divx272 divide 1 0.99e999999999 -> 1.01010101E-999999999 Inexact Rounded divx273 divide 1 0.999999999e999999999 -> 1.00000000E-999999999 Inexact Rounded divx274 divide 9e999999999 1 -> 9E+999999999 divx275 divide 9.9e999999999 1 -> 9.9E+999999999 divx276 divide 9.99e999999999 1 -> 9.99E+999999999 divx277 divide 9.99999999e999999999 1 -> 9.99999999E+999999999 divx280 divide 0.1 9e-999999999 -> 1.11111111E+999999997 Inexact Rounded divx281 divide 0.1 99e-999999999 -> 1.01010101E+999999996 Inexact Rounded divx282 divide 0.1 999e-999999999 -> 1.00100100E+999999995 Inexact Rounded divx283 divide 0.1 9e-999999998 -> 1.11111111E+999999996 Inexact Rounded divx284 divide 0.1 99e-999999998 -> 1.01010101E+999999995 Inexact Rounded divx285 divide 0.1 999e-999999998 -> 1.00100100E+999999994 Inexact Rounded divx286 divide 0.1 999e-999999997 -> 1.00100100E+999999993 Inexact Rounded divx287 divide 0.1 9999e-999999997 -> 1.00010001E+999999992 Inexact Rounded divx288 divide 0.1 99999e-999999997 -> 1.00001000E+999999991 Inexact Rounded -- Divide into 0 tests divx301 divide 0 7 -> 0 divx302 divide 0 7E-5 -> 0E+5 divx303 divide 0 7E-1 -> 0E+1 divx304 divide 0 7E+1 -> 0.0 divx305 divide 0 7E+5 -> 0.00000 divx306 divide 0 7E+6 -> 0.000000 divx307 divide 0 7E+7 -> 0E-7 divx308 divide 0 70E-5 -> 0E+4 divx309 divide 0 70E-1 -> 0 divx310 divide 0 70E+0 -> 0.0 divx311 divide 0 70E+1 -> 0.00 divx312 divide 0 70E+5 -> 0.000000 divx313 divide 0 70E+6 -> 0E-7 divx314 divide 0 70E+7 -> 0E-8 divx315 divide 0 700E-5 -> 0E+3 divx316 divide 0 700E-1 -> 0.0 divx317 divide 0 700E+0 -> 0.00 divx318 divide 0 700E+1 -> 0.000 divx319 divide 0 700E+5 -> 0E-7 divx320 divide 0 700E+6 -> 0E-8 divx321 divide 0 700E+7 -> 0E-9 divx331 divide 0E-3 7E-5 -> 0E+2 divx332 divide 0E-3 7E-1 -> 0.00 divx333 divide 0E-3 7E+1 -> 0.0000 divx334 divide 0E-3 7E+5 -> 0E-8 divx335 divide 0E-1 7E-5 -> 0E+4 divx336 divide 0E-1 7E-1 -> 0 divx337 divide 0E-1 7E+1 -> 0.00 divx338 divide 0E-1 7E+5 -> 0.000000 divx339 divide 0E+1 7E-5 -> 0E+6 divx340 divide 0E+1 7E-1 -> 0E+2 divx341 divide 0E+1 7E+1 -> 0 divx342 divide 0E+1 7E+5 -> 0.0000 divx343 divide 0E+3 7E-5 -> 0E+8 divx344 divide 0E+3 7E-1 -> 0E+4 divx345 divide 0E+3 7E+1 -> 0E+2 divx346 divide 0E+3 7E+5 -> 0.00 maxexponent: 92 minexponent: -92 precision: 7 divx351 divide 0E-92 7E-1 -> 0E-91 divx352 divide 0E-92 7E+1 -> 0E-93 divx353 divide 0E-92 7E+5 -> 0E-97 divx354 divide 0E-92 7E+6 -> 0E-98 divx355 divide 0E-92 7E+7 -> 0E-98 Clamped divx356 divide 0E-92 777E-1 -> 0E-93 divx357 divide 0E-92 777E+1 -> 0E-95 divx358 divide 0E-92 777E+3 -> 0E-97 divx359 divide 0E-92 777E+4 -> 0E-98 divx360 divide 0E-92 777E+5 -> 0E-98 Clamped divx361 divide 0E+92 7E+1 -> 0E+91 divx362 divide 0E+92 7E+0 -> 0E+92 divx363 divide 0E+92 7E-1 -> 0E+92 Clamped divx364 divide 0E+92 777E+1 -> 0E+89 divx365 divide 0E+92 777E-1 -> 0E+91 divx366 divide 0E+92 777E-2 -> 0E+92 divx367 divide 0E+92 777E-3 -> 0E+92 Clamped divx368 divide 0E+92 777E-4 -> 0E+92 Clamped -- input rounding checks maxexponent: 999 minexponent: -999 precision: 9 divx401 divide 12345678000 1 -> 1.23456780E+10 Rounded divx402 divide 1 12345678000 -> 8.10000066E-11 Inexact Rounded divx403 divide 1234567800 1 -> 1.23456780E+9 Rounded divx404 divide 1 1234567800 -> 8.10000066E-10 Inexact Rounded divx405 divide 1234567890 1 -> 1.23456789E+9 Rounded divx406 divide 1 1234567890 -> 8.10000007E-10 Inexact Rounded divx407 divide 1234567891 1 -> 1.23456789E+9 Inexact Rounded divx408 divide 1 1234567891 -> 8.10000007E-10 Inexact Rounded divx409 divide 12345678901 1 -> 1.23456789E+10 Inexact Rounded divx410 divide 1 12345678901 -> 8.10000007E-11 Inexact Rounded divx411 divide 1234567896 1 -> 1.23456790E+9 Inexact Rounded divx412 divide 1 1234567896 -> 8.10000003E-10 Inexact Rounded divx413 divide 1 1234567897 -> 8.10000003E-10 Inexact Rounded divx414 divide 1 1234567898 -> 8.10000002E-10 Inexact Rounded divx415 divide 1 1234567899 -> 8.10000001E-10 Inexact Rounded divx416 divide 1 1234567900 -> 8.10000001E-10 Inexact Rounded divx417 divide 1 1234567901 -> 8.10000000E-10 Inexact Rounded divx418 divide 1 1234567902 -> 8.09999999E-10 Inexact Rounded -- some longies divx421 divide 1234567896.000000000000 1 -> 1.23456790E+9 Inexact Rounded divx422 divide 1 1234567896.000000000000 -> 8.10000003E-10 Inexact Rounded divx423 divide 1234567896.000000000001 1 -> 1.23456790E+9 Inexact Rounded divx424 divide 1 1234567896.000000000001 -> 8.10000003E-10 Inexact Rounded divx425 divide 1234567896.000000000000000000000000000000000000000009 1 -> 1.23456790E+9 Inexact Rounded divx426 divide 1 1234567896.000000000000000000000000000000000000000009 -> 8.10000003E-10 Inexact Rounded divx427 divide 1234567897.900010000000000000000000000000000000000009 1 -> 1.23456790E+9 Inexact Rounded divx428 divide 1 1234567897.900010000000000000000000000000000000000009 -> 8.10000002E-10 Inexact Rounded precision: 15 -- still checking... divx441 divide 12345678000 1 -> 12345678000 divx442 divide 1 12345678000 -> 8.10000066420005E-11 Inexact Rounded divx443 divide 1234567800 1 -> 1234567800 divx444 divide 1 1234567800 -> 8.10000066420005E-10 Inexact Rounded divx445 divide 1234567890 1 -> 1234567890 divx446 divide 1 1234567890 -> 8.10000007371000E-10 Inexact Rounded divx447 divide 1234567891 1 -> 1234567891 divx448 divide 1 1234567891 -> 8.10000006714900E-10 Inexact Rounded divx449 divide 12345678901 1 -> 12345678901 divx450 divide 1 12345678901 -> 8.10000007305390E-11 Inexact Rounded divx451 divide 1234567896 1 -> 1234567896 divx452 divide 1 1234567896 -> 8.10000003434400E-10 Inexact Rounded -- some suggested by Dan Zuras divx460 divide 3e0 2e0 -> 1.5 divx461 divide 30e-1 2e0 -> 1.5 divx462 divide 300e-2 2e0 -> 1.50 divx464 divide 3000e-3 2e0 -> 1.500 divx465 divide 3e0 20e-1 -> 1.5 divx466 divide 30e-1 20e-1 -> 1.5 divx467 divide 300e-2 20e-1 -> 1.5 divx468 divide 3000e-3 20e-1 -> 1.50 divx469 divide 3e0 200e-2 -> 1.5 divx470 divide 30e-1 200e-2 -> 1.5 divx471 divide 300e-2 200e-2 -> 1.5 divx472 divide 3000e-3 200e-2 -> 1.5 divx473 divide 3e0 2000e-3 -> 1.5 divx474 divide 30e-1 2000e-3 -> 1.5 divx475 divide 300e-2 2000e-3 -> 1.5 divx476 divide 3000e-3 2000e-3 -> 1.5 -- some reciprocals divx480 divide 1 1.0E+33 -> 1E-33 divx481 divide 1 10E+33 -> 1E-34 divx482 divide 1 1.0E-33 -> 1E+33 divx483 divide 1 10E-33 -> 1E+32 -- tryzeros cases precision: 7 rounding: half_up maxExponent: 92 minexponent: -92 divx496 divide 0E+86 1000E-13 -> 0E+92 Clamped divx497 divide 0E-98 1000E+13 -> 0E-98 Clamped precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- focus on trailing zeros issues precision: 9 divx500 divide 1 9.9 -> 0.101010101 Inexact Rounded precision: 8 divx501 divide 1 9.9 -> 0.10101010 Inexact Rounded precision: 7 divx502 divide 1 9.9 -> 0.1010101 Inexact Rounded precision: 6 divx503 divide 1 9.9 -> 0.101010 Inexact Rounded precision: 9 divx531 divide 1 2 -> 0.5 divx532 divide 1.0 2 -> 0.5 divx533 divide 1.00 2 -> 0.50 divx534 divide 1.000 2 -> 0.500 divx535 divide 1.0000 2 -> 0.5000 divx536 divide 1.00000 2 -> 0.50000 divx537 divide 1.000000 2 -> 0.500000 divx538 divide 1.0000000 2 -> 0.5000000 divx539 divide 1.00 2.00 -> 0.5 divx541 divide 2 1 -> 2 divx542 divide 2 1.0 -> 2 divx543 divide 2 1.00 -> 2 divx544 divide 2 1.000 -> 2 divx545 divide 2 1.0000 -> 2 divx546 divide 2 1.00000 -> 2 divx547 divide 2 1.000000 -> 2 divx548 divide 2 1.0000000 -> 2 divx549 divide 2.00 1.00 -> 2 divx550 divide 2.40 2 -> 1.20 divx551 divide 2.40 4 -> 0.60 divx552 divide 2.40 10 -> 0.24 divx553 divide 2.40 2.0 -> 1.2 divx554 divide 2.40 4.0 -> 0.6 divx555 divide 2.40 10.0 -> 0.24 divx556 divide 2.40 2.00 -> 1.2 divx557 divide 2.40 4.00 -> 0.6 divx558 divide 2.40 10.00 -> 0.24 divx559 divide 0.9 0.1 -> 9 divx560 divide 0.9 0.01 -> 9E+1 divx561 divide 0.9 0.001 -> 9E+2 divx562 divide 5 2 -> 2.5 divx563 divide 5 2.0 -> 2.5 divx564 divide 5 2.00 -> 2.5 divx565 divide 5 20 -> 0.25 divx566 divide 5 20.0 -> 0.25 divx567 divide 2.400 2 -> 1.200 divx568 divide 2.400 2.0 -> 1.20 divx569 divide 2.400 2.400 -> 1 -- +ve exponent precision: 5 divx570 divide 2.4E+6 2 -> 1.2E+6 divx571 divide 2.40E+6 2 -> 1.20E+6 divx572 divide 2.400E+6 2 -> 1.200E+6 divx573 divide 2.4000E+6 2 -> 1.2000E+6 divx574 divide 24E+5 2 -> 1.2E+6 divx575 divide 240E+4 2 -> 1.20E+6 divx576 divide 2400E+3 2 -> 1.200E+6 divx577 divide 24000E+2 2 -> 1.2000E+6 precision: 6 divx580 divide 2.4E+6 2 -> 1.2E+6 divx581 divide 2.40E+6 2 -> 1.20E+6 divx582 divide 2.400E+6 2 -> 1.200E+6 divx583 divide 2.4000E+6 2 -> 1.2000E+6 divx584 divide 24E+5 2 -> 1.2E+6 divx585 divide 240E+4 2 -> 1.20E+6 divx586 divide 2400E+3 2 -> 1.200E+6 divx587 divide 24000E+2 2 -> 1.2000E+6 precision: 7 divx590 divide 2.4E+6 2 -> 1.2E+6 divx591 divide 2.40E+6 2 -> 1.20E+6 divx592 divide 2.400E+6 2 -> 1.200E+6 divx593 divide 2.4000E+6 2 -> 1.2000E+6 divx594 divide 24E+5 2 -> 1.2E+6 divx595 divide 240E+4 2 -> 1.20E+6 divx596 divide 2400E+3 2 -> 1.200E+6 divx597 divide 24000E+2 2 -> 1.2000E+6 precision: 9 divx600 divide 2.4E+9 2 -> 1.2E+9 divx601 divide 2.40E+9 2 -> 1.20E+9 divx602 divide 2.400E+9 2 -> 1.200E+9 divx603 divide 2.4000E+9 2 -> 1.2000E+9 divx604 divide 24E+8 2 -> 1.2E+9 divx605 divide 240E+7 2 -> 1.20E+9 divx606 divide 2400E+6 2 -> 1.200E+9 divx607 divide 24000E+5 2 -> 1.2000E+9 -- long operand triangle precision: 33 divx610 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131097703792 Inexact Rounded precision: 32 divx611 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813109770379 Inexact Rounded precision: 31 divx612 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977038 Inexact Rounded precision: 30 divx613 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131097704 Inexact Rounded precision: 29 divx614 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813109770 Inexact Rounded precision: 28 divx615 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81310977 Inexact Rounded precision: 27 divx616 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131098 Inexact Rounded precision: 26 divx617 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813110 Inexact Rounded precision: 25 divx618 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81311 Inexact Rounded precision: 24 divx619 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8131 Inexact Rounded precision: 23 divx620 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.813 Inexact Rounded precision: 22 divx621 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.81 Inexact Rounded precision: 21 divx622 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817797.8 Inexact Rounded precision: 20 divx623 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -41011408883796817798 Inexact Rounded precision: 19 divx624 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888379681780E+19 Inexact Rounded precision: 18 divx625 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088837968178E+19 Inexact Rounded precision: 17 divx626 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408883796818E+19 Inexact Rounded precision: 16 divx627 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888379682E+19 Inexact Rounded precision: 15 divx628 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088837968E+19 Inexact Rounded precision: 14 divx629 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408883797E+19 Inexact Rounded precision: 13 divx630 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888380E+19 Inexact Rounded precision: 12 divx631 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114088838E+19 Inexact Rounded precision: 11 divx632 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011408884E+19 Inexact Rounded precision: 10 divx633 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101140888E+19 Inexact Rounded precision: 9 divx634 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114089E+19 Inexact Rounded precision: 8 divx635 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011409E+19 Inexact Rounded precision: 7 divx636 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101141E+19 Inexact Rounded precision: 6 divx637 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10114E+19 Inexact Rounded precision: 5 divx638 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1011E+19 Inexact Rounded precision: 4 divx639 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.101E+19 Inexact Rounded precision: 3 divx640 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.10E+19 Inexact Rounded precision: 2 divx641 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4.1E+19 Inexact Rounded precision: 1 divx642 divide -3374988581607586061255542201048 82293895124.90045271504836568681 -> -4E+19 Inexact Rounded -- more zeros, etc. precision: 9 divx731 divide 5.00 1E-3 -> 5.00E+3 divx732 divide 00.00 0.000 -> NaN Division_undefined divx733 divide 00.00 0E-3 -> NaN Division_undefined divx734 divide 0 -0 -> NaN Division_undefined divx735 divide -0 0 -> NaN Division_undefined divx736 divide -0 -0 -> NaN Division_undefined divx741 divide 0 -1 -> -0 divx742 divide -0 -1 -> 0 divx743 divide 0 1 -> 0 divx744 divide -0 1 -> -0 divx745 divide -1 0 -> -Infinity Division_by_zero divx746 divide -1 -0 -> Infinity Division_by_zero divx747 divide 1 0 -> Infinity Division_by_zero divx748 divide 1 -0 -> -Infinity Division_by_zero divx751 divide 0.0 -1 -> -0.0 divx752 divide -0.0 -1 -> 0.0 divx753 divide 0.0 1 -> 0.0 divx754 divide -0.0 1 -> -0.0 divx755 divide -1.0 0 -> -Infinity Division_by_zero divx756 divide -1.0 -0 -> Infinity Division_by_zero divx757 divide 1.0 0 -> Infinity Division_by_zero divx758 divide 1.0 -0 -> -Infinity Division_by_zero divx761 divide 0 -1.0 -> -0 divx762 divide -0 -1.0 -> 0 divx763 divide 0 1.0 -> 0 divx764 divide -0 1.0 -> -0 divx765 divide -1 0.0 -> -Infinity Division_by_zero divx766 divide -1 -0.0 -> Infinity Division_by_zero divx767 divide 1 0.0 -> Infinity Division_by_zero divx768 divide 1 -0.0 -> -Infinity Division_by_zero divx771 divide 0.0 -1.0 -> -0.0 divx772 divide -0.0 -1.0 -> 0.0 divx773 divide 0.0 1.0 -> 0.0 divx774 divide -0.0 1.0 -> -0.0 divx775 divide -1.0 0.0 -> -Infinity Division_by_zero divx776 divide -1.0 -0.0 -> Infinity Division_by_zero divx777 divide 1.0 0.0 -> Infinity Division_by_zero divx778 divide 1.0 -0.0 -> -Infinity Division_by_zero -- Specials divx780 divide Inf -Inf -> NaN Invalid_operation divx781 divide Inf -1000 -> -Infinity divx782 divide Inf -1 -> -Infinity divx783 divide Inf -0 -> -Infinity Division_by_zero divx784 divide Inf 0 -> Infinity Division_by_zero divx785 divide Inf 1 -> Infinity divx786 divide Inf 1000 -> Infinity divx787 divide Inf Inf -> NaN Invalid_operation divx788 divide -1000 Inf -> -0 divx789 divide -Inf Inf -> NaN Invalid_operation divx790 divide -1 Inf -> -0 divx791 divide -0 Inf -> -0 divx792 divide 0 Inf -> 0 divx793 divide 1 Inf -> 0 divx794 divide 1000 Inf -> 0 divx795 divide Inf Inf -> NaN Invalid_operation divx800 divide -Inf -Inf -> NaN Invalid_operation divx801 divide -Inf -1000 -> Infinity divx802 divide -Inf -1 -> Infinity divx803 divide -Inf -0 -> Infinity Division_by_zero divx804 divide -Inf 0 -> -Infinity Division_by_zero divx805 divide -Inf 1 -> -Infinity divx806 divide -Inf 1000 -> -Infinity divx807 divide -Inf Inf -> NaN Invalid_operation divx808 divide -1000 Inf -> -0 divx809 divide -Inf -Inf -> NaN Invalid_operation divx810 divide -1 -Inf -> 0 divx811 divide -0 -Inf -> 0 divx812 divide 0 -Inf -> -0 divx813 divide 1 -Inf -> -0 divx814 divide 1000 -Inf -> -0 divx815 divide Inf -Inf -> NaN Invalid_operation divx821 divide NaN -Inf -> NaN divx822 divide NaN -1000 -> NaN divx823 divide NaN -1 -> NaN divx824 divide NaN -0 -> NaN divx825 divide NaN 0 -> NaN divx826 divide NaN 1 -> NaN divx827 divide NaN 1000 -> NaN divx828 divide NaN Inf -> NaN divx829 divide NaN NaN -> NaN divx830 divide -Inf NaN -> NaN divx831 divide -1000 NaN -> NaN divx832 divide -1 NaN -> NaN divx833 divide -0 NaN -> NaN divx834 divide 0 NaN -> NaN divx835 divide 1 NaN -> NaN divx836 divide 1000 NaN -> NaN divx837 divide Inf NaN -> NaN divx841 divide sNaN -Inf -> NaN Invalid_operation divx842 divide sNaN -1000 -> NaN Invalid_operation divx843 divide sNaN -1 -> NaN Invalid_operation divx844 divide sNaN -0 -> NaN Invalid_operation divx845 divide sNaN 0 -> NaN Invalid_operation divx846 divide sNaN 1 -> NaN Invalid_operation divx847 divide sNaN 1000 -> NaN Invalid_operation divx848 divide sNaN NaN -> NaN Invalid_operation divx849 divide sNaN sNaN -> NaN Invalid_operation divx850 divide NaN sNaN -> NaN Invalid_operation divx851 divide -Inf sNaN -> NaN Invalid_operation divx852 divide -1000 sNaN -> NaN Invalid_operation divx853 divide -1 sNaN -> NaN Invalid_operation divx854 divide -0 sNaN -> NaN Invalid_operation divx855 divide 0 sNaN -> NaN Invalid_operation divx856 divide 1 sNaN -> NaN Invalid_operation divx857 divide 1000 sNaN -> NaN Invalid_operation divx858 divide Inf sNaN -> NaN Invalid_operation divx859 divide NaN sNaN -> NaN Invalid_operation maxexponent: 999999999 minexponent: -999999999 -- Various flavours of divide by 0 divx901 divide 0 0 -> NaN Division_undefined divx902 divide 0.0E5 0 -> NaN Division_undefined divx903 divide 0.000 0 -> NaN Division_undefined divx904 divide 0.0001 0 -> Infinity Division_by_zero divx905 divide 0.01 0 -> Infinity Division_by_zero divx906 divide 0.1 0 -> Infinity Division_by_zero divx907 divide 1 0 -> Infinity Division_by_zero divx908 divide 1 0.0 -> Infinity Division_by_zero divx909 divide 10 0.0 -> Infinity Division_by_zero divx910 divide 1E+100 0.0 -> Infinity Division_by_zero divx911 divide 1E+1000 0 -> Infinity Division_by_zero divx921 divide -0.0001 0 -> -Infinity Division_by_zero divx922 divide -0.01 0 -> -Infinity Division_by_zero divx923 divide -0.1 0 -> -Infinity Division_by_zero divx924 divide -1 0 -> -Infinity Division_by_zero divx925 divide -1 0.0 -> -Infinity Division_by_zero divx926 divide -10 0.0 -> -Infinity Division_by_zero divx927 divide -1E+100 0.0 -> -Infinity Division_by_zero divx928 divide -1E+1000 0 -> -Infinity Division_by_zero divx931 divide 0.0001 -0 -> -Infinity Division_by_zero divx932 divide 0.01 -0 -> -Infinity Division_by_zero divx933 divide 0.1 -0 -> -Infinity Division_by_zero divx934 divide 1 -0 -> -Infinity Division_by_zero divx935 divide 1 -0.0 -> -Infinity Division_by_zero divx936 divide 10 -0.0 -> -Infinity Division_by_zero divx937 divide 1E+100 -0.0 -> -Infinity Division_by_zero divx938 divide 1E+1000 -0 -> -Infinity Division_by_zero divx941 divide -0.0001 -0 -> Infinity Division_by_zero divx942 divide -0.01 -0 -> Infinity Division_by_zero divx943 divide -0.1 -0 -> Infinity Division_by_zero divx944 divide -1 -0 -> Infinity Division_by_zero divx945 divide -1 -0.0 -> Infinity Division_by_zero divx946 divide -10 -0.0 -> Infinity Division_by_zero divx947 divide -1E+100 -0.0 -> Infinity Division_by_zero divx948 divide -1E+1000 -0 -> Infinity Division_by_zero -- overflow and underflow tests maxexponent: 999999999 minexponent: -999999999 divx951 divide 9E+999999999 +0.23456789012345E-0 -> Infinity Inexact Overflow Rounded divx952 divide +0.100 9E+999999999 -> 1.111111E-1000000001 Inexact Rounded Underflow Subnormal divx953 divide 9E-999999999 +9.100 -> 9.8901099E-1000000000 Inexact Rounded Underflow Subnormal divx954 divide -1.23456789 9E+999999999 -> -1.3717421E-1000000000 Subnormal divx955 divide -1.23456789012345E-0 9E+999999999 -> -1.3717421E-1000000000 Underflow Subnormal Rounded Inexact divx956 divide -1.23456789012345E-0 7E+999999999 -> -1.7636684E-1000000000 Inexact Rounded Underflow Subnormal divx957 divide 9E+999999999 -0.83456789012345E-0 -> -Infinity Inexact Overflow Rounded divx958 divide -0.100 9E+999999999 -> -1.111111E-1000000001 Subnormal Inexact Rounded Underflow divx959 divide 9E-999999999 -9.100 -> -9.8901099E-1000000000 Inexact Rounded Underflow Subnormal -- overflow and underflow (additional edge tests in multiply.decTest) -- 'subnormal' results now possible (all hard underflow or overflow in -- base arithemtic) divx960 divide 1e-600000000 1e+400000001 -> 1E-1000000001 Subnormal divx961 divide 1e-600000000 1e+400000002 -> 1E-1000000002 Subnormal divx962 divide 1e-600000000 1e+400000003 -> 1E-1000000003 Subnormal divx963 divide 1e-600000000 1e+400000004 -> 1E-1000000004 Subnormal divx964 divide 1e-600000000 1e+400000005 -> 1E-1000000005 Subnormal divx965 divide 1e-600000000 1e+400000006 -> 1E-1000000006 Subnormal divx966 divide 1e-600000000 1e+400000007 -> 1E-1000000007 Subnormal divx967 divide 1e-600000000 1e+400000008 -> 0E-1000000007 Underflow Subnormal Inexact Rounded divx968 divide 1e-600000000 1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded divx969 divide 1e-600000000 1e+400000010 -> 0E-1000000007 Underflow Subnormal Inexact Rounded -- [no equivalent of 'subnormal' for overflow] divx970 divide 1e+600000000 1e-400000001 -> Infinity Overflow Inexact Rounded divx971 divide 1e+600000000 1e-400000002 -> Infinity Overflow Inexact Rounded divx972 divide 1e+600000000 1e-400000003 -> Infinity Overflow Inexact Rounded divx973 divide 1e+600000000 1e-400000004 -> Infinity Overflow Inexact Rounded divx974 divide 1e+600000000 1e-400000005 -> Infinity Overflow Inexact Rounded divx975 divide 1e+600000000 1e-400000006 -> Infinity Overflow Inexact Rounded divx976 divide 1e+600000000 1e-400000007 -> Infinity Overflow Inexact Rounded divx977 divide 1e+600000000 1e-400000008 -> Infinity Overflow Inexact Rounded divx978 divide 1e+600000000 1e-400000009 -> Infinity Overflow Inexact Rounded divx979 divide 1e+600000000 1e-400000010 -> Infinity Overflow Inexact Rounded -- Sign after overflow and underflow divx980 divide 1e-600000000 1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded divx981 divide 1e-600000000 -1e+400000009 -> -0E-1000000007 Underflow Subnormal Inexact Rounded divx982 divide -1e-600000000 1e+400000009 -> -0E-1000000007 Underflow Subnormal Inexact Rounded divx983 divide -1e-600000000 -1e+400000009 -> 0E-1000000007 Underflow Subnormal Inexact Rounded divx984 divide 1e+600000000 1e-400000009 -> Infinity Overflow Inexact Rounded divx985 divide 1e+600000000 -1e-400000009 -> -Infinity Overflow Inexact Rounded divx986 divide -1e+600000000 1e-400000009 -> -Infinity Overflow Inexact Rounded divx987 divide -1e+600000000 -1e-400000009 -> Infinity Overflow Inexact Rounded -- Long operand overflow may be a different path precision: 3 divx990 divide 1000 9.999E-999999999 -> Infinity Inexact Overflow Rounded divx991 divide 1000 -9.999E-999999999 -> -Infinity Inexact Overflow Rounded divx992 divide 9.999E+999999999 0.01 -> Infinity Inexact Overflow Rounded divx993 divide -9.999E+999999999 0.01 -> -Infinity Inexact Overflow Rounded -- check for double-rounded subnormals precision: 5 maxexponent: 79 minexponent: -79 divx1001 divide 1.52444E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow divx1002 divide 1.52445E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow divx1003 divide 1.52446E-80 1 -> 1.524E-80 Inexact Rounded Subnormal Underflow -- Null tests divx9998 divide 10 # -> NaN Invalid_operation divx9999 divide # 10 -> NaN Invalid_operation --- NEW FILE: decimal64.decTest --- ------------------------------------------------------------------------ -- decimal64.decTest -- decimal eight-byte format testcases -- -- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of tests is for the eight-byte concrete representation. -- Its characteristics are: -- -- 1 bit sign -- 5 bits combination field -- 8 bits exponent continuation -- 50 bits coefficient continuation -- -- Total exponent length 10 bits -- Total coefficient length 54 bits (16 digits) -- -- Elimit = 767 (maximum encoded exponent) -- Emax = 384 (largest exponent value) -- Emin = -383 (smallest exponent value) -- bias = 398 (subtracted from encoded exponent) = -Etiny extended: 1 precision: 16 rounding: half_up maxExponent: 384 minExponent: -383 -- General testcases -- (mostly derived from the Strawman 4 document and examples) dece001 apply #A2300000000003D0 -> -7.50 dece002 apply -7.50 -> #A2300000000003D0 -- Normality dece010 apply 1234567890123456 -> #263934b9c1e28e56 dece011 apply 1234567890123456.0 -> #263934b9c1e28e56 Rounded dece012 apply 1234567890123456.1 -> #263934b9c1e28e56 Rounded Inexact dece013 apply -1234567890123456 -> #a63934b9c1e28e56 dece014 apply -1234567890123456.0 -> #a63934b9c1e28e56 Rounded dece015 apply -1234567890123456.1 -> #a63934b9c1e28e56 Rounded Inexact -- Nmax and similar dece022 apply 9.999999999999999E+384 -> #77fcff3fcff3fcff dece023 apply #77fcff3fcff3fcff -> 9.999999999999999E+384 dece024 apply 1.234567890123456E+384 -> #47fd34b9c1e28e56 dece025 apply #47fd34b9c1e28e56 -> 1.234567890123456E+384 -- fold-downs (more below) dece030 apply 1.23E+384 -> #47fd300000000000 Clamped dece031 apply #47fd300000000000 -> 1.230000000000000E+384 dece032 apply 1E+384 -> #47fc000000000000 Clamped dece033 apply #47fc000000000000 -> 1.000000000000000E+384 -- overflows maxExponent: 999 -- set high so conversion causes the overflow minExponent: -999 dece040 apply 10E+384 -> #7800000000000000 Overflow Rounded Inexact dece041 apply 1.000000000000000E+385 -> #7800000000000000 Overflow Rounded Inexact maxExponent: 384 minExponent: -383 dece051 apply 12345 -> #22380000000049c5 dece052 apply #22380000000049c5 -> 12345 dece053 apply 1234 -> #2238000000000534 dece054 apply #2238000000000534 -> 1234 dece055 apply 123 -> #22380000000000a3 dece056 apply #22380000000000a3 -> 123 dece057 apply 12 -> #2238000000000012 dece058 apply #2238000000000012 -> 12 dece059 apply 1 -> #2238000000000001 dece060 apply #2238000000000001 -> 1 dece061 apply 1.23 -> #22300000000000a3 dece062 apply #22300000000000a3 -> 1.23 dece063 apply 123.45 -> #22300000000049c5 dece064 apply #22300000000049c5 -> 123.45 -- Nmin and below dece071 apply 1E-383 -> #003c000000000001 dece072 apply #003c000000000001 -> 1E-383 dece073 apply 1.000000000000000E-383 -> #0400000000000000 dece074 apply #0400000000000000 -> 1.000000000000000E-383 dece075 apply 1.000000000000001E-383 -> #0400000000000001 dece076 apply #0400000000000001 -> 1.000000000000001E-383 dece077 apply 0.100000000000000E-383 -> #0000800000000000 Subnormal dece078 apply #0000800000000000 -> 1.00000000000000E-384 Subnormal dece079 apply 0.000000000000010E-383 -> #0000000000000010 Subnormal dece080 apply #0000000000000010 -> 1.0E-397 Subnormal dece081 apply 0.00000000000001E-383 -> #0004000000000001 Subnormal dece082 apply #0004000000000001 -> 1E-397 Subnormal dece083 apply 0.000000000000001E-383 -> #0000000000000001 Subnormal dece084 apply #0000000000000001 -> 1E-398 Subnormal -- underflows dece090 apply 1e-398 -> #0000000000000001 Subnormal dece091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded dece092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded dece093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded dece094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded dece095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded dece096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded dece097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded dece098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded dece099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -- Same again, negatives -- Nmax and similar dece122 apply -9.999999999999999E+384 -> #f7fcff3fcff3fcff dece123 apply #f7fcff3fcff3fcff -> -9.999999999999999E+384 dece124 apply -1.234567890123456E+384 -> #c7fd34b9c1e28e56 dece125 apply #c7fd34b9c1e28e56 -> -1.234567890123456E+384 -- fold-downs (more below) dece130 apply -1.23E+384 -> #c7fd300000000000 Clamped dece131 apply #c7fd300000000000 -> -1.230000000000000E+384 dece132 apply -1E+384 -> #c7fc000000000000 Clamped dece133 apply #c7fc000000000000 -> -1.000000000000000E+384 -- overflows maxExponent: 999 -- set high so conversion causes the overflow minExponent: -999 dece140 apply -10E+384 -> #f800000000000000 Overflow Rounded Inexact dece141 apply -1.000000000000000E+385 -> #f800000000000000 Overflow Rounded Inexact maxExponent: 384 minExponent: -383 dece151 apply -12345 -> #a2380000000049c5 dece152 apply #a2380000000049c5 -> -12345 dece153 apply -1234 -> #a238000000000534 dece154 apply #a238000000000534 -> -1234 dece155 apply -123 -> #a2380000000000a3 dece156 apply #a2380000000000a3 -> -123 dece157 apply -12 -> #a238000000000012 dece158 apply #a238000000000012 -> -12 dece159 apply -1 -> #a238000000000001 dece160 apply #a238000000000001 -> -1 dece161 apply -1.23 -> #a2300000000000a3 dece162 apply #a2300000000000a3 -> -1.23 dece163 apply -123.45 -> #a2300000000049c5 dece164 apply #a2300000000049c5 -> -123.45 -- Nmin and below dece171 apply -1E-383 -> #803c000000000001 dece172 apply #803c000000000001 -> -1E-383 dece173 apply -1.000000000000000E-383 -> #8400000000000000 dece174 apply #8400000000000000 -> -1.000000000000000E-383 dece175 apply -1.000000000000001E-383 -> #8400000000000001 dece176 apply #8400000000000001 -> -1.000000000000001E-383 dece177 apply -0.100000000000000E-383 -> #8000800000000000 Subnormal dece178 apply #8000800000000000 -> -1.00000000000000E-384 Subnormal dece179 apply -0.000000000000010E-383 -> #8000000000000010 Subnormal dece180 apply #8000000000000010 -> -1.0E-397 Subnormal dece181 apply -0.00000000000001E-383 -> #8004000000000001 Subnormal dece182 apply #8004000000000001 -> -1E-397 Subnormal dece183 apply -0.000000000000001E-383 -> #8000000000000001 Subnormal dece184 apply #8000000000000001 -> -1E-398 Subnormal -- underflows dece189 apply -1e-398 -> #8000000000000001 Subnormal dece190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded dece191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded dece192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded dece193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded dece194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded dece195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded dece196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded dece197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded dece198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded dece199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -- zeros dece401 apply 0E-500 -> #0000000000000000 Clamped dece402 apply 0E-400 -> #0000000000000000 Clamped dece403 apply 0E-398 -> #0000000000000000 dece404 apply #0000000000000000 -> 0E-398 dece405 apply 0.000000000000000E-383 -> #0000000000000000 dece406 apply #0000000000000000 -> 0E-398 dece407 apply 0E-2 -> #2230000000000000 dece408 apply #2230000000000000 -> 0.00 dece409 apply 0 -> #2238000000000000 dece410 apply #2238000000000000 -> 0 dece411 apply 0E+3 -> #2244000000000000 dece412 apply #2244000000000000 -> 0E+3 dece413 apply 0E+369 -> #43fc000000000000 dece414 apply #43fc000000000000 -> 0E+369 -- clamped zeros... dece415 apply 0E+370 -> #43fc000000000000 Clamped dece416 apply #43fc000000000000 -> 0E+369 dece417 apply 0E+384 -> #43fc000000000000 Clamped dece418 apply #43fc000000000000 -> 0E+369 dece419 apply 0E+400 -> #43fc000000000000 Clamped dece420 apply #43fc000000000000 -> 0E+369 dece421 apply 0E+500 -> #43fc000000000000 Clamped dece422 apply #43fc000000000000 -> 0E+369 -- negative zeros dece431 apply -0E-400 -> #8000000000000000 Clamped dece432 apply -0E-400 -> #8000000000000000 Clamped dece433 apply -0E-398 -> #8000000000000000 dece434 apply #8000000000000000 -> -0E-398 dece435 apply -0.000000000000000E-383 -> #8000000000000000 dece436 apply #8000000000000000 -> -0E-398 dece437 apply -0E-2 -> #a230000000000000 dece438 apply #a230000000000000 -> -0.00 dece439 apply -0 -> #a238000000000000 dece440 apply #a238000000000000 -> -0 dece441 apply -0E+3 -> #a244000000000000 dece442 apply #a244000000000000 -> -0E+3 dece443 apply -0E+369 -> #c3fc000000000000 dece444 apply #c3fc000000000000 -> -0E+369 -- clamped zeros... dece445 apply -0E+370 -> #c3fc000000000000 Clamped dece446 apply #c3fc000000000000 -> -0E+369 dece447 apply -0E+384 -> #c3fc000000000000 Clamped dece448 apply #c3fc000000000000 -> -0E+369 dece449 apply -0E+400 -> #c3fc000000000000 Clamped dece450 apply #c3fc000000000000 -> -0E+369 dece451 apply -0E+500 -> #c3fc000000000000 Clamped dece452 apply #c3fc000000000000 -> -0E+369 -- Specials dece501 apply #7878787878787878 -> #7800000000000000 dece502 apply #7800000000000000 -> Infinity dece503 apply #7979797979797979 -> #7800000000000000 dece504 apply #7900000000000000 -> Infinity dece505 apply #7a7a7a7a7a7a7a7a -> #7800000000000000 dece506 apply #7a00000000000000 -> Infinity dece507 apply #7b7b7b7b7b7b7b7b -> #7800000000000000 dece508 apply #7b00000000000000 -> Infinity dece509 apply #7c7c7c7c7c7c7c7c -> #7dffffffffffffff dece510 apply #7c00000000000000 -> NaN dece511 apply #7d7d7d7d7d7d7d7d -> #7dffffffffffffff dece512 apply #7d00000000000000 -> NaN dece513 apply #7e7e7e7e7e7e7e7e -> #7fffffffffffffff dece514 apply #7e00000000000000 -> sNaN dece515 apply #7f7f7f7f7f7f7f7f -> #7fffffffffffffff dece516 apply #7f00000000000000 -> sNaN dece521 apply #f878787878787878 -> #f800000000000000 dece522 apply #f800000000000000 -> -Infinity dece523 apply #f979797979797979 -> #f800000000000000 dece524 apply #f900000000000000 -> -Infinity dece525 apply #fa7a7a7a7a7a7a7a -> #f800000000000000 dece526 apply #fa00000000000000 -> -Infinity dece527 apply #fb7b7b7b7b7b7b7b -> #f800000000000000 dece528 apply #fb00000000000000 -> -Infinity dece529 apply #fc7c7c7c7c7c7c7c -> #7dffffffffffffff dece530 apply #fc00000000000000 -> NaN dece531 apply #fd7d7d7d7d7d7d7d -> #7dffffffffffffff dece532 apply #fd00000000000000 -> NaN dece533 apply #fe7e7e7e7e7e7e7e -> #7fffffffffffffff dece534 apply #fe00000000000000 -> sNaN dece535 apply #ff7f7f7f7f7f7f7f -> #7fffffffffffffff dece536 apply #ff00000000000000 -> sNaN -- fold-down full sequence dece601 apply 1E+384 -> #47fc000000000000 Clamped dece602 apply #47fc000000000000 -> 1.000000000000000E+384 dece603 apply 1E+383 -> #43fc800000000000 Clamped dece604 apply #43fc800000000000 -> 1.00000000000000E+383 dece605 apply 1E+382 -> #43fc100000000000 Clamped dece606 apply #43fc100000000000 -> 1.0000000000000E+382 dece607 apply 1E+381 -> #43fc010000000000 Clamped dece608 apply #43fc010000000000 -> 1.000000000000E+381 dece609 apply 1E+380 -> #43fc002000000000 Clamped dece610 apply #43fc002000000000 -> 1.00000000000E+380 dece611 apply 1E+379 -> #43fc000400000000 Clamped dece612 apply #43fc000400000000 -> 1.0000000000E+379 dece613 apply 1E+378 -> #43fc000040000000 Clamped dece614 apply #43fc000040000000 -> 1.000000000E+378 dece615 apply 1E+377 -> #43fc000008000000 Clamped dece616 apply #43fc000008000000 -> 1.00000000E+377 dece617 apply 1E+376 -> #43fc000001000000 Clamped dece618 apply #43fc000001000000 -> 1.0000000E+376 dece619 apply 1E+375 -> #43fc000000100000 Clamped dece620 apply #43fc000000100000 -> 1.000000E+375 dece621 apply 1E+374 -> #43fc000000020000 Clamped dece622 apply #43fc000000020000 -> 1.00000E+374 dece623 apply 1E+373 -> #43fc000000004000 Clamped dece624 apply #43fc000000004000 -> 1.0000E+373 dece625 apply 1E+372 -> #43fc000000000400 Clamped dece626 apply #43fc000000000400 -> 1.000E+372 dece627 apply 1E+371 -> #43fc000000000080 Clamped dece628 apply #43fc000000000080 -> 1.00E+371 dece629 apply 1E+370 -> #43fc000000000010 Clamped dece630 apply #43fc000000000010 -> 1.0E+370 dece631 apply 1E+369 -> #43fc000000000001 dece632 apply #43fc000000000001 -> 1E+369 dece633 apply 1E+368 -> #43f8000000000001 dece634 apply #43f8000000000001 -> 1E+368 -- same with 9s dece641 apply 9E+384 -> #77fc000000000000 Clamped dece642 apply #77fc000000000000 -> 9.000000000000000E+384 dece643 apply 9E+383 -> #43fc8c0000000000 Clamped dece644 apply #43fc8c0000000000 -> 9.00000000000000E+383 dece645 apply 9E+382 -> #43fc1a0000000000 Clamped dece646 apply #43fc1a0000000000 -> 9.0000000000000E+382 dece647 apply 9E+381 -> #43fc090000000000 Clamped dece648 apply #43fc090000000000 -> 9.000000000000E+381 dece649 apply 9E+380 -> #43fc002300000000 Clamped dece650 apply #43fc002300000000 -> 9.00000000000E+380 dece651 apply 9E+379 -> #43fc000680000000 Clamped dece652 apply #43fc000680000000 -> 9.0000000000E+379 dece653 apply 9E+378 -> #43fc000240000000 Clamped dece654 apply #43fc000240000000 -> 9.000000000E+378 dece655 apply 9E+377 -> #43fc000008c00000 Clamped dece656 apply #43fc000008c00000 -> 9.00000000E+377 dece657 apply 9E+376 -> #43fc000001a00000 Clamped dece658 apply #43fc000001a00000 -> 9.0000000E+376 dece659 apply 9E+375 -> #43fc000000900000 Clamped dece660 apply #43fc000000900000 -> 9.000000E+375 dece661 apply 9E+374 -> #43fc000000023000 Clamped dece662 apply #43fc000000023000 -> 9.00000E+374 dece663 apply 9E+373 -> #43fc000000006800 Clamped dece664 apply #43fc000000006800 -> 9.0000E+373 dece665 apply 9E+372 -> #43fc000000002400 Clamped dece666 apply #43fc000000002400 -> 9.000E+372 dece667 apply 9E+371 -> #43fc00000000008c Clamped dece668 apply #43fc00000000008c -> 9.00E+371 dece669 apply 9E+370 -> #43fc00000000001a Clamped dece670 apply #43fc00000000001a -> 9.0E+370 dece671 apply 9E+369 -> #43fc000000000009 dece672 apply #43fc000000000009 -> 9E+369 dece673 apply 9E+368 -> #43f8000000000009 dece674 apply #43f8000000000009 -> 9E+368 -- Selected DPD codes dece700 apply #2238000000000000 -> 0 dece701 apply #2238000000000009 -> 9 dece702 apply #2238000000000010 -> 10 dece703 apply #2238000000000019 -> 19 dece704 apply #2238000000000020 -> 20 dece705 apply #2238000000000029 -> 29 dece706 apply #2238000000000030 -> 30 dece707 apply #2238000000000039 -> 39 dece708 apply #2238000000000040 -> 40 dece709 apply #2238000000000049 -> 49 dece710 apply #2238000000000050 -> 50 dece711 apply #2238000000000059 -> 59 dece712 apply #2238000000000060 -> 60 dece713 apply #2238000000000069 -> 69 dece714 apply #2238000000000070 -> 70 dece715 apply #2238000000000071 -> 71 dece716 apply #2238000000000072 -> 72 dece717 apply #2238000000000073 -> 73 dece718 apply #2238000000000074 -> 74 dece719 apply #2238000000000075 -> 75 dece720 apply #2238000000000076 -> 76 dece721 apply #2238000000000077 -> 77 dece722 apply #2238000000000078 -> 78 dece723 apply #2238000000000079 -> 79 dece730 apply #223800000000029e -> 994 dece731 apply #223800000000029f -> 995 dece732 apply #22380000000002a0 -> 520 dece733 apply #22380000000002a1 -> 521 -- DPD: one of each of the huffman groups dece740 apply #22380000000003f7 -> 777 dece741 apply #22380000000003f8 -> 778 dece742 apply #22380000000003eb -> 787 dece743 apply #223800000000037d -> 877 dece744 apply #223800000000039f -> 997 dece745 apply #22380000000003bf -> 979 dece746 apply #22380000000003df -> 799 dece747 apply #223800000000006e -> 888 -- DPD all-highs cases (includes the 24 redundant codes) dece750 apply #223800000000006e -> 888 dece751 apply #223800000000016e -> 888 dece752 apply #223800000000026e -> 888 dece753 apply #223800000000036e -> 888 dece754 apply #223800000000006f -> 889 dece755 apply #223800000000016f -> 889 dece756 apply #223800000000026f -> 889 dece757 apply #223800000000036f -> 889 dece760 apply #223800000000007e -> 898 dece761 apply #223800000000017e -> 898 dece762 apply #223800000000027e -> 898 dece763 apply #223800000000037e -> 898 dece764 apply #223800000000007f -> 899 dece765 apply #223800000000017f -> 899 dece766 apply #223800000000027f -> 899 dece767 apply #223800000000037f -> 899 dece770 apply #22380000000000ee -> 988 dece771 apply #22380000000001ee -> 988 dece772 apply #22380000000002ee -> 988 dece773 apply #22380000000003ee -> 988 dece774 apply #22380000000000ef -> 989 dece775 apply #22380000000001ef -> 989 dece776 apply #22380000000002ef -> 989 dece777 apply #22380000000003ef -> 989 dece780 apply #22380000000000fe -> 998 dece781 apply #22380000000001fe -> 998 dece782 apply #22380000000002fe -> 998 dece783 apply #22380000000003fe -> 998 dece784 apply #22380000000000ff -> 999 dece785 apply #22380000000001ff -> 999 dece786 apply #22380000000002ff -> 999 dece787 apply #22380000000003ff -> 999 --- NEW FILE: compare.decTest --- ------------------------------------------------------------------------ -- compare.decTest -- decimal comparison -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- Note that we cannot assume add/subtract tests cover paths adequately, -- here, because the code might be quite different (comparison cannot -- overflow or underflow, so actual subtractions are not necesary). extended: 1 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 -- sanity checks comx001 compare -2 -2 -> 0 comx002 compare -2 -1 -> -1 comx003 compare -2 0 -> -1 comx004 compare -2 1 -> -1 comx005 compare -2 2 -> -1 comx006 compare -1 -2 -> 1 comx007 compare -1 -1 -> 0 comx008 compare -1 0 -> -1 comx009 compare -1 1 -> -1 comx010 compare -1 2 -> -1 comx011 compare 0 -2 -> 1 comx012 compare 0 -1 -> 1 comx013 compare 0 0 -> 0 comx014 compare 0 1 -> -1 comx015 compare 0 2 -> -1 comx016 compare 1 -2 -> 1 comx017 compare 1 -1 -> 1 comx018 compare 1 0 -> 1 comx019 compare 1 1 -> 0 comx020 compare 1 2 -> -1 comx021 compare 2 -2 -> 1 comx022 compare 2 -1 -> 1 comx023 compare 2 0 -> 1 comx025 compare 2 1 -> 1 comx026 compare 2 2 -> 0 comx031 compare -20 -20 -> 0 comx032 compare -20 -10 -> -1 comx033 compare -20 00 -> -1 comx034 compare -20 10 -> -1 comx035 compare -20 20 -> -1 comx036 compare -10 -20 -> 1 comx037 compare -10 -10 -> 0 comx038 compare -10 00 -> -1 comx039 compare -10 10 -> -1 comx040 compare -10 20 -> -1 comx041 compare 00 -20 -> 1 comx042 compare 00 -10 -> 1 comx043 compare 00 00 -> 0 comx044 compare 00 10 -> -1 comx045 compare 00 20 -> -1 comx046 compare 10 -20 -> 1 comx047 compare 10 -10 -> 1 comx048 compare 10 00 -> 1 comx049 compare 10 10 -> 0 comx050 compare 10 20 -> -1 comx051 compare 20 -20 -> 1 comx052 compare 20 -10 -> 1 comx053 compare 20 00 -> 1 comx055 compare 20 10 -> 1 comx056 compare 20 20 -> 0 comx061 compare -2.0 -2.0 -> 0 comx062 compare -2.0 -1.0 -> -1 comx063 compare -2.0 0.0 -> -1 comx064 compare -2.0 1.0 -> -1 comx065 compare -2.0 2.0 -> -1 comx066 compare -1.0 -2.0 -> 1 comx067 compare -1.0 -1.0 -> 0 comx068 compare -1.0 0.0 -> -1 comx069 compare -1.0 1.0 -> -1 comx070 compare -1.0 2.0 -> -1 comx071 compare 0.0 -2.0 -> 1 comx072 compare 0.0 -1.0 -> 1 comx073 compare 0.0 0.0 -> 0 comx074 compare 0.0 1.0 -> -1 comx075 compare 0.0 2.0 -> -1 comx076 compare 1.0 -2.0 -> 1 comx077 compare 1.0 -1.0 -> 1 comx078 compare 1.0 0.0 -> 1 comx079 compare 1.0 1.0 -> 0 comx080 compare 1.0 2.0 -> -1 comx081 compare 2.0 -2.0 -> 1 comx082 compare 2.0 -1.0 -> 1 comx083 compare 2.0 0.0 -> 1 comx085 compare 2.0 1.0 -> 1 comx086 compare 2.0 2.0 -> 0 -- now some cases which might overflow if subtract were used maxexponent: 999999999 minexponent: -999999999 comx090 compare 9.99999999E+999999999 9.99999999E+999999999 -> 0 comx091 compare -9.99999999E+999999999 9.99999999E+999999999 -> -1 comx092 compare 9.99999999E+999999999 -9.99999999E+999999999 -> 1 comx093 compare -9.99999999E+999999999 -9.99999999E+999999999 -> 0 -- some differing length/exponent cases comx100 compare 7.0 7.0 -> 0 comx101 compare 7.0 7 -> 0 comx102 compare 7 7.0 -> 0 comx103 compare 7E+0 7.0 -> 0 comx104 compare 70E-1 7.0 -> 0 comx105 compare 0.7E+1 7 -> 0 comx106 compare 70E-1 7 -> 0 comx107 compare 7.0 7E+0 -> 0 comx108 compare 7.0 70E-1 -> 0 comx109 compare 7 0.7E+1 -> 0 comx110 compare 7 70E-1 -> 0 comx120 compare 8.0 7.0 -> 1 comx121 compare 8.0 7 -> 1 comx122 compare 8 7.0 -> 1 comx123 compare 8E+0 7.0 -> 1 comx124 compare 80E-1 7.0 -> 1 comx125 compare 0.8E+1 7 -> 1 comx126 compare 80E-1 7 -> 1 comx127 compare 8.0 7E+0 -> 1 comx128 compare 8.0 70E-1 -> 1 comx129 compare 8 0.7E+1 -> 1 comx130 compare 8 70E-1 -> 1 comx140 compare 8.0 9.0 -> -1 comx141 compare 8.0 9 -> -1 comx142 compare 8 9.0 -> -1 comx143 compare 8E+0 9.0 -> -1 comx144 compare 80E-1 9.0 -> -1 comx145 compare 0.8E+1 9 -> -1 comx146 compare 80E-1 9 -> -1 comx147 compare 8.0 9E+0 -> -1 comx148 compare 8.0 90E-1 -> -1 comx149 compare 8 0.9E+1 -> -1 comx150 compare 8 90E-1 -> -1 -- and again, with sign changes -+ .. comx200 compare -7.0 7.0 -> -1 comx201 compare -7.0 7 -> -1 comx202 compare -7 7.0 -> -1 comx203 compare -7E+0 7.0 -> -1 comx204 compare -70E-1 7.0 -> -1 comx205 compare -0.7E+1 7 -> -1 comx206 compare -70E-1 7 -> -1 comx207 compare -7.0 7E+0 -> -1 comx208 compare -7.0 70E-1 -> -1 comx209 compare -7 0.7E+1 -> -1 comx210 compare -7 70E-1 -> -1 comx220 compare -8.0 7.0 -> -1 comx221 compare -8.0 7 -> -1 comx222 compare -8 7.0 -> -1 comx223 compare -8E+0 7.0 -> -1 comx224 compare -80E-1 7.0 -> -1 comx225 compare -0.8E+1 7 -> -1 comx226 compare -80E-1 7 -> -1 comx227 compare -8.0 7E+0 -> -1 comx228 compare -8.0 70E-1 -> -1 comx229 compare -8 0.7E+1 -> -1 comx230 compare -8 70E-1 -> -1 comx240 compare -8.0 9.0 -> -1 comx241 compare -8.0 9 -> -1 comx242 compare -8 9.0 -> -1 comx243 compare -8E+0 9.0 -> -1 comx244 compare -80E-1 9.0 -> -1 comx245 compare -0.8E+1 9 -> -1 comx246 compare -80E-1 9 -> -1 comx247 compare -8.0 9E+0 -> -1 comx248 compare -8.0 90E-1 -> -1 comx249 compare -8 0.9E+1 -> -1 comx250 compare -8 90E-1 -> -1 -- and again, with sign changes +- .. comx300 compare 7.0 -7.0 -> 1 comx301 compare 7.0 -7 -> 1 comx302 compare 7 -7.0 -> 1 comx303 compare 7E+0 -7.0 -> 1 comx304 compare 70E-1 -7.0 -> 1 comx305 compare .7E+1 -7 -> 1 comx306 compare 70E-1 -7 -> 1 comx307 compare 7.0 -7E+0 -> 1 comx308 compare 7.0 -70E-1 -> 1 comx309 compare 7 -.7E+1 -> 1 comx310 compare 7 -70E-1 -> 1 comx320 compare 8.0 -7.0 -> 1 comx321 compare 8.0 -7 -> 1 comx322 compare 8 -7.0 -> 1 comx323 compare 8E+0 -7.0 -> 1 comx324 compare 80E-1 -7.0 -> 1 comx325 compare .8E+1 -7 -> 1 comx326 compare 80E-1 -7 -> 1 comx327 compare 8.0 -7E+0 -> 1 comx328 compare 8.0 -70E-1 -> 1 comx329 compare 8 -.7E+1 -> 1 comx330 compare 8 -70E-1 -> 1 comx340 compare 8.0 -9.0 -> 1 comx341 compare 8.0 -9 -> 1 comx342 compare 8 -9.0 -> 1 comx343 compare 8E+0 -9.0 -> 1 comx344 compare 80E-1 -9.0 -> 1 comx345 compare .8E+1 -9 -> 1 comx346 compare 80E-1 -9 -> 1 comx347 compare 8.0 -9E+0 -> 1 comx348 compare 8.0 -90E-1 -> 1 comx349 compare 8 -.9E+1 -> 1 comx350 compare 8 -90E-1 -> 1 -- and again, with sign changes -- .. comx400 compare -7.0 -7.0 -> 0 comx401 compare -7.0 -7 -> 0 comx402 compare -7 -7.0 -> 0 comx403 compare -7E+0 -7.0 -> 0 comx404 compare -70E-1 -7.0 -> 0 comx405 compare -.7E+1 -7 -> 0 comx406 compare -70E-1 -7 -> 0 comx407 compare -7.0 -7E+0 -> 0 comx408 compare -7.0 -70E-1 -> 0 comx409 compare -7 -.7E+1 -> 0 comx410 compare -7 -70E-1 -> 0 comx420 compare -8.0 -7.0 -> -1 comx421 compare -8.0 -7 -> -1 comx422 compare -8 -7.0 -> -1 comx423 compare -8E+0 -7.0 -> -1 comx424 compare -80E-1 -7.0 -> -1 comx425 compare -.8E+1 -7 -> -1 comx426 compare -80E-1 -7 -> -1 comx427 compare -8.0 -7E+0 -> -1 comx428 compare -8.0 -70E-1 -> -1 comx429 compare -8 -.7E+1 -> -1 comx430 compare -8 -70E-1 -> -1 comx440 compare -8.0 -9.0 -> 1 comx441 compare -8.0 -9 -> 1 comx442 compare -8 -9.0 -> 1 comx443 compare -8E+0 -9.0 -> 1 comx444 compare -80E-1 -9.0 -> 1 comx445 compare -.8E+1 -9 -> 1 comx446 compare -80E-1 -9 -> 1 comx447 compare -8.0 -9E+0 -> 1 comx448 compare -8.0 -90E-1 -> 1 comx449 compare -8 -.9E+1 -> 1 comx450 compare -8 -90E-1 -> 1 -- testcases that subtract to lots of zeros at boundaries [pgr] precision: 40 comx470 compare 123.4560000000000000E789 123.456E789 -> 0 comx471 compare 123.456000000000000E-89 123.456E-89 -> 0 comx472 compare 123.45600000000000E789 123.456E789 -> 0 comx473 compare 123.4560000000000E-89 123.456E-89 -> 0 comx474 compare 123.456000000000E789 123.456E789 -> 0 comx475 compare 123.45600000000E-89 123.456E-89 -> 0 comx476 compare 123.4560000000E789 123.456E789 -> 0 comx477 compare 123.456000000E-89 123.456E-89 -> 0 comx478 compare 123.45600000E789 123.456E789 -> 0 comx479 compare 123.4560000E-89 123.456E-89 -> 0 comx480 compare 123.456000E789 123.456E789 -> 0 comx481 compare 123.45600E-89 123.456E-89 -> 0 comx482 compare 123.4560E789 123.456E789 -> 0 comx483 compare 123.456E-89 123.456E-89 -> 0 comx484 compare 123.456E-89 123.4560000000000000E-89 -> 0 comx485 compare 123.456E789 123.456000000000000E789 -> 0 comx486 compare 123.456E-89 123.45600000000000E-89 -> 0 comx487 compare 123.456E789 123.4560000000000E789 -> 0 comx488 compare 123.456E-89 123.456000000000E-89 -> 0 comx489 compare 123.456E789 123.45600000000E789 -> 0 comx490 compare 123.456E-89 123.4560000000E-89 -> 0 comx491 compare 123.456E789 123.456000000E789 -> 0 comx492 compare 123.456E-89 123.45600000E-89 -> 0 comx493 compare 123.456E789 123.4560000E789 -> 0 comx494 compare 123.456E-89 123.456000E-89 -> 0 comx495 compare 123.456E789 123.45600E789 -> 0 comx496 compare 123.456E-89 123.4560E-89 -> 0 comx497 compare 123.456E789 123.456E789 -> 0 -- wide-ranging, around precision; signs equal precision: 9 comx500 compare 1 1E-15 -> 1 comx501 compare 1 1E-14 -> 1 comx502 compare 1 1E-13 -> 1 comx503 compare 1 1E-12 -> 1 comx504 compare 1 1E-11 -> 1 comx505 compare 1 1E-10 -> 1 comx506 compare 1 1E-9 -> 1 comx507 compare 1 1E-8 -> 1 comx508 compare 1 1E-7 -> 1 comx509 compare 1 1E-6 -> 1 comx510 compare 1 1E-5 -> 1 comx511 compare 1 1E-4 -> 1 comx512 compare 1 1E-3 -> 1 comx513 compare 1 1E-2 -> 1 comx514 compare 1 1E-1 -> 1 comx515 compare 1 1E-0 -> 0 comx516 compare 1 1E+1 -> -1 comx517 compare 1 1E+2 -> -1 comx518 compare 1 1E+3 -> -1 comx519 compare 1 1E+4 -> -1 comx521 compare 1 1E+5 -> -1 comx522 compare 1 1E+6 -> -1 comx523 compare 1 1E+7 -> -1 comx524 compare 1 1E+8 -> -1 comx525 compare 1 1E+9 -> -1 comx526 compare 1 1E+10 -> -1 comx527 compare 1 1E+11 -> -1 comx528 compare 1 1E+12 -> -1 comx529 compare 1 1E+13 -> -1 comx530 compare 1 1E+14 -> -1 comx531 compare 1 1E+15 -> -1 -- LR swap comx540 compare 1E-15 1 -> -1 comx541 compare 1E-14 1 -> -1 comx542 compare 1E-13 1 -> -1 comx543 compare 1E-12 1 -> -1 comx544 compare 1E-11 1 -> -1 comx545 compare 1E-10 1 -> -1 comx546 compare 1E-9 1 -> -1 comx547 compare 1E-8 1 -> -1 comx548 compare 1E-7 1 -> -1 comx549 compare 1E-6 1 -> -1 comx550 compare 1E-5 1 -> -1 comx551 compare 1E-4 1 -> -1 comx552 compare 1E-3 1 -> -1 comx553 compare 1E-2 1 -> -1 comx554 compare 1E-1 1 -> -1 comx555 compare 1E-0 1 -> 0 comx556 compare 1E+1 1 -> 1 comx557 compare 1E+2 1 -> 1 comx558 compare 1E+3 1 -> 1 comx559 compare 1E+4 1 -> 1 comx561 compare 1E+5 1 -> 1 comx562 compare 1E+6 1 -> 1 comx563 compare 1E+7 1 -> 1 comx564 compare 1E+8 1 -> 1 comx565 compare 1E+9 1 -> 1 comx566 compare 1E+10 1 -> 1 comx567 compare 1E+11 1 -> 1 comx568 compare 1E+12 1 -> 1 comx569 compare 1E+13 1 -> 1 comx570 compare 1E+14 1 -> 1 comx571 compare 1E+15 1 -> 1 -- similar with an useful coefficient, one side only comx580 compare 0.000000987654321 1E-15 -> 1 comx581 compare 0.000000987654321 1E-14 -> 1 comx582 compare 0.000000987654321 1E-13 -> 1 comx583 compare 0.000000987654321 1E-12 -> 1 comx584 compare 0.000000987654321 1E-11 -> 1 comx585 compare 0.000000987654321 1E-10 -> 1 comx586 compare 0.000000987654321 1E-9 -> 1 comx587 compare 0.000000987654321 1E-8 -> 1 comx588 compare 0.000000987654321 1E-7 -> 1 comx589 compare 0.000000987654321 1E-6 -> -1 comx590 compare 0.000000987654321 1E-5 -> -1 comx591 compare 0.000000987654321 1E-4 -> -1 comx592 compare 0.000000987654321 1E-3 -> -1 comx593 compare 0.000000987654321 1E-2 -> -1 comx594 compare 0.000000987654321 1E-1 -> -1 comx595 compare 0.000000987654321 1E-0 -> -1 comx596 compare 0.000000987654321 1E+1 -> -1 comx597 compare 0.000000987654321 1E+2 -> -1 comx598 compare 0.000000987654321 1E+3 -> -1 comx599 compare 0.000000987654321 1E+4 -> -1 -- check some unit-y traps precision: 20 comx600 compare 12 12.2345 -> -1 comx601 compare 12.0 12.2345 -> -1 comx602 compare 12.00 12.2345 -> -1 comx603 compare 12.000 12.2345 -> -1 comx604 compare 12.0000 12.2345 -> -1 comx605 compare 12.00000 12.2345 -> -1 comx606 compare 12.000000 12.2345 -> -1 comx607 compare 12.0000000 12.2345 -> -1 comx608 compare 12.00000000 12.2345 -> -1 comx609 compare 12.000000000 12.2345 -> -1 comx610 compare 12.1234 12 -> 1 comx611 compare 12.1234 12.0 -> 1 comx612 compare 12.1234 12.00 -> 1 comx613 compare 12.1234 12.000 -> 1 comx614 compare 12.1234 12.0000 -> 1 comx615 compare 12.1234 12.00000 -> 1 comx616 compare 12.1234 12.000000 -> 1 comx617 compare 12.1234 12.0000000 -> 1 comx618 compare 12.1234 12.00000000 -> 1 comx619 compare 12.1234 12.000000000 -> 1 comx620 compare -12 -12.2345 -> 1 comx621 compare -12.0 -12.2345 -> 1 comx622 compare -12.00 -12.2345 -> 1 comx623 compare -12.000 -12.2345 -> 1 comx624 compare -12.0000 -12.2345 -> 1 comx625 compare -12.00000 -12.2345 -> 1 comx626 compare -12.000000 -12.2345 -> 1 comx627 compare -12.0000000 -12.2345 -> 1 comx628 compare -12.00000000 -12.2345 -> 1 comx629 compare -12.000000000 -12.2345 -> 1 comx630 compare -12.1234 -12 -> -1 comx631 compare -12.1234 -12.0 -> -1 comx632 compare -12.1234 -12.00 -> -1 comx633 compare -12.1234 -12.000 -> -1 comx634 compare -12.1234 -12.0000 -> -1 comx635 compare -12.1234 -12.00000 -> -1 comx636 compare -12.1234 -12.000000 -> -1 comx637 compare -12.1234 -12.0000000 -> -1 comx638 compare -12.1234 -12.00000000 -> -1 comx639 compare -12.1234 -12.000000000 -> -1 precision: 9 -- extended zeros comx640 compare 0 0 -> 0 comx641 compare 0 -0 -> 0 comx642 compare 0 -0.0 -> 0 comx643 compare 0 0.0 -> 0 comx644 compare -0 0 -> 0 comx645 compare -0 -0 -> 0 comx646 compare -0 -0.0 -> 0 comx647 compare -0 0.0 -> 0 comx648 compare 0.0 0 -> 0 comx649 compare 0.0 -0 -> 0 comx650 compare 0.0 -0.0 -> 0 comx651 compare 0.0 0.0 -> 0 comx652 compare -0.0 0 -> 0 comx653 compare -0.0 -0 -> 0 comx654 compare -0.0 -0.0 -> 0 comx655 compare -0.0 0.0 -> 0 comx656 compare -0E1 0.0 -> 0 comx657 compare -0E2 0.0 -> 0 comx658 compare 0E1 0.0 -> 0 comx659 compare 0E2 0.0 -> 0 comx660 compare -0E1 0 -> 0 comx661 compare -0E2 0 -> 0 comx662 compare 0E1 0 -> 0 comx663 compare 0E2 0 -> 0 comx664 compare -0E1 -0E1 -> 0 comx665 compare -0E2 -0E1 -> 0 comx666 compare 0E1 -0E1 -> 0 comx667 compare 0E2 -0E1 -> 0 comx668 compare -0E1 -0E2 -> 0 comx669 compare -0E2 -0E2 -> 0 comx670 compare 0E1 -0E2 -> 0 comx671 compare 0E2 -0E2 -> 0 comx672 compare -0E1 0E1 -> 0 comx673 compare -0E2 0E1 -> 0 comx674 compare 0E1 0E1 -> 0 comx675 compare 0E2 0E1 -> 0 comx676 compare -0E1 0E2 -> 0 comx677 compare -0E2 0E2 -> 0 comx678 compare 0E1 0E2 -> 0 comx679 compare 0E2 0E2 -> 0 -- trailing zeros; unit-y precision: 20 comx680 compare 12 12 -> 0 comx681 compare 12 12.0 -> 0 comx682 compare 12 12.00 -> 0 comx683 compare 12 12.000 -> 0 comx684 compare 12 12.0000 -> 0 comx685 compare 12 12.00000 -> 0 comx686 compare 12 12.000000 -> 0 comx687 compare 12 12.0000000 -> 0 comx688 compare 12 12.00000000 -> 0 comx689 compare 12 12.000000000 -> 0 comx690 compare 12 12 -> 0 comx691 compare 12.0 12 -> 0 comx692 compare 12.00 12 -> 0 comx693 compare 12.000 12 -> 0 comx694 compare 12.0000 12 -> 0 comx695 compare 12.00000 12 -> 0 comx696 compare 12.000000 12 -> 0 comx697 compare 12.0000000 12 -> 0 comx698 compare 12.00000000 12 -> 0 comx699 compare 12.000000000 12 -> 0 -- long operand checks maxexponent: 999 minexponent: -999 precision: 9 comx701 compare 12345678000 1 -> 1 comx702 compare 1 12345678000 -> -1 comx703 compare 1234567800 1 -> 1 comx704 compare 1 1234567800 -> -1 comx705 compare 1234567890 1 -> 1 comx706 compare 1 1234567890 -> -1 comx707 compare 1234567891 1 -> 1 comx708 compare 1 1234567891 -> -1 comx709 compare 12345678901 1 -> 1 comx710 compare 1 12345678901 -> -1 comx711 compare 1234567896 1 -> 1 comx712 compare 1 1234567896 -> -1 comx713 compare -1234567891 1 -> -1 comx714 compare 1 -1234567891 -> 1 comx715 compare -12345678901 1 -> -1 comx716 compare 1 -12345678901 -> 1 comx717 compare -1234567896 1 -> -1 comx718 compare 1 -1234567896 -> 1 precision: 15 -- same with plenty of precision comx721 compare 12345678000 1 -> 1 comx722 compare 1 12345678000 -> -1 comx723 compare 1234567800 1 -> 1 comx724 compare 1 1234567800 -> -1 comx725 compare 1234567890 1 -> 1 comx726 compare 1 1234567890 -> -1 comx727 compare 1234567891 1 -> 1 comx728 compare 1 1234567891 -> -1 comx729 compare 12345678901 1 -> 1 comx730 compare 1 12345678901 -> -1 comx731 compare 1234567896 1 -> 1 comx732 compare 1 1234567896 -> -1 -- residue cases precision: 5 comx740 compare 1 0.9999999 -> 1 comx741 compare 1 0.999999 -> 1 comx742 compare 1 0.99999 -> 1 comx743 compare 1 1.0000 -> 0 comx744 compare 1 1.00001 -> -1 comx745 compare 1 1.000001 -> -1 comx746 compare 1 1.0000001 -> -1 comx750 compare 0.9999999 1 -> -1 comx751 compare 0.999999 1 -> -1 comx752 compare 0.99999 1 -> -1 comx753 compare 1.0000 1 -> 0 comx754 compare 1.00001 1 -> 1 comx755 compare 1.000001 1 -> 1 comx756 compare 1.0000001 1 -> 1 -- a selection of longies comx760 compare -36852134.84194296250843579428931 -5830629.8347085025808756560357940 -> -1 comx761 compare -36852134.84194296250843579428931 -36852134.84194296250843579428931 -> 0 comx762 compare -36852134.94194296250843579428931 -36852134.84194296250843579428931 -> -1 comx763 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -- precisions above or below the difference should have no effect precision: 11 comx764 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 10 comx765 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 9 comx766 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 8 comx767 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 7 comx768 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 6 comx769 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 5 comx770 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 4 comx771 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 3 comx772 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 2 comx773 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 precision: 1 comx774 compare -36852134.84194296250843579428931 -36852134.94194296250843579428931 -> 1 -- Specials precision: 9 comx780 compare Inf -Inf -> 1 comx781 compare Inf -1000 -> 1 comx782 compare Inf -1 -> 1 comx783 compare Inf -0 -> 1 comx784 compare Inf 0 -> 1 comx785 compare Inf 1 -> 1 comx786 compare Inf 1000 -> 1 comx787 compare Inf Inf -> 0 comx788 compare -1000 Inf -> -1 comx789 compare -Inf Inf -> -1 comx790 compare -1 Inf -> -1 comx791 compare -0 Inf -> -1 comx792 compare 0 Inf -> -1 comx793 compare 1 Inf -> -1 comx794 compare 1000 Inf -> -1 comx795 compare Inf Inf -> 0 comx800 compare -Inf -Inf -> 0 comx801 compare -Inf -1000 -> -1 comx802 compare -Inf -1 -> -1 comx803 compare -Inf -0 -> -1 comx804 compare -Inf 0 -> -1 comx805 compare -Inf 1 -> -1 comx806 compare -Inf 1000 -> -1 comx807 compare -Inf Inf -> -1 comx808 compare -Inf -Inf -> 0 comx809 compare -1000 -Inf -> 1 comx810 compare -1 -Inf -> 1 comx811 compare -0 -Inf -> 1 comx812 compare 0 -Inf -> 1 comx813 compare 1 -Inf -> 1 comx814 compare 1000 -Inf -> 1 comx815 compare Inf -Inf -> 1 comx821 compare NaN -Inf -> NaN comx822 compare NaN -1000 -> NaN comx823 compare NaN -1 -> NaN comx824 compare NaN -0 -> NaN comx825 compare NaN 0 -> NaN comx826 compare NaN 1 -> NaN comx827 compare NaN 1000 -> NaN comx828 compare NaN Inf -> NaN comx829 compare NaN NaN -> NaN comx830 compare -Inf NaN -> NaN comx831 compare -1000 NaN -> NaN comx832 compare -1 NaN -> NaN comx833 compare -0 NaN -> NaN comx834 compare 0 NaN -> NaN comx835 compare 1 NaN -> NaN comx836 compare 1000 NaN -> NaN comx837 compare Inf NaN -> NaN comx841 compare sNaN -Inf -> NaN Invalid_operation comx842 compare sNaN -1000 -> NaN Invalid_operation comx843 compare sNaN -1 -> NaN Invalid_operation comx844 compare sNaN -0 -> NaN Invalid_operation comx845 compare sNaN 0 -> NaN Invalid_operation comx846 compare sNaN 1 -> NaN Invalid_operation comx847 compare sNaN 1000 -> NaN Invalid_operation comx848 compare sNaN NaN -> NaN Invalid_operation comx849 compare sNaN sNaN -> NaN Invalid_operation comx850 compare NaN sNaN -> NaN Invalid_operation comx851 compare -Inf sNaN -> NaN Invalid_operation comx852 compare -1000 sNaN -> NaN Invalid_operation comx853 compare -1 sNaN -> NaN Invalid_operation comx854 compare -0 sNaN -> NaN Invalid_operation comx855 compare 0 sNaN -> NaN Invalid_operation comx856 compare 1 sNaN -> NaN Invalid_operation comx857 compare 1000 sNaN -> NaN Invalid_operation comx858 compare Inf sNaN -> NaN Invalid_operation comx859 compare NaN sNaN -> NaN Invalid_operation -- overflow and underflow tests .. subnormal results now allowed maxExponent: 999999999 minexponent: -999999999 comx860 compare +1.23456789012345E-0 9E+999999999 -> -1 comx861 compare 9E+999999999 +1.23456789012345E-0 -> 1 comx862 compare +0.100 9E-999999999 -> 1 comx863 compare 9E-999999999 +0.100 -> -1 comx865 compare -1.23456789012345E-0 9E+999999999 -> -1 comx866 compare 9E+999999999 -1.23456789012345E-0 -> 1 comx867 compare -0.100 9E-999999999 -> -1 comx868 compare 9E-999999999 -0.100 -> 1 comx869 compare 1e-599999999 1e-400000001 -> -1 comx870 compare 1e-599999999 1e-400000000 -> -1 comx871 compare 1e-600000000 1e-400000000 -> -1 comx872 compare 9e-999999998 0.01 -> -1 comx873 compare 9e-999999998 0.1 -> -1 comx874 compare 0.01 9e-999999998 -> 1 comx875 compare 1e599999999 1e400000001 -> 1 comx876 compare 1e599999999 1e400000000 -> 1 comx877 compare 1e600000000 1e400000000 -> 1 comx878 compare 9e999999998 100 -> 1 comx879 compare 9e999999998 10 -> 1 comx880 compare 100 9e999999998 -> -1 -- signs comx881 compare 1e+777777777 1e+411111111 -> 1 comx882 compare 1e+777777777 -1e+411111111 -> 1 comx883 compare -1e+777777777 1e+411111111 -> -1 comx884 compare -1e+777777777 -1e+411111111 -> -1 comx885 compare 1e-777777777 1e-411111111 -> -1 comx886 compare 1e-777777777 -1e-411111111 -> 1 comx887 compare -1e-777777777 1e-411111111 -> -1 comx888 compare -1e-777777777 -1e-411111111 -> 1 -- Null tests comx900 compare 10 # -> NaN Invalid_operation comx901 compare # 10 -> NaN Invalid_operation --- NEW FILE: clamp.decTest --- ------------------------------------------------------------------------ -- clamp.decTest -- clamped exponent tests (format-independent) -- -- Copyright (c) IBM Corporation, 2000, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of tests uses the same limits as the 8-byte concrete -- representation, but applies clamping without using format-specific -- conversions. extended: 1 precision: 16 rounding: half_even maxExponent: 384 minExponent: -383 clamp: 1 -- General testcases -- Normality clam010 apply 1234567890123456 -> 1234567890123456 clam011 apply 1234567890123456.0 -> 1234567890123456 Rounded clam012 apply 1234567890123456.1 -> 1234567890123456 Rounded Inexact clam013 apply -1234567890123456 -> -1234567890123456 clam014 apply -1234567890123456.0 -> -1234567890123456 Rounded clam015 apply -1234567890123456.1 -> -1234567890123456 Rounded Inexact -- Nmax and similar clam022 apply 9.999999999999999E+384 -> 9.999999999999999E+384 clam024 apply 1.234567890123456E+384 -> 1.234567890123456E+384 -- fold-downs (more below) clam030 apply 1.23E+384 -> 1.230000000000000E+384 Clamped clam032 apply 1E+384 -> 1.000000000000000E+384 Clamped clam051 apply 12345 -> 12345 clam053 apply 1234 -> 1234 clam055 apply 123 -> 123 clam057 apply 12 -> 12 clam059 apply 1 -> 1 clam061 apply 1.23 -> 1.23 clam063 apply 123.45 -> 123.45 -- Nmin and below clam071 apply 1E-383 -> 1E-383 clam073 apply 1.000000000000000E-383 -> 1.000000000000000E-383 clam075 apply 1.000000000000001E-383 -> 1.000000000000001E-383 clam077 apply 0.100000000000000E-383 -> 1.00000000000000E-384 Subnormal clam079 apply 0.000000000000010E-383 -> 1.0E-397 Subnormal clam081 apply 0.00000000000001E-383 -> 1E-397 Subnormal clam083 apply 0.000000000000001E-383 -> 1E-398 Subnormal -- underflows clam090 apply 1e-398 -> #0000000000000001 Subnormal clam091 apply 1.9e-398 -> #0000000000000002 Subnormal Underflow Inexact Rounded clam092 apply 1.1e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded clam093 apply 1.00000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded clam094 apply 1.00000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded clam095 apply 1.000000000000001e-398 -> #0000000000000001 Subnormal Underflow Inexact Rounded clam096 apply 0.1e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded clam097 apply 0.00000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded clam098 apply 0.00000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded clam099 apply 0.000000000000001e-398 -> #0000000000000000 Subnormal Underflow Inexact Rounded -- Same again, negatives -- Nmax and similar clam122 apply -9.999999999999999E+384 -> -9.999999999999999E+384 clam124 apply -1.234567890123456E+384 -> -1.234567890123456E+384 -- fold-downs (more below) clam130 apply -1.23E+384 -> -1.230000000000000E+384 Clamped clam132 apply -1E+384 -> -1.000000000000000E+384 Clamped clam151 apply -12345 -> -12345 clam153 apply -1234 -> -1234 clam155 apply -123 -> -123 clam157 apply -12 -> -12 clam159 apply -1 -> -1 clam161 apply -1.23 -> -1.23 clam163 apply -123.45 -> -123.45 -- Nmin and below clam171 apply -1E-383 -> -1E-383 clam173 apply -1.000000000000000E-383 -> -1.000000000000000E-383 clam175 apply -1.000000000000001E-383 -> -1.000000000000001E-383 clam177 apply -0.100000000000000E-383 -> -1.00000000000000E-384 Subnormal clam179 apply -0.000000000000010E-383 -> -1.0E-397 Subnormal clam181 apply -0.00000000000001E-383 -> -1E-397 Subnormal clam183 apply -0.000000000000001E-383 -> -1E-398 Subnormal -- underflows clam189 apply -1e-398 -> #8000000000000001 Subnormal clam190 apply -1.0e-398 -> #8000000000000001 Subnormal Rounded clam191 apply -1.9e-398 -> #8000000000000002 Subnormal Underflow Inexact Rounded clam192 apply -1.1e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded clam193 apply -1.00000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded clam194 apply -1.00000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded clam195 apply -1.000000000000001e-398 -> #8000000000000001 Subnormal Underflow Inexact Rounded clam196 apply -0.1e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded clam197 apply -0.00000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded clam198 apply -0.00000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded clam199 apply -0.000000000000001e-398 -> #8000000000000000 Subnormal Underflow Inexact Rounded -- zeros clam401 apply 0E-500 -> 0E-398 Clamped clam402 apply 0E-400 -> 0E-398 Clamped clam403 apply 0E-398 -> 0E-398 clam404 apply 0.000000000000000E-383 -> 0E-398 clam405 apply 0E-2 -> 0.00 clam406 apply 0 -> 0 clam407 apply 0E+3 -> 0E+3 clam408 apply 0E+369 -> 0E+369 -- clamped zeros... clam410 apply 0E+370 -> 0E+369 Clamped clam411 apply 0E+384 -> 0E+369 Clamped clam412 apply 0E+400 -> 0E+369 Clamped clam413 apply 0E+500 -> 0E+369 Clamped -- negative zeros clam420 apply -0E-500 -> -0E-398 Clamped clam421 apply -0E-400 -> -0E-398 Clamped clam422 apply -0E-398 -> -0E-398 clam423 apply -0.000000000000000E-383 -> -0E-398 clam424 apply -0E-2 -> -0.00 clam425 apply -0 -> -0 clam426 apply -0E+3 -> -0E+3 clam427 apply -0E+369 -> -0E+369 -- clamped zeros... clam431 apply -0E+370 -> -0E+369 Clamped clam432 apply -0E+384 -> -0E+369 Clamped clam433 apply -0E+400 -> -0E+369 Clamped clam434 apply -0E+500 -> -0E+369 Clamped -- fold-down full sequence clam601 apply 1E+384 -> 1.000000000000000E+384 Clamped clam603 apply 1E+383 -> 1.00000000000000E+383 Clamped clam605 apply 1E+382 -> 1.0000000000000E+382 Clamped clam607 apply 1E+381 -> 1.000000000000E+381 Clamped clam609 apply 1E+380 -> 1.00000000000E+380 Clamped clam611 apply 1E+379 -> 1.0000000000E+379 Clamped clam613 apply 1E+378 -> 1.000000000E+378 Clamped clam615 apply 1E+377 -> 1.00000000E+377 Clamped clam617 apply 1E+376 -> 1.0000000E+376 Clamped clam619 apply 1E+375 -> 1.000000E+375 Clamped clam621 apply 1E+374 -> 1.00000E+374 Clamped clam623 apply 1E+373 -> 1.0000E+373 Clamped clam625 apply 1E+372 -> 1.000E+372 Clamped clam627 apply 1E+371 -> 1.00E+371 Clamped clam629 apply 1E+370 -> 1.0E+370 Clamped clam631 apply 1E+369 -> 1E+369 clam633 apply 1E+368 -> 1E+368 -- same with 9s clam641 apply 9E+384 -> 9.000000000000000E+384 Clamped clam643 apply 9E+383 -> 9.00000000000000E+383 Clamped clam645 apply 9E+382 -> 9.0000000000000E+382 Clamped clam647 apply 9E+381 -> 9.000000000000E+381 Clamped clam649 apply 9E+380 -> 9.00000000000E+380 Clamped clam651 apply 9E+379 -> 9.0000000000E+379 Clamped clam653 apply 9E+378 -> 9.000000000E+378 Clamped clam655 apply 9E+377 -> 9.00000000E+377 Clamped clam657 apply 9E+376 -> 9.0000000E+376 Clamped clam659 apply 9E+375 -> 9.000000E+375 Clamped clam661 apply 9E+374 -> 9.00000E+374 Clamped clam663 apply 9E+373 -> 9.0000E+373 Clamped clam665 apply 9E+372 -> 9.000E+372 Clamped clam667 apply 9E+371 -> 9.00E+371 Clamped clam669 apply 9E+370 -> 9.0E+370 Clamped clam671 apply 9E+369 -> 9E+369 clam673 apply 9E+368 -> 9E+368 -- example from documentation precision: 7 rounding: half_even maxExponent: +96 minExponent: -95 clamp: 0 clam700 apply 1.23E+96 -> 1.23E+96 clamp: 1 clam701 apply 1.23E+96 -> 1.230000E+96 Clamped --- NEW FILE: base.decTest --- ------------------------------------------------------------------------ -- base.decTest -- base decimal <--> string conversions -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ [...1173 lines suppressed...] basx1001 toSci 1e999999999 -> 1E+999999999 basx1002 toSci 1e0999999999 -> 1E+999999999 basx1003 toSci 1e00999999999 -> 1E+999999999 basx1004 toSci 1e000999999999 -> 1E+999999999 basx1005 toSci 1e000000000000999999999 -> 1E+999999999 basx1006 toSci 1e000000000001000000007 -> Infinity Overflow Inexact Rounded basx1007 toSci 1e-999999999 -> 1E-999999999 basx1008 toSci 1e-0999999999 -> 1E-999999999 basx1009 toSci 1e-00999999999 -> 1E-999999999 basx1010 toSci 1e-000999999999 -> 1E-999999999 basx1011 toSci 1e-000000000000999999999 -> 1E-999999999 basx1012 toSci 1e-000000000001000000007 -> 1E-1000000007 Subnormal -- check for double-rounded subnormals precision: 5 maxexponent: 79 minexponent: -79 basx1021 toSci 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow basx1022 toSci 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow basx1023 toSci 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow --- NEW FILE: add.decTest --- ------------------------------------------------------------------------ -- add.decTest -- decimal addition -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 extended: 1 -- [first group are 'quick confidence check'] addx001 add 1 1 -> 2 addx002 add 2 3 -> 5 addx003 add '5.75' '3.3' -> 9.05 addx004 add '5' '-3' -> 2 addx005 add '-5' '-3' -> -8 addx006 add '-7' '2.5' -> -4.5 addx007 add '0.7' '0.3' -> 1.0 addx008 add '1.25' '1.25' -> 2.50 addx009 add '1.23456789' '1.00000000' -> '2.23456789' addx010 add '1.23456789' '1.00000011' -> '2.23456800' addx011 add '0.4444444444' '0.5555555555' -> '1.00000000' Inexact Rounded addx012 add '0.4444444440' '0.5555555555' -> '1.00000000' Inexact Rounded addx013 add '0.4444444444' '0.5555555550' -> '0.999999999' Inexact Rounded addx014 add '0.44444444449' '0' -> '0.444444444' Inexact Rounded addx015 add '0.444444444499' '0' -> '0.444444444' Inexact Rounded addx016 add '0.4444444444999' '0' -> '0.444444444' Inexact Rounded addx017 add '0.4444444445000' '0' -> '0.444444445' Inexact Rounded addx018 add '0.4444444445001' '0' -> '0.444444445' Inexact Rounded addx019 add '0.444444444501' '0' -> '0.444444445' Inexact Rounded addx020 add '0.44444444451' '0' -> '0.444444445' Inexact Rounded addx021 add 0 1 -> 1 addx022 add 1 1 -> 2 addx023 add 2 1 -> 3 addx024 add 3 1 -> 4 addx025 add 4 1 -> 5 addx026 add 5 1 -> 6 addx027 add 6 1 -> 7 addx028 add 7 1 -> 8 addx029 add 8 1 -> 9 addx030 add 9 1 -> 10 -- some carrying effects addx031 add '0.9998' '0.0000' -> '0.9998' addx032 add '0.9998' '0.0001' -> '0.9999' addx033 add '0.9998' '0.0002' -> '1.0000' addx034 add '0.9998' '0.0003' -> '1.0001' addx035 add '70' '10000e+9' -> '1.00000000E+13' Inexact Rounded addx036 add '700' '10000e+9' -> '1.00000000E+13' Inexact Rounded addx037 add '7000' '10000e+9' -> '1.00000000E+13' Inexact Rounded addx038 add '70000' '10000e+9' -> '1.00000001E+13' Inexact Rounded addx039 add '700000' '10000e+9' -> '1.00000007E+13' Rounded -- symmetry: addx040 add '10000e+9' '70' -> '1.00000000E+13' Inexact Rounded addx041 add '10000e+9' '700' -> '1.00000000E+13' Inexact Rounded addx042 add '10000e+9' '7000' -> '1.00000000E+13' Inexact Rounded addx044 add '10000e+9' '70000' -> '1.00000001E+13' Inexact Rounded addx045 add '10000e+9' '700000' -> '1.00000007E+13' Rounded -- same, higher precision precision: 15 addx046 add '10000e+9' '7' -> '10000000000007' addx047 add '10000e+9' '70' -> '10000000000070' addx048 add '10000e+9' '700' -> '10000000000700' addx049 add '10000e+9' '7000' -> '10000000007000' addx050 add '10000e+9' '70000' -> '10000000070000' addx051 add '10000e+9' '700000' -> '10000000700000' -- examples from decarith addx053 add '12' '7.00' -> '19.00' addx054 add '1.3' '-1.07' -> '0.23' addx055 add '1.3' '-1.30' -> '0.00' addx056 add '1.3' '-2.07' -> '-0.77' addx057 add '1E+2' '1E+4' -> '1.01E+4' -- zero preservation precision: 6 addx060 add '10000e+9' '70000' -> '1.00000E+13' Inexact Rounded addx061 add 1 '0.0001' -> '1.0001' addx062 add 1 '0.00001' -> '1.00001' addx063 add 1 '0.000001' -> '1.00000' Inexact Rounded addx064 add 1 '0.0000001' -> '1.00000' Inexact Rounded addx065 add 1 '0.00000001' -> '1.00000' Inexact Rounded -- some funny zeros [in case of bad signum] addx070 add 1 0 -> 1 addx071 add 1 0. -> 1 addx072 add 1 .0 -> 1.0 addx073 add 1 0.0 -> 1.0 addx074 add 1 0.00 -> 1.00 addx075 add 0 1 -> 1 addx076 add 0. 1 -> 1 addx077 add .0 1 -> 1.0 addx078 add 0.0 1 -> 1.0 addx079 add 0.00 1 -> 1.00 precision: 9 -- some carries addx080 add 999999998 1 -> 999999999 addx081 add 999999999 1 -> 1.00000000E+9 Rounded addx082 add 99999999 1 -> 100000000 addx083 add 9999999 1 -> 10000000 addx084 add 999999 1 -> 1000000 addx085 add 99999 1 -> 100000 addx086 add 9999 1 -> 10000 addx087 add 999 1 -> 1000 addx088 add 99 1 -> 100 addx089 add 9 1 -> 10 -- more LHS swaps addx090 add '-56267E-10' 0 -> '-0.0000056267' addx091 add '-56267E-6' 0 -> '-0.056267' addx092 add '-56267E-5' 0 -> '-0.56267' addx093 add '-56267E-4' 0 -> '-5.6267' addx094 add '-56267E-3' 0 -> '-56.267' addx095 add '-56267E-2' 0 -> '-562.67' addx096 add '-56267E-1' 0 -> '-5626.7' addx097 add '-56267E-0' 0 -> '-56267' addx098 add '-5E-10' 0 -> '-5E-10' addx099 add '-5E-7' 0 -> '-5E-7' addx100 add '-5E-6' 0 -> '-0.000005' addx101 add '-5E-5' 0 -> '-0.00005' addx102 add '-5E-4' 0 -> '-0.0005' addx103 add '-5E-1' 0 -> '-0.5' addx104 add '-5E0' 0 -> '-5' addx105 add '-5E1' 0 -> '-50' addx106 add '-5E5' 0 -> '-500000' addx107 add '-5E8' 0 -> '-500000000' addx108 add '-5E9' 0 -> '-5.00000000E+9' Rounded addx109 add '-5E10' 0 -> '-5.00000000E+10' Rounded addx110 add '-5E11' 0 -> '-5.00000000E+11' Rounded addx111 add '-5E100' 0 -> '-5.00000000E+100' Rounded -- more RHS swaps addx113 add 0 '-56267E-10' -> '-0.0000056267' addx114 add 0 '-56267E-6' -> '-0.056267' addx116 add 0 '-56267E-5' -> '-0.56267' addx117 add 0 '-56267E-4' -> '-5.6267' addx119 add 0 '-56267E-3' -> '-56.267' addx120 add 0 '-56267E-2' -> '-562.67' addx121 add 0 '-56267E-1' -> '-5626.7' addx122 add 0 '-56267E-0' -> '-56267' addx123 add 0 '-5E-10' -> '-5E-10' addx124 add 0 '-5E-7' -> '-5E-7' addx125 add 0 '-5E-6' -> '-0.000005' addx126 add 0 '-5E-5' -> '-0.00005' addx127 add 0 '-5E-4' -> '-0.0005' addx128 add 0 '-5E-1' -> '-0.5' addx129 add 0 '-5E0' -> '-5' addx130 add 0 '-5E1' -> '-50' addx131 add 0 '-5E5' -> '-500000' addx132 add 0 '-5E8' -> '-500000000' addx133 add 0 '-5E9' -> '-5.00000000E+9' Rounded addx134 add 0 '-5E10' -> '-5.00000000E+10' Rounded addx135 add 0 '-5E11' -> '-5.00000000E+11' Rounded addx136 add 0 '-5E100' -> '-5.00000000E+100' Rounded -- related addx137 add 1 '0E-12' -> '1.00000000' Rounded addx138 add -1 '0E-12' -> '-1.00000000' Rounded addx139 add '0E-12' 1 -> '1.00000000' Rounded addx140 add '0E-12' -1 -> '-1.00000000' Rounded addx141 add 1E+4 0.0000 -> '10000.0000' addx142 add 1E+4 0.00000 -> '10000.0000' Rounded addx143 add 0.000 1E+5 -> '100000.000' addx144 add 0.0000 1E+5 -> '100000.000' Rounded -- [some of the next group are really constructor tests] addx146 add '00.0' 0 -> '0.0' addx147 add '0.00' 0 -> '0.00' addx148 add 0 '0.00' -> '0.00' addx149 add 0 '00.0' -> '0.0' addx150 add '00.0' '0.00' -> '0.00' addx151 add '0.00' '00.0' -> '0.00' addx152 add '3' '.3' -> '3.3' addx153 add '3.' '.3' -> '3.3' addx154 add '3.0' '.3' -> '3.3' addx155 add '3.00' '.3' -> '3.30' addx156 add '3' '3' -> '6' addx157 add '3' '+3' -> '6' addx158 add '3' '-3' -> '0' addx159 add '0.3' '-0.3' -> '0.0' addx160 add '0.03' '-0.03' -> '0.00' -- try borderline precision, with carries, etc. precision: 15 addx161 add '1E+12' '-1' -> '999999999999' addx162 add '1E+12' '1.11' -> '1000000000001.11' addx163 add '1.11' '1E+12' -> '1000000000001.11' addx164 add '-1' '1E+12' -> '999999999999' addx165 add '7E+12' '-1' -> '6999999999999' addx166 add '7E+12' '1.11' -> '7000000000001.11' addx167 add '1.11' '7E+12' -> '7000000000001.11' addx168 add '-1' '7E+12' -> '6999999999999' -- 123456789012345 123456789012345 1 23456789012345 addx170 add '0.444444444444444' '0.555555555555563' -> '1.00000000000001' Inexact Rounded addx171 add '0.444444444444444' '0.555555555555562' -> '1.00000000000001' Inexact Rounded addx172 add '0.444444444444444' '0.555555555555561' -> '1.00000000000001' Inexact Rounded addx173 add '0.444444444444444' '0.555555555555560' -> '1.00000000000000' Inexact Rounded addx174 add '0.444444444444444' '0.555555555555559' -> '1.00000000000000' Inexact Rounded addx175 add '0.444444444444444' '0.555555555555558' -> '1.00000000000000' Inexact Rounded addx176 add '0.444444444444444' '0.555555555555557' -> '1.00000000000000' Inexact Rounded addx177 add '0.444444444444444' '0.555555555555556' -> '1.00000000000000' Rounded addx178 add '0.444444444444444' '0.555555555555555' -> '0.999999999999999' addx179 add '0.444444444444444' '0.555555555555554' -> '0.999999999999998' addx180 add '0.444444444444444' '0.555555555555553' -> '0.999999999999997' addx181 add '0.444444444444444' '0.555555555555552' -> '0.999999999999996' addx182 add '0.444444444444444' '0.555555555555551' -> '0.999999999999995' addx183 add '0.444444444444444' '0.555555555555550' -> '0.999999999999994' -- and some more, including residue effects and different roundings precision: 9 rounding: half_up addx200 add '123456789' 0 -> '123456789' addx201 add '123456789' 0.000000001 -> '123456789' Inexact Rounded addx202 add '123456789' 0.000001 -> '123456789' Inexact Rounded addx203 add '123456789' 0.1 -> '123456789' Inexact Rounded addx204 add '123456789' 0.4 -> '123456789' Inexact Rounded addx205 add '123456789' 0.49 -> '123456789' Inexact Rounded addx206 add '123456789' 0.499999 -> '123456789' Inexact Rounded addx207 add '123456789' 0.499999999 -> '123456789' Inexact Rounded addx208 add '123456789' 0.5 -> '123456790' Inexact Rounded addx209 add '123456789' 0.500000001 -> '123456790' Inexact Rounded addx210 add '123456789' 0.500001 -> '123456790' Inexact Rounded addx211 add '123456789' 0.51 -> '123456790' Inexact Rounded addx212 add '123456789' 0.6 -> '123456790' Inexact Rounded addx213 add '123456789' 0.9 -> '123456790' Inexact Rounded addx214 add '123456789' 0.99999 -> '123456790' Inexact Rounded addx215 add '123456789' 0.999999999 -> '123456790' Inexact Rounded addx216 add '123456789' 1 -> '123456790' addx217 add '123456789' 1.000000001 -> '123456790' Inexact Rounded addx218 add '123456789' 1.00001 -> '123456790' Inexact Rounded addx219 add '123456789' 1.1 -> '123456790' Inexact Rounded rounding: half_even addx220 add '123456789' 0 -> '123456789' addx221 add '123456789' 0.000000001 -> '123456789' Inexact Rounded addx222 add '123456789' 0.000001 -> '123456789' Inexact Rounded addx223 add '123456789' 0.1 -> '123456789' Inexact Rounded addx224 add '123456789' 0.4 -> '123456789' Inexact Rounded addx225 add '123456789' 0.49 -> '123456789' Inexact Rounded addx226 add '123456789' 0.499999 -> '123456789' Inexact Rounded addx227 add '123456789' 0.499999999 -> '123456789' Inexact Rounded addx228 add '123456789' 0.5 -> '123456790' Inexact Rounded addx229 add '123456789' 0.500000001 -> '123456790' Inexact Rounded addx230 add '123456789' 0.500001 -> '123456790' Inexact Rounded addx231 add '123456789' 0.51 -> '123456790' Inexact Rounded addx232 add '123456789' 0.6 -> '123456790' Inexact Rounded addx233 add '123456789' 0.9 -> '123456790' Inexact Rounded addx234 add '123456789' 0.99999 -> '123456790' Inexact Rounded addx235 add '123456789' 0.999999999 -> '123456790' Inexact Rounded addx236 add '123456789' 1 -> '123456790' addx237 add '123456789' 1.00000001 -> '123456790' Inexact Rounded addx238 add '123456789' 1.00001 -> '123456790' Inexact Rounded addx239 add '123456789' 1.1 -> '123456790' Inexact Rounded -- critical few with even bottom digit... addx240 add '123456788' 0.499999999 -> '123456788' Inexact Rounded addx241 add '123456788' 0.5 -> '123456788' Inexact Rounded addx242 add '123456788' 0.500000001 -> '123456789' Inexact Rounded rounding: down addx250 add '123456789' 0 -> '123456789' addx251 add '123456789' 0.000000001 -> '123456789' Inexact Rounded addx252 add '123456789' 0.000001 -> '123456789' Inexact Rounded addx253 add '123456789' 0.1 -> '123456789' Inexact Rounded addx254 add '123456789' 0.4 -> '123456789' Inexact Rounded addx255 add '123456789' 0.49 -> '123456789' Inexact Rounded addx256 add '123456789' 0.499999 -> '123456789' Inexact Rounded addx257 add '123456789' 0.499999999 -> '123456789' Inexact Rounded addx258 add '123456789' 0.5 -> '123456789' Inexact Rounded addx259 add '123456789' 0.500000001 -> '123456789' Inexact Rounded addx260 add '123456789' 0.500001 -> '123456789' Inexact Rounded addx261 add '123456789' 0.51 -> '123456789' Inexact Rounded addx262 add '123456789' 0.6 -> '123456789' Inexact Rounded addx263 add '123456789' 0.9 -> '123456789' Inexact Rounded addx264 add '123456789' 0.99999 -> '123456789' Inexact Rounded addx265 add '123456789' 0.999999999 -> '123456789' Inexact Rounded addx266 add '123456789' 1 -> '123456790' addx267 add '123456789' 1.00000001 -> '123456790' Inexact Rounded addx268 add '123456789' 1.00001 -> '123456790' Inexact Rounded addx269 add '123456789' 1.1 -> '123456790' Inexact Rounded rounding: half_up -- input preparation tests (operands should not be rounded) precision: 3 rounding: half_up addx270 add '12345678900000' 9999999999999 -> '2.23E+13' Inexact Rounded addx271 add '9999999999999' 12345678900000 -> '2.23E+13' Inexact Rounded addx272 add '12E+3' '3444' -> '1.54E+4' Inexact Rounded addx273 add '12E+3' '3446' -> '1.54E+4' Inexact Rounded addx274 add '12E+3' '3449.9' -> '1.54E+4' Inexact Rounded addx275 add '12E+3' '3450.0' -> '1.55E+4' Inexact Rounded addx276 add '12E+3' '3450.1' -> '1.55E+4' Inexact Rounded addx277 add '12E+3' '3454' -> '1.55E+4' Inexact Rounded addx278 add '12E+3' '3456' -> '1.55E+4' Inexact Rounded addx281 add '3444' '12E+3' -> '1.54E+4' Inexact Rounded addx282 add '3446' '12E+3' -> '1.54E+4' Inexact Rounded addx283 add '3449.9' '12E+3' -> '1.54E+4' Inexact Rounded addx284 add '3450.0' '12E+3' -> '1.55E+4' Inexact Rounded addx285 add '3450.1' '12E+3' -> '1.55E+4' Inexact Rounded addx286 add '3454' '12E+3' -> '1.55E+4' Inexact Rounded addx287 add '3456' '12E+3' -> '1.55E+4' Inexact Rounded rounding: half_down addx291 add '3444' '12E+3' -> '1.54E+4' Inexact Rounded addx292 add '3446' '12E+3' -> '1.54E+4' Inexact Rounded addx293 add '3449.9' '12E+3' -> '1.54E+4' Inexact Rounded addx294 add '3450.0' '12E+3' -> '1.54E+4' Inexact Rounded addx295 add '3450.1' '12E+3' -> '1.55E+4' Inexact Rounded addx296 add '3454' '12E+3' -> '1.55E+4' Inexact Rounded addx297 add '3456' '12E+3' -> '1.55E+4' Inexact Rounded -- 1 in last place tests rounding: half_up addx301 add -1 1 -> 0 addx302 add 0 1 -> 1 addx303 add 1 1 -> 2 addx304 add 12 1 -> 13 addx305 add 98 1 -> 99 addx306 add 99 1 -> 100 addx307 add 100 1 -> 101 addx308 add 101 1 -> 102 addx309 add -1 -1 -> -2 addx310 add 0 -1 -> -1 addx311 add 1 -1 -> 0 addx312 add 12 -1 -> 11 addx313 add 98 -1 -> 97 addx314 add 99 -1 -> 98 addx315 add 100 -1 -> 99 addx316 add 101 -1 -> 100 addx321 add -0.01 0.01 -> 0.00 addx322 add 0.00 0.01 -> 0.01 addx323 add 0.01 0.01 -> 0.02 addx324 add 0.12 0.01 -> 0.13 addx325 add 0.98 0.01 -> 0.99 addx326 add 0.99 0.01 -> 1.00 addx327 add 1.00 0.01 -> 1.01 addx328 add 1.01 0.01 -> 1.02 addx329 add -0.01 -0.01 -> -0.02 addx330 add 0.00 -0.01 -> -0.01 addx331 add 0.01 -0.01 -> 0.00 addx332 add 0.12 -0.01 -> 0.11 addx333 add 0.98 -0.01 -> 0.97 addx334 add 0.99 -0.01 -> 0.98 addx335 add 1.00 -0.01 -> 0.99 addx336 add 1.01 -0.01 -> 1.00 -- some more cases where adding 0 affects the coefficient precision: 9 addx340 add 1E+3 0 -> 1000 addx341 add 1E+8 0 -> 100000000 addx342 add 1E+9 0 -> 1.00000000E+9 Rounded addx343 add 1E+10 0 -> 1.00000000E+10 Rounded -- which simply follow from these cases ... addx344 add 1E+3 1 -> 1001 addx345 add 1E+8 1 -> 100000001 addx346 add 1E+9 1 -> 1.00000000E+9 Inexact Rounded addx347 add 1E+10 1 -> 1.00000000E+10 Inexact Rounded addx348 add 1E+3 7 -> 1007 addx349 add 1E+8 7 -> 100000007 addx350 add 1E+9 7 -> 1.00000001E+9 Inexact Rounded addx351 add 1E+10 7 -> 1.00000000E+10 Inexact Rounded -- tryzeros cases precision: 7 rounding: half_up maxExponent: 92 minexponent: -92 addx361 add 0E+50 10000E+1 -> 1.0000E+5 addx362 add 10000E+1 0E-50 -> 100000.0 Rounded addx363 add 10000E+1 10000E-50 -> 100000.0 Rounded Inexact -- ulp replacement tests precision: 9 maxexponent: 999999999 minexponent: -999999999 addx400 add 1 77e-7 -> 1.0000077 addx401 add 1 77e-8 -> 1.00000077 addx402 add 1 77e-9 -> 1.00000008 Inexact Rounded addx403 add 1 77e-10 -> 1.00000001 Inexact Rounded addx404 add 1 77e-11 -> 1.00000000 Inexact Rounded addx405 add 1 77e-12 -> 1.00000000 Inexact Rounded addx406 add 1 77e-999 -> 1.00000000 Inexact Rounded addx407 add 1 77e-9999999 -> 1.00000000 Inexact Rounded addx410 add 10 77e-7 -> 10.0000077 addx411 add 10 77e-8 -> 10.0000008 Inexact Rounded addx412 add 10 77e-9 -> 10.0000001 Inexact Rounded addx413 add 10 77e-10 -> 10.0000000 Inexact Rounded addx414 add 10 77e-11 -> 10.0000000 Inexact Rounded addx415 add 10 77e-12 -> 10.0000000 Inexact Rounded addx416 add 10 77e-999 -> 10.0000000 Inexact Rounded addx417 add 10 77e-9999999 -> 10.0000000 Inexact Rounded addx420 add 77e-7 1 -> 1.0000077 addx421 add 77e-8 1 -> 1.00000077 addx422 add 77e-9 1 -> 1.00000008 Inexact Rounded addx423 add 77e-10 1 -> 1.00000001 Inexact Rounded addx424 add 77e-11 1 -> 1.00000000 Inexact Rounded addx425 add 77e-12 1 -> 1.00000000 Inexact Rounded addx426 add 77e-999 1 -> 1.00000000 Inexact Rounded addx427 add 77e-9999999 1 -> 1.00000000 Inexact Rounded addx430 add 77e-7 10 -> 10.0000077 addx431 add 77e-8 10 -> 10.0000008 Inexact Rounded addx432 add 77e-9 10 -> 10.0000001 Inexact Rounded addx433 add 77e-10 10 -> 10.0000000 Inexact Rounded addx434 add 77e-11 10 -> 10.0000000 Inexact Rounded addx435 add 77e-12 10 -> 10.0000000 Inexact Rounded addx436 add 77e-999 10 -> 10.0000000 Inexact Rounded addx437 add 77e-9999999 10 -> 10.0000000 Inexact Rounded -- negative ulps addx440 add 1 -77e-7 -> 0.9999923 addx441 add 1 -77e-8 -> 0.99999923 addx442 add 1 -77e-9 -> 0.999999923 addx443 add 1 -77e-10 -> 0.999999992 Inexact Rounded addx444 add 1 -77e-11 -> 0.999999999 Inexact Rounded addx445 add 1 -77e-12 -> 1.00000000 Inexact Rounded addx446 add 1 -77e-999 -> 1.00000000 Inexact Rounded addx447 add 1 -77e-9999999 -> 1.00000000 Inexact Rounded addx450 add 10 -77e-7 -> 9.9999923 addx451 add 10 -77e-8 -> 9.99999923 addx452 add 10 -77e-9 -> 9.99999992 Inexact Rounded addx453 add 10 -77e-10 -> 9.99999999 Inexact Rounded addx454 add 10 -77e-11 -> 10.0000000 Inexact Rounded addx455 add 10 -77e-12 -> 10.0000000 Inexact Rounded addx456 add 10 -77e-999 -> 10.0000000 Inexact Rounded addx457 add 10 -77e-9999999 -> 10.0000000 Inexact Rounded addx460 add -77e-7 1 -> 0.9999923 addx461 add -77e-8 1 -> 0.99999923 addx462 add -77e-9 1 -> 0.999999923 addx463 add -77e-10 1 -> 0.999999992 Inexact Rounded addx464 add -77e-11 1 -> 0.999999999 Inexact Rounded addx465 add -77e-12 1 -> 1.00000000 Inexact Rounded addx466 add -77e-999 1 -> 1.00000000 Inexact Rounded addx467 add -77e-9999999 1 -> 1.00000000 Inexact Rounded addx470 add -77e-7 10 -> 9.9999923 addx471 add -77e-8 10 -> 9.99999923 addx472 add -77e-9 10 -> 9.99999992 Inexact Rounded addx473 add -77e-10 10 -> 9.99999999 Inexact Rounded addx474 add -77e-11 10 -> 10.0000000 Inexact Rounded addx475 add -77e-12 10 -> 10.0000000 Inexact Rounded addx476 add -77e-999 10 -> 10.0000000 Inexact Rounded addx477 add -77e-9999999 10 -> 10.0000000 Inexact Rounded -- negative ulps addx480 add -1 77e-7 -> -0.9999923 addx481 add -1 77e-8 -> -0.99999923 addx482 add -1 77e-9 -> -0.999999923 addx483 add -1 77e-10 -> -0.999999992 Inexact Rounded addx484 add -1 77e-11 -> -0.999999999 Inexact Rounded addx485 add -1 77e-12 -> -1.00000000 Inexact Rounded addx486 add -1 77e-999 -> -1.00000000 Inexact Rounded addx487 add -1 77e-9999999 -> -1.00000000 Inexact Rounded addx490 add -10 77e-7 -> -9.9999923 addx491 add -10 77e-8 -> -9.99999923 addx492 add -10 77e-9 -> -9.99999992 Inexact Rounded addx493 add -10 77e-10 -> -9.99999999 Inexact Rounded addx494 add -10 77e-11 -> -10.0000000 Inexact Rounded addx495 add -10 77e-12 -> -10.0000000 Inexact Rounded addx496 add -10 77e-999 -> -10.0000000 Inexact Rounded addx497 add -10 77e-9999999 -> -10.0000000 Inexact Rounded addx500 add 77e-7 -1 -> -0.9999923 addx501 add 77e-8 -1 -> -0.99999923 addx502 add 77e-9 -1 -> -0.999999923 addx503 add 77e-10 -1 -> -0.999999992 Inexact Rounded addx504 add 77e-11 -1 -> -0.999999999 Inexact Rounded addx505 add 77e-12 -1 -> -1.00000000 Inexact Rounded addx506 add 77e-999 -1 -> -1.00000000 Inexact Rounded addx507 add 77e-9999999 -1 -> -1.00000000 Inexact Rounded addx510 add 77e-7 -10 -> -9.9999923 addx511 add 77e-8 -10 -> -9.99999923 addx512 add 77e-9 -10 -> -9.99999992 Inexact Rounded addx513 add 77e-10 -10 -> -9.99999999 Inexact Rounded addx514 add 77e-11 -10 -> -10.0000000 Inexact Rounded addx515 add 77e-12 -10 -> -10.0000000 Inexact Rounded addx516 add 77e-999 -10 -> -10.0000000 Inexact Rounded addx517 add 77e-9999999 -10 -> -10.0000000 Inexact Rounded -- long operands maxexponent: 999 minexponent: -999 precision: 9 addx521 add 12345678000 0 -> 1.23456780E+10 Rounded addx522 add 0 12345678000 -> 1.23456780E+10 Rounded addx523 add 1234567800 0 -> 1.23456780E+9 Rounded addx524 add 0 1234567800 -> 1.23456780E+9 Rounded addx525 add 1234567890 0 -> 1.23456789E+9 Rounded addx526 add 0 1234567890 -> 1.23456789E+9 Rounded addx527 add 1234567891 0 -> 1.23456789E+9 Inexact Rounded addx528 add 0 1234567891 -> 1.23456789E+9 Inexact Rounded addx529 add 12345678901 0 -> 1.23456789E+10 Inexact Rounded addx530 add 0 12345678901 -> 1.23456789E+10 Inexact Rounded addx531 add 1234567896 0 -> 1.23456790E+9 Inexact Rounded addx532 add 0 1234567896 -> 1.23456790E+9 Inexact Rounded precision: 15 -- still checking addx541 add 12345678000 0 -> 12345678000 addx542 add 0 12345678000 -> 12345678000 addx543 add 1234567800 0 -> 1234567800 addx544 add 0 1234567800 -> 1234567800 addx545 add 1234567890 0 -> 1234567890 addx546 add 0 1234567890 -> 1234567890 addx547 add 1234567891 0 -> 1234567891 addx548 add 0 1234567891 -> 1234567891 addx549 add 12345678901 0 -> 12345678901 addx550 add 0 12345678901 -> 12345678901 addx551 add 1234567896 0 -> 1234567896 addx552 add 0 1234567896 -> 1234567896 -- some more residue effects with extreme rounding precision: 9 rounding: half_up addx601 add 123456789 0.000001 -> 123456789 Inexact Rounded rounding: half_even addx602 add 123456789 0.000001 -> 123456789 Inexact Rounded rounding: half_down addx603 add 123456789 0.000001 -> 123456789 Inexact Rounded rounding: floor addx604 add 123456789 0.000001 -> 123456789 Inexact Rounded rounding: ceiling addx605 add 123456789 0.000001 -> 123456790 Inexact Rounded rounding: up addx606 add 123456789 0.000001 -> 123456790 Inexact Rounded rounding: down addx607 add 123456789 0.000001 -> 123456789 Inexact Rounded rounding: half_up addx611 add 123456789 -0.000001 -> 123456789 Inexact Rounded rounding: half_even addx612 add 123456789 -0.000001 -> 123456789 Inexact Rounded rounding: half_down addx613 add 123456789 -0.000001 -> 123456789 Inexact Rounded rounding: floor addx614 add 123456789 -0.000001 -> 123456788 Inexact Rounded rounding: ceiling addx615 add 123456789 -0.000001 -> 123456789 Inexact Rounded rounding: up addx616 add 123456789 -0.000001 -> 123456789 Inexact Rounded rounding: down addx617 add 123456789 -0.000001 -> 123456788 Inexact Rounded rounding: half_up addx621 add 123456789 0.499999 -> 123456789 Inexact Rounded rounding: half_even addx622 add 123456789 0.499999 -> 123456789 Inexact Rounded rounding: half_down addx623 add 123456789 0.499999 -> 123456789 Inexact Rounded rounding: floor addx624 add 123456789 0.499999 -> 123456789 Inexact Rounded rounding: ceiling addx625 add 123456789 0.499999 -> 123456790 Inexact Rounded rounding: up addx626 add 123456789 0.499999 -> 123456790 Inexact Rounded rounding: down addx627 add 123456789 0.499999 -> 123456789 Inexact Rounded rounding: half_up addx631 add 123456789 -0.499999 -> 123456789 Inexact Rounded rounding: half_even addx632 add 123456789 -0.499999 -> 123456789 Inexact Rounded rounding: half_down addx633 add 123456789 -0.499999 -> 123456789 Inexact Rounded rounding: floor addx634 add 123456789 -0.499999 -> 123456788 Inexact Rounded rounding: ceiling addx635 add 123456789 -0.499999 -> 123456789 Inexact Rounded rounding: up addx636 add 123456789 -0.499999 -> 123456789 Inexact Rounded rounding: down addx637 add 123456789 -0.499999 -> 123456788 Inexact Rounded rounding: half_up addx641 add 123456789 0.500001 -> 123456790 Inexact Rounded rounding: half_even addx642 add 123456789 0.500001 -> 123456790 Inexact Rounded rounding: half_down addx643 add 123456789 0.500001 -> 123456790 Inexact Rounded rounding: floor addx644 add 123456789 0.500001 -> 123456789 Inexact Rounded rounding: ceiling addx645 add 123456789 0.500001 -> 123456790 Inexact Rounded rounding: up addx646 add 123456789 0.500001 -> 123456790 Inexact Rounded rounding: down addx647 add 123456789 0.500001 -> 123456789 Inexact Rounded rounding: half_up addx651 add 123456789 -0.500001 -> 123456788 Inexact Rounded rounding: half_even addx652 add 123456789 -0.500001 -> 123456788 Inexact Rounded rounding: half_down addx653 add 123456789 -0.500001 -> 123456788 Inexact Rounded rounding: floor addx654 add 123456789 -0.500001 -> 123456788 Inexact Rounded rounding: ceiling addx655 add 123456789 -0.500001 -> 123456789 Inexact Rounded rounding: up addx656 add 123456789 -0.500001 -> 123456789 Inexact Rounded rounding: down addx657 add 123456789 -0.500001 -> 123456788 Inexact Rounded -- long operand triangle rounding: half_up precision: 37 addx660 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337114834538 precision: 36 addx661 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711483454 Inexact Rounded precision: 35 addx662 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371148345 Inexact Rounded precision: 34 addx663 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337114835 Inexact Rounded precision: 33 addx664 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711483 Inexact Rounded precision: 32 addx665 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371148 Inexact Rounded precision: 31 addx666 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337115 Inexact Rounded precision: 30 addx667 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892233711 Inexact Rounded precision: 29 addx668 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223371 Inexact Rounded precision: 28 addx669 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922337 Inexact Rounded precision: 27 addx670 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892234 Inexact Rounded precision: 26 addx671 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389223 Inexact Rounded precision: 25 addx672 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023638922 Inexact Rounded precision: 24 addx673 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102363892 Inexact Rounded precision: 23 addx674 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236389 Inexact Rounded precision: 22 addx675 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211023639 Inexact Rounded precision: 21 addx676 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102364 Inexact Rounded precision: 20 addx677 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110236 Inexact Rounded precision: 19 addx678 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211024 Inexact Rounded precision: 18 addx679 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221102 Inexact Rounded precision: 17 addx680 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422110 Inexact Rounded precision: 16 addx681 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42211 Inexact Rounded precision: 15 addx682 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4221 Inexact Rounded precision: 14 addx683 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.422 Inexact Rounded precision: 13 addx684 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.42 Inexact Rounded precision: 12 addx685 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166.4 Inexact Rounded precision: 11 addx686 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 98471174166 Inexact Rounded precision: 10 addx687 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847117417E+10 Inexact Rounded precision: 9 addx688 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.84711742E+10 Inexact Rounded precision: 8 addx689 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8471174E+10 Inexact Rounded precision: 7 addx690 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847117E+10 Inexact Rounded precision: 6 addx691 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.84712E+10 Inexact Rounded precision: 5 addx692 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8471E+10 Inexact Rounded precision: 4 addx693 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.847E+10 Inexact Rounded precision: 3 addx694 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.85E+10 Inexact Rounded precision: 2 addx695 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 9.8E+10 Inexact Rounded precision: 1 addx696 add 98471198160.56524417578665886060 -23994.14313393939743548945165462 -> 1E+11 Inexact Rounded -- more zeros, etc. rounding: half_up precision: 9 addx701 add 5.00 1.00E-3 -> 5.00100 addx702 add 00.00 0.000 -> 0.000 addx703 add 00.00 0E-3 -> 0.000 addx704 add 0E-3 00.00 -> 0.000 addx710 add 0E+3 00.00 -> 0.00 addx711 add 0E+3 00.0 -> 0.0 addx712 add 0E+3 00. -> 0 addx713 add 0E+3 00.E+1 -> 0E+1 addx714 add 0E+3 00.E+2 -> 0E+2 addx715 add 0E+3 00.E+3 -> 0E+3 addx716 add 0E+3 00.E+4 -> 0E+3 addx717 add 0E+3 00.E+5 -> 0E+3 addx718 add 0E+3 -00.0 -> 0.0 addx719 add 0E+3 -00. -> 0 addx731 add 0E+3 -00.E+1 -> 0E+1 addx720 add 00.00 0E+3 -> 0.00 addx721 add 00.0 0E+3 -> 0.0 addx722 add 00. 0E+3 -> 0 addx723 add 00.E+1 0E+3 -> 0E+1 addx724 add 00.E+2 0E+3 -> 0E+2 addx725 add 00.E+3 0E+3 -> 0E+3 addx726 add 00.E+4 0E+3 -> 0E+3 addx727 add 00.E+5 0E+3 -> 0E+3 addx728 add -00.00 0E+3 -> 0.00 addx729 add -00.0 0E+3 -> 0.0 addx730 add -00. 0E+3 -> 0 addx732 add 0 0 -> 0 addx733 add 0 -0 -> 0 addx734 add -0 0 -> 0 addx735 add -0 -0 -> -0 -- IEEE 854 exception addx736 add 1 -1 -> 0 addx737 add -1 -1 -> -2 addx738 add 1 1 -> 2 addx739 add -1 1 -> 0 addx741 add 0 -1 -> -1 addx742 add -0 -1 -> -1 addx743 add 0 1 -> 1 addx744 add -0 1 -> 1 addx745 add -1 0 -> -1 addx746 add -1 -0 -> -1 addx747 add 1 0 -> 1 addx748 add 1 -0 -> 1 addx751 add 0.0 -1 -> -1.0 addx752 add -0.0 -1 -> -1.0 addx753 add 0.0 1 -> 1.0 addx754 add -0.0 1 -> 1.0 addx755 add -1.0 0 -> -1.0 addx756 add -1.0 -0 -> -1.0 addx757 add 1.0 0 -> 1.0 addx758 add 1.0 -0 -> 1.0 addx761 add 0 -1.0 -> -1.0 addx762 add -0 -1.0 -> -1.0 addx763 add 0 1.0 -> 1.0 addx764 add -0 1.0 -> 1.0 addx765 add -1 0.0 -> -1.0 addx766 add -1 -0.0 -> -1.0 addx767 add 1 0.0 -> 1.0 addx768 add 1 -0.0 -> 1.0 addx771 add 0.0 -1.0 -> -1.0 addx772 add -0.0 -1.0 -> -1.0 addx773 add 0.0 1.0 -> 1.0 addx774 add -0.0 1.0 -> 1.0 addx775 add -1.0 0.0 -> -1.0 addx776 add -1.0 -0.0 -> -1.0 addx777 add 1.0 0.0 -> 1.0 addx778 add 1.0 -0.0 -> 1.0 -- Specials addx780 add -Inf -Inf -> -Infinity addx781 add -Inf -1000 -> -Infinity addx782 add -Inf -1 -> -Infinity addx783 add -Inf -0 -> -Infinity addx784 add -Inf 0 -> -Infinity addx785 add -Inf 1 -> -Infinity addx786 add -Inf 1000 -> -Infinity addx787 add -1000 -Inf -> -Infinity addx788 add -Inf -Inf -> -Infinity addx789 add -1 -Inf -> -Infinity addx790 add -0 -Inf -> -Infinity addx791 add 0 -Inf -> -Infinity addx792 add 1 -Inf -> -Infinity addx793 add 1000 -Inf -> -Infinity addx800 add Inf -Inf -> NaN Invalid_operation addx801 add Inf -1000 -> Infinity addx802 add Inf -1 -> Infinity addx803 add Inf -0 -> Infinity addx804 add Inf 0 -> Infinity addx805 add Inf 1 -> Infinity addx806 add Inf 1000 -> Infinity addx807 add Inf Inf -> Infinity addx808 add -1000 Inf -> Infinity addx809 add -Inf Inf -> NaN Invalid_operation addx810 add -1 Inf -> Infinity addx811 add -0 Inf -> Infinity addx812 add 0 Inf -> Infinity addx813 add 1 Inf -> Infinity addx814 add 1000 Inf -> Infinity addx815 add Inf Inf -> Infinity addx821 add NaN -Inf -> NaN addx822 add NaN -1000 -> NaN addx823 add NaN -1 -> NaN addx824 add NaN -0 -> NaN addx825 add NaN 0 -> NaN addx826 add NaN 1 -> NaN addx827 add NaN 1000 -> NaN addx828 add NaN Inf -> NaN addx829 add NaN NaN -> NaN addx830 add -Inf NaN -> NaN addx831 add -1000 NaN -> NaN addx832 add -1 NaN -> NaN addx833 add -0 NaN -> NaN addx834 add 0 NaN -> NaN addx835 add 1 NaN -> NaN addx836 add 1000 NaN -> NaN addx837 add Inf NaN -> NaN addx841 add sNaN -Inf -> NaN Invalid_operation addx842 add sNaN -1000 -> NaN Invalid_operation addx843 add sNaN -1 -> NaN Invalid_operation addx844 add sNaN -0 -> NaN Invalid_operation addx845 add sNaN 0 -> NaN Invalid_operation addx846 add sNaN 1 -> NaN Invalid_operation addx847 add sNaN 1000 -> NaN Invalid_operation addx848 add sNaN NaN -> NaN Invalid_operation addx849 add sNaN sNaN -> NaN Invalid_operation addx850 add NaN sNaN -> NaN Invalid_operation addx851 add -Inf sNaN -> NaN Invalid_operation addx852 add -1000 sNaN -> NaN Invalid_operation addx853 add -1 sNaN -> NaN Invalid_operation addx854 add -0 sNaN -> NaN Invalid_operation addx855 add 0 sNaN -> NaN Invalid_operation addx856 add 1 sNaN -> NaN Invalid_operation addx857 add 1000 sNaN -> NaN Invalid_operation addx858 add Inf sNaN -> NaN Invalid_operation addx859 add NaN sNaN -> NaN Invalid_operation -- overflow, underflow and subnormal tests maxexponent: 999999999 minexponent: -999999999 precision: 9 addx860 add 1E+999999999 9E+999999999 -> Infinity Overflow Inexact Rounded addx861 add 9E+999999999 1E+999999999 -> Infinity Overflow Inexact Rounded addx862 add -1.1E-999999999 1E-999999999 -> -1E-1000000000 Subnormal addx863 add 1E-999999999 -1.1e-999999999 -> -1E-1000000000 Subnormal addx864 add -1.0001E-999999999 1E-999999999 -> -1E-1000000003 Subnormal addx865 add 1E-999999999 -1.0001e-999999999 -> -1E-1000000003 Subnormal addx866 add -1E+999999999 -9E+999999999 -> -Infinity Overflow Inexact Rounded addx867 add -9E+999999999 -1E+999999999 -> -Infinity Overflow Inexact Rounded addx868 add +1.1E-999999999 -1E-999999999 -> 1E-1000000000 Subnormal addx869 add -1E-999999999 +1.1e-999999999 -> 1E-1000000000 Subnormal addx870 add +1.0001E-999999999 -1E-999999999 -> 1E-1000000003 Subnormal addx871 add -1E-999999999 +1.0001e-999999999 -> 1E-1000000003 Subnormal addx872 add -1E+999999999 +9E+999999999 -> 8E+999999999 addx873 add -9E+999999999 +1E+999999999 -> -8E+999999999 precision: 3 addx880 add 0 -9.999E+999999999 -> -Infinity Inexact Overflow Rounded addx881 add -9.999E+999999999 0 -> -Infinity Inexact Overflow Rounded addx882 add 0 9.999E+999999999 -> Infinity Inexact Overflow Rounded addx883 add 9.999E+999999999 0 -> Infinity Inexact Overflow Rounded precision: 3 maxexponent: 999 minexponent: -999 addx910 add 1.00E-999 0 -> 1.00E-999 addx911 add 0.1E-999 0 -> 1E-1000 Subnormal addx912 add 0.10E-999 0 -> 1.0E-1000 Subnormal addx913 add 0.100E-999 0 -> 1.0E-1000 Subnormal Rounded addx914 add 0.01E-999 0 -> 1E-1001 Subnormal -- next is rounded to Emin addx915 add 0.999E-999 0 -> 1.00E-999 Inexact Rounded Subnormal Underflow addx916 add 0.099E-999 0 -> 1.0E-1000 Inexact Rounded Subnormal Underflow addx917 add 0.009E-999 0 -> 1E-1001 Inexact Rounded Subnormal Underflow addx918 add 0.001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow addx919 add 0.0009E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow addx920 add 0.0001E-999 0 -> 0E-1001 Inexact Rounded Subnormal Underflow addx930 add -1.00E-999 0 -> -1.00E-999 addx931 add -0.1E-999 0 -> -1E-1000 Subnormal addx932 add -0.10E-999 0 -> -1.0E-1000 Subnormal addx933 add -0.100E-999 0 -> -1.0E-1000 Subnormal Rounded addx934 add -0.01E-999 0 -> -1E-1001 Subnormal -- next is rounded to Emin addx935 add -0.999E-999 0 -> -1.00E-999 Inexact Rounded Subnormal Underflow addx936 add -0.099E-999 0 -> -1.0E-1000 Inexact Rounded Subnormal Underflow addx937 add -0.009E-999 0 -> -1E-1001 Inexact Rounded Subnormal Underflow addx938 add -0.001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow addx939 add -0.0009E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow addx940 add -0.0001E-999 0 -> -0E-1001 Inexact Rounded Subnormal Underflow -- some non-zero subnormal adds addx950 add 1.00E-999 0.1E-999 -> 1.10E-999 addx951 add 0.1E-999 0.1E-999 -> 2E-1000 Subnormal addx952 add 0.10E-999 0.1E-999 -> 2.0E-1000 Subnormal addx953 add 0.100E-999 0.1E-999 -> 2.0E-1000 Subnormal Rounded addx954 add 0.01E-999 0.1E-999 -> 1.1E-1000 Subnormal addx955 add 0.999E-999 0.1E-999 -> 1.10E-999 Inexact Rounded addx956 add 0.099E-999 0.1E-999 -> 2.0E-1000 Inexact Rounded Subnormal Underflow addx957 add 0.009E-999 0.1E-999 -> 1.1E-1000 Inexact Rounded Subnormal Underflow addx958 add 0.001E-999 0.1E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow addx959 add 0.0009E-999 0.1E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow addx960 add 0.0001E-999 0.1E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow -- negatives... addx961 add 1.00E-999 -0.1E-999 -> 9.0E-1000 Subnormal addx962 add 0.1E-999 -0.1E-999 -> 0E-1000 addx963 add 0.10E-999 -0.1E-999 -> 0E-1001 addx964 add 0.100E-999 -0.1E-999 -> 0E-1001 Clamped addx965 add 0.01E-999 -0.1E-999 -> -9E-1001 Subnormal addx966 add 0.999E-999 -0.1E-999 -> 9.0E-1000 Inexact Rounded Subnormal Underflow addx967 add 0.099E-999 -0.1E-999 -> -0E-1001 Inexact Rounded Subnormal Underflow addx968 add 0.009E-999 -0.1E-999 -> -9E-1001 Inexact Rounded Subnormal Underflow addx969 add 0.001E-999 -0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow addx970 add 0.0009E-999 -0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow addx971 add 0.0001E-999 -0.1E-999 -> -1.0E-1000 Inexact Rounded Subnormal Underflow -- check for double-rounded subnormals precision: 5 maxexponent: 79 minexponent: -79 -- Add: lhs and rhs 0 addx1001 add 1.52444E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1002 add 1.52445E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1003 add 1.52446E-80 0 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1004 add 0 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1005 add 0 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1006 add 0 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -- Add: lhs >> rhs and vice versa addx1011 add 1.52444E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1012 add 1.52445E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1013 add 1.52446E-80 1E-100 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1014 add 1E-100 1.52444E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1015 add 1E-100 1.52445E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow addx1016 add 1E-100 1.52446E-80 -> 1.524E-80 Inexact Rounded Subnormal Underflow -- Add: lhs + rhs addition carried out addx1021 add 1.52443E-80 1.00001E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow addx1022 add 1.52444E-80 1.00001E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow addx1023 add 1.52445E-80 1.00001E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow addx1024 add 1.00001E-80 1.52443E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow addx1025 add 1.00001E-80 1.52444E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow addx1026 add 1.00001E-80 1.52445E-80 -> 2.524E-80 Inexact Rounded Subnormal Underflow -- Null tests addx9990 add 10 # -> NaN Invalid_operation addx9991 add # 10 -> NaN Invalid_operation --- NEW FILE: abs.decTest --- ------------------------------------------------------------------------ -- abs.decTest -- decimal absolute value -- -- Copyright (c) IBM Corporation, 1981, 2003. All rights reserved. -- ------------------------------------------------------------------------ -- Please see the document "General Decimal Arithmetic Testcases" -- -- at http://www2.hursley.ibm.com/decimal for the description of -- -- these testcases. -- -- -- -- These testcases are experimental ('beta' versions), and they -- -- may contain errors. They are offered on an as-is basis. In -- -- particular, achieving the same results as the tests here is not -- -- a guarantee that an implementation complies with any Standard -- -- or specification. The tests are not exhaustive. -- -- -- -- Please send comments, suggestions, and corrections to the author: -- -- Mike Cowlishaw, IBM Fellow -- -- IBM UK, PO Box 31, Birmingham Road, Warwick CV34 5JL, UK -- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ version: 2.21 -- This set of tests primarily tests the existence of the operator. -- Additon, subtraction, rounding, and more overflows are tested -- elsewhere. precision: 9 rounding: half_up maxExponent: 999 minexponent: -999 extended: 1 absx001 abs '1' -> '1' absx002 abs '-1' -> '1' absx003 abs '1.00' -> '1.00' absx004 abs '-1.00' -> '1.00' absx005 abs '0' -> '0' absx006 abs '0.00' -> '0.00' absx007 abs '00.0' -> '0.0' absx008 abs '00.00' -> '0.00' absx009 abs '00' -> '0' absx010 abs '-2' -> '2' absx011 abs '2' -> '2' absx012 abs '-2.00' -> '2.00' absx013 abs '2.00' -> '2.00' absx014 abs '-0' -> '0' absx015 abs '-0.00' -> '0.00' absx016 abs '-00.0' -> '0.0' absx017 abs '-00.00' -> '0.00' absx018 abs '-00' -> '0' absx020 abs '-2000000' -> '2000000' absx021 abs '2000000' -> '2000000' precision: 7 absx022 abs '-2000000' -> '2000000' absx023 abs '2000000' -> '2000000' precision: 6 absx024 abs '-2000000' -> '2.00000E+6' Rounded absx025 abs '2000000' -> '2.00000E+6' Rounded precision: 3 absx026 abs '-2000000' -> '2.00E+6' Rounded absx027 abs '2000000' -> '2.00E+6' Rounded absx030 abs '+0.1' -> '0.1' absx031 abs '-0.1' -> '0.1' absx032 abs '+0.01' -> '0.01' absx033 abs '-0.01' -> '0.01' absx034 abs '+0.001' -> '0.001' absx035 abs '-0.001' -> '0.001' absx036 abs '+0.000001' -> '0.000001' absx037 abs '-0.000001' -> '0.000001' absx038 abs '+0.000000000001' -> '1E-12' absx039 abs '-0.000000000001' -> '1E-12' -- examples from decArith precision: 9 absx040 abs '2.1' -> '2.1' absx041 abs '-100' -> '100' absx042 abs '101.5' -> '101.5' absx043 abs '-101.5' -> '101.5' -- more fixed, potential LHS swaps/overlays if done by subtract 0 precision: 9 absx060 abs '-56267E-10' -> '0.0000056267' absx061 abs '-56267E-5' -> '0.56267' absx062 abs '-56267E-2' -> '562.67' absx063 abs '-56267E-1' -> '5626.7' absx065 abs '-56267E-0' -> '56267' -- overflow tests maxexponent: 999999999 minexponent: -999999999 precision: 3 absx120 abs 9.999E+999999999 -> Infinity Inexact Overflow Rounded -- subnormals and underflow precision: 3 maxexponent: 999 minexponent: -999 absx210 abs 1.00E-999 -> 1.00E-999 absx211 abs 0.1E-999 -> 1E-1000 Subnormal absx212 abs 0.10E-999 -> 1.0E-1000 Subnormal absx213 abs 0.100E-999 -> 1.0E-1000 Subnormal Rounded absx214 abs 0.01E-999 -> 1E-1001 Subnormal -- next is rounded to Emin absx215 abs 0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow absx216 abs 0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow absx217 abs 0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow absx218 abs 0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow absx219 abs 0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow absx220 abs 0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow absx230 abs -1.00E-999 -> 1.00E-999 absx231 abs -0.1E-999 -> 1E-1000 Subnormal absx232 abs -0.10E-999 -> 1.0E-1000 Subnormal absx233 abs -0.100E-999 -> 1.0E-1000 Subnormal Rounded absx234 abs -0.01E-999 -> 1E-1001 Subnormal -- next is rounded to Emin absx235 abs -0.999E-999 -> 1.00E-999 Inexact Rounded Subnormal Underflow absx236 abs -0.099E-999 -> 1.0E-1000 Inexact Rounded Subnormal Underflow absx237 abs -0.009E-999 -> 1E-1001 Inexact Rounded Subnormal Underflow absx238 abs -0.001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow absx239 abs -0.0009E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow absx240 abs -0.0001E-999 -> 0E-1001 Inexact Rounded Subnormal Underflow -- long operand tests maxexponent: 999 minexponent: -999 precision: 9 absx301 abs 12345678000 -> 1.23456780E+10 Rounded absx302 abs 1234567800 -> 1.23456780E+9 Rounded absx303 abs 1234567890 -> 1.23456789E+9 Rounded absx304 abs 1234567891 -> 1.23456789E+9 Inexact Rounded absx305 abs 12345678901 -> 1.23456789E+10 Inexact Rounded absx306 abs 1234567896 -> 1.23456790E+9 Inexact Rounded precision: 15 absx321 abs 12345678000 -> 12345678000 absx322 abs 1234567800 -> 1234567800 absx323 abs 1234567890 -> 1234567890 absx324 abs 1234567891 -> 1234567891 absx325 abs 12345678901 -> 12345678901 absx326 abs 1234567896 -> 1234567896 -- Specials precision: 9 -- specials absx520 abs 'Inf' -> 'Infinity' absx521 abs '-Inf' -> 'Infinity' absx522 abs NaN -> NaN absx523 abs sNaN -> NaN Invalid_operation -- Null tests absx900 abs # -> NaN Invalid_operation From jvr@users.sourceforge.net Sat May 3 00:40:31 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 02 May 2003 16:40:31 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDE.py,1.11,1.12 PythonIDEMain.py,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv29884 Modified Files: PythonIDE.py PythonIDEMain.py Log Message: Fixed age-old beginner's error: don't start the main loop as a side effect of an import. (This is one step towards threading support in the IDE.) Index: PythonIDE.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDE.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** PythonIDE.py 18 Nov 2002 15:29:02 -0000 1.11 --- PythonIDE.py 2 May 2003 23:40:29 -0000 1.12 *************** *** 49,51 **** del init ! import PythonIDEMain --- 49,52 ---- del init ! import PythonIDEMain as _PythonIDEMain ! _PythonIDEMain.PythonIDE() Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** PythonIDEMain.py 31 Mar 2003 15:11:14 -0000 1.33 --- PythonIDEMain.py 2 May 2003 23:40:29 -0000 1.34 *************** *** 464,469 **** pass # W.Message("Cannot register Python Documentation: %s" % str(arg)) return has_help, has_doc - - - PythonIDE() - --- 464,465 ---- From montanaro@users.sourceforge.net Sat May 3 00:41:21 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 May 2003 16:41:21 -0700 Subject: [Python-checkins] python/nondist/sandbox/csv README,1.3,NONE _csv.c,1.35,NONE __init__.py,1.1,NONE libcsv.tex,1.13,NONE csv.py,1.36,NONE .cvsignore,1.2,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv In directory sc8-pr-cvs1:/tmp/cvs-serv31316 Removed Files: README _csv.c __init__.py libcsv.tex csv.py .cvsignore Log Message: csv sandbox cleanup --- README DELETED --- --- _csv.c DELETED --- --- __init__.py DELETED --- --- libcsv.tex DELETED --- --- csv.py DELETED --- --- .cvsignore DELETED --- From montanaro@users.sourceforge.net Sat May 3 00:42:02 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 May 2003 16:42:02 -0700 Subject: [Python-checkins] python/nondist/sandbox/csv setup.py,1.4,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv In directory sc8-pr-cvs1:/tmp/cvs-serv31734 Removed Files: setup.py Log Message: csv sandbox cleanup --- setup.py DELETED --- From montanaro@users.sourceforge.net Sat May 3 00:44:56 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 May 2003 16:44:56 -0700 Subject: [Python-checkins] python/nondist/sandbox/csv/test __init__.py,1.1,NONE test_csv.py,1.37,NONE unicode_test.py,1.1,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/test In directory sc8-pr-cvs1:/tmp/cvs-serv1241/test Removed Files: __init__.py test_csv.py unicode_test.py Log Message: csv sandbox cleanup --- __init__.py DELETED --- --- test_csv.py DELETED --- --- unicode_test.py DELETED --- From montanaro@users.sourceforge.net Sat May 3 00:44:56 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 02 May 2003 16:44:56 -0700 Subject: [Python-checkins] python/nondist/sandbox/csv/util __init__.py,1.1,NONE sniffer.py,1.7,NONE Message-ID: Update of /cvsroot/python/python/nondist/sandbox/csv/util In directory sc8-pr-cvs1:/tmp/cvs-serv1241/util Removed Files: __init__.py sniffer.py Log Message: csv sandbox cleanup --- __init__.py DELETED --- --- sniffer.py DELETED --- From jvr@users.sourceforge.net Sat May 3 01:18:57 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 02 May 2003 17:18:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules autoGIL.c,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21490 Added Files: autoGIL.c Log Message: Short and sweet module doing something very useful: for event loop based threads, release the GIL when the event loop goes to sleep, and acquire it again when the event loop wakes up again. OSX-only. --- NEW FILE: autoGIL.c --- #include "Python.h" #include /* These macros are defined in Python 2.3 but not 2.2 */ #ifndef PyMODINIT_FUNC #define PyMODINIT_FUNC void #endif #ifndef PyDoc_STRVAR #define PyDoc_STRVAR(Var,Str) static char Var[] = Str #endif #undef AUTOGIL_DEBUG static PyObject *AutoGILError; static void autoGILCallback(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *info) { PyThreadState **p_tstate = (PyThreadState **)info; switch (activity) { case kCFRunLoopBeforeWaiting: /* going to sleep, release GIL */ #ifdef AUTOGIL_DEBUG fprintf(stderr, "going to sleep, release GIL\n"); #endif *p_tstate = PyEval_SaveThread(); break; case kCFRunLoopAfterWaiting: /* waking up, acquire GIL */ #ifdef AUTOGIL_DEBUG fprintf(stderr, "waking up, acquire GIL\n"); #endif PyEval_RestoreThread(*p_tstate); *p_tstate = NULL; break; default: break; } } static void infoRelease(const void *info) { /* XXX This should get called when the run loop is deallocated, but this doesn't seem to happen. So for now: leak. */ PyMem_Free((void *)info); } static PyObject * autoGIL_installAutoGIL(PyObject *self) { PyObject *tstate_dict = PyThreadState_GetDict(); PyObject *v; CFRunLoopRef rl; PyThreadState **p_tstate; /* for use in the info field */ CFRunLoopObserverContext context = {0, NULL, NULL, NULL, NULL}; CFRunLoopObserverRef observer; if (tstate_dict == NULL) return NULL; v = PyDict_GetItemString(tstate_dict, "autoGIL.InstalledAutoGIL"); if (v != NULL) { /* we've already installed a callback for this thread */ Py_INCREF(Py_None); return Py_None; } rl = CFRunLoopGetCurrent(); if (rl == NULL) { PyErr_SetString(AutoGILError, "can't get run loop for current thread"); return NULL; } p_tstate = PyMem_Malloc(sizeof(PyThreadState *)); if (p_tstate == NULL) { PyErr_SetString(PyExc_MemoryError, "not enough memory to allocate " "tstate pointer"); return NULL; } *p_tstate = NULL; context.info = (void *)p_tstate; context.release = infoRelease; observer = CFRunLoopObserverCreate( NULL, kCFRunLoopBeforeWaiting | kCFRunLoopAfterWaiting, 1, 0, autoGILCallback, &context); if (observer == NULL) { PyErr_SetString(AutoGILError, "can't create event loop observer"); return NULL; } CFRunLoopAddObserver(rl, observer, kCFRunLoopDefaultMode); /* XXX how to check for errors? */ /* register that we have installed a callback for this thread */ if (PyDict_SetItemString(tstate_dict, "autoGIL.InstalledAutoGIL", Py_None) < 0) return NULL; Py_INCREF(Py_None); return Py_None; } PyDoc_STRVAR(autoGIL_installAutoGIL_doc, "installAutoGIL() -> None\n\ Install an observer callback in the event loop (CFRunLoop) for the\n\ current thread that will lock and unlock the Global Interpreter Lock\n\ (GIL) at appropriate times, allowing other Python threads to run while\n\ the event loop is running." ); static PyMethodDef autoGIL_methods[] = { { "installAutoGIL", (PyCFunction)autoGIL_installAutoGIL, METH_NOARGS, autoGIL_installAutoGIL_doc }, { 0, 0, 0, 0 } /* sentinel */ }; PyDoc_STRVAR(autoGIL_docs, "The autoGIL module provides a function (installAutoGIL) that\n\ automatically locks and unlocks Python's Global Interpreter Lock\n\ when running an event loop." ); PyMODINIT_FUNC initautoGIL(void) { PyObject *mod; mod = Py_InitModule4("autoGIL", autoGIL_methods, autoGIL_docs, NULL, PYTHON_API_VERSION); if (mod == NULL) return; AutoGILError = PyErr_NewException("autoGIL.AutoGILError", PyExc_Exception, NULL); if (AutoGILError == NULL) return; Py_INCREF(AutoGILError); if (PyModule_AddObject(mod, "AutoGILError", AutoGILError) < 0) return; } From jvr@users.sourceforge.net Sat May 3 01:27:25 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 02 May 2003 17:27:25 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.160,1.161 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv27421 Modified Files: setup.py Log Message: build the new autoGIL module on OSX Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** setup.py 17 Apr 2003 22:23:36 -0000 1.160 --- setup.py 3 May 2003 00:27:23 -0000 1.161 *************** *** 749,752 **** --- 749,754 ---- extra_link_args=['-framework', 'CoreFoundation']) ) + exts.append( Extension('autoGIL', ['autoGIL.c'], + extra_link_args=['-framework', 'CoreFoundation']) ) exts.append( Extension('gestalt', ['gestaltmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From jvr@users.sourceforge.net Sat May 3 01:31:37 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 02 May 2003 17:31:37 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDE.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv27839 Modified Files: PythonIDE.py Log Message: Install automatic GIL switcher upon IDE startup. (Jack: maybe this could/should be done in Framework.py instead, that way apps don't have to think about it. PackMan springs to mind...) Index: PythonIDE.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDE.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PythonIDE.py 2 May 2003 23:40:29 -0000 1.12 --- PythonIDE.py 3 May 2003 00:31:35 -0000 1.13 *************** *** 13,16 **** --- 13,23 ---- MacOS.EnableAppswitch(-1) + try: + import autoGIL + except ImportError: + pass + else: + autoGIL.installAutoGIL() + from Carbon import Qd, QuickDraw Qd.SetCursor(Qd.GetCursor(QuickDraw.watchCursor).data) From jvr@users.sourceforge.net Sat May 3 01:38:28 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 02 May 2003 17:38:28 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules autoGIL.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv1281 Modified Files: autoGIL.c Log Message: fixed typo Index: autoGIL.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/autoGIL.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** autoGIL.c 3 May 2003 00:18:55 -0000 1.1 --- autoGIL.c 3 May 2003 00:38:26 -0000 1.2 *************** *** 109,115 **** "installAutoGIL() -> None\n\ Install an observer callback in the event loop (CFRunLoop) for the\n\ ! current thread that will lock and unlock the Global Interpreter Lock\n\ (GIL) at appropriate times, allowing other Python threads to run while\n\ ! the event loop is running." ); --- 109,115 ---- "installAutoGIL() -> None\n\ Install an observer callback in the event loop (CFRunLoop) for the\n\ ! current thread, that will lock and unlock the Global Interpreter Lock\n\ (GIL) at appropriate times, allowing other Python threads to run while\n\ ! the event loop is idle." ); From fdrake@users.sourceforge.net Sat May 3 03:07:24 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 02 May 2003 19:07:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/perl l2hinit.perl,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv26345 Modified Files: l2hinit.perl Log Message: - add title attributes to the navigation icons on the navigation bars; this causes some browsers to offer descriptive tooltips when the mouse hovers over the linked icon - clean up the code in this area Index: l2hinit.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/l2hinit.perl,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** l2hinit.perl 2 May 2003 20:30:18 -0000 1.72 --- l2hinit.perl 3 May 2003 02:07:22 -0000 1.73 *************** *** 142,166 **** } ! sub use_my_icon($$) { ! my($s,$rel) = @_; ! if ($s =~ /\/) { ! my $r = get_my_icon($1); ! $s =~ s/\/$r/; } - $s =~ s/<[aA] /' --- 142,178 ---- } ! sub unlinkify($) { ! my $text = "$_[0]"; ! $text =~ s|||; ! $text =~ s|]*>||i; ! return $text; ! } ! ! sub use_icon($$$) { ! my($rel,$str,$title) = @_; ! if ($title) { ! my $s = "$str"; ! if ($s =~ /\/) { ! my $r = get_my_icon($1); ! $s =~ s/\/$r/; ! } ! $s =~ s/<[aA] /' From rhettinger@users.sourceforge.net Sat May 3 04:38:03 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 20:38:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_random.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11136 Modified Files: test_random.py Log Message: Apply the simplified test_support boilerplate. Index: test_random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_random.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_random.py 2 May 2003 22:44:59 -0000 1.10 --- test_random.py 3 May 2003 03:38:01 -0000 1.11 *************** *** 273,283 **** def test_main(verbose=None): ! suite = unittest.TestSuite() ! for testclass in (WichmannHill_TestBasicOps, MersenneTwister_TestBasicOps, TestDistributions, ! TestModule): ! suite.addTest(unittest.makeSuite(testclass)) ! test_support.run_suite(suite) # verify reference counting --- 273,281 ---- def test_main(verbose=None): ! testclasses = (WichmannHill_TestBasicOps, MersenneTwister_TestBasicOps, TestDistributions, ! TestModule) ! test_support.run_unittest(*testclasses) # verify reference counting *************** *** 286,290 **** counts = [None] * 5 for i in xrange(len(counts)): ! test_support.run_suite(suite) counts[i] = sys.gettotalrefcount() print counts --- 284,288 ---- counts = [None] * 5 for i in xrange(len(counts)): ! test_support.run_unittest(*testclasses) counts[i] = sys.gettotalrefcount() print counts From rhettinger@users.sourceforge.net Sat May 3 06:59:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 22:59:50 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31727/Modules Modified Files: itertoolsmodule.c Log Message: * Added a substantial number of edge case and argument tests for the itertoolsmodule. * Taught itertools.repeat(obj, n) to treat negative repeat counts as zero. This behavior matches that for sequences and prevents infinite loops. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** itertoolsmodule.c 2 May 2003 19:44:20 -0000 1.12 --- itertoolsmodule.c 3 May 2003 05:59:47 -0000 1.13 *************** *** 1692,1695 **** --- 1692,1698 ---- return NULL; + if (PyTuple_Size(args) == 2 && cnt < 0) + cnt = 0; + ro = (repeatobject *)type->tp_alloc(type, 0); if (ro == NULL) From rhettinger@users.sourceforge.net Sat May 3 06:59:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 22:59:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31727/Lib/test Modified Files: test_itertools.py Log Message: * Added a substantial number of edge case and argument tests for the itertoolsmodule. * Taught itertools.repeat(obj, n) to treat negative repeat counts as zero. This behavior matches that for sequences and prevents infinite loops. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_itertools.py 2 May 2003 22:38:07 -0000 1.9 --- test_itertools.py 3 May 2003 05:59:48 -0000 1.10 *************** *** 3,10 **** --- 3,38 ---- from itertools import * import sys + import operator + + def onearg(x): + 'Test function of one argument' + return x + + def errfunc(*args): + 'Test function that raises an error' + raise ValueError + + def gen3(): + 'Non-restartable source sequence' + for i in (0, 1, 2): + yield i + + def isEven(x): + 'Test predicate' + return x%2==0 + + class StopNow: + 'Class emulating an empty iterable.' + def __iter__(self): + return self + def next(self): + raise StopIteration class TestBasicOps(unittest.TestCase): def test_chain(self): self.assertEqual(list(chain('abc', 'def')), list('abcdef')) + self.assertEqual(list(chain('abc')), list('abc')) + self.assertEqual(list(chain('')), []) + self.assertRaises(TypeError, chain, 2, 3) def test_count(self): *************** *** 12,42 **** self.assertEqual(zip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)]) self.assertRaises(TypeError, count, 2, 3) def test_cycle(self): self.assertEqual(list(islice(cycle('abc'),10)), list('abcabcabca')) self.assertEqual(list(cycle('')), []) def test_ifilter(self): - def isEven(x): - return x%2==0 self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) self.assertEqual(list(ifilter(None, [0,1,0,2,0])), [1,2]) self.assertRaises(TypeError, ifilter) ! self.assertRaises(TypeError, ifilter, 3) self.assertRaises(TypeError, ifilter, isEven, 3) def test_ifilterfalse(self): - def isEven(x): - return x%2==0 self.assertEqual(list(ifilterfalse(isEven, range(6))), [1,3,5]) self.assertEqual(list(ifilterfalse(None, [0,1,0,2,0])), [0,0,0]) self.assertRaises(TypeError, ifilterfalse) ! self.assertRaises(TypeError, ifilterfalse, 3) self.assertRaises(TypeError, ifilterfalse, isEven, 3) def test_izip(self): ans = [(x,y) for x, y in izip('abc',count())] self.assertEqual(ans, [('a', 0), ('b', 1), ('c', 2)]) self.assertRaises(TypeError, izip) def test_repeat(self): --- 40,86 ---- self.assertEqual(zip('abc',count(3)), [('a', 3), ('b', 4), ('c', 5)]) self.assertRaises(TypeError, count, 2, 3) + self.assertRaises(TypeError, count, 'a') + c = count(sys.maxint-2) # verify that rollover doesn't crash + c.next(); c.next(); c.next(); c.next(); c.next() def test_cycle(self): self.assertEqual(list(islice(cycle('abc'),10)), list('abcabcabca')) self.assertEqual(list(cycle('')), []) + self.assertRaises(TypeError, cycle) + self.assertRaises(TypeError, cycle, 5) + self.assertEqual(list(islice(cycle(gen3()),10)), [0,1,2,0,1,2,0,1,2,0]) def test_ifilter(self): self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) self.assertEqual(list(ifilter(None, [0,1,0,2,0])), [1,2]) self.assertRaises(TypeError, ifilter) ! self.assertRaises(TypeError, ifilter, lambda x:x) ! self.assertRaises(TypeError, ifilter, lambda x:x, range(6), 7) self.assertRaises(TypeError, ifilter, isEven, 3) + self.assertRaises(TypeError, ifilter(range(6), range(6)).next) def test_ifilterfalse(self): self.assertEqual(list(ifilterfalse(isEven, range(6))), [1,3,5]) self.assertEqual(list(ifilterfalse(None, [0,1,0,2,0])), [0,0,0]) self.assertRaises(TypeError, ifilterfalse) ! self.assertRaises(TypeError, ifilterfalse, lambda x:x) ! self.assertRaises(TypeError, ifilterfalse, lambda x:x, range(6), 7) self.assertRaises(TypeError, ifilterfalse, isEven, 3) + self.assertRaises(TypeError, ifilterfalse(range(6), range(6)).next) def test_izip(self): ans = [(x,y) for x, y in izip('abc',count())] self.assertEqual(ans, [('a', 0), ('b', 1), ('c', 2)]) + self.assertEqual(list(izip('abc', range(6))), zip('abc', range(6))) + self.assertEqual(list(izip('abcdef', range(3))), zip('abcdef', range(3))) + self.assertEqual(list(izip('abcdef')), zip('abcdef')) self.assertRaises(TypeError, izip) + self.assertRaises(TypeError, izip, 3) + self.assertRaises(TypeError, izip, range(3), 3) + # Check tuple re-use (implementation detail) + self.assertEqual([tuple(list(pair)) for pair in izip('abc', 'def')], + zip('abc', 'def')) + ids = map(id, izip('abc', 'def')) + self.assertEqual(min(ids), max(ids)) def test_repeat(self): *************** *** 44,63 **** [(0, 'a'), (1, 'a'), (2, 'a')]) self.assertEqual(list(repeat('a', 3)), ['a', 'a', 'a']) self.assertRaises(TypeError, repeat) def test_imap(self): - import operator self.assertEqual(list(imap(operator.pow, range(3), range(1,7))), [0**1, 1**2, 2**3]) self.assertEqual(list(imap(None, 'abc', range(5))), [('a',0),('b',1),('c',2)]) self.assertRaises(TypeError, imap) self.assertRaises(TypeError, imap, operator.neg) def test_starmap(self): - import operator self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))), [0**1, 1**2, 2**3]) self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]])) def test_islice(self): --- 88,119 ---- [(0, 'a'), (1, 'a'), (2, 'a')]) self.assertEqual(list(repeat('a', 3)), ['a', 'a', 'a']) + self.assertEqual(list(repeat('a', 0)), []) + self.assertEqual(list(repeat('a', -3)), []) self.assertRaises(TypeError, repeat) + self.assertRaises(TypeError, repeat, None, 3, 4) + self.assertRaises(TypeError, repeat, None, 'a') def test_imap(self): self.assertEqual(list(imap(operator.pow, range(3), range(1,7))), [0**1, 1**2, 2**3]) self.assertEqual(list(imap(None, 'abc', range(5))), [('a',0),('b',1),('c',2)]) + self.assertEqual(list(imap(operator.pow, [])), []) self.assertRaises(TypeError, imap) self.assertRaises(TypeError, imap, operator.neg) + self.assertRaises(TypeError, imap(10, range(5)).next) + self.assertRaises(ValueError, imap(errfunc, [4], [5]).next) + self.assertRaises(TypeError, imap(onearg, [4], [5]).next) def test_starmap(self): self.assertEqual(list(starmap(operator.pow, zip(range(3), range(1,7)))), [0**1, 1**2, 2**3]) + self.assertEqual(list(starmap(operator.pow, [])), []) self.assertRaises(TypeError, list, starmap(operator.pow, [[4,5]])) + self.assertRaises(TypeError, starmap) + self.assertRaises(TypeError, starmap, operator.pow, [(4,5)], 'extra') + self.assertRaises(TypeError, starmap(10, [(4,5)]).next) + self.assertRaises(ValueError, starmap(errfunc, [(4,5)]).next) + self.assertRaises(TypeError, starmap(onearg, [(4,5)]).next) def test_islice(self): *************** *** 101,104 **** --- 157,166 ---- underten = lambda x: x<10 self.assertEqual(list(takewhile(underten, data)), [1, 3, 5]) + self.assertEqual(list(takewhile(underten, [])), []) + self.assertRaises(TypeError, takewhile) + self.assertRaises(TypeError, takewhile, operator.pow) + self.assertRaises(TypeError, takewhile, operator.pow, [(4,5)], 'extra') + self.assertRaises(TypeError, takewhile(10, [(4,5)]).next) + self.assertRaises(ValueError, takewhile(errfunc, [(4,5)]).next) def test_dropwhile(self): *************** *** 106,118 **** underten = lambda x: x<10 self.assertEqual(list(dropwhile(underten, data)), [20, 2, 4, 6, 8]) def test_StopIteration(self): - class StopNow: - """Test support class . Emulates an empty iterable.""" - def __iter__(self): - return self - def next(self): - raise StopIteration - for f in (chain, cycle, izip): self.assertRaises(StopIteration, f([]).next) --- 168,179 ---- underten = lambda x: x<10 self.assertEqual(list(dropwhile(underten, data)), [20, 2, 4, 6, 8]) + self.assertEqual(list(dropwhile(underten, [])), []) + self.assertRaises(TypeError, dropwhile) + self.assertRaises(TypeError, dropwhile, operator.pow) + self.assertRaises(TypeError, dropwhile, operator.pow, [(4,5)], 'extra') + self.assertRaises(TypeError, dropwhile(10, [(4,5)]).next) + self.assertRaises(ValueError, dropwhile(errfunc, [(4,5)]).next) def test_StopIteration(self): for f in (chain, cycle, izip): self.assertRaises(StopIteration, f([]).next) From rhettinger@users.sourceforge.net Sat May 3 07:52:01 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 23:52:01 -0700 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv31206/Include Modified Files: dictobject.h Log Message: Add a reference to dictnotes.txt. It does no good if you don't know it's there or where to find it. Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** dictobject.h 11 Dec 2002 13:21:12 -0000 2.26 --- dictobject.h 3 May 2003 06:51:58 -0000 2.27 *************** *** 8,11 **** --- 8,17 ---- /* Dictionary object type -- mapping from hashable object to object */ + /* The distribution includes a separate file, Objects/dictnotes.txt, + describing explorations into dictionary design and optimization. + It covers typical dictionary use patterns, the parameters for + tuning dictionaries, and several ideas for possible optimizations. + */ + /* There are three kinds of slots in the table: From rhettinger@users.sourceforge.net Sat May 3 07:52:01 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 02 May 2003 23:52:01 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.143,2.144 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31206/Objects Modified Files: dictobject.c Log Message: Add a reference to dictnotes.txt. It does no good if you don't know it's there or where to find it. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.143 retrieving revision 2.144 diff -C2 -d -r2.143 -r2.144 *** dictobject.c 17 Mar 2003 19:46:09 -0000 2.143 --- dictobject.c 3 May 2003 06:51:59 -0000 2.144 *************** *** 2,5 **** --- 2,11 ---- /* Dictionary object implementation using a hash table */ + /* The distribution includes a separate file, Objects/dictnotes.txt, + describing explorations into dictionary design and optimization. + It covers typical dictionary use patterns, the parameters for + tuning dictionaries, and several ideas for possible optimizations. + */ + #include "Python.h" From loewis@users.sourceforge.net Sat May 3 09:45:53 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 01:45:53 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.161,1.162 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv5524 Modified Files: setup.py Log Message: Change 'and' to 'or' in _tkinter test. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.161 retrieving revision 1.162 diff -C2 -d -r1.161 -r1.162 *** setup.py 3 May 2003 00:27:23 -0000 1.161 --- setup.py 3 May 2003 08:45:51 -0000 1.162 *************** *** 933,937 **** tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) ! if (tcllib is None or tklib is None and tcl_includes is None or tk_includes is None): # Something's missing, so give up --- 933,937 ---- tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) ! if (tcllib is None or tklib is None or tcl_includes is None or tk_includes is None): # Something's missing, so give up From loewis@users.sourceforge.net Sat May 3 10:09:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:09:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_inspect.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17854/Lib/test Modified Files: test_inspect.py Log Message: Patch #711902: Cause pydoc to show data descriptor __doc__ strings. Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_inspect.py 30 Nov 2002 03:53:15 -0000 1.9 --- test_inspect.py 3 May 2003 09:09:02 -0000 1.10 *************** *** 62,65 **** --- 62,66 ---- # getsourcefile, getcomments, getsource, getclasstree, getargspec, # getargvalues, formatargspec, formatargvalues, currentframe, stack, trace + # isdatadescriptor from test.test_support import TestFailed, TESTFN *************** *** 105,108 **** --- 106,111 ---- istest(inspect.ismodule, 'mod') istest(inspect.istraceback, 'tb') + istest(inspect.isdatadescriptor, '__builtins__.file.closed') + istest(inspect.isdatadescriptor, '__builtins__.file.softspace') test(inspect.isroutine(mod.spam), 'isroutine(mod.spam)') test(inspect.isroutine([].count), 'isroutine([].count)') From loewis@users.sourceforge.net Sat May 3 10:09:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:09:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17854/Doc/lib Modified Files: libinspect.tex Log Message: Patch #711902: Cause pydoc to show data descriptor __doc__ strings. Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libinspect.tex 23 Apr 2002 21:21:20 -0000 1.11 --- libinspect.tex 3 May 2003 09:09:01 -0000 1.12 *************** *** 162,165 **** --- 162,190 ---- \end{funcdesc} + \begin{funcdesc}{ismethoddescriptor}{object} + Return true if the object is a method descriptor, but not if ismethod() or + isclass() or isfunction() are true. + + This is new as of Python 2.2, and, for example, is true of int.__add__. + An object passing this test has a __get__ attribute but not a __set__ + attribute, but beyond that the set of attributes varies. __name__ is + usually sensible, and __doc__ often is. + + Methods implemented via descriptors that also pass one of the other + tests return false from the ismethoddescriptor() test, simply because + the other tests promise more -- you can, e.g., count on having the + im_func attribute (etc) when an object passes ismethod(). + \end{funcdesc} + + \begin{funcdesc}{isdatadescriptor}{object} + Return true if the object is a data descriptor. + + Data descriptors have both a __get__ and a __set__ attribute. Examples are + properties (defined in Python) and getsets and members (defined in C). + Typically, data descriptors will also have __name__ and __doc__ attributes + (properties, getsets, and members have both of these attributes), but this + is not guaranteed. + \end{funcdesc} + \subsection{Retrieving source code \label{inspect-source}} From loewis@users.sourceforge.net Sat May 3 10:09:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:09:04 -0700 Subject: [Python-checkins] python/dist/src/Lib inspect.py,1.42,1.43 pydoc.py,1.81,1.82 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv17854/Lib Modified Files: inspect.py pydoc.py Log Message: Patch #711902: Cause pydoc to show data descriptor __doc__ strings. Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** inspect.py 28 Mar 2003 16:29:50 -0000 1.42 --- inspect.py 3 May 2003 09:09:01 -0000 1.43 *************** *** 79,82 **** --- 79,92 ---- and not isclass(object)) + def isdatadescriptor(object): + """Return true if the object is a data descriptor. + + Data descriptors have both a __get__ and a __set__ attribute. Examples are + properties (defined in Python) and getsets and members (defined in C). + Typically, data descriptors will also have __name__ and __doc__ attributes + (properties, getsets, and members have both of these attributes), but this + is not guaranteed.""" + return (hasattr(object, "__set__") and hasattr(object, "__get__")) + def isfunction(object): """Return true if the object is a user-defined function. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.81 retrieving revision 1.82 diff -C2 -d -r1.81 -r1.82 *** pydoc.py 30 Mar 2003 20:31:34 -0000 1.81 --- pydoc.py 3 May 2003 09:09:01 -0000 1.82 *************** *** 687,691 **** for name, kind, homecls, value in ok: base = self.docother(getattr(object, name), name, mod) ! if callable(value): doc = getattr(value, "__doc__", None) else: --- 687,691 ---- for name, kind, homecls, value in ok: base = self.docother(getattr(object, name), name, mod) ! if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: *************** *** 1088,1092 **** push(msg) for name, kind, homecls, value in ok: ! if callable(value): doc = getattr(value, "__doc__", None) else: --- 1088,1092 ---- push(msg) for name, kind, homecls, value in ok: ! if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: From loewis@users.sourceforge.net Sat May 3 10:09:05 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:09:05 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.754,1.755 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17854/Misc Modified Files: NEWS Log Message: Patch #711902: Cause pydoc to show data descriptor __doc__ strings. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.754 retrieving revision 1.755 diff -C2 -d -r1.754 -r1.755 *** NEWS 2 May 2003 20:24:56 -0000 1.754 --- NEWS 3 May 2003 09:09:02 -0000 1.755 *************** *** 22,25 **** --- 22,28 ---- ------- + - inspect.is{method|data}descriptor was added, to allow pydoc display + __doc__ of data descriptors. + - Fixed socket speed loss caused by use of the _socketobject wrapper class in socket.py. From loewis@users.sourceforge.net Sat May 3 10:14:55 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:14:55 -0700 Subject: [Python-checkins] python/dist/src/Parser myreadline.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv20733/Parser Modified Files: myreadline.c Log Message: Patch #708495: Port more stuff to OpenVMS. Index: myreadline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/myreadline.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** myreadline.c 26 Oct 2002 14:39:09 -0000 2.28 --- myreadline.c 3 May 2003 09:14:53 -0000 2.29 *************** *** 16,19 **** --- 16,23 ---- #endif /* MS_WINDOWS */ + #ifdef __VMS + extern char* vms__StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt); + #endif + int (*PyOS_InputHook)(void) = NULL; *************** *** 160,164 **** --- 164,172 ---- if (PyOS_ReadlineFunctionPointer == NULL) { + #ifdef __VMS + PyOS_ReadlineFunctionPointer = vms__StdioReadline; + #else PyOS_ReadlineFunctionPointer = PyOS_StdioReadline; + #endif } From loewis@users.sourceforge.net Sat May 3 10:14:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:14:56 -0700 Subject: [Python-checkins] python/dist/src/Modules bz2module.c,1.18,1.19 fcntlmodule.c,2.38,2.39 fpectlmodule.c,2.18,2.19 grpmodule.c,2.20,2.21 mmapmodule.c,2.44,2.45 posixmodule.c,2.298,2.299 socketmodule.c,1.262,1.263 socketmodule.h,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv20733/Modules Modified Files: bz2module.c fcntlmodule.c fpectlmodule.c grpmodule.c mmapmodule.c posixmodule.c socketmodule.c socketmodule.h Log Message: Patch #708495: Port more stuff to OpenVMS. Index: bz2module.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bz2module.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** bz2module.c 29 Apr 2003 14:53:06 -0000 1.18 --- bz2module.c 3 May 2003 09:14:53 -0000 1.19 *************** *** 1310,1314 **** --- 1310,1316 ---- case 'U': + #ifdef WITH_UNIVERSAL_NEWLINES self->f_univ_newline = 1; + #endif break; Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.38 retrieving revision 2.39 diff -C2 -d -r2.38 -r2.39 *** fcntlmodule.c 3 Mar 2003 12:29:42 -0000 2.38 --- fcntlmodule.c 3 May 2003 09:14:53 -0000 2.39 *************** *** 183,187 **** --- 183,191 ---- } Py_BEGIN_ALLOW_THREADS + #ifdef __VMS + ret = ioctl(fd, code, (void *)arg); + #else ret = ioctl(fd, code, arg); + #endif Py_END_ALLOW_THREADS if (ret < 0) { Index: fpectlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fpectlmodule.c,v retrieving revision 2.18 retrieving revision 2.19 diff -C2 -d -r2.18 -r2.19 *** fpectlmodule.c 26 Sep 2002 16:52:02 -0000 2.18 --- fpectlmodule.c 3 May 2003 09:14:53 -0000 2.19 *************** *** 189,192 **** --- 189,196 ---- PyOS_setsig(SIGFPE, handler); + /*-- DEC ALPHA VMS --------------------------------------------------------*/ + #elif defined(__ALPHA) && defined(__VMS) + PyOS_setsig(SIGFPE, handler); + /*-- Cray Unicos ----------------------------------------------------------*/ #elif defined(cray) Index: grpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/grpmodule.c,v retrieving revision 2.20 retrieving revision 2.21 diff -C2 -d -r2.20 -r2.21 *** grpmodule.c 17 Sep 2002 07:05:25 -0000 2.20 --- grpmodule.c 3 May 2003 09:14:53 -0000 2.21 *************** *** 59,62 **** --- 59,66 ---- #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) SET(setIndex++, PyString_FromString(p->gr_name)); + #ifdef __VMS + SET(setIndex++, Py_None); + Py_INCREF(Py_None); + #else if (p->gr_passwd) SET(setIndex++, PyString_FromString(p->gr_passwd)); *************** *** 65,68 **** --- 69,73 ---- Py_INCREF(Py_None); } + #endif SET(setIndex++, PyInt_FromLong((long) p->gr_gid)); SET(setIndex++, w); Index: mmapmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/mmapmodule.c,v retrieving revision 2.44 retrieving revision 2.45 diff -C2 -d -r2.44 -r2.45 *** mmapmodule.c 9 Apr 2003 19:31:02 -0000 2.44 --- mmapmodule.c 3 May 2003 09:14:53 -0000 2.45 *************** *** 898,901 **** --- 898,905 ---- #ifdef HAVE_FSTAT + # ifdef __VMS + /* on OpenVMS we must ensure that all bytes are written to the file */ + fsync(fd); + # endif if (fstat(fd, &st) == 0 && (size_t)map_size > st.st_size) { PyErr_SetString(PyExc_ValueError, Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.298 retrieving revision 2.299 diff -C2 -d -r2.298 -r2.299 *** posixmodule.c 23 Apr 2003 02:39:17 -0000 2.298 --- posixmodule.c 3 May 2003 09:14:53 -0000 2.299 *************** *** 18,33 **** #if defined(__VMS) - # include /* tolower() */ - # include /* string descriptors */ - # include /* DVI$_name */ - # include /* -> O_RDWR */ - # include /* JPI$_name */ - # include /* LIB$name */ - # include /* OTS$name */ - # include /* SS$_name */ # include - # include - # include - # include /* define wait() */ #endif /* defined(__VMS) */ --- 18,22 ---- *************** *** 326,386 **** #endif /* !_MSC_VER */ - #if defined(__VMS) - /* add some values to provide a similar environment like POSIX */ - static - void - vms_add_posix_env(PyObject *d) - { - PyObject *o; - char* str; - - str = getenv("LINES"); - o = Py_BuildValue("s", str); - if (o != NULL) { - (void)PyDict_SetItemString(d, "LINES", o); - Py_DECREF(o); - } - - str = getenv("COLUMNS"); - o = Py_BuildValue("s", str); - if (o != NULL) { - (void)PyDict_SetItemString(d, "COLUMNS", o); - Py_DECREF(o); - } - - str = getenv("USER"); - o = Py_BuildValue("s", str); - if (o != NULL) { - (void)PyDict_SetItemString(d, "USERNAME", o); - Py_DECREF(o); - } - o = Py_BuildValue("s", str); - if (o != NULL) { - (void)PyDict_SetItemString(d, "LOGNAME", o); - Py_DECREF(o); - } - - str = getenv("HOME"); - o = Py_BuildValue("s", str); - if (o != NULL) { - (void)PyDict_SetItemString(d, "HOME", o); - Py_DECREF(o); - } - - str = getenv("PATH"); - o = Py_BuildValue("s", str); - if (o != NULL) { - (void)PyDict_SetItemString(d, "PATH", o); - Py_DECREF(o); - } - /* OS = "OpenVMS" */ - o = PyString_FromString ("OpenVMS"); - if (o != NULL) { - (void)PyDict_SetItemString(d, "OS", o); - Py_DECREF(o); - } - } - #endif /* __VMS */ - static PyObject * convertenviron(void) --- 315,318 ---- *************** *** 422,428 **** Py_DECREF(v); } ! #if defined(__VMS) ! vms_add_posix_env(d); ! #elif defined(PYOS_OS2) { APIRET rc; --- 354,358 ---- Py_DECREF(v); } ! #if defined(PYOS_OS2) { APIRET rc; *************** *** 1134,1138 **** #if defined(__VMS) ! /* DECC V5.0 - only about FD= 0 @@ try getname()+$getdvi(dvi$_devnam) */ if (id == 0) { ret = ttyname(); --- 1064,1068 ---- #if defined(__VMS) ! /* file descriptor 0 only, the default input device (stdin) */ if (id == 0) { ret = ttyname(); *************** *** 1340,1346 **** #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(buf, sizeof buf); - #elif defined(__VMS) - /* 0 = force Unix-style path if in the VMS DCL environment! */ - res = getcwd(buf, sizeof buf, 0); #else res = getcwd(buf, sizeof buf); --- 1270,1273 ---- *************** *** 1379,1385 **** #if defined(PYOS_OS2) && defined(PYCC_GCC) res = _getcwd2(buf, sizeof buf); - #elif defined(__VMS) - /* 0 = force Unix-style path if in the VMS DCL environment! */ - res = getcwd(buf, sizeof buf, 0); #else res = getcwd(buf, sizeof buf); --- 1306,1309 ---- *************** *** 5184,5192 **** int res; Py_BEGIN_ALLOW_THREADS - #if defined(__VMS) - res = pipe(fds,0,2100); /* bigger mailbox quota than 512 */ - #else res = pipe(fds); - #endif Py_END_ALLOW_THREADS if (res != 0) --- 5108,5112 ---- Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.262 retrieving revision 1.263 diff -C2 -d -r1.262 -r1.263 *** socketmodule.c 2 May 2003 15:40:46 -0000 1.262 --- socketmodule.c 3 May 2003 09:14:53 -0000 1.263 *************** *** 2200,2204 **** --- 2200,2208 ---- { char *name; + #ifdef ENABLE_IPV6 struct sockaddr_storage addrbuf; + #else + struct sockaddr_in addrbuf; + #endif if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) *************** *** 2358,2362 **** char *name; struct hostent *h; ! struct sockaddr_storage addr; struct sockaddr *sa; PyObject *ret; --- 2362,2370 ---- char *name; struct hostent *h; ! #ifdef ENABLE_IPV6 ! struct sockaddr_storage addr; ! #else ! struct sockaddr_in addr; ! #endif struct sockaddr *sa; PyObject *ret; Index: socketmodule.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** socketmodule.h 13 Jun 2002 15:07:44 -0000 1.8 --- socketmodule.h 3 May 2003 09:14:53 -0000 1.9 *************** *** 3,7 **** /* Includes needed for the sockaddr_* symbols below */ #ifndef MS_WINDOWS ! # include # include # if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP))) --- 3,11 ---- /* Includes needed for the sockaddr_* symbols below */ #ifndef MS_WINDOWS ! #ifdef __VMS ! # include ! # else ! # include ! # endif # include # if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP))) From loewis@users.sourceforge.net Sat May 3 10:14:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:14:56 -0700 Subject: [Python-checkins] python/dist/src/Python dynload_shlib.c,2.14,2.15 sysmodule.c,2.117,2.118 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20733/Python Modified Files: dynload_shlib.c sysmodule.c Log Message: Patch #708495: Port more stuff to OpenVMS. Index: dynload_shlib.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/dynload_shlib.c,v retrieving revision 2.14 retrieving revision 2.15 diff -C2 -d -r2.14 -r2.15 *** dynload_shlib.c 26 Feb 2002 11:41:34 -0000 2.14 --- dynload_shlib.c 3 May 2003 09:14:53 -0000 2.15 *************** *** 41,48 **** --- 41,55 ---- {".dll", "rb", C_EXTENSION}, #else + #ifdef __VMS + {".exe", "rb", C_EXTENSION}, + {".EXE", "rb", C_EXTENSION}, + {"module.exe", "rb", C_EXTENSION}, + {"MODULE.EXE", "rb", C_EXTENSION}, + #else {".so", "rb", C_EXTENSION}, {"module.so", "rb", C_EXTENSION}, #endif #endif + #endif {0, 0} }; *************** *** 50,54 **** --- 57,65 ---- static struct { dev_t dev; + #ifdef __VMS + ino_t ino[3]; + #else ino_t ino; + #endif void *handle; } handles[128]; *************** *** 88,92 **** --- 99,109 ---- if (nhandles < 128) { handles[nhandles].dev = statb.st_dev; + #ifdef __VMS + handles[nhandles].ino[0] = statb.st_ino[0]; + handles[nhandles].ino[1] = statb.st_ino[1]; + handles[nhandles].ino[2] = statb.st_ino[2]; + #else handles[nhandles].ino = statb.st_ino; + #endif } } *************** *** 98,101 **** --- 115,129 ---- if (Py_VerboseFlag) printf("dlopen(\"%s\", %x);\n", pathname, dlopenflags); + + #ifdef __VMS + /* VMS currently don't allow a pathname, use a logical name instead */ + /* Concatenate 'python_module_' and shortname */ + /* so "import vms.bar" will use the logical python_module_bar */ + /* As C module use only one name space this is probably not a */ + /* important limitation */ + PyOS_snprintf(pathbuf, sizeof(pathbuf), "python_module_%-.200s", + shortname); + pathname = pathbuf; + #endif handle = dlopen(pathname, dlopenflags); Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.117 retrieving revision 2.118 diff -C2 -d -r2.117 -r2.118 *** sysmodule.c 9 Apr 2003 19:06:19 -0000 2.117 --- sysmodule.c 3 May 2003 09:14:54 -0000 2.118 *************** *** 33,36 **** --- 33,40 ---- #endif + #ifdef __VMS + #include + #endif + PyObject * PySys_GetObject(char *name) *************** *** 1051,1055 **** --- 1055,1074 ---- int i; for (i = 0; i < argc; i++) { + #ifdef __VMS + PyObject *v; + + /* argv[0] is the script pathname if known */ + if (i == 0) { + char* fn = decc$translate_vms(argv[0]); + if ((fn == (char *)0) || fn == (char *)-1) + v = PyString_FromString(argv[0]); + else + v = PyString_FromString( + decc$translate_vms(argv[0])); + } else + v = PyString_FromString(argv[i]); + #else PyObject *v = PyString_FromString(argv[i]); + #endif if (v == NULL) { Py_DECREF(av); From loewis@users.sourceforge.net Sat May 3 10:45:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:45:15 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.156,1.157 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7009/Modules Modified Files: _tkinter.c Log Message: Implement tcl object __cmp__. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** _tkinter.c 1 May 2003 05:47:00 -0000 1.156 --- _tkinter.c 3 May 2003 09:45:12 -0000 1.157 *************** *** 811,814 **** --- 811,825 ---- } + static int + PyTclObject_cmp(PyTclObject *self, PyTclObject *other) + { + int res; + res = strcmp(Tcl_GetString(self->value), + Tcl_GetString(other->value)); + if (res < 0) return -1; + if (res > 0) return 1; + return 0; + } + PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type"); *************** *** 844,848 **** 0, /*tp_getattr*/ 0, /*tp_setattr*/ ! 0, /*tp_compare*/ (reprfunc)PyTclObject_repr, /*tp_repr*/ 0, /*tp_as_number*/ --- 855,859 ---- 0, /*tp_getattr*/ 0, /*tp_setattr*/ ! (cmpfunc)PyTclObject_cmp, /*tp_compare*/ (reprfunc)PyTclObject_repr, /*tp_repr*/ 0, /*tp_as_number*/ From loewis@users.sourceforge.net Sat May 3 10:58:28 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 02:58:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_inspect.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14489/Lib/test Modified Files: test_inspect.py Log Message: Refer to __builtin__.file, not __builtins__.file Index: test_inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_inspect.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_inspect.py 3 May 2003 09:09:02 -0000 1.10 --- test_inspect.py 3 May 2003 09:58:26 -0000 1.11 *************** *** 106,111 **** istest(inspect.ismodule, 'mod') istest(inspect.istraceback, 'tb') ! istest(inspect.isdatadescriptor, '__builtins__.file.closed') ! istest(inspect.isdatadescriptor, '__builtins__.file.softspace') test(inspect.isroutine(mod.spam), 'isroutine(mod.spam)') test(inspect.isroutine([].count), 'isroutine([].count)') --- 106,112 ---- istest(inspect.ismodule, 'mod') istest(inspect.istraceback, 'tb') ! import __builtin__ ! istest(inspect.isdatadescriptor, '__builtin__.file.closed') ! istest(inspect.isdatadescriptor, '__builtin__.file.softspace') test(inspect.isroutine(mod.spam), 'isroutine(mod.spam)') test(inspect.isroutine([].count), 'isroutine([].count)') From loewis@users.sourceforge.net Sat May 3 11:00:27 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:00:27 -0700 Subject: [Python-checkins] python/dist/src/Python getargs.c,2.99,2.100 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv15015/Python Modified Files: getargs.c Log Message: Patch #684981: Add cleanup capability for argument parsers. Fixes 501716. Index: getargs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/getargs.c,v retrieving revision 2.99 retrieving revision 2.100 diff -C2 -d -r2.99 -r2.100 *** getargs.c 18 Apr 2003 00:12:30 -0000 2.99 --- getargs.c 3 May 2003 10:00:22 -0000 2.100 *************** *** 18,25 **** static void seterror(int, char *, int *, char *, char *); static char *convertitem(PyObject *, char **, va_list *, int *, char *, ! size_t); static char *converttuple(PyObject *, char **, va_list *, ! int *, char *, size_t, int); ! static char *convertsimple(PyObject *, char **, va_list *, char *, size_t); static int convertbuffer(PyObject *, void **p, char **); --- 18,26 ---- static void seterror(int, char *, int *, char *, char *); static char *convertitem(PyObject *, char **, va_list *, int *, char *, ! size_t, PyObject **); static char *converttuple(PyObject *, char **, va_list *, ! int *, char *, size_t, int, PyObject **); ! static char *convertsimple(PyObject *, char **, va_list *, char *, ! size_t, PyObject **); static int convertbuffer(PyObject *, void **p, char **); *************** *** 73,76 **** --- 74,120 ---- + /* Handle cleanup of allocated memory in case of exception */ + + static int + addcleanup(void *ptr, PyObject **freelist) + { + PyObject *cobj; + if (!*freelist) { + *freelist = PyList_New(0); + if (!*freelist) { + PyMem_FREE(ptr); + return -1; + } + } + cobj = PyCObject_FromVoidPtr(ptr, NULL); + if (!cobj) { + PyMem_FREE(ptr); + return -1; + } + if(PyList_Append(*freelist, cobj)) { + PyMem_FREE(ptr); + Py_DECREF(cobj); + return -1; + } + Py_DECREF(cobj); + return 0; + } + + static int + cleanreturn(int retval, PyObject *freelist) + { + if(freelist) { + if((retval) == 0) { + int len = PyList_GET_SIZE(freelist), i; + for (i = 0; i < len; i++) + PyMem_FREE(PyCObject_AsVoidPtr( + PyList_GET_ITEM(freelist, i))); + } + Py_DECREF(freelist); + } + return retval; + } + + static int vgetargs1(PyObject *args, char *format, va_list *p_va, int compat) *************** *** 87,90 **** --- 131,135 ---- int i, len; char *msg; + PyObject *freelist = NULL; assert(compat || (args != (PyObject*)NULL)); *************** *** 158,166 **** } msg = convertitem(args, &format, p_va, levels, msgbuf, ! sizeof(msgbuf)); if (msg == NULL) ! return 1; seterror(levels[0], msg, levels+1, fname, message); ! return 0; } else { --- 203,211 ---- } msg = convertitem(args, &format, p_va, levels, msgbuf, ! sizeof(msgbuf), &freelist); if (msg == NULL) ! return cleanreturn(1, freelist); seterror(levels[0], msg, levels+1, fname, message); ! return cleanreturn(0, freelist); } else { *************** *** 201,208 **** format++; msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, ! levels, msgbuf, sizeof(msgbuf)); if (msg) { seterror(i+1, msg, levels, fname, message); ! return 0; } } --- 246,253 ---- format++; msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, ! levels, msgbuf, sizeof(msgbuf), &freelist); if (msg) { seterror(i+1, msg, levels, fname, message); ! return cleanreturn(0, freelist); } } *************** *** 213,220 **** PyErr_Format(PyExc_SystemError, "bad format string: %.200s", formatsave); ! return 0; } ! return 1; } --- 258,265 ---- PyErr_Format(PyExc_SystemError, "bad format string: %.200s", formatsave); ! return cleanreturn(0, freelist); } ! return cleanreturn(1, freelist); } *************** *** 278,282 **** static char * converttuple(PyObject *arg, char **p_format, va_list *p_va, int *levels, ! char *msgbuf, size_t bufsize, int toplevel) { int level = 0; --- 323,327 ---- static char * converttuple(PyObject *arg, char **p_format, va_list *p_va, int *levels, ! char *msgbuf, size_t bufsize, int toplevel, PyObject **freelist) { int level = 0; *************** *** 328,332 **** item = PySequence_GetItem(arg, i); msg = convertitem(item, &format, p_va, levels+1, msgbuf, ! bufsize); /* PySequence_GetItem calls tp->sq_item, which INCREFs */ Py_XDECREF(item); --- 373,377 ---- item = PySequence_GetItem(arg, i); msg = convertitem(item, &format, p_va, levels+1, msgbuf, ! bufsize, freelist); /* PySequence_GetItem calls tp->sq_item, which INCREFs */ Py_XDECREF(item); *************** *** 346,350 **** static char * convertitem(PyObject *arg, char **p_format, va_list *p_va, int *levels, ! char *msgbuf, size_t bufsize) { char *msg; --- 391,395 ---- static char * convertitem(PyObject *arg, char **p_format, va_list *p_va, int *levels, ! char *msgbuf, size_t bufsize, PyObject **freelist) { char *msg; *************** *** 354,363 **** format++; msg = converttuple(arg, &format, p_va, levels, msgbuf, ! bufsize, 0); if (msg == NULL) format++; } else { ! msg = convertsimple(arg, &format, p_va, msgbuf, bufsize); if (msg != NULL) levels[0] = 0; --- 399,409 ---- format++; msg = converttuple(arg, &format, p_va, levels, msgbuf, ! bufsize, 0, freelist); if (msg == NULL) format++; } else { ! msg = convertsimple(arg, &format, p_va, msgbuf, bufsize, ! freelist); if (msg != NULL) levels[0] = 0; *************** *** 410,414 **** static char * convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf, ! size_t bufsize) { char *format = *p_format; --- 456,460 ---- static char * convertsimple(PyObject *arg, char **p_format, va_list *p_va, char *msgbuf, ! size_t bufsize, PyObject **freelist) { char *format = *p_format; *************** *** 837,844 **** format++; ! if (buffer_len == NULL) return converterr( "(buffer_len is NULL)", arg, msgbuf, bufsize); if (*buffer == NULL) { *buffer = PyMem_NEW(char, size + 1); --- 883,892 ---- format++; ! if (buffer_len == NULL) { ! Py_DECREF(s); return converterr( "(buffer_len is NULL)", arg, msgbuf, bufsize); + } if (*buffer == NULL) { *buffer = PyMem_NEW(char, size + 1); *************** *** 849,852 **** --- 897,906 ---- arg, msgbuf, bufsize); } + if(addcleanup(*buffer, freelist)) { + Py_DECREF(s); + return converterr( + "(cleanup problem)", + arg, msgbuf, bufsize); + } } else { if (size + 1 > *buffer_len) { *************** *** 875,882 **** */ ! if ((int)strlen(PyString_AS_STRING(s)) != size) return converterr( "(encoded string without NULL bytes)", arg, msgbuf, bufsize); *buffer = PyMem_NEW(char, size + 1); if (*buffer == NULL) { --- 929,938 ---- */ ! if ((int)strlen(PyString_AS_STRING(s)) != size) { ! Py_DECREF(s); return converterr( "(encoded string without NULL bytes)", arg, msgbuf, bufsize); + } *buffer = PyMem_NEW(char, size + 1); if (*buffer == NULL) { *************** *** 885,888 **** --- 941,949 ---- arg, msgbuf, bufsize); } + if(addcleanup(*buffer, freelist)) { + Py_DECREF(s); + return converterr("(cleanup problem)", + arg, msgbuf, bufsize); + } memcpy(*buffer, PyString_AS_STRING(s), *************** *** 1104,1107 **** --- 1165,1169 ---- int i, len, nargs, nkeywords; char *msg, **p; + PyObject *freelist = NULL; assert(args != NULL && PyTuple_Check(args)); *************** *** 1228,1235 **** format++; msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, ! levels, msgbuf, sizeof(msgbuf)); if (msg) { seterror(i+1, msg, levels, fname, message); ! return 0; } } --- 1290,1297 ---- format++; msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, ! levels, msgbuf, sizeof(msgbuf), &freelist); if (msg) { seterror(i+1, msg, levels, fname, message); ! return cleanreturn(0, freelist); } } *************** *** 1237,1241 **** /* handle no keyword parameters in call */ if (nkeywords == 0) ! return 1; /* convert the keyword arguments; this uses the format --- 1299,1303 ---- /* handle no keyword parameters in call */ if (nkeywords == 0) ! return cleanreturn(1, freelist); /* convert the keyword arguments; this uses the format *************** *** 1249,1257 **** Py_INCREF(item); msg = convertitem(item, &format, p_va, levels, msgbuf, ! sizeof(msgbuf)); Py_DECREF(item); if (msg) { seterror(i+1, msg, levels, fname, message); ! return 0; } --nkeywords; --- 1311,1319 ---- Py_INCREF(item); msg = convertitem(item, &format, p_va, levels, msgbuf, ! sizeof(msgbuf), &freelist); Py_DECREF(item); if (msg) { seterror(i+1, msg, levels, fname, message); ! return cleanreturn(0, freelist); } --nkeywords; *************** *** 1260,1269 **** } else if (PyErr_Occurred()) ! return 0; else { msg = skipitem(&format, p_va); if (msg) { seterror(i+1, msg, levels, fname, message); ! return 0; } } --- 1322,1331 ---- } else if (PyErr_Occurred()) ! return cleanreturn(0, freelist); else { msg = skipitem(&format, p_va); if (msg) { seterror(i+1, msg, levels, fname, message); ! return cleanreturn(0, freelist); } } *************** *** 1280,1284 **** PyErr_SetString(PyExc_TypeError, "keywords must be strings"); ! return 0; } ks = PyString_AsString(key); --- 1342,1346 ---- PyErr_SetString(PyExc_TypeError, "keywords must be strings"); ! return cleanreturn(0, freelist); } ks = PyString_AsString(key); *************** *** 1294,1303 **** "argument for this function", ks); ! return 0; } } } ! return 1; } --- 1356,1365 ---- "argument for this function", ks); ! return cleanreturn(0, freelist); } } } ! return cleanreturn(1, freelist); } From loewis@users.sourceforge.net Sat May 3 11:12:48 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:12:48 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.263,1.264 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22931/Modules Modified Files: socketmodule.c Log Message: Patch #724588: Check whether the address of hstrerror and inet_pton can be taken, and define NI_MAX{HOST|SERV} if necessary. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.263 retrieving revision 1.264 diff -C2 -d -r1.263 -r1.264 *** socketmodule.c 3 May 2003 09:14:53 -0000 1.263 --- socketmodule.c 3 May 2003 10:12:45 -0000 1.264 *************** *** 294,297 **** --- 294,307 ---- #endif + /* + * Constants for getnameinfo() + */ + #if !defined(NI_MAXHOST) + #define NI_MAXHOST 1025 + #endif + #if !defined(NI_MAXSERV) + #define NI_MAXSERV 32 + #endif + /* XXX There's a problem here: *static* functions are not supposed to have a Py prefix (or use CapitalizedWords). Later... */ From loewis@users.sourceforge.net Sat May 3 11:12:48 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:12:48 -0700 Subject: [Python-checkins] python/dist/src configure,1.390,1.391 configure.in,1.401,1.402 pyconfig.h.in,1.76,1.77 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv22931 Modified Files: configure configure.in pyconfig.h.in Log Message: Patch #724588: Check whether the address of hstrerror and inet_pton can be taken, and define NI_MAX{HOST|SERV} if necessary. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.390 retrieving revision 1.391 diff -C2 -d -r1.390 -r1.391 *** configure 11 Apr 2003 15:35:40 -0000 1.390 --- configure 3 May 2003 10:12:42 -0000 1.391 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.400 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.401 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 12110,12121 **** - - - for ac_func in alarm chown clock confstr ctermid execv \ fchdir fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getpwent getwd \ ! hstrerror inet_aton inet_pton kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ --- 12110,12118 ---- for ac_func in alarm chown clock confstr ctermid execv \ fchdir fork fsync fdatasync fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getpwent getwd \ ! kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ *************** *** 12503,12506 **** --- 12500,12660 ---- rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: checking for hstrerror" >&5 + echo $ECHO_N "checking for hstrerror... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include "confdefs.h" + #include + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void* p = hstrerror + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_HSTRERROR 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + + echo "$as_me:$LINENO: checking for inet_aton" >&5 + echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include "confdefs.h" + #include + #include + #include + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void* p = inet_aton + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_INET_ATON 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + + echo "$as_me:$LINENO: checking for inet_pton" >&5 + echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include "confdefs.h" + #include + #include + #include + + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + void* p = inet_pton + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\_ACEOF + #define HAVE_INET_PTON 1 + _ACEOF + + echo "$as_me:$LINENO: result: yes" >&5 + echo "${ECHO_T}yes" >&6 + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + + fi + rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: checking for setgroups" >&5 echo $ECHO_N "checking for setgroups... $ECHO_C" >&6 *************** *** 17829,17833 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 17983,17987 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.401 retrieving revision 1.402 diff -C2 -d -r1.401 -r1.402 *** configure.in 11 Apr 2003 15:35:52 -0000 1.401 --- configure.in 3 May 2003 10:12:45 -0000 1.402 *************** *** 1858,1862 **** gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getpwent getwd \ ! hstrerror inet_aton inet_pton kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ --- 1858,1862 ---- gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ getpriority getpwent getwd \ ! kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ *************** *** 1920,1923 **** --- 1920,1957 ---- ], void* p = getpagesize, AC_DEFINE(HAVE_GETPAGESIZE, 1, Define if you have the 'getpagesize' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + + AC_MSG_CHECKING(for hstrerror) + AC_TRY_COMPILE([ + #include "confdefs.h" + #include + ], void* p = hstrerror, + AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + + AC_MSG_CHECKING(for inet_aton) + AC_TRY_COMPILE([ + #include "confdefs.h" + #include + #include + #include + ], void* p = inet_aton, + AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.) + AC_MSG_RESULT(yes), + AC_MSG_RESULT(no) + ) + + AC_MSG_CHECKING(for inet_pton) + AC_TRY_COMPILE([ + #include "confdefs.h" + #include + #include + #include + ], void* p = inet_pton, + AC_DEFINE(HAVE_INET_PTON, 1, Define if you have the 'inet_pton' function.) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.76 retrieving revision 1.77 diff -C2 -d -r1.76 -r1.77 *** pyconfig.h.in 30 Mar 2003 17:23:49 -0000 1.76 --- pyconfig.h.in 3 May 2003 10:12:45 -0000 1.77 *************** *** 208,212 **** #undef HAVE_GRP_H ! /* Define to 1 if you have the `hstrerror' function. */ #undef HAVE_HSTRERROR --- 208,212 ---- #undef HAVE_GRP_H ! /* Define if you have the 'hstrerror' function. */ #undef HAVE_HSTRERROR *************** *** 214,221 **** #undef HAVE_HYPOT ! /* Define to 1 if you have the `inet_aton' function. */ #undef HAVE_INET_ATON ! /* Define to 1 if you have the `inet_pton' function. */ #undef HAVE_INET_PTON --- 214,221 ---- #undef HAVE_HYPOT ! /* Define if you have the 'inet_aton' function. */ #undef HAVE_INET_ATON ! /* Define if you have the 'inet_pton' function. */ #undef HAVE_INET_PTON From loewis@users.sourceforge.net Sat May 3 11:32:20 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:32:20 -0700 Subject: [Python-checkins] python/dist/src configure,1.391,1.392 configure.in,1.402,1.403 pyconfig.h.in,1.77,1.78 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv5610 Modified Files: configure configure.in pyconfig.h.in Log Message: Patch #730826: Enable extensions on NetBSD 2.0. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.391 retrieving revision 1.392 diff -C2 -d -r1.391 -r1.392 *** configure 3 May 2003 10:12:42 -0000 1.391 --- configure 3 May 2003 10:32:17 -0000 1.392 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.401 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.402 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1250,1253 **** --- 1250,1262 ---- cat >>confdefs.h <<\_ACEOF #define _GNU_SOURCE 1 + _ACEOF + + + # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables + # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable + # them. + + cat >>confdefs.h <<\_ACEOF + #define _NETBSD_SOURCE 1 _ACEOF Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.402 retrieving revision 1.403 diff -C2 -d -r1.402 -r1.403 *** configure.in 3 May 2003 10:12:45 -0000 1.402 --- configure.in 3 May 2003 10:32:18 -0000 1.403 *************** *** 35,38 **** --- 35,43 ---- AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features]) + # The later defininition of _XOPEN_SOURCE and _POSIX_C_SOURCE disables + # certain features on NetBSD, so we need _NETBSD_SOURCE to re-enable + # them. + AC_DEFINE(_NETBSD_SOURCE, 1, [Define on NetBSD to activate all library features]) + define_xopen_source=yes Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.77 retrieving revision 1.78 diff -C2 -d -r1.77 -r1.78 *** pyconfig.h.in 3 May 2003 10:12:45 -0000 1.77 --- pyconfig.h.in 3 May 2003 10:32:18 -0000 1.78 *************** *** 818,821 **** --- 818,824 ---- #undef _MINIX + /* Define on NetBSD to activate all library features */ + #undef _NETBSD_SOURCE + /* Define _OSF_SOURCE to get the makedev macro. */ #undef _OSF_SOURCE From loewis@users.sourceforge.net Sat May 3 11:53:10 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:53:10 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.150,2.151 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv20734/Objects Modified Files: listobject.c Log Message: Patch #708604: Check more function results. Will backport to 2.2. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.150 retrieving revision 2.151 diff -C2 -d -r2.150 -r2.151 *** listobject.c 24 Apr 2003 20:59:50 -0000 2.150 --- listobject.c 3 May 2003 10:53:08 -0000 2.151 *************** *** 474,477 **** --- 474,479 ---- int ret; v = list_slice(b, 0, n); + if (v == NULL) + return -1; ret = list_ass_slice(a, ilow, ihigh, v); Py_DECREF(v); *************** *** 489,494 **** item = a->ob_item; d = n - (ihigh-ilow); ! if (ihigh > ilow) p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow)); else p = recycle = NULL; --- 491,501 ---- item = a->ob_item; d = n - (ihigh-ilow); ! if (ihigh > ilow) { p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow)); + if (recycle == NULL) { + PyErr_NoMemory(); + return -1; + } + } else p = recycle = NULL; From loewis@users.sourceforge.net Sat May 3 11:53:11 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:53:11 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.282,2.283 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv20734/Python Modified Files: compile.c Log Message: Patch #708604: Check more function results. Will backport to 2.2. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.282 retrieving revision 2.283 diff -C2 -d -r2.282 -r2.283 *** compile.c 29 Apr 2003 17:07:34 -0000 2.282 --- compile.c 3 May 2003 10:53:08 -0000 2.283 *************** *** 4619,4632 **** PyList_SET_ITEM(list, 0, v); Py_INCREF(v); ! } else ! PyList_Insert(list, 0, v); } } ! if (list == NULL || PyList_GET_SIZE(list) == 0) ! return 0; /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. */ d = PyDict_New(); for (i = PyList_GET_SIZE(list); --i >= 0; ) { v = PyInt_FromLong(i); --- 4619,4639 ---- PyList_SET_ITEM(list, 0, v); Py_INCREF(v); ! } else { ! if (PyList_Insert(list, 0, v) < 0) { ! Py_DECREF(list); ! return -1; ! } ! } } } ! if (list == NULL) /* There used to be a check here for the size of */ ! return 0; /* the list being 0, which would have leaked the */ ! /* list if that condition was ever possible. JRH */ /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. */ d = PyDict_New(); + if (d == NULL) + return -1; for (i = PyList_GET_SIZE(list); --i >= 0; ) { v = PyInt_FromLong(i); *************** *** 4644,4647 **** --- 4651,4656 ---- while (PyDict_Next(*cellvars, &pos, &v, &w)) { w = PyInt_FromLong(i++); /* don't care about the old key */ + if (w == NULL) + goto fail; if (PyDict_SetItem(d, v, w) < 0) { Py_DECREF(w); *************** *** 4794,4797 **** --- 4803,4808 ---- for (i = 0; i < si.si_nlocals; ++i) { v = PyInt_FromLong(i); + if (v == NULL) + goto fail; if (PyDict_SetItem(c->c_locals, PyList_GET_ITEM(varnames, i), v) < 0) *************** *** 4866,4869 **** --- 4877,4882 ---- if (st->st_nscopes != 1) { v = PyInt_FromLong(flags); + if (v == NULL) + goto fail; if (PyDict_SetItem(st->st_global, name, v)) *************** *** 4902,4905 **** --- 4915,4919 ---- st->st_filename = NULL; + st->st_symbols = NULL; if ((st->st_stack = PyList_New(0)) == NULL) goto fail; *************** *** 4954,4959 **** if (list) ! PyList_SetSlice(list, 0, ! ((PyVarObject*)list)->ob_size, 0); child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); --- 4968,4979 ---- if (list) ! if (PyList_SetSlice(list, 0, ! ((PyVarObject*)list)->ob_size, 0) < 0) ! return -1; ! /* Yes, the above call CAN fail, even though it's reducing ! the size of the list. The current implementation will ! allocate temp memory equal to the size of the list: this ! is avoidable in this specific case, but probably not ! worth the effort of special-casing it. - JRH */ child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); *************** *** 5105,5109 **** prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { ! Py_DECREF(st->st_cur); st->st_errors++; return; --- 5125,5131 ---- prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { ! /* Py_DECREF(st->st_cur); */ ! /* I believe the previous line would lead to a ! double-DECREF when st is disposed - JRH */ st->st_errors++; return; *************** *** 5112,5115 **** --- 5134,5141 ---- st->st_cur = (PySymtableEntryObject *) PySymtableEntry_New(st, name, type, lineno); + if (st->st_cur == NULL) { + st->st_errors++; + return; + } if (strcmp(name, TOP) == 0) st->st_global = st->st_cur->ste_symbols; *************** *** 5188,5191 **** --- 5214,5219 ---- val = flag; o = PyInt_FromLong(val); + if (o == NULL) + return -1; if (PyDict_SetItem(dict, name, o) < 0) { Py_DECREF(o); *************** *** 5206,5209 **** --- 5234,5239 ---- val = flag; o = PyInt_FromLong(val); + if (o == NULL) + return -1; if (PyDict_SetItem(st->st_global, name, o) < 0) { Py_DECREF(o); From loewis@users.sourceforge.net Sat May 3 11:53:53 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:53:53 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.103.6.5,2.103.6.6 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv21458/Objects Modified Files: Tag: release22-maint listobject.c Log Message: Patch #708604: Check more function results. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.103.6.5 retrieving revision 2.103.6.6 diff -C2 -d -r2.103.6.5 -r2.103.6.6 *** listobject.c 29 Dec 2002 05:59:09 -0000 2.103.6.5 --- listobject.c 3 May 2003 10:53:51 -0000 2.103.6.6 *************** *** 469,472 **** --- 469,474 ---- int ret; v = list_slice(b, 0, n); + if (v == NULL) + return -1; ret = list_ass_slice(a, ilow, ihigh, v); Py_DECREF(v); *************** *** 490,495 **** item = a->ob_item; d = n - (ihigh-ilow); ! if (ihigh > ilow) p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow)); else p = recycle = NULL; --- 492,502 ---- item = a->ob_item; d = n - (ihigh-ilow); ! if (ihigh > ilow) { p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow)); + if (recycle == NULL) { + PyErr_NoMemory(); + return -1; + } + } else p = recycle = NULL; From loewis@users.sourceforge.net Sat May 3 11:53:54 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:53:54 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.234.4.6,2.234.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv21458/Python Modified Files: Tag: release22-maint compile.c Log Message: Patch #708604: Check more function results. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.234.4.6 retrieving revision 2.234.4.7 diff -C2 -d -r2.234.4.6 -r2.234.4.7 *** compile.c 12 Feb 2003 19:09:41 -0000 2.234.4.6 --- compile.c 3 May 2003 10:53:51 -0000 2.234.4.7 *************** *** 4382,4395 **** PyList_SET_ITEM(list, 0, v); Py_INCREF(v); ! } else ! PyList_Insert(list, 0, v); } } ! if (list == NULL || PyList_GET_SIZE(list) == 0) ! return 0; /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. */ d = PyDict_New(); for (i = PyList_GET_SIZE(list); --i >= 0; ) { v = PyInt_FromLong(i); --- 4382,4402 ---- PyList_SET_ITEM(list, 0, v); Py_INCREF(v); ! } else { ! if (PyList_Insert(list, 0, v) < 0) { ! Py_DECREF(list); ! return -1; ! } ! } } } ! if (list == NULL) /* There used to be a check here for the size of */ ! return 0; /* the list being 0, which would have leaked the */ ! /* list if that condition was ever possible. JRH */ /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. */ d = PyDict_New(); + if (d == NULL) + return -1; for (i = PyList_GET_SIZE(list); --i >= 0; ) { v = PyInt_FromLong(i); *************** *** 4406,4409 **** --- 4413,4418 ---- while (PyDict_Next(*cellvars, &pos, &v, &w)) { w = PyInt_FromLong(i++); /* don't care about the old key */ + if (w == NULL) + goto fail; if (PyDict_SetItem(d, v, w) < 0) { Py_DECREF(w); *************** *** 4560,4563 **** --- 4569,4574 ---- for (i = 0; i < si.si_nlocals; ++i) { v = PyInt_FromLong(i); + if (v == NULL) + goto fail; if (PyDict_SetItem(c->c_locals, PyList_GET_ITEM(varnames, i), v) < 0) *************** *** 4632,4635 **** --- 4643,4648 ---- if (st->st_nscopes != 1) { v = PyInt_FromLong(flags); + if (v == NULL) + goto fail; if (PyDict_SetItem(st->st_global, name, v)) *************** *** 4668,4671 **** --- 4681,4685 ---- st->st_filename = NULL; + st->st_symbols = NULL; if ((st->st_stack = PyList_New(0)) == NULL) goto fail; *************** *** 4720,4725 **** if (list) ! PyList_SetSlice(list, 0, ! ((PyVarObject*)list)->ob_size, 0); child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); --- 4734,4745 ---- if (list) ! if (PyList_SetSlice(list, 0, ! ((PyVarObject*)list)->ob_size, 0) < 0) ! return -1; ! /* Yes, the above call CAN fail, even though it's reducing ! the size of the list. The current implementation will ! allocate temp memory equal to the size of the list: this ! is avoidable in this specific case, but probably not ! worth the effort of special-casing it. - JRH */ child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); *************** *** 4871,4875 **** prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { ! Py_DECREF(st->st_cur); st->st_errors++; return; --- 4891,4897 ---- prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { ! /* Py_DECREF(st->st_cur); */ ! /* I believe the previous line would lead to a ! double-DECREF when st is disposed - JRH */ st->st_errors++; return; *************** *** 4878,4881 **** --- 4900,4907 ---- st->st_cur = (PySymtableEntryObject *) PySymtableEntry_New(st, name, type, lineno); + if (st->st_cur == NULL) { + st->st_errors++; + return; + } if (strcmp(name, TOP) == 0) st->st_global = st->st_cur->ste_symbols; *************** *** 4946,4949 **** --- 4972,4977 ---- val = flag; o = PyInt_FromLong(val); + if (o == NULL) + return -1; if (PyDict_SetItem(dict, name, o) < 0) { Py_DECREF(o); *************** *** 4964,4967 **** --- 4992,4997 ---- val = flag; o = PyInt_FromLong(val); + if (o == NULL) + return -1; if (PyDict_SetItem(st->st_global, name, o) < 0) { Py_DECREF(o); From loewis@users.sourceforge.net Sat May 3 11:57:56 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:57:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.97,1.98 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23113 Modified Files: libre.tex Log Message: Patch #731514: Update recursion documentation to mention simple recursion. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** libre.tex 20 Apr 2003 01:48:59 -0000 1.97 --- libre.tex 3 May 2003 10:57:53 -0000 1.98 *************** *** 897,909 **** \end{verbatim} ! \leftline{\strong{Avoiding backtracking}} ! If you create regular expressions that require the engine to perform a lot ! of backtracking, you may encounter a RuntimeError exception with the message ! \code{maximum recursion limit exceeded}. For example, \begin{verbatim} ! >>> s = "<" + "that's a very big string!"*1000 + ">" ! >>> re.match('<.*?>', s) Traceback (most recent call last): File "", line 1, in ? --- 897,910 ---- \end{verbatim} ! \leftline{\strong{Avoiding recursion}} ! If you create regular expressions that require the engine to perform a ! lot of recursion, you may encounter a RuntimeError exception with ! the message \code{maximum recursion limit} exceeded. For example, \begin{verbatim} ! >>> import re ! >>> s = 'Begin ' + 1000*'a very long string ' + 'end' ! >>> re.match('Begin (\w| )*? end', s).end() Traceback (most recent call last): File "", line 1, in ? *************** *** 913,919 **** \end{verbatim} ! You can often restructure your regular expression to avoid backtracking. ! The above regular expression can be recast as ! \regexp{\textless[\textasciicircum \textgreater]*\textgreater}. As a ! further benefit, such regular expressions will run faster than their ! backtracking equivalents. --- 914,922 ---- \end{verbatim} ! You can often restructure your regular expression to avoid recursion. ! ! \versionadded[Simple uses of the \regexp{*?} pattern are now ! special-cased to avoid recursion. Thus, the above regular expression ! can avoid recursion by being recast as \regexp{Begin [a-zA-Z0-9_ ]*?end}. ! As a further benefit, such regular expressions will run faster than ! their recursive equivalents.]{2.3} From loewis@users.sourceforge.net Sat May 3 11:59:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 03:59:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.98,1.99 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24306 Modified Files: libre.tex Log Message: Use \versionchanged, not \versionadded. Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** libre.tex 3 May 2003 10:57:53 -0000 1.98 --- libre.tex 3 May 2003 10:59:13 -0000 1.99 *************** *** 916,920 **** You can often restructure your regular expression to avoid recursion. ! \versionadded[Simple uses of the \regexp{*?} pattern are now special-cased to avoid recursion. Thus, the above regular expression can avoid recursion by being recast as \regexp{Begin [a-zA-Z0-9_ ]*?end}. --- 916,920 ---- You can often restructure your regular expression to avoid recursion. ! \versionchanged[Simple uses of the \regexp{*?} pattern are now special-cased to avoid recursion. Thus, the above regular expression can avoid recursion by being recast as \regexp{Begin [a-zA-Z0-9_ ]*?end}. From loewis@users.sourceforge.net Sat May 3 12:25:45 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 04:25:45 -0700 Subject: [Python-checkins] python/dist/src configure,1.392,1.393 configure.in,1.403,1.404 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv7925 Modified Files: configure configure.in Log Message: Patch #730170: Check for sem_init in -lpthread. Fixes #727051. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.392 retrieving revision 1.393 diff -C2 -d -r1.392 -r1.393 *** configure 3 May 2003 10:32:17 -0000 1.392 --- configure 3 May 2003 11:25:40 -0000 1.393 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.402 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.403 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 9716,9720 **** rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_sem_init" = no; then ! for ac_lib in rt posix4; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF --- 9716,9720 ---- rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_search_sem_init" = no; then ! for ac_lib in pthread rt posix4; do LIBS="-l$ac_lib $ac_func_search_save_LIBS" cat >conftest.$ac_ext <<_ACEOF *************** *** 9772,9777 **** fi ! # 'Real Time' functions on Solaris, ! # posix4 on Solaris 2.6 # checks for system dependent C++ extensions support --- 9772,9778 ---- fi ! # 'Real Time' functions on Solaris ! # posix4 on Solaris 2.6 ! # pthread (first!) on Linux # checks for system dependent C++ extensions support Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.403 retrieving revision 1.404 diff -C2 -d -r1.403 -r1.404 *** configure.in 3 May 2003 10:32:18 -0000 1.403 --- configure.in 3 May 2003 11:25:43 -0000 1.404 *************** *** 1249,1254 **** AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX ! AC_SEARCH_LIBS(sem_init, rt posix4) # 'Real Time' functions on Solaris, ! # posix4 on Solaris 2.6 # checks for system dependent C++ extensions support --- 1249,1255 ---- AC_CHECK_LIB(dl, dlopen) # Dynamic linking for SunOS/Solaris and SYSV AC_CHECK_LIB(dld, shl_load) # Dynamic linking for HP-UX ! AC_SEARCH_LIBS(sem_init, pthread rt posix4) # 'Real Time' functions on Solaris ! # posix4 on Solaris 2.6 ! # pthread (first!) on Linux # checks for system dependent C++ extensions support From loewis@users.sourceforge.net Sat May 3 13:10:50 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 03 May 2003 05:10:50 -0700 Subject: [Python-checkins] python/dist/src configure,1.393,1.394 configure.in,1.404,1.405 pyconfig.h.in,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv8842 Modified Files: configure configure.in pyconfig.h.in Log Message: Try linking hstrerror and inet_aton tests. Look for these functions in -lresolv. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.393 retrieving revision 1.394 diff -C2 -d -r1.393 -r1.394 *** configure 3 May 2003 11:25:40 -0000 1.393 --- configure 3 May 2003 12:10:46 -0000 1.394 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.403 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.404 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 12510,12513 **** --- 12510,12640 ---- rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 + echo $ECHO_N "checking for inet_aton in -lc... $ECHO_C" >&6 + if test "${ac_cv_lib_c_inet_aton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS + LIBS="-lc $LIBS" + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + /* Override any gcc2 internal prototype to avoid an error. */ + #ifdef __cplusplus + extern "C" + #endif + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char inet_aton (); + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + inet_aton (); + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_inet_aton=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_lib_c_inet_aton=no + fi + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_c_inet_aton" >&5 + echo "${ECHO_T}$ac_cv_lib_c_inet_aton" >&6 + if test $ac_cv_lib_c_inet_aton = yes; then + /bin/true + else + + echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 + echo $ECHO_N "checking for inet_aton in -lresolv... $ECHO_C" >&6 + if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_check_lib_save_LIBS=$LIBS + LIBS="-lresolv $LIBS" + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + /* Override any gcc2 internal prototype to avoid an error. */ + #ifdef __cplusplus + extern "C" + #endif + /* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ + char inet_aton (); + #ifdef F77_DUMMY_MAIN + # ifdef __cplusplus + extern "C" + # endif + int F77_DUMMY_MAIN() { return 1; } + #endif + int + main () + { + inet_aton (); + ; + return 0; + } + _ACEOF + rm -f conftest.$ac_objext conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_resolv_inet_aton=yes + else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_lib_resolv_inet_aton=no + fi + rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_lib_save_LIBS + fi + echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 + echo "${ECHO_T}$ac_cv_lib_resolv_inet_aton" >&6 + if test $ac_cv_lib_resolv_inet_aton = yes; then + cat >>confdefs.h <<_ACEOF + #define HAVE_LIBRESOLV 1 + _ACEOF + + LIBS="-lresolv $LIBS" + + fi + + + fi + + echo "$as_me:$LINENO: checking for hstrerror" >&5 echo $ECHO_N "checking for hstrerror... $ECHO_C" >&6 *************** *** 12528,12543 **** main () { ! void* p = hstrerror ; return 0; } _ACEOF ! rm -f conftest.$ac_objext ! if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ! (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && ! { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 --- 12655,12670 ---- main () { ! void* p = hstrerror; hstrerror(0) ; return 0; } _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ! (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 *************** *** 12559,12563 **** fi ! rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for inet_aton" >&5 --- 12686,12690 ---- fi ! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for inet_aton" >&5 *************** *** 12581,12596 **** main () { ! void* p = inet_aton ; return 0; } _ACEOF ! rm -f conftest.$ac_objext ! if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ! (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && ! { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 --- 12708,12723 ---- main () { ! void* p = inet_aton;inet_aton(0,0) ; return 0; } _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ! (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 *************** *** 12612,12616 **** fi ! rm -f conftest.$ac_objext conftest.$ac_ext echo "$as_me:$LINENO: checking for inet_pton" >&5 --- 12739,12743 ---- fi ! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext echo "$as_me:$LINENO: checking for inet_pton" >&5 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.404 retrieving revision 1.405 diff -C2 -d -r1.404 -r1.405 *** configure.in 3 May 2003 11:25:43 -0000 1.404 --- configure.in 3 May 2003 12:10:48 -0000 1.405 *************** *** 1930,1938 **** ) AC_MSG_CHECKING(for hstrerror) ! AC_TRY_COMPILE([ #include "confdefs.h" #include ! ], void* p = hstrerror, AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.) AC_MSG_RESULT(yes), --- 1930,1944 ---- ) + dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv + dnl On others, they are in the C library, so we to take no action + AC_CHECK_LIB(c, inet_aton, [/bin/true], + AC_CHECK_LIB(resolv, inet_aton) + ) + AC_MSG_CHECKING(for hstrerror) ! AC_TRY_LINK([ #include "confdefs.h" #include ! ], void* p = hstrerror; hstrerror(0), AC_DEFINE(HAVE_HSTRERROR, 1, Define if you have the 'hstrerror' function.) AC_MSG_RESULT(yes), *************** *** 1941,1950 **** AC_MSG_CHECKING(for inet_aton) ! AC_TRY_COMPILE([ #include "confdefs.h" #include #include #include ! ], void* p = inet_aton, AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.) AC_MSG_RESULT(yes), --- 1947,1956 ---- AC_MSG_CHECKING(for inet_aton) ! AC_TRY_LINK([ #include "confdefs.h" #include #include #include ! ], void* p = inet_aton;inet_aton(0,0), AC_DEFINE(HAVE_INET_ATON, 1, Define if you have the 'inet_aton' function.) AC_MSG_RESULT(yes), Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** pyconfig.h.in 3 May 2003 10:32:18 -0000 1.78 --- pyconfig.h.in 3 May 2003 12:10:48 -0000 1.79 *************** *** 253,256 **** --- 253,259 ---- #undef HAVE_LIBINTL_H + /* Define to 1 if you have the `resolv' library (-lresolv). */ + #undef HAVE_LIBRESOLV + /* Define to 1 if you have the header file. */ #undef HAVE_LIBUTIL_H From goodger@users.sourceforge.net Sat May 3 17:01:35 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Sat, 03 May 2003 09:01:35 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.41,1.42 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27536 Modified Files: pep-0001.txt Log Message: converted to reStructuredText Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** pep-0001.txt 2 May 2003 21:34:44 -0000 1.41 --- pep-0001.txt 3 May 2003 16:01:32 -0000 1.42 *************** *** 6,416 **** Status: Active Type: Informational ! Content-Type: text/plain Created: 13-Jun-2000 ! Post-History: 21-Mar-2001, 29-Jul-2002 What is a PEP? ! PEP stands for Python Enhancement Proposal. A PEP is a design ! document providing information to the Python community, or ! describing a new feature for Python. The PEP should provide a ! concise technical specification of the feature and a rationale for ! the feature. ! We intend PEPs to be the primary mechanisms for proposing new ! features, for collecting community input on an issue, and for ! documenting the design decisions that have gone into Python. The ! PEP author is responsible for building consensus within the ! community and documenting dissenting opinions. ! Because the PEPs are maintained as text files under CVS control, ! their revision history is the historical record of the feature ! proposal[1]. Kinds of PEPs ! There are two kinds of PEPs. A Standards Track PEP describes a ! new feature or implementation for Python. An Informational PEP ! describes a Python design issue, or provides general guidelines or ! information to the Python community, but does not propose a new ! feature. Informational PEPs do not necessarily represent a Python ! community consensus or recommendation, so users and implementors ! are free to ignore Informational PEPs or follow their advice. PEP Work Flow ! The PEP editors assign PEP numbers and change their status. The ! current PEP editors are David Goodger and Barry Warsaw. Please ! send all PEP-related email to . ! The PEP process begins with a new idea for Python. It is highly ! recommended that a single PEP contain a single key proposal or new ! idea. The more focussed the PEP, the more successfully it tends ! to be. The PEP editor reserves the right to reject PEP proposals ! if they appear too unfocussed or too broad. If in doubt, split ! your PEP into several well-focussed ones. ! Each PEP must have a champion -- someone who writes the PEP using ! the style and format described below, shepherds the discussions in ! the appropriate forums, and attempts to build community consensus ! around the idea. The PEP champion (a.k.a. Author) should first ! attempt to ascertain whether the idea is PEP-able. Small ! enhancements or patches often don't need a PEP and can be injected ! into the Python development work flow with a patch submission to ! the SourceForge patch manager[2] or feature request tracker[3]. ! The PEP champion then emails the PEP editor with ! a proposed title and a rough, but fleshed out, draft of the PEP. ! This draft must be written in PEP style as described below. ! If the PEP editor approves, he will assign the PEP a number, label ! it as Standards Track or Informational, give it status "Draft", ! and create and check-in the initial draft of the PEP. The PEP ! editor will not unreasonably deny a PEP. Reasons for denying PEP ! status include duplication of effort, being technically unsound, ! not providing proper motivation or addressing backwards ! compatibility, or not in keeping with the Python philosophy. The ! BDFL (Benevolent Dictator for Life, Guido van Rossum) can be ! consulted during the approval phase, and is the final arbitrator ! of the draft's PEP-ability. ! If a pre-PEP is rejected, the author may elect to take the pre-PEP ! to the comp.lang.python newsgroup (a.k.a. python-list@python.org ! mailing list) to help flesh it out, gain feedback and consensus ! from the community at large, and improve the PEP for ! re-submission. ! The author of the PEP is then responsible for posting the PEP to ! the community forums, and marshaling community support for it. As ! updates are necessary, the PEP author can check in new versions if ! they have CVS commit permissions, or can email new PEP versions to ! the PEP editor for committing. ! Standards Track PEPs consists of two parts, a design document and ! a reference implementation. The PEP should be reviewed and ! accepted before a reference implementation is begun, unless a ! reference implementation will aid people in studying the PEP. ! Standards Track PEPs must include an implementation - in the form ! of code, patch, or URL to same - before it can be considered ! Final. ! PEP authors are responsible for collecting community feedback on a ! PEP before submitting it for review. A PEP that has not been ! discussed on python-list@python.org and/or python-dev@python.org ! will not be accepted. However, wherever possible, long open-ended ! discussions on public mailing lists should be avoided. Strategies ! to keep the discussions efficient include, setting up a separate ! SIG mailing list for the topic, having the PEP author accept ! private comments in the early design phases, etc. PEP authors ! should use their discretion here. ! Once the authors have completed a PEP, they must inform the PEP ! editor that it is ready for review. PEPs are reviewed by the BDFL ! and his chosen consultants, who may accept or reject a PEP or send ! it back to the author(s) for revision. For a PEP that is ! pre-determined to be acceptable (e.g., it is an obvious win as-is ! and/or its implementation has already been checked in) the BDFL ! may also initiate a PEP review, first notifying the PEP author(s) ! and giving them a chance to make revisions. ! For a PEP to be accepted it must meet certain minimum criteria. ! It must be a clear and complete description of the proposed ! enhancement. The enhancement must represent a net improvement. ! The proposed implementation, if applicable, must be solid and must ! not complicate the interpreter unduly. Finally, a proposed ! enhancement must be "pythonic" in order to be accepted by the ! BDFL. (However, "pythonic" is an imprecise term; it may be ! defined as whatever is acceptable to the BDFL. This logic is ! intentionally circular.) See PEP 2 [10] for standard library ! module acceptance criteria. ! Once a PEP has been accepted, the reference implementation must be ! completed. When the reference implementation is complete and ! accepted by the BDFL, the status will be changed to "Final". ! A PEP can also be assigned status "Deferred". The PEP author or ! editor can assign the PEP this status when no progress is being ! made on the PEP. Once a PEP is deferred, the PEP editor can ! re-assign it to draft status. ! A PEP can also be "Rejected". Perhaps after all is said and done ! it was not a good idea. It is still important to have a record of ! this fact. ! PEPs can also be replaced by a different PEP, rendering the ! original obsolete. This is intended for Informational PEPs, where ! version 2 of an API can replace version 1. ! PEP work flow is as follows: ! Draft -> Accepted -> Final -> Replaced ! ^ ! +----> Rejected ! v ! Deferred ! Some Informational PEPs may also have a status of "Active" if they ! are never meant to be completed. E.g. PEP 1. What belongs in a successful PEP? ! Each PEP should have the following parts: ! 1. Preamble -- RFC822 style headers containing meta-data about the ! PEP, including the PEP number, a short descriptive title ! (limited to a maximum of 44 characters), the names, and ! optionally the contact info for each author, etc. ! 2. Abstract -- a short (~200 word) description of the technical ! issue being addressed. ! 3. Copyright/public domain -- Each PEP must either be explicitly ! labelled as placed in the public domain (see this PEP as an ! example) or licensed under the Open Publication License[4]. ! 4. Specification -- The technical specification should describe ! the syntax and semantics of any new language feature. The ! specification should be detailed enough to allow competing, ! interoperable implementations for any of the current Python ! platforms (CPython, JPython, Python .NET). ! 5. Motivation -- The motivation is critical for PEPs that want to ! change the Python language. It should clearly explain why the ! existing language specification is inadequate to address the ! problem that the PEP solves. PEP submissions without ! sufficient motivation may be rejected outright. ! 6. Rationale -- The rationale fleshes out the specification by ! describing what motivated the design and why particular design ! decisions were made. It should describe alternate designs that ! were considered and related work, e.g. how the feature is ! supported in other languages. ! The rationale should provide evidence of consensus within the ! community and discuss important objections or concerns raised ! during discussion. ! 7. Backwards Compatibility -- All PEPs that introduce backwards ! incompatibilities must include a section describing these ! incompatibilities and their severity. The PEP must explain how ! the author proposes to deal with these incompatibilities. PEP ! submissions without a sufficient backwards compatibility ! treatise may be rejected outright. ! 8. Reference Implementation -- The reference implementation must ! be completed before any PEP is given status "Final", but it ! need not be completed before the PEP is accepted. It is better ! to finish the specification and rationale first and reach ! consensus on it before writing code. ! The final implementation must include test code and ! documentation appropriate for either the Python language ! reference or the standard library reference. PEP Formats and Templates ! There are two PEP formats available to authors: plaintext and ! reStructuredText. ! Plaintext PEPs are written in plain ASCII text, contain minimal ! structural markup, and should adhere to a rigid style. PEP 9 ! contains a boilerplate template[7] you can use to get started ! writing your plaintext PEP. ! ReStructuredText PEPs allow for rich markup that is still quite ! easy to read, but results in much better-looking and more ! functional HTML. PEP 12 contains a boilerplate template[8] for ! use with reStructuredText PEPs. ! There is a Python script that converts both styles of PEPs to HTML ! for viewing on the web[5]. Parsing and conversion of plaintext ! PEPs is self-contained within the script. reStructuredText PEPs ! are parsed and converted by Docutils[9] code called from the ! script. PEP Header Preamble ! Each PEP must begin with an RFC822 style header preamble. The ! headers must appear in the following order. Headers marked with ! "*" are optional and are described below. All other headers are ! required. ! PEP: ! Title: ! Version: ! Last-Modified: ! Author: ! * Discussions-To: ! Status: ! Type: ! * Content-Type: ! * Requires: ! Created: ! * Python-Version: ! Post-History: ! * Replaces: ! * Replaced-By: ! The Author header lists the names, and optionally the email ! addresses of all the authors/owners of the PEP. The format of the ! Author header value must be ! Random J. User ! if the email address is included, and just ! Random J. User ! if the address is not given. For historical reasons the format ! "address@dom.ain (Random J. User)" may appear in a PEP, however ! new PEPs must use the mandated format above, and it is acceptable ! to change to this format when PEPs are updated. ! If there are multiple authors, each should be on a separate line ! following RFC 2822 continuation line conventions. Note that ! personal email addresses in PEPs will be obscured as a defense ! against spam harvesters. ! While a PEP is in private discussions (usually during the initial ! Draft phase), a Discussions-To header will indicate the mailing ! list or URL where the PEP is being discussed. No Discussions-To ! header is necessary if the PEP is being discussed privately with ! the author, or on the python-list or python-dev email mailing ! lists. Note that email addresses in the Discussions-To header ! will not be obscured. ! The Type header specifies the type of PEP: Informational or ! Standards Track. ! The format of a PEP is specified with a Content-Type header. The ! acceptable values are "text/plain" for plaintext PEPs (see PEP 9 ! [7]) and "text/x-rst" for reStructuredText PEPs (see PEP 12 [8]). ! Plaintext ("text/plain") is the default if no Content-Type header ! is present. ! The Created header records the date that the PEP was assigned a ! number, while Post-History is used to record the dates of when new ! versions of the PEP are posted to python-list and/or python-dev. ! Both headers should be in dd-mmm-yyyy format, e.g. 14-Aug-2001. ! Standards Track PEPs must have a Python-Version header which ! indicates the version of Python that the feature will be released ! with. Informational PEPs do not need a Python-Version header. ! PEPs may have a Requires header, indicating the PEP numbers ! that this PEP depends on. ! PEPs may also have a Replaced-By header indicating that a PEP has ! been rendered obsolete by a later document; the value is the ! number of the PEP that replaces the current document. The newer ! PEP must have a Replaces header containing the number of the PEP ! that it rendered obsolete. Reporting PEP Bugs, or Submitting PEP Updates ! How you report a bug, or submit a PEP update depends on several ! factors, such as the maturity of the PEP, the preferences of the ! PEP author, and the nature of your comments. For the early draft ! stages of the PEP, it's probably best to send your comments and ! changes directly to the PEP author. For more mature, or finished ! PEPs you may want to submit corrections to the SourceForge bug ! manager[6] or better yet, the SourceForge patch manager[2] so that ! your changes don't get lost. If the PEP author is a SF developer, ! assign the bug/patch to him, otherwise assign it to the PEP ! editor. ! When in doubt about where to send your changes, please check first ! with the PEP author and/or PEP editor. ! PEP authors who are also SF committers, can update the PEPs ! themselves by using "cvs commit" to commit their changes. ! Remember to also push the formatted PEP text out to the web by ! doing the following: % python pep2html.py -i NUM ! where NUM is the number of the PEP you want to push out. See % python pep2html.py --help ! for details. Transferring PEP Ownership ! It occasionally becomes necessary to transfer ownership of PEPs to ! a new champion. In general, we'd like to retain the original ! author as a co-author of the transferred PEP, but that's really up ! to the original author. A good reason to transfer ownership is ! because the original author no longer has the time or interest in ! updating it or following through with the PEP process, or has ! fallen off the face of the 'net (i.e. is unreachable or not ! responding to email). A bad reason to transfer ownership is ! because you don't agree with the direction of the PEP. We try to ! build consensus around a PEP, but if that's not possible, you can ! always submit a competing PEP. ! If you are interested in assuming ownership of a PEP, send a ! message asking to take over, addressed to both the original author ! and the PEP editor . If the original author ! doesn't respond to email in a timely manner, the PEP editor will ! make a unilateral decision (it's not like such decisions can't be ! reversed :). References and Footnotes ! [1] This historical record is available by the normal CVS commands ! for retrieving older revisions. For those without direct access ! to the CVS tree, you can browse the current and past PEP revisions ! via the SourceForge web site at ! ! http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/python/nondist/peps/?cvsroot=python ! [2] http://sourceforge.net/tracker/?group_id=5470&atid=305470 ! [3] http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse ! [4] http://www.opencontent.org/openpub/ ! [5] The script referred to here is pep2html.py, which lives in ! the same directory in the CVS tree as the PEPs themselves. ! Try "pep2html.py --help" for details. ! The URL for viewing PEPs on the web is ! http://www.python.org/peps/ ! [6] http://sourceforge.net/tracker/?group_id=5470&atid=305470 ! [7] PEP 9, Sample Plaintext PEP Template, Warsaw ! http://www.python.org/peps/pep-0009.html ! [8] PEP 12, Sample reStructuredText PEP Template, Goodger, Warsaw ! http://www.python.org/peps/pep-0012.html ! [9] http://docutils.sourceforge.net/ ! [10] PEP 2, Procedure for Adding New Modules, Faassen ! http://www.python.org/peps/pep-0002.html Copyright ! This document has been placed in the public domain. ! ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: --- 6,416 ---- Status: Active Type: Informational ! Content-Type: text/x-rst Created: 13-Jun-2000 ! Post-History: 21-Mar-2001, 29-Jul-2002, 03-May-2003 What is a PEP? + ============== ! PEP stands for Python Enhancement Proposal. A PEP is a design ! document providing information to the Python community, or describing ! a new feature for Python. The PEP should provide a concise technical ! specification of the feature and a rationale for the feature. ! We intend PEPs to be the primary mechanisms for proposing new ! features, for collecting community input on an issue, and for ! documenting the design decisions that have gone into Python. The PEP ! author is responsible for building consensus within the community and ! documenting dissenting opinions. ! Because the PEPs are maintained as text files under CVS control, their ! revision history is the historical record of the feature proposal ! [1]_. Kinds of PEPs + ============= ! There are two kinds of PEPs. A Standards Track PEP describes a new ! feature or implementation for Python. An Informational PEP describes ! a Python design issue, or provides general guidelines or information ! to the Python community, but does not propose a new feature. ! Informational PEPs do not necessarily represent a Python community ! consensus or recommendation, so users and implementors are free to ! ignore Informational PEPs or follow their advice. PEP Work Flow + ============= ! The PEP editors assign PEP numbers and change their status. The ! current PEP editors are David Goodger and Barry Warsaw. Please send ! all PEP-related email to . ! The PEP process begins with a new idea for Python. It is highly ! recommended that a single PEP contain a single key proposal or new ! idea. The more focussed the PEP, the more successfully it tends to ! be. The PEP editor reserves the right to reject PEP proposals if they ! appear too unfocussed or too broad. If in doubt, split your PEP into ! several well-focussed ones. ! Each PEP must have a champion -- someone who writes the PEP using the ! style and format described below, shepherds the discussions in the ! appropriate forums, and attempts to build community consensus around ! the idea. The PEP champion (a.k.a. Author) should first attempt to ! ascertain whether the idea is PEP-able. Small enhancements or patches ! often don't need a PEP and can be injected into the Python development ! work flow with a patch submission to the SourceForge `patch manager`_ ! or `feature request tracker`_. ! The PEP champion then emails the PEP editor with a ! proposed title and a rough, but fleshed out, draft of the PEP. This ! draft must be written in PEP style as described below. ! If the PEP editor approves, he will assign the PEP a number, label it ! as Standards Track or Informational, give it status "Draft", and ! create and check-in the initial draft of the PEP. The PEP editor will ! not unreasonably deny a PEP. Reasons for denying PEP status include ! duplication of effort, being technically unsound, not providing proper ! motivation or addressing backwards compatibility, or not in keeping ! with the Python philosophy. The BDFL (Benevolent Dictator for Life, ! Guido van Rossum) can be consulted during the approval phase, and is ! the final arbitrator of the draft's PEP-ability. ! If a pre-PEP is rejected, the author may elect to take the pre-PEP to ! the comp.lang.python newsgroup (a.k.a. python-list@python.org mailing ! list) to help flesh it out, gain feedback and consensus from the ! community at large, and improve the PEP for re-submission. ! The author of the PEP is then responsible for posting the PEP to the ! community forums, and marshaling community support for it. As updates ! are necessary, the PEP author can check in new versions if they have ! CVS commit permissions, or can email new PEP versions to the PEP ! editor for committing. ! Standards Track PEPs consists of two parts, a design document and a ! reference implementation. The PEP should be reviewed and accepted ! before a reference implementation is begun, unless a reference ! implementation will aid people in studying the PEP. Standards Track ! PEPs must include an implementation -- in the form of code, patch, or ! URL to same -- before it can be considered Final. ! PEP authors are responsible for collecting community feedback on a PEP ! before submitting it for review. A PEP that has not been discussed on ! python-list@python.org and/or python-dev@python.org will not be ! accepted. However, wherever possible, long open-ended discussions on ! public mailing lists should be avoided. Strategies to keep the ! discussions efficient include, setting up a separate SIG mailing list ! for the topic, having the PEP author accept private comments in the ! early design phases, etc. PEP authors should use their discretion ! here. ! Once the authors have completed a PEP, they must inform the PEP editor ! that it is ready for review. PEPs are reviewed by the BDFL and his ! chosen consultants, who may accept or reject a PEP or send it back to ! the author(s) for revision. For a PEP that is pre-determined to be ! acceptable (e.g., it is an obvious win as-is and/or its implementation ! has already been checked in) the BDFL may also initiate a PEP review, ! first notifying the PEP author(s) and giving them a chance to make ! revisions. ! For a PEP to be accepted it must meet certain minimum criteria. It ! must be a clear and complete description of the proposed enhancement. ! The enhancement must represent a net improvement. The proposed ! implementation, if applicable, must be solid and must not complicate ! the interpreter unduly. Finally, a proposed enhancement must be ! "pythonic" in order to be accepted by the BDFL. (However, "pythonic" ! is an imprecise term; it may be defined as whatever is acceptable to ! the BDFL. This logic is intentionally circular.) See PEP 2 [2]_ for ! standard library module acceptance criteria. ! Once a PEP has been accepted, the reference implementation must be ! completed. When the reference implementation is complete and accepted ! by the BDFL, the status will be changed to "Final". ! A PEP can also be assigned status "Deferred". The PEP author or ! editor can assign the PEP this status when no progress is being made ! on the PEP. Once a PEP is deferred, the PEP editor can re-assign it ! to draft status. ! A PEP can also be "Rejected". Perhaps after all is said and done it ! was not a good idea. It is still important to have a record of this ! fact. ! PEPs can also be replaced by a different PEP, rendering the original ! obsolete. This is intended for Informational PEPs, where version 2 of ! an API can replace version 1. ! PEP work flow is as follows:: ! Draft -> Accepted -> Final -> Replaced ! ^ ! +----> Rejected ! v ! Deferred ! Some Informational PEPs may also have a status of "Active" if they are ! never meant to be completed. E.g. PEP 1 (this PEP). What belongs in a successful PEP? + ================================= ! Each PEP should have the following parts: ! 1. Preamble -- RFC 822 style headers containing meta-data about the ! PEP, including the PEP number, a short descriptive title (limited ! to a maximum of 44 characters), the names, and optionally the ! contact info for each author, etc. ! 2. Abstract -- a short (~200 word) description of the technical issue ! being addressed. ! 3. Copyright/public domain -- Each PEP must either be explicitly ! labelled as placed in the public domain (see this PEP as an ! example) or licensed under the `Open Publication License`_. ! 4. Specification -- The technical specification should describe the ! syntax and semantics of any new language feature. The ! specification should be detailed enough to allow competing, ! interoperable implementations for any of the current Python ! platforms (CPython, Jython, Python .NET). ! 5. Motivation -- The motivation is critical for PEPs that want to ! change the Python language. It should clearly explain why the ! existing language specification is inadequate to address the ! problem that the PEP solves. PEP submissions without sufficient ! motivation may be rejected outright. ! 6. Rationale -- The rationale fleshes out the specification by ! describing what motivated the design and why particular design ! decisions were made. It should describe alternate designs that ! were considered and related work, e.g. how the feature is supported ! in other languages. ! The rationale should provide evidence of consensus within the ! community and discuss important objections or concerns raised ! during discussion. ! 7. Backwards Compatibility -- All PEPs that introduce backwards ! incompatibilities must include a section describing these ! incompatibilities and their severity. The PEP must explain how the ! author proposes to deal with these incompatibilities. PEP ! submissions without a sufficient backwards compatibility treatise ! may be rejected outright. ! 8. Reference Implementation -- The reference implementation must be ! completed before any PEP is given status "Final", but it need not ! be completed before the PEP is accepted. It is better to finish ! the specification and rationale first and reach consensus on it ! before writing code. ! The final implementation must include test code and documentation ! appropriate for either the Python language reference or the ! standard library reference. PEP Formats and Templates + ========================= ! There are two PEP formats available to authors: plaintext and ! reStructuredText_. ! Plaintext PEPs are written in plain ASCII text, contain minimal ! structural markup, and should adhere to a rigid style. PEP 9 contains ! a boilerplate template [3]_ you can use to get started writing your ! plaintext PEP. ! ReStructuredText_ PEPs allow for rich markup that is still quite easy ! to read, but results in much better-looking and more functional HTML. ! PEP 12 contains a boilerplate template [4]_ for use with ! reStructuredText PEPs. ! There is a Python script that converts both styles of PEPs to HTML for ! viewing on the web [5]_. Parsing and conversion of plaintext PEPs is ! self-contained within the script. reStructuredText PEPs are parsed ! and converted by Docutils_ code called from the script. PEP Header Preamble + =================== ! Each PEP must begin with an RFC 822 style header preamble. The headers ! must appear in the following order. Headers marked with "*" are ! optional and are described below. All other headers are required. :: ! PEP: ! Title: ! Version: ! Last-Modified: ! Author: ! * Discussions-To: ! Status: ! Type: ! * Content-Type: ! * Requires: ! Created: ! * Python-Version: ! Post-History: ! * Replaces: ! * Replaced-By: ! The Author header lists the names, and optionally the email addresses ! of all the authors/owners of the PEP. The format of the Author header ! value must be ! Random J. User ! if the email address is included, and just ! Random J. User ! if the address is not given. For historical reasons the format ! "address@dom.ain (Random J. User)" may appear in a PEP, however new ! PEPs must use the mandated format above, and it is acceptable to ! change to this format when PEPs are updated. ! If there are multiple authors, each should be on a separate line ! following RFC 2822 continuation line conventions. Note that personal ! email addresses in PEPs will be obscured as a defense against spam ! harvesters. ! While a PEP is in private discussions (usually during the initial ! Draft phase), a Discussions-To header will indicate the mailing list ! or URL where the PEP is being discussed. No Discussions-To header is ! necessary if the PEP is being discussed privately with the author, or ! on the python-list or python-dev email mailing lists. Note that email ! addresses in the Discussions-To header will not be obscured. ! The Type header specifies the type of PEP: Informational or Standards ! Track. ! The format of a PEP is specified with a Content-Type header. The ! acceptable values are "text/plain" for plaintext PEPs (see PEP 9 [3]_) ! and "text/x-rst" for reStructuredText PEPs (see PEP 12 [4]_). ! Plaintext ("text/plain") is the default if no Content-Type header is ! present. ! The Created header records the date that the PEP was assigned a ! number, while Post-History is used to record the dates of when new ! versions of the PEP are posted to python-list and/or python-dev. Both ! headers should be in dd-mmm-yyyy format, e.g. 14-Aug-2001. ! Standards Track PEPs must have a Python-Version header which indicates ! the version of Python that the feature will be released with. ! Informational PEPs do not need a Python-Version header. ! PEPs may have a Requires header, indicating the PEP numbers that this ! PEP depends on. ! PEPs may also have a Replaced-By header indicating that a PEP has been ! rendered obsolete by a later document; the value is the number of the ! PEP that replaces the current document. The newer PEP must have a ! Replaces header containing the number of the PEP that it rendered ! obsolete. Reporting PEP Bugs, or Submitting PEP Updates + ============================================= ! How you report a bug, or submit a PEP update depends on several ! factors, such as the maturity of the PEP, the preferences of the PEP ! author, and the nature of your comments. For the early draft stages ! of the PEP, it's probably best to send your comments and changes ! directly to the PEP author. For more mature, or finished PEPs you may ! want to submit corrections to the SourceForge `bug manager`_ or better ! yet, the SourceForge `patch manager`_ so that your changes don't get ! lost. If the PEP author is a SF developer, assign the bug/patch to ! him, otherwise assign it to the PEP editor. ! When in doubt about where to send your changes, please check first ! with the PEP author and/or PEP editor. ! PEP authors who are also SF committers, can update the PEPs themselves ! by using "cvs commit" to commit their changes. Remember to also push ! the formatted PEP text out to the web by doing the following:: % python pep2html.py -i NUM ! where NUM is the number of the PEP you want to push out. See :: % python pep2html.py --help ! for details. Transferring PEP Ownership + ========================== ! It occasionally becomes necessary to transfer ownership of PEPs to a ! new champion. In general, we'd like to retain the original author as ! a co-author of the transferred PEP, but that's really up to the ! original author. A good reason to transfer ownership is because the ! original author no longer has the time or interest in updating it or ! following through with the PEP process, or has fallen off the face of ! the 'net (i.e. is unreachable or not responding to email). A bad ! reason to transfer ownership is because you don't agree with the ! direction of the PEP. We try to build consensus around a PEP, but if ! that's not possible, you can always submit a competing PEP. ! If you are interested in assuming ownership of a PEP, send a message ! asking to take over, addressed to both the original author and the PEP ! editor . If the original author doesn't respond to ! email in a timely manner, the PEP editor will make a unilateral ! decision (it's not like such decisions can't be reversed :). References and Footnotes + ======================== ! .. [1] This historical record is available by the normal CVS commands ! for retrieving older revisions. For those without direct access to ! the CVS tree, you can browse the current and past PEP revisions via ! the SourceForge web site at ! http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/python/python/nondist/peps/ ! .. [2] PEP 2, Procedure for Adding New Modules, Faassen ! (http://www.python.org/peps/pep-0002.html) ! .. [3] PEP 9, Sample Plaintext PEP Template, Warsaw ! (http://www.python.org/peps/pep-0009.html) ! .. [4] PEP 12, Sample reStructuredText PEP Template, Goodger, Warsaw ! (http://www.python.org/peps/pep-0012.html) ! .. [5] The script referred to here is pep2html.py, which lives in the ! same directory in the CVS tree as the PEPs themselves. Try ! ``pep2html.py --help`` for details. The URL for viewing PEPs on ! the web is http://www.python.org/peps/. ! .. _patch manager: ! http://sourceforge.net/tracker/?group_id=5470&atid=305470 ! .. _feature request tracker: ! http://sourceforge.net/tracker/?atid=355470&group_id=5470&func=browse ! .. _Open Publication License: http://www.opencontent.org/openpub/ ! .. _reStructuredText: http://docutils.sourceforge.net/rst.html ! .. _Docutils: http://docutils.sourceforge.net/ ! .. _bug manager: ! http://sourceforge.net/tracker/?group_id=5470&atid=105470 Copyright + ========= ! This document has been placed in the public domain. ! .. ! Local Variables: ! mode: indented-text ! indent-tabs-mode: nil ! sentence-end-double-space: t ! fill-column: 70 ! End: From gward@users.sourceforge.net Sat May 3 20:16:39 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 03 May 2003 12:16:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15157 Modified Files: liboptparse.tex Log Message: Fix various markup errors: use \longprogramopt{} more, and use it correctly. (Closes SF #731689.) Use \emph{} in a few places. Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** liboptparse.tex 18 Apr 2003 15:50:13 -0000 1.2 --- liboptparse.tex 3 May 2003 19:16:36 -0000 1.3 *************** *** 110,114 **** \begin{itemize} \item a hyphen followed by a few letters, e.g. \programopt{-pf} (this is ! *not* the same as multiple options merged into a single argument.) \item a hyphen followed by a whole word, e.g. \programopt{-file} (this is --- 110,114 ---- \begin{itemize} \item a hyphen followed by a few letters, e.g. \programopt{-pf} (this is ! \emph{not} the same as multiple options merged into a single argument.) \item a hyphen followed by a whole word, e.g. \programopt{-file} (this is *************** *** 450,454 **** If \module{optparse} encounters either \programopt{-h} or ! \longprogramopt{--help} on the command-line, or if you just call \method{parser.print_help()}, it prints the following to stdout: --- 450,454 ---- If \module{optparse} encounters either \programopt{-h} or ! \longprogramopt{help} on the command-line, or if you just call \method{parser.print_help()}, it prints the following to stdout: *************** *** 562,566 **** Note that ``\%prog'' is expanded just like it is in \var{usage}. Apart from that, \var{version} can contain anything you like. When you supply it, ! \module{optparse} automatically adds a\ longprogramopt{version} option to your parser. If it encounters this option on the command line, it expands your \var{version} string (by replacing ``\%prog''), prints it to --- 562,566 ---- Note that ``\%prog'' is expanded just like it is in \var{usage}. Apart from that, \var{version} can contain anything you like. When you supply it, ! \module{optparse} automatically adds a \longprogramopt{version} option to your parser. If it encounters this option on the command line, it expands your \var{version} string (by replacing ``\%prog''), prints it to *************** *** 787,791 **** Clearly, the \var{type} and \var{dest} arguments are (usually) almost as important as \var{action}. \var{action} is the only attribute that ! is meaningful for *all* options, though, so it is the most important. \subsubsection{Option actions\label{optparse-option-actions}} --- 787,792 ---- Clearly, the \var{type} and \var{dest} arguments are (usually) almost as important as \var{action}. \var{action} is the only attribute that ! is meaningful for \emph{all} options, though, so it is the most ! important. \subsubsection{Option actions\label{optparse-option-actions}} *************** *** 813,819 **** If \var{dest} is not supplied, \module{optparse} derives a destination from the first long option strings (e.g., ! \longprogramopt{foo-bar} -> \var{foo_bar}). If there are no long option strings, \module{optparse} derives a destination from the first ! short option string (e.g., \programopt{-f} -> \var{f}). Example: --- 814,820 ---- If \var{dest} is not supplied, \module{optparse} derives a destination from the first long option strings (e.g., ! \longprogramopt{foo-bar} becomes \var{foo_bar}). If there are no long option strings, \module{optparse} derives a destination from the first ! short option string (e.g., \programopt{-f} becomes \var{f}). Example: *************** *** 903,907 **** \end{verbatim} ! If, a little later on, \samp{--tracks=4} is seen, it does: \begin{verbatim} --- 904,908 ---- \end{verbatim} ! If, a little later on, \longprogramopt{tracks=4} is seen, it does: \begin{verbatim} *************** *** 911,915 **** See ``Error handling'' (section~\ref{optparse-error-handling}) for information on how \module{optparse} deals with something like ! \samp{--tracks=x}. \term{count} [required: \var{dest}] --- 912,916 ---- See ``Error handling'' (section~\ref{optparse-error-handling}) for information on how \module{optparse} deals with something like ! \longprogramopt{tracks=x}. \term{count} [required: \var{dest}] *************** *** 983,989 **** \end{verbatim} ! If \module{optparse} sees either \longprogramopt{-h} or \longprogramopt{help} on ! the command line, it will print something like the following help ! message to stdout: \begin{verbatim} --- 984,990 ---- \end{verbatim} ! If \module{optparse} sees either \programopt{-h} or ! \longprogramopt{help} on the command line, it will print something ! like the following help message to stdout: \begin{verbatim} From gward@users.sourceforge.net Sat May 3 20:41:47 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 03 May 2003 12:41:47 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27231 Modified Files: liboptparse.tex Log Message: Use TeX quotes -- ``foo'' -- as appropriate. Remove whitespace around em-dashes. Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** liboptparse.tex 3 May 2003 19:16:36 -0000 1.3 --- liboptparse.tex 3 May 2003 19:41:45 -0000 1.4 *************** *** 34,38 **** With these few lines of code, users of your script can now do the ! "usual thing" on the command-line: \begin{verbatim} --- 34,38 ---- With these few lines of code, users of your script can now do the ! ``usual thing'' on the command-line: \begin{verbatim} *************** *** 189,193 **** toolsets. Can it run without any options at all and still make sense? The only exceptions I can think of are \program{find}, \program{tar}, ! and \program{dd} --- all of which are mutant oddballs that have been rightly criticized for their non-standard syntax and confusing interfaces.) --- 189,193 ---- toolsets. Can it run without any options at all and still make sense? The only exceptions I can think of are \program{find}, \program{tar}, ! and \program{dd}---all of which are mutant oddballs that have been rightly criticized for their non-standard syntax and confusing interfaces.) *************** *** 229,233 **** possible. If your program requires 17 distinct pieces of information in order to run successfully, it doesn't much matter \emph{how} you get that ! information from the user --- most people will give up and walk away before they successfully run the program. This applies whether the user interface is a command-line, a configuration file, a GUI, or whatever: --- 229,233 ---- possible. If your program requires 17 distinct pieces of information in order to run successfully, it doesn't much matter \emph{how} you get that ! information from the user---most people will give up and walk away before they successfully run the program. This applies whether the user interface is a command-line, a configuration file, a GUI, or whatever: *************** *** 236,244 **** In short, try to minimize the amount of information that users are ! absolutely required to supply --- use sensible defaults whenever possible. Of course, you also want to make your programs reasonably flexible. That's what options are for. Again, it doesn't matter if they are entries in a config file, checkboxes in the ``Preferences'' ! dialog of a GUI, or command-line options --- the more options you implement, the more flexible your program is, and the more complicated its implementation becomes. It's quite easy to overwhelm users (and --- 236,244 ---- In short, try to minimize the amount of information that users are ! absolutely required to supply---use sensible defaults whenever possible. Of course, you also want to make your programs reasonably flexible. That's what options are for. Again, it doesn't matter if they are entries in a config file, checkboxes in the ``Preferences'' ! dialog of a GUI, or command-line options---the more options you implement, the more flexible your program is, and the more complicated its implementation becomes. It's quite easy to overwhelm users (and *************** *** 282,286 **** \var{help}. ! \subsubsection{The "store" action\label{optparse-store-action}} The action tells \module{optparse} what to do when it sees one of the --- 282,286 ---- \var{help}. ! \subsubsection{The \var{store} action\label{optparse-store-action}} The action tells \module{optparse} what to do when it sees one of the *************** *** 290,294 **** store it to your chosen destination. ! For example, let's fill in the "..." of that last option: \begin{verbatim} --- 290,294 ---- store it to your chosen destination. ! For example, let's fill in the ``...'' of that last option: \begin{verbatim} *************** *** 309,313 **** When \module{optparse} sees the \programopt{-f}, it sucks in the next ! argument --- ``foo.txt'' --- and stores it in the \var{filename} attribute of a special object. That object is the first return value from \function{parse_args()}, so: --- 309,313 ---- When \module{optparse} sees the \programopt{-f}, it sucks in the next ! argument---\code{foo.txt}---and stores it in the \var{filename} attribute of a special object. That object is the first return value from \function{parse_args()}, so: *************** *** 317,324 **** \end{verbatim} ! will print ``foo.txt''. ! Other option types supported by \module{optparse} are ``int'' and ! ``float''. Here's an option that expects an integer argument: \begin{verbatim} --- 317,324 ---- \end{verbatim} ! will print \code{foo.txt}. ! Other option types supported by \module{optparse} are \code{int} and ! \code{float}. Here's an option that expects an integer argument: \begin{verbatim} *************** *** 327,334 **** Note that I didn't supply a long option, which is perfectly acceptable. ! I also didn't specify the action --- it defaults to ``store''. Let's parse another fake command-line. This time, we'll jam the ! option argument right up against the option --- \programopt{-n42} (one argument) is equivalent to \programopt{-n 42} (two arguments). : --- 327,334 ---- Note that I didn't supply a long option, which is perfectly acceptable. ! I also didn't specify the action---it defaults to ``store''. Let's parse another fake command-line. This time, we'll jam the ! option argument right up against the option---\programopt{-n42} (one argument) is equivalent to \programopt{-n 42} (two arguments). : *************** *** 360,367 **** section~\ref{optparse-adding-types}, ``Adding new types.'' ! \subsubsection{Other "store_*" actions\label{optparse-other-store-actions}} ! Flag options --- set a variable to true or false when a particular ! option is seen --- are quite common. \module{optparse} supports them with two separate actions, ``store_true'' and ``store_false''. For example, you might have a \var{verbose} flag that is turned on with --- 360,367 ---- section~\ref{optparse-adding-types}, ``Adding new types.'' ! \subsubsection{Other \var{store_*} actions\label{optparse-other-store-actions}} ! Flag options---set a variable to true or false when a particular ! option is seen---are quite common. \module{optparse} supports them with two separate actions, ``store_true'' and ``store_false''. For example, you might have a \var{verbose} flag that is turned on with *************** *** 375,379 **** Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting ! default values --- see below.) When \module{optparse} sees \programopt{-v} on the command line, it --- 375,379 ---- Here we have two different options with the same destination, which is perfectly OK. (It just means you have to be a bit careful when setting ! default values---see below.) When \module{optparse} sees \programopt{-v} on the command line, it *************** *** 475,488 **** \end{verbatim} ! \module{optparse} expands "\%prog" in the usage string to the name of the current script, ie. \code{os.path.basename(sys.argv[0])}. The expanded string is then printed before the detailed option help. If you don't supply a usage string, \module{optparse} uses a bland but ! sensible default: ``usage: \%prog [options]'', which is fine if your script doesn't take any positional arguments. \item every option defines a help string, and doesn't worry about ! line-wrapping --- \module{optparse} takes care of wrapping lines and making the help output look good. --- 475,488 ---- \end{verbatim} ! \module{optparse} expands \samp{\%prog} in the usage string to the name of the current script, ie. \code{os.path.basename(sys.argv[0])}. The expanded string is then printed before the detailed option help. If you don't supply a usage string, \module{optparse} uses a bland but ! sensible default: \code{"usage: \%prog [options]"}, which is fine if your script doesn't take any positional arguments. \item every option defines a help string, and doesn't worry about ! line-wrapping---\module{optparse} takes care of wrapping lines and making the help output look good. *************** *** 498,502 **** \programopt{-m}/\longprogramopt{mode}. By default, \module{optparse} converts the destination variable name to uppercase and uses that for ! the meta-variable. Sometimes, that's not what you want --- for example, the \var{filename} option explicitly sets \code{metavar="FILE"}, resulting in this automatically-generated --- 498,502 ---- \programopt{-m}/\longprogramopt{mode}. By default, \module{optparse} converts the destination variable name to uppercase and uses that for ! the meta-variable. Sometimes, that's not what you want---for example, the \var{filename} option explicitly sets \code{metavar="FILE"}, resulting in this automatically-generated *************** *** 579,583 **** The one thing you need to know for basic usage is how \module{optparse} behaves when it encounters an error on the ! command-line --- e.g. \programopt{-n4x} where \programopt{-n} is an integer-valued option. \module{optparse} prints your usage message to stderr, followed by a useful and human-readable error message. Then --- 579,583 ---- The one thing you need to know for basic usage is how \module{optparse} behaves when it encounters an error on the ! command-line---e.g. \programopt{-n4x} where \programopt{-n} is an integer-valued option. \module{optparse} prints your usage message to stderr, followed by a useful and human-readable error message. Then *************** *** 674,678 **** This method makes it easier to track down exceptions raised by the \class{Option} constructor, which are common because of the complicated ! interdependencies among the various keyword arguments --- if you get it wrong, \module{optparse} raises \exception{OptionError}. --- 674,678 ---- This method makes it easier to track down exceptions raised by the \class{Option} constructor, which are common because of the complicated ! interdependencies among the various keyword arguments---if you get it wrong, \module{optparse} raises \exception{OptionError}. *************** *** 1085,1089 **** raises an exception (\exception{OptionConflictError}) by default when this happens. Since this is an easily-fixed programming error, you ! shouldn't try to catch this exception --- fix your mistake and get on with life. --- 1085,1089 ---- raises an exception (\exception{OptionConflictError}) by default when this happens. Since this is an easily-fixed programming error, you ! shouldn't try to catch this exception---fix your mistake and get on with life. *************** *** 1186,1190 **** \end{verbatim} ! Note that you supply a function object here --- so you must have already defined a function \function{my_callback()} when you define the callback option. In this simple case, \module{optparse} knows --- 1186,1190 ---- \end{verbatim} ! Note that you supply a function object here---so you must have already defined a function \function{my_callback()} when you define the callback option. In this simple case, \module{optparse} knows *************** *** 1238,1242 **** is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, \var{opt} will be ! the full, canonical option string --- e.g. if the user puts \longprogramopt{foo} on the command-line as an abbreviation for \longprogramopt{foobar}, then \var{opt} will be --- 1238,1242 ---- is the option string seen on the command-line that's triggering the callback. (If an abbreviated long option was used, \var{opt} will be ! the full, canonical option string---e.g. if the user puts \longprogramopt{foo} on the command-line as an abbreviation for \longprogramopt{foobar}, then \var{opt} will be *************** *** 1349,1353 **** \end{verbatim} ! Of course, you could put any condition in there --- you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all --- 1349,1353 ---- \end{verbatim} ! Of course, you could put any condition in there---you're not limited to checking the values of already-defined options. For example, if you have options that should not be called when the moon is full, all *************** *** 1364,1368 **** \end{verbatim} ! (The definition of is_full_moon() is left as an exercise for the reader.) --- 1364,1368 ---- \end{verbatim} ! (The definition of \code{is_full_moon()} is left as an exercise for the reader.) *************** *** 1568,1585 **** \begin{definitions} ! \term{"store" actions} actions that result in \module{optparse} storing a value to an attribute ! of the OptionValues instance; these options require a 'dest' attribute to be supplied to the Option constructor ! \term{"typed" actions} actions that take a value from the command line and expect it to be of a certain type; or rather, a string that can be converted to a ! certain type. These options require a 'type' attribute to the Option constructor. \end{definitions} ! Some default ``store'' actions are ``store'', ``store_const'', ! ``append'', and ``count''. The default ``typed'' actions are ! ``store'', ``append'', and ``callback''. When you add an action, you need to decide if it's a ``store'' action, --- 1568,1585 ---- \begin{definitions} ! \term{``store'' actions} actions that result in \module{optparse} storing a value to an attribute ! of the OptionValues instance; these options require a \var{dest} attribute to be supplied to the Option constructor ! \term{``typed'' actions} actions that take a value from the command line and expect it to be of a certain type; or rather, a string that can be converted to a ! certain type. These options require a \var{type} attribute to the Option constructor. \end{definitions} ! Some default ``store'' actions are \var{store}, \var{store_const}, ! \var{append}, and \var{count}. The default ``typed'' actions are ! \var{store}, \var{append}, and \var{callback}. When you add an action, you need to decide if it's a ``store'' action, *************** *** 1591,1598 **** \end{memberdesc} \begin{memberdesc}{STORE_ACTIONS} ! "store" actions are additionally listed here. \end{memberdesc} \begin{memberdesc}{TYPED_ACTIONS} ! "typed" actions are additionally listed here. \end{memberdesc} --- 1591,1598 ---- \end{memberdesc} \begin{memberdesc}{STORE_ACTIONS} ! ``store'' actions are additionally listed here. \end{memberdesc} \begin{memberdesc}{TYPED_ACTIONS} ! ``typed'' actions are additionally listed here. \end{memberdesc} *************** *** 1689,1694 **** \begin{enumerate} \item subclass OptionParser and override the error() method ! \item subclass Option and override the take_action() method --- you'll ! need to provide your own handling of the "help" action that doesn't call sys.exit() \end{enumerate} --- 1689,1694 ---- \begin{enumerate} \item subclass OptionParser and override the error() method ! \item subclass Option and override the take_action() method---you'll ! need to provide your own handling of the ``help'' action that doesn't call sys.exit() \end{enumerate} From gward@users.sourceforge.net Sat May 3 20:45:49 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 03 May 2003 12:45:49 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28624 Modified Files: libossaudiodev.tex Log Message: Add a big comment about cross-platform issues (especially OpenBSD). This should be turned into a footnote by someone who actually understands OSS and its relationship to Linux, FreeBSD, OpenBSD, NetBSD, etc. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** libossaudiodev.tex 10 Mar 2003 03:18:19 -0000 1.6 --- libossaudiodev.tex 3 May 2003 19:45:47 -0000 1.7 *************** *** 3,20 **** \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD} \modulesynopsis{Access to OSS-compatible audio devices.} - % XXX OSS is standard for Linux and FreeBSD -- what about NetBSD? - % OpenBSD? others? This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and ! commercial Unices, and is the standard audio interface for Linux (up to ! kernel 2.4) and FreeBSD. \begin{seealso} \seetitle[http://www.opensound.com/pguide/oss.pdf] ! {Open Sound System Programmer's Guide} ! {the official documentation for the OSS C API} \seetext{The module defines a large number of constants supplied by the OSS device driver; see \file{} on either --- 3,46 ---- \declaremodule{builtin}{ossaudiodev} ! \platform{Linux, FreeBSD, possibly other \UNIX-like systems} \modulesynopsis{Access to OSS-compatible audio devices.} This module allows you to access the OSS (Open Sound System) audio interface. OSS is available for a wide range of open-source and ! commercial Unices, and is the standard audio interface for Linux and ! recent versions of FreeBSD. ! ! % Things will get more complicated for future Linux versions, since ! % ALSA is in the standard kernel as of 2.5.x. Presumably if you ! % use ALSA, you'll have to make sure its OSS compatibility layer ! % is active to use ossaudiodev, but you're gonna need it for the vast ! % majority of Linux audio apps anyways. ! % ! % Sounds like things are also complicated for other BSDs. In response ! % to my python-dev query, Thomas Wouters said: ! % ! % > Likewise, googling shows OpenBSD also uses OSS/Free -- the commercial ! % > OSS installation manual tells you to remove references to OSS/Free from the ! % > kernel :) ! % ! % but Aleksander Piotrowsk actually has an OpenBSD box, and he quotes ! % from its : ! % > * WARNING! WARNING! ! % > * This is an OSS (Linux) audio emulator. ! % > * Use the Native NetBSD API for developing new code, and this ! % > * only for compiling Linux programs. ! % ! % There's also an ossaudio manpage on OpenBSD that explains things ! % further. Presumably NetBSD and OpenBSD have a different standard ! % audio interface. That's the great thing about standards, there are so ! % many to choose from ... ;-) ! % ! % This probably all warrants a footnote or two, but I don't understand ! % things well enough right now to write it! --GPW \begin{seealso} \seetitle[http://www.opensound.com/pguide/oss.pdf] ! {Open Sound System Programmer's Guide} {the official ! documentation for the OSS C API} \seetext{The module defines a large number of constants supplied by the OSS device driver; see \file{} on either From gward@users.sourceforge.net Sat May 3 21:13:11 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 03 May 2003 13:13:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9372 Modified Files: liboptparse.tex Log Message: Use True/False instead of 1/0 when talking about store_true/store_false. Particularly important since they now store True and False rather than 1 and 0! Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** liboptparse.tex 3 May 2003 19:41:45 -0000 1.4 --- liboptparse.tex 3 May 2003 20:13:08 -0000 1.5 *************** *** 27,31 **** help="write report to FILE", metavar="FILE") parser.add_option("-q", "--quiet", ! action="store_false", dest="verbose", default=1, help="don't print status messages to stdout") --- 27,31 ---- help="write report to FILE", metavar="FILE") parser.add_option("-q", "--quiet", ! action="store_false", dest="verbose", default=True, help="don't print status messages to stdout") *************** *** 44,48 **** (All of these result in \code{options.filename == "outfile"} and ! \code{options.verbose == 0} ...just as you might expect.) Even niftier, users can run one of --- 44,48 ---- (All of these result in \code{options.filename == "outfile"} and ! \code{options.verbose == False}, just as you might expect.) Even niftier, users can run one of *************** *** 394,402 **** First, consider the verbose/quiet example. If we want ! \module{optparse} to set \var{verbose} to 1 unless \programopt{-q} is ! seen, then we can do this: \begin{verbatim} ! parser.add_option("-v", action="store_true", dest="verbose", default=1) parser.add_option("-q", action="store_false", dest="verbose") \end{verbatim} --- 394,402 ---- First, consider the verbose/quiet example. If we want ! \module{optparse} to set \var{verbose} to \code{True} unless ! \programopt{-q} is seen, then we can do this: \begin{verbatim} ! parser.add_option("-v", action="store_true", dest="verbose", default=True) parser.add_option("-q", action="store_false", dest="verbose") \end{verbatim} *************** *** 406,410 **** \begin{verbatim} parser.add_option("-v", action="store_true", dest="verbose") ! parser.add_option("-q", action="store_false", dest="verbose", default=1) \end{verbatim} --- 406,410 ---- \begin{verbatim} parser.add_option("-v", action="store_true", dest="verbose") ! parser.add_option("-q", action="store_false", dest="verbose", default=True) \end{verbatim} *************** *** 416,424 **** \begin{verbatim} ! parser.add_option("-v", action="store_true", dest="verbose", default=0) ! parser.add_option("-q", action="store_false", dest="verbose", default=1) \end{verbatim} ! Again, the default value for \var{verbose} will be 1: the last default value supplied for any particular destination attribute is the one that counts. --- 416,424 ---- \begin{verbatim} ! parser.add_option("-v", action="store_true", dest="verbose", default=False) ! parser.add_option("-q", action="store_false", dest="verbose", default=True) \end{verbatim} ! Again, the default value for \var{verbose} will be \code{True}: the last default value supplied for any particular destination attribute is the one that counts. *************** *** 436,440 **** parser = OptionParser(usage=usage) parser.add_option("-v", "--verbose", ! action="store_true", dest="verbose", default=1, help="make lots of noise [default]") parser.add_option("-q", "--quiet", --- 436,440 ---- parser = OptionParser(usage=usage) parser.add_option("-v", "--verbose", ! action="store_true", dest="verbose", default=True, help="make lots of noise [default]") parser.add_option("-q", "--quiet", *************** *** 865,874 **** \term{store_true} [required: \var{dest}] ! A special case of ``store_const'' that stores a true value ! (specifically, the integer 1) to \var{dest}. \term{store_false} [required: \var{dest}] ! Like ``store_true'', but stores a false value (the integer 0). Example: --- 865,873 ---- \term{store_true} [required: \var{dest}] ! A special case of ``store_const'' that stores \code{True} to \var{dest}. \term{store_false} [required: \var{dest}] ! Like ``store_true'', but stores a \code{False} Example: From gward@users.sourceforge.net Sat May 3 21:41:39 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 03 May 2003 13:41:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23012 Modified Files: liboptparse.tex Log Message: Rename "The Tao of Option Parsing" section to "Philosophy". Remove first-person usage from it. Various wording tweaks. Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** liboptparse.tex 3 May 2003 20:13:08 -0000 1.5 --- liboptparse.tex 3 May 2003 20:41:37 -0000 1.6 *************** *** 66,78 **** parsing your command-line. ! \subsection{The Tao of Option Parsing\label{optparse-tao}} ! \module{optparse} is an implementation of what I have always ! considered the most obvious, straightforward, and user-friendly way to ! design a user interface for command-line programs. In short, I have ! fairly firm ideas of the Right Way (and the many Wrong Ways) to do ! argument parsing, and \module{optparse} reflects many of those ideas. ! This section is meant to explain this philosophy, which in turn is ! heavily influenced by the \UNIX{} and GNU toolkits. \subsubsection{Terminology\label{optparse-terminology}} --- 66,76 ---- parsing your command-line. ! \subsection{Philosophy\label{optparse-philosophy}} ! The purpose of \module{optparse} is to make it very easy to provide the ! most standard, obvious, straightforward, and user-friendly user ! interface for \UNIX{} command-line programs. The \module{optparse} ! philosophy is heavily influenced by the \UNIX{} and GNU toolkits, and ! this section is meant to explain that philosophy. \subsubsection{Terminology\label{optparse-terminology}} *************** *** 89,94 **** important.) \UNIX{} shells also use the term ``word''. ! It's occasionally desirable to substitute an argument list other ! than \var{sys.argv[1:]}, so you should read ``argument'' as ``an element of \var{sys.argv[1:]}, or of some other list provided as a substitute for \var{sys.argv[1:]}''. --- 87,92 ---- important.) \UNIX{} shells also use the term ``word''. ! It is occasionally desirable to use an argument list other than ! \var{sys.argv[1:]}, so you should read ``argument'' as ``an element of \var{sys.argv[1:]}, or of some other list provided as a substitute for \var{sys.argv[1:]}''. *************** *** 121,131 **** \end{itemize} ! These option syntaxes are not supported by \module{optparse}, and they ! never will be. (If you really want to use one of those option ! syntaxes, you'll have to subclass OptionParser and override all the ! difficult bits. But please don't! \module{optparse} does things the ! traditional \UNIX/GNU way deliberately; the first three are ! non-standard anywhere, and the last one makes sense only if you're ! exclusively targeting MS-DOS/Windows and/or VMS.) \term{option argument} --- 119,129 ---- \end{itemize} ! \module{optparse} does not support these option syntaxes, and it never ! will. (If you really want to use one of those option syntaxes, you'll ! have to subclass \class{OptionParser} and override all the difficult ! bits. But please don't! \module{optparse} does things the traditional ! \UNIX/GNU way deliberately; the first three are non-standard anywhere, ! and the last one makes sense only if you're exclusively targeting ! MS-DOS/Windows and/or VMS.) \term{option argument} *************** *** 151,170 **** meaning that some options will take an argument if they see it, and won't if they don't. This is somewhat controversial, because it makes ! parsing ambiguous: if \programopt{-a} takes an optional argument and ! \programopt{-b} is another option entirely, how do we interpret ! \programopt{-ab}? \module{optparse} does not currently support this. \term{positional argument} something leftover in the argument list after options have been ! parsed, ie. after options and their arguments have been parsed and removed from the argument list. \term{required option} ! an option that must be supplied on the command-line; the phrase ! ``required option'' is an oxymoron and is usually considered poor UI ! design. \module{optparse} doesn't prevent you from implementing ! required options, but doesn't give you much help with it either. See ! ``Extending Examples'' (section~\ref{optparse-extending-examples}) for ! two ways to implement required options with \module{optparse}. \end{definitions} --- 149,170 ---- meaning that some options will take an argument if they see it, and won't if they don't. This is somewhat controversial, because it makes ! parsing ambiguous: if \programopt{-a} and \programopt{-b} are both ! options, and \programopt{-a} takes an optional argument, how do we ! interpret \programopt{-ab}? \module{optparse} does not support optional ! option arguments. \term{positional argument} something leftover in the argument list after options have been ! parsed, i.e., after options and their arguments have been parsed and removed from the argument list. \term{required option} ! an option that must be supplied on the command-line. The phrase ! ``required option'' is an oxymoron; the presence of ``required options'' ! in a program is usually a sign of careless user interface design. ! \module{optparse} doesn't prevent you from implementing required ! options, but doesn't give you much help with it either. See ``Extending ! Examples'' (section~\ref{optparse-extending-examples}) for two ways to ! implement required options with \module{optparse}. \end{definitions} *************** *** 178,188 **** \programopt{-v} and \longprogramopt{report} are both options. Assuming the \longprogramopt{report} option takes one argument, ! ``/tmp/report.txt'' is an option argument. ``foo'' and ``bar'' are ! positional arguments. \subsubsection{What are options for?\label{optparse-options}} Options are used to provide extra information to tune or customize the ! execution of a program. In case it wasn't clear, options are usually \emph{optional}. A program should be able to run just fine with no options whatsoever. (Pick a random program from the \UNIX{} or GNU --- 178,188 ---- \programopt{-v} and \longprogramopt{report} are both options. Assuming the \longprogramopt{report} option takes one argument, ! \code{/tmp/report.txt} is an option argument. \code{foo} and \code{bar} ! are positional arguments. \subsubsection{What are options for?\label{optparse-options}} Options are used to provide extra information to tune or customize the ! execution of a program. In case it wasn't clear, options should be \emph{optional}. A program should be able to run just fine with no options whatsoever. (Pick a random program from the \UNIX{} or GNU From gward@users.sourceforge.net Sat May 3 22:23:01 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sat, 03 May 2003 14:23:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8404 Modified Files: liboptparse.tex Log Message: Scattered wording and typographical improvements (up to but not including the "Callback Options" section). Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** liboptparse.tex 3 May 2003 20:41:37 -0000 1.6 --- liboptparse.tex 3 May 2003 21:22:58 -0000 1.7 *************** *** 278,283 **** The interesting stuff, of course, is what comes after the option ! strings. In this document, we'll only cover four of the things you ! can put there: \var{action}, \var{type}, \var{dest} (destination), and \var{help}. --- 278,283 ---- The interesting stuff, of course, is what comes after the option ! strings. For now, we'll only cover four of the things you can put ! there: \var{action}, \var{type}, \var{dest} (destination), and \var{help}. *************** *** 308,312 **** \function{parse_args()}, it automatically uses \var{sys.argv[1:]}.) ! When \module{optparse} sees the \programopt{-f}, it sucks in the next argument---\code{foo.txt}---and stores it in the \var{filename} attribute of a special object. That object is the first return value --- 308,312 ---- \function{parse_args()}, it automatically uses \var{sys.argv[1:]}.) ! When \module{optparse} sees the \programopt{-f}, it consumes the next argument---\code{foo.txt}---and stores it in the \var{filename} attribute of a special object. That object is the first return value *************** *** 326,335 **** \end{verbatim} ! Note that I didn't supply a long option, which is perfectly acceptable. ! I also didn't specify the action---it defaults to ``store''. ! Let's parse another fake command-line. This time, we'll jam the ! option argument right up against the option---\programopt{-n42} (one ! argument) is equivalent to \programopt{-n 42} (two arguments). : \begin{verbatim} --- 326,336 ---- \end{verbatim} ! This example doesn't provide a long option, which is perfectly ! acceptable. It also doesn't specify the action---it defaults to ! ``store''. ! Let's parse another fake command-line. This time, we'll jam the option ! argument right up against the option, since \programopt{-n42} (one ! argument) is equivalent to \programopt{-n 42} (two arguments). \begin{verbatim} *************** *** 338,342 **** \end{verbatim} ! will print ``42''. Trying out the ``float'' type is left as an exercise for the reader. --- 339,343 ---- \end{verbatim} ! This prints \code{42}. Trying out the ``float'' type is left as an exercise for the reader. *************** *** 377,384 **** default values---see below.) ! When \module{optparse} sees \programopt{-v} on the command line, it ! sets the \var{verbose} attribute of the special {option values} ! object to 1; when it sees \programopt{-q}, it sets \var{verbose} to ! 0. \subsubsection{Setting default values\label{optparse-setting-default-values}} --- 378,384 ---- default values---see below.) ! When \module{optparse} sees \programopt{-v} on the command line, it sets ! \var{options.verbose} to \code{True}; when it sees \programopt{-q}, it ! sets \var{options.verbose} to \code{False}. \subsubsection{Setting default values\label{optparse-setting-default-values}} *************** *** 387,395 **** ``destination'') when certain command-line options are seen. What happens if those options are never seen? Since we didn't supply any ! defaults, they are all set to None. Sometimes, this is just fine ! (which is why it's the default), but sometimes, you want more control. ! To address that need, \module{optparse} lets you supply a default ! value for each destination, which is assigned before the command-line ! is parsed. First, consider the verbose/quiet example. If we want --- 387,394 ---- ``destination'') when certain command-line options are seen. What happens if those options are never seen? Since we didn't supply any ! defaults, they are all set to \code{None}. Sometimes, this is just fine (which ! is why it's the default), but sometimes, you want more control. To ! address that need, \module{optparse} lets you supply a default value for ! each destination, which is assigned before the command-line is parsed. First, consider the verbose/quiet example. If we want *************** *** 421,426 **** Again, the default value for \var{verbose} will be \code{True}: the last ! default value supplied for any particular destination attribute is the ! one that counts. \subsubsection{Generating help\label{optparse-generating-help}} --- 420,425 ---- Again, the default value for \var{verbose} will be \code{True}: the last ! default value supplied for any particular destination is the one that ! counts. \subsubsection{Generating help\label{optparse-generating-help}} *************** *** 476,480 **** \module{optparse} expands \samp{\%prog} in the usage string to the name of the ! current script, ie. \code{os.path.basename(sys.argv[0])}. The expanded string is then printed before the detailed option help. --- 475,479 ---- \module{optparse} expands \samp{\%prog} in the usage string to the name of the ! current script, i.e. \code{os.path.basename(sys.argv[0])}. The expanded string is then printed before the detailed option help. *************** *** 524,529 **** \begin{verbatim} group = OptionGroup(parser, "Dangerous Options", ! "Caution: use these options at your own risk." ! " It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.") parser.add_option_group(group) --- 523,528 ---- \begin{verbatim} group = OptionGroup(parser, "Dangerous Options", ! "Caution: use these options at your own risk. " ! "It is believed that some of them bite.") group.add_option("-g", action="store_true", help="Group option.") parser.add_option_group(group) *************** *** 560,569 **** \end{verbatim} ! Note that ``\%prog'' is expanded just like it is in \var{usage}. Apart from ! that, \var{version} can contain anything you like. When you supply it, ! \module{optparse} automatically adds a \longprogramopt{version} option to your ! parser. If it encounters this option on the command line, it expands ! your \var{version} string (by replacing ``\%prog''), prints it to ! stdout, and exits. For example, if your script is called /usr/bin/foo, a user might do: --- 559,568 ---- \end{verbatim} ! \var{version} can contain anything you like; \code{\%prog} is expanded ! in \var{version} just as with \var{usage}. When you supply it, ! \module{optparse} automatically adds a \longprogramopt{version} option ! to your parser. If it encounters this option on the command line, it ! expands your \var{version} string (by replacing \code{\%prog}), prints ! it to stdout, and exits. For example, if your script is called /usr/bin/foo, a user might do: *************** *** 572,577 **** $ /usr/bin/foo --version foo 1.0 ! $ ! \end{verbatim} \subsubsection{Error-handling\label{optparse-error-handling}} --- 571,575 ---- $ /usr/bin/foo --version foo 1.0 ! \end{verbatim} % $ (avoid confusing emacs) \subsubsection{Error-handling\label{optparse-error-handling}} *************** *** 579,587 **** The one thing you need to know for basic usage is how \module{optparse} behaves when it encounters an error on the ! command-line---e.g. \programopt{-n4x} where \programopt{-n} is an ! integer-valued option. \module{optparse} prints your usage message to ! stderr, followed by a useful and human-readable error message. Then ! it terminates (calls \function{sys.exit()}) with a non-zero exit ! status. If you don't like this, subclass \class{OptionParser} and override the --- 577,585 ---- The one thing you need to know for basic usage is how \module{optparse} behaves when it encounters an error on the ! command-line---e.g. \programopt{-n 4x} where \programopt{-n} is an ! integer-valued option. In this case, \module{optparse} prints your ! usage message to stderr, followed by a useful and human-readable error ! message. Then it terminates (calls \function{sys.exit()}) with a ! non-zero exit status. If you don't like this, subclass \class{OptionParser} and override the *************** *** 591,603 **** \subsubsection{Putting it all together\label{optparse-basic-summary}} ! Here's what my \module{optparse}-based scripts usually look like: \begin{verbatim} from optparse import OptionParser ! ! ... ! ! def main (): ! usage = "usage: %prog [options] arg" parser = OptionParser(usage) parser.add_option("-f", "--file", type="string", dest="filename", --- 589,599 ---- \subsubsection{Putting it all together\label{optparse-basic-summary}} ! Here's what \module{optparse}-based scripts typically look like: \begin{verbatim} from optparse import OptionParser ! [...] ! def main(): ! usage = "usage: \%prog [-f] [-v] [-q] firstarg secondarg" parser = OptionParser(usage) parser.add_option("-f", "--file", type="string", dest="filename", *************** *** 607,611 **** parser.add_option("-q", "--quiet", action="store_false", dest="verbose") - # more options ... (options, args) = parser.parse_args() --- 603,606 ---- *************** *** 614,620 **** if options.verbose: ! print "reading %s..." % options.filename ! ! # go to work ... if __name__ == "__main__": --- 609,614 ---- if options.verbose: ! print "reading \%s..." \% options.filename ! [... go to work ...] if __name__ == "__main__": *************** *** 624,630 **** \subsection{Advanced Usage\label{optparse-advanced-usage}} - This is reference documentation. If you haven't read the basic - documentation in section~\ref{optparse-basic-usage}, do so now. - \subsubsection{Creating and populating the parser\label{optparse-creating-the-parser}} --- 618,621 ---- *************** *** 635,638 **** --- 626,631 ---- \begin{verbatim} + from optparse import OptionParser, make_option + [...] parser = OptionParser(option_list=[ make_option("-f", "--filename", *************** *** 642,653 **** \end{verbatim} ! (\function{make_option()} is an alias for ! the \class{Option} class, ie. this just calls the \class{Option} ! constructor. A future version of \module{optparse} will probably ! split \class{Option} into several classes, and ! \function{make_option()} will become a factory function that picks the ! right class to instantiate.) ! For long option lists, it's often more convenient/readable to create the list separately: --- 635,642 ---- \end{verbatim} ! (\function{make_option()} is a factory function for generating ! \class{Option} objects.) ! For long option lists, it may be more convenient/readable to create the list separately: *************** *** 655,659 **** option_list = [make_option("-f", "--filename", action="store", type="string", dest="filename"), ! # 17 other options ... make_option("-q", "--quiet", action="store_false", dest="verbose")] --- 644,648 ---- option_list = [make_option("-f", "--filename", action="store", type="string", dest="filename"), ! [... more options ...] make_option("-q", "--quiet", action="store_false", dest="verbose")] *************** *** 674,679 **** This method makes it easier to track down exceptions raised by the \class{Option} constructor, which are common because of the complicated ! interdependencies among the various keyword arguments---if you get it ! wrong, \module{optparse} raises \exception{OptionError}. \method{add_option()} can be called in one of two ways: --- 663,668 ---- This method makes it easier to track down exceptions raised by the \class{Option} constructor, which are common because of the complicated ! interdependencies among the various keyword arguments. (If you get it ! wrong, \module{optparse} raises \exception{OptionError}.) \method{add_option()} can be called in one of two ways: *************** *** 682,686 **** \item pass it an \class{Option} instance (as returned by \function{make_option()}) \item pass it any combination of positional and keyword arguments that ! are acceptable to \function{make_option()} (ie., to the \class{Option} constructor), and it will create the \class{Option} instance for you (shown above). --- 671,675 ---- \item pass it an \class{Option} instance (as returned by \function{make_option()}) \item pass it any combination of positional and keyword arguments that ! are acceptable to \function{make_option()} (i.e., to the \class{Option} constructor), and it will create the \class{Option} instance for you (shown above). *************** *** 690,694 **** Each \class{Option} instance represents a set of synonymous ! command-line options, ie. options that have the same meaning and effect, but different spellings. You can specify any number of short or long option strings, but you must specify at least one option --- 679,683 ---- Each \class{Option} instance represents a set of synonymous ! command-line options, i.e. options that have the same meaning and effect, but different spellings. You can specify any number of short or long option strings, but you must specify at least one option *************** *** 707,741 **** \end{verbatim} ! The ``...'' represents a set of keyword arguments that define ! attributes of the \class{Option} object. Just which keyword args you ! must supply for a given \class{Option} is fairly complicated (see the ! various \method{_check_*()} methods in the \class{Option} class if you ! don't believe me), but you always have to supply \emph{some}. If you ! get it wrong, \module{optparse} raises an \exception{OptionError} ! exception explaining your mistake. ! The most important attribute of an option is its action, ie. what to do when we encounter this option on the command-line. The possible actions are: ! \begin{definitions} ! \term{store} [default] ! store this option's argument. ! \term{store_const} ! store a constant value. ! \term{store_true} ! store a true value. ! \term{store_false} ! store a false value. ! \term{append} ! append this option's argument to a list. ! \term{count} ! increment a counter by one. ! \term{callback} ! call a specified function. ! \term{help} ! print a usage message including all options and the documentation for ! them. ! \end{definitions} (If you don't supply an action, the default is ``store''. For this --- 696,721 ---- \end{verbatim} ! The ``...'' represents a set of keyword arguments that define attributes ! of the \class{Option} object. The rules governing which keyword args ! you must supply for a given \class{Option} are fairly complicated, but ! you always have to supply \emph{some}. If you get it wrong, ! \module{optparse} raises an \exception{OptionError} exception explaining ! your mistake. ! The most important attribute of an option is its action, i.e. what to do when we encounter this option on the command-line. The possible actions are: ! \begin{tableii}{l|l}{code}{Action}{Meaning} ! \lineii{store}{store this option's argument (default)} ! \lineii{store_const}{store a constant value} ! \lineii{store_true}{store a true value} ! \lineii{store_false}{store a false value} ! \lineii{append}{append this option's argument to a list} ! \lineii{count}{increment a counter by one} ! \lineii{callback}{call a specified function} ! \lineii{help}{print a usage message including all options and the ! documentation for them} ! \end{tableii} (If you don't supply an action, the default is ``store''. For this *************** *** 785,789 **** \end{verbatim} ! Clearly, the \var{type} and \var{dest} arguments are (usually) almost as important as \var{action}. \var{action} is the only attribute that is meaningful for \emph{all} options, though, so it is the most --- 765,769 ---- \end{verbatim} ! Clearly, the \var{type} and \var{dest} arguments are almost as important as \var{action}. \var{action} is the only attribute that is meaningful for \emph{all} options, though, so it is the most *************** *** 802,811 **** The option must be followed by an argument, which is converted to a value according to \var{type} and stored in \var{dest}. If ! \var{nargs} > 1, multiple arguments will be consumed from the command line; all will be converted according to \var{type} and stored to \var{dest} as a tuple. See section~\ref{optparse-option-types}, ``Option types'' below. ! If \var{choices} is supplied (a list or tuple of strings), the type defaults to ``choice''. --- 782,791 ---- The option must be followed by an argument, which is converted to a value according to \var{type} and stored in \var{dest}. If ! \code{nargs > 1}, multiple arguments will be consumed from the command line; all will be converted according to \var{type} and stored to \var{dest} as a tuple. See section~\ref{optparse-option-types}, ``Option types'' below. ! If \var{choices} (a sequence of strings) is supplied, the type defaults to ``choice''. *************** *** 853,857 **** make_option("-v", "--verbose", action="store_const", const=1, dest="verbose"), ! make_option(None, "--noisy", action="store_const", const=2, dest="verbose"), \end{verbatim} --- 833,837 ---- make_option("-v", "--verbose", action="store_const", const=1, dest="verbose"), ! make_option("--noisy", action="store_const", const=2, dest="verbose"), \end{verbatim} *************** *** 869,873 **** \term{store_false} [required: \var{dest}] ! Like ``store_true'', but stores a \code{False} Example: --- 849,853 ---- \term{store_false} [required: \var{dest}] ! Like ``store_true'', but stores \code{False} Example: *************** *** 882,888 **** The option must be followed by an argument, which is appended to the list in \var{dest}. If no default value for \var{dest} is supplied ! (ie. the default is None), an empty list is automatically created when \module{optparse} first encounters this option on the command-line. ! If \samp{nargs > 1}, multiple arguments are consumed, and a tuple of length \var{nargs} is appended to \var{dest}. --- 862,868 ---- The option must be followed by an argument, which is appended to the list in \var{dest}. If no default value for \var{dest} is supplied ! (i.e. the default is \code{None}), an empty list is automatically created when \module{optparse} first encounters this option on the command-line. ! If \code{nargs > 1}, multiple arguments are consumed, and a tuple of length \var{nargs} is appended to \var{dest}. *************** *** 939,943 **** \end{verbatim} ! \term{callback} [required: \var{'callback'}; relevant: \var{type}, \var{nargs}, \var{callback_args}, \var{callback_kwargs}] --- 919,923 ---- \end{verbatim} ! \term{callback} [required: \var{callback}; relevant: \var{type}, \var{nargs}, \var{callback_args}, \var{callback_kwargs}] *************** *** 955,959 **** Callback options are covered in detail in ! section~\ref{optparse-callback-options} ``Callback Options.'' \term{help} [required: none] --- 935,939 ---- Callback options are covered in detail in ! section~\ref{optparse-callback-options}, ``Callback Options.'' \term{help} [required: none] *************** *** 1013,1017 **** \dfn{int}, \dfn{long}, \dfn{choice}, \dfn{float} and \dfn{complex}. (Of these, string, int, float, and choice are the most commonly used ! -- long and complex are there mainly for completeness.) It's easy to add new option types by subclassing the \class{Option} class; see section~\ref{optparse-extending}, ``Extending \module{optparse}.'' --- 993,997 ---- \dfn{int}, \dfn{long}, \dfn{choice}, \dfn{float} and \dfn{complex}. (Of these, string, int, float, and choice are the most commonly used ! ---long and complex are there mainly for completeness.) It's easy to add new option types by subclassing the \class{Option} class; see section~\ref{optparse-extending}, ``Extending \module{optparse}.'' *************** *** 1026,1031 **** Internally, \module{optparse} raises \exception{OptionValueError} in \function{optparse.check_builtin()}; at a higher level (in ! \class{OptionParser}) this is caught and \module{optparse} terminates ! your program with a useful error message. Likewise, float arguments are passed to \function{float()} for --- 1006,1011 ---- Internally, \module{optparse} raises \exception{OptionValueError} in \function{optparse.check_builtin()}; at a higher level (in ! \class{OptionParser}), \module{optparse} catches this exception and ! terminates your program with a useful error message. Likewise, float arguments are passed to \function{float()} for *************** *** 1037,1041 **** tuple of choices (strings) must be passed to the option constructor (\function{make_option()} or \method{OptionParser.add_option()}) as ! the ``choices'' keyword argument. Choice option arguments are compared against this master list in \function{optparse.check_choice()}, and \exception{OptionValueError} --- 1017,1021 ---- tuple of choices (strings) must be passed to the option constructor (\function{make_option()} or \method{OptionParser.add_option()}) as ! the \var{choices} keyword argument. Choice option arguments are compared against this master list in \function{optparse.check_choice()}, and \exception{OptionValueError} *************** *** 1055,1059 **** \begin{methoddesc}{get_option}{opt_str} Returns the \class{Option} instance that implements the option ! string you supplied, or None if no options implement it. \end{methoddesc} --- 1035,1039 ---- \begin{methoddesc}{get_option}{opt_str} Returns the \class{Option} instance that implements the option ! string you supplied, or \code{None} if no options implement it. \end{methoddesc} *************** *** 1108,1114 **** or via the \method{set_conflict_handler()} method. ! The default conflict-handling mechanism is ``error''. The only other ! one is ``ignore'', which restores the (arguably broken) behaviour of ! \module{optparse} 1.1 and earlier. Here's an example: first, define an \class{OptionParser} set to --- 1088,1092 ---- or via the \method{set_conflict_handler()} method. ! The default conflict-handling mechanism is \code{error}. Here's an example: first, define an \class{OptionParser} set to *************** *** 1247,1252 **** set; the type of \var{value} will be the type implied by the option's type (see~\ref{optparse-option-types}, ``Option types''). If ! \var{type} for this option is None (no argument expected), then ! \var{value} will be None. If \samp{nargs > 1}, \var{value} will be a tuple of values of the appropriate type. --- 1225,1230 ---- set; the type of \var{value} will be the type implied by the option's type (see~\ref{optparse-option-types}, ``Option types''). If ! \var{type} for this option is \code{None} (no argument expected), then ! \var{value} will be \code{None}. If \samp{nargs > 1}, \var{value} will be a tuple of values of the appropriate type. *************** *** 1258,1262 **** \begin{definitions} \term{parser.rargs} ! the current remaining argument list, ie. with \var{opt} (and \var{value}, if any) removed, and only the arguments following them still there. Feel free to modify \member{parser.rargs}, --- 1236,1240 ---- \begin{definitions} \term{parser.rargs} ! the current remaining argument list, i.e. with \var{opt} (and \var{value}, if any) removed, and only the arguments following them still there. Feel free to modify \member{parser.rargs}, *************** *** 1264,1268 **** \term{parser.largs} ! the current set of leftover arguments, ie. arguments that have been processed but have not been consumed as options (or arguments to options). Feel free to modify \member{parser.largs} e.g. by adding --- 1242,1246 ---- \term{parser.largs} ! the current set of leftover arguments, i.e. arguments that have been processed but have not been consumed as options (or arguments to options). Feel free to modify \member{parser.largs} e.g. by adding *************** *** 1464,1468 **** Also, the examples section includes several demonstrations of ! extending \module{optparse} in different ways: eg. a case-insensitive option parser, or two kinds of option parsers that implement ``required options''. --- 1442,1446 ---- Also, the examples section includes several demonstrations of ! extending \module{optparse} in different ways: e.g. a case-insensitive option parser, or two kinds of option parsers that implement ``required options''. *************** *** 1657,1661 **** If the \member{attr} attribute of \var{values} doesn't exist or is ! None, then \method{ensure_value()} first sets it to \var{value}, and then returns \var{value}. This is very handy for actions like ``extend'', ``append'', and ``count'', all of which accumulate data in --- 1635,1639 ---- If the \member{attr} attribute of \var{values} doesn't exist or is ! \code{None}, then \method{ensure_value()} first sets it to \var{value}, and then returns \var{value}. This is very handy for actions like ``extend'', ``append'', and ``count'', all of which accumulate data in *************** *** 1664,1668 **** \method{ensure_value()} means that scripts using your action don't have to worry about setting a default value for the option ! destinations in question; they can just leave the default as None and \method{ensure_value()} will take care of getting it right when it's needed. --- 1642,1646 ---- \method{ensure_value()} means that scripts using your action don't have to worry about setting a default value for the option ! destinations in question; they can just leave the default as \code{None} and \method{ensure_value()} will take care of getting it right when it's needed. *************** *** 1675,1679 **** First, the simple one: \class{OptionParser} tries to be helpful by ! calling \function{sys.exit()} when appropriate, ie. when there's an error on the command-line or when the user requests help. In the former case, the traditional course of letting the script crash with a --- 1653,1657 ---- First, the simple one: \class{OptionParser} tries to be helpful by ! calling \function{sys.exit()} when appropriate, i.e. when there's an error on the command-line or when the user requests help. In the former case, the traditional course of letting the script crash with a From tim_one@users.sourceforge.net Sun May 4 05:16:53 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 May 2003 21:16:53 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_file.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30029/Lib/test Modified Files: test_file.py Log Message: Somewhere along the way, the softspace attr of file objects became read- only. Repaired, and added new tests to test_file.py. Index: test_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_file.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_file.py 6 Aug 2002 15:58:24 -0000 1.11 --- test_file.py 4 May 2003 04:16:50 -0000 1.12 *************** *** 6,9 **** --- 6,29 ---- from UserList import UserList + # verify expected attributes exist + f = file(TESTFN, 'w') + softspace = f.softspace + f.name # merely shouldn't blow up + f.mode # ditto + f.closed # ditto + + # verify softspace is writable + f.softspace = softspace # merely shouldn't blow up + + # verify the others aren't + for attr in 'name', 'mode', 'closed': + try: + setattr(f, attr, 'oops') + except TypeError: + pass + else: + raise TestFailed('expected TypeError setting file attr %r' % attr) + f.close() + # verify writelines with instance sequence l = UserList(['1', '2']) From tim_one@users.sourceforge.net Sun May 4 05:16:54 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 May 2003 21:16:54 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.755,1.756 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30029/Misc Modified Files: NEWS Log Message: Somewhere along the way, the softspace attr of file objects became read- only. Repaired, and added new tests to test_file.py. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.755 retrieving revision 1.756 diff -C2 -d -r1.755 -r1.756 *** NEWS 3 May 2003 09:09:02 -0000 1.755 --- NEWS 4 May 2003 04:16:51 -0000 1.756 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - The softspace attribute of file objects became read-only by oversight. + It's writable again. + Extension modules ----------------- From tim_one@users.sourceforge.net Sun May 4 05:16:54 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 03 May 2003 21:16:54 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.176,2.177 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv30029/Objects Modified Files: fileobject.c Log Message: Somewhere along the way, the softspace attr of file objects became read- only. Repaired, and added new tests to test_file.py. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.176 retrieving revision 2.177 diff -C2 -d -r2.176 -r2.177 *** fileobject.c 9 Feb 2003 01:10:02 -0000 2.176 --- fileobject.c 4 May 2003 04:16:52 -0000 2.177 *************** *** 1963,1967 **** 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ ! 0, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ --- 1963,1968 ---- 0, /* tp_str */ PyObject_GenericGetAttr, /* tp_getattro */ ! /* softspace is writable: we must supply tp_setattro */ ! PyObject_GenericSetAttr, /* tp_setattro */ 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ From bcannon@users.sourceforge.net Sun May 4 22:15:30 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sun, 04 May 2003 14:15:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv3106/Lib/test Modified Files: test_support.py Log Message: 'forget' now also deletes any proper .pyo files. Added some docstrings. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** test_support.py 1 May 2003 17:45:51 -0000 1.52 --- test_support.py 4 May 2003 21:15:27 -0000 1.53 *************** *** 1,3 **** ! """Supporting definitions for the Python regression test.""" if __name__ != 'test.test_support': --- 1,3 ---- ! """Supporting definitions for the Python regression tests.""" if __name__ != 'test.test_support': *************** *** 51,54 **** --- 51,56 ---- def forget(modname): + '''"Forget" a module was ever imported by removing it from sys.modules and + deleting any .pyc and .pyo files.''' unload(modname) import os *************** *** 58,66 **** --- 60,81 ---- except os.error: pass + # Deleting the .pyo file cannot be within the 'try' for the .pyc since + # the chance exists that there is no .pyc (and thus the 'try' statement + # is exited) but there is a .pyo file. + try: + os.unlink(os.path.join(dirname, modname + '.pyo')) + except os.error: + pass def is_resource_enabled(resource): + """Test whether a resource is enabled. Known resources are set by + regrtest.py.""" return use_resources is not None and resource in use_resources def requires(resource, msg=None): + """Raise ResourceDenied if the specified resource is not available. + + If the caller's module is __main__ then automatically return True. The + possibility of False being returned occurs when regrtest.py is executing.""" # see if the caller's module is __main__ - if so, treat as if # the resource was set *************** *** 142,145 **** --- 157,163 ---- def findfile(file, here=__file__): + """Try to find a file on sys.path and the working directory. If it is not + found the argument passed to the function is returned (this does not + necessarily signal failure; could still be the legitimate path).""" import os if os.path.isabs(file): From rhettinger@users.sourceforge.net Sun May 4 22:25:21 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 04 May 2003 14:25:21 -0700 Subject: [Python-checkins] python/dist/src/Objects dictnotes.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv5773 Modified Files: dictnotes.txt Log Message: * Note how dummy entry re-use benefits use cases with interspersed deletes and adds. * Note that dictionary iteration is negatively impacted by additional sparseness. Index: dictnotes.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictnotes.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** dictnotes.txt 2 May 2003 20:11:29 -0000 1.1 --- dictnotes.txt 4 May 2003 21:25:19 -0000 1.2 *************** *** 44,47 **** --- 44,51 ---- such as with the % formatting operator. + Dynamic Mappings + Characterized by deletions interspersed with adds and replacments. + Performance benefits greatly from the re-use of dummy entries. + Data Layout (assuming a 32-bit box with 64 bytes per cache line) *************** *** 92,95 **** --- 96,105 ---- others). Any one test or benchmark is likely to prove misleading. + While making a dictionary more sparse reduces collisions, it impairs + iteration and key listing. Those methods loop over every potential + entry. Doubling the size of dictionary results in twice as many + non-overlapping memory accesses for keys(), items(), values(), + __iter__(), iterkeys(), iteritems(), itervalues(), and update(). + Results of Cache Locality Experiments *************** *** 166,170 **** is not at a premium, the user may benefit from setting the maximum load ratio at 5% or 10% instead of the usual 66.7%. This will sharply ! curtail the number of collisions. 2) Dictionary creation time can be shortened in cases where the ultimate --- 176,180 ---- is not at a premium, the user may benefit from setting the maximum load ratio at 5% or 10% instead of the usual 66.7%. This will sharply ! curtail the number of collisions but will increase iteration time. 2) Dictionary creation time can be shortened in cases where the ultimate From jhylton@users.sourceforge.net Mon May 5 00:44:51 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 May 2003 16:44:51 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv22613 Modified Files: urllib2.py Log Message: Repair redirect handling and raise URLError on host-not-found. The latest changes to the redirect handler couldn't possibly have been tested, because they did not compute a newurl and failed with a NameError. The __name__ == "__main__": block has a test for redirects. Also, fix SF bug 723831. A urlopen() that failed because the host was not found raised a socket.gaierror unlike earlier versions of urllib2. The problem is that httplib actually establishes the connection at a different point starting with Python 2.2. Move the try/except to endheaders(), which is where the connection gets established. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** urllib2.py 24 Apr 2003 15:32:12 -0000 1.39 --- urllib2.py 4 May 2003 23:44:49 -0000 1.40 *************** *** 417,428 **** raise HTTPError if no-one else should try to handle this url. Return None if you can't but another Handler might. - """ ! if (code in (301, 302, 303, 307) and req.method() in ("GET", "HEAD") or ! code in (302, 303) and req.method() == "POST"): ! # Strictly (according to RFC 2616), 302 in response to a POST ! # MUST NOT cause a redirection without confirmation from the user ! # (of urllib2, in this case). In practice, essentially all clients ! # do redirect in this case, so we do the same. return Request(newurl, headers=req.headers) else: --- 417,439 ---- raise HTTPError if no-one else should try to handle this url. Return None if you can't but another Handler might. """ ! # XXX 301 and 302 errors must have a location or uri header. ! # Not sure about the other error codes. ! if "location" in headers: ! newurl = headers["location"] ! elif "uri" in headers: ! newurl = headers["uri"] ! else: ! return ! newurl = urlparse.urljoin(req.get_full_url(), newurl) ! ! m = req.get_method() ! if (code in (301, 302, 303, 307) and m in ("GET", "HEAD") ! or code in (302, 303) and m == "POST"): ! # Strictly (according to RFC 2616), 302 in response to a ! # POST MUST NOT cause a redirection without confirmation ! # from the user (of urllib2, in this case). In practice, ! # essentially all clients do redirect in this case, so we ! # do the same. return Request(newurl, headers=req.headers) else: *************** *** 778,781 **** --- 789,795 ---- class AbstractHTTPHandler(BaseHandler): + # XXX Should rewrite do_open() to use the new httplib interface, + # would would be a little simpler. + def do_open(self, http_class, req): host = req.get_host() *************** *** 783,800 **** raise URLError('no host given') ! try: ! h = http_class(host) # will parse host:port ! if req.has_data(): ! data = req.get_data() ! h.putrequest('POST', req.get_selector()) ! if not 'Content-type' in req.headers: ! h.putheader('Content-type', ! 'application/x-www-form-urlencoded') ! if not 'Content-length' in req.headers: ! h.putheader('Content-length', '%d' % len(data)) ! else: ! h.putrequest('GET', req.get_selector()) ! except socket.error, err: ! raise URLError(err) scheme, sel = splittype(req.get_selector()) --- 797,811 ---- raise URLError('no host given') ! h = http_class(host) # will parse host:port ! if req.has_data(): ! data = req.get_data() ! h.putrequest('POST', req.get_selector()) ! if not 'Content-type' in req.headers: ! h.putheader('Content-type', ! 'application/x-www-form-urlencoded') ! if not 'Content-length' in req.headers: ! h.putheader('Content-length', '%d' % len(data)) ! else: ! h.putrequest('GET', req.get_selector()) scheme, sel = splittype(req.get_selector()) *************** *** 807,811 **** for k, v in req.headers.items(): h.putheader(k, v) ! h.endheaders() if req.has_data(): h.send(data) --- 818,825 ---- for k, v in req.headers.items(): h.putheader(k, v) ! try: ! h.endheaders() ! except socket.error, err: ! raise URLError(err) if req.has_data(): h.send(data) From jhylton@users.sourceforge.net Mon May 5 02:47:19 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 May 2003 18:47:19 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv22327 Modified Files: urllib2.py Log Message: Add comment explaining try/except for endheaders(). Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** urllib2.py 4 May 2003 23:44:49 -0000 1.40 --- urllib2.py 5 May 2003 01:47:13 -0000 1.41 *************** *** 818,821 **** --- 818,823 ---- for k, v in req.headers.items(): h.putheader(k, v) + # httplib will attempt to connect() here. be prepared + # to convert a socket error to a URLError. try: h.endheaders() From jhylton@users.sourceforge.net Mon May 5 04:18:43 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 May 2003 20:18:43 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.24.8.4,1.24.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12183 Modified Files: Tag: release22-maint urllib2.py Log Message: Backport fix for SF #723831: urlopen() raises URLError. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.24.8.4 retrieving revision 1.24.8.5 diff -C2 -d -r1.24.8.4 -r1.24.8.5 *** urllib2.py 25 Apr 2003 05:33:07 -0000 1.24.8.4 --- urllib2.py 5 May 2003 03:18:41 -0000 1.24.8.5 *************** *** 781,798 **** raise URLError('no host given') ! try: ! h = http_class(host) # will parse host:port ! if req.has_data(): ! data = req.get_data() ! h.putrequest('POST', req.get_selector()) ! if not req.headers.has_key('Content-type'): ! h.putheader('Content-type', ! 'application/x-www-form-urlencoded') ! if not req.headers.has_key('Content-length'): ! h.putheader('Content-length', '%d' % len(data)) ! else: ! h.putrequest('GET', req.get_selector()) ! except socket.error, err: ! raise URLError(err) scheme, sel = splittype(req.get_selector()) --- 781,795 ---- raise URLError('no host given') ! h = http_class(host) # will parse host:port ! if req.has_data(): ! data = req.get_data() ! h.putrequest('POST', req.get_selector()) ! if not req.headers.has_key('Content-type'): ! h.putheader('Content-type', ! 'application/x-www-form-urlencoded') ! if not req.headers.has_key('Content-length'): ! h.putheader('Content-length', '%d' % len(data)) ! else: ! h.putrequest('GET', req.get_selector()) scheme, sel = splittype(req.get_selector()) *************** *** 803,807 **** for k, v in req.headers.items(): h.putheader(k, v) ! h.endheaders() if req.has_data(): h.send(data) --- 800,809 ---- for k, v in req.headers.items(): h.putheader(k, v) ! # httplib will attempt to connect() here. be prepared ! # to convert a socket error to a URLError. ! try: ! h.endheaders() ! except socket.error, err: ! raise URLError(err) if req.has_data(): h.send(data) From jhylton@users.sourceforge.net Mon May 5 05:09:15 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 May 2003 21:09:15 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv22598 Modified Files: urllib2.py Log Message: Better fix for newurl as suggested by Jim Jewett in SF bug #730963. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** urllib2.py 5 May 2003 01:47:13 -0000 1.41 --- urllib2.py 5 May 2003 04:09:13 -0000 1.42 *************** *** 409,413 **** class HTTPRedirectHandler(BaseHandler): ! def redirect_request(self, req, fp, code, msg, headers): """Return a Request or None in response to a redirect. --- 409,413 ---- class HTTPRedirectHandler(BaseHandler): ! def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect. *************** *** 418,431 **** None if you can't but another Handler might. """ - # XXX 301 and 302 errors must have a location or uri header. - # Not sure about the other error codes. - if "location" in headers: - newurl = headers["location"] - elif "uri" in headers: - newurl = headers["uri"] - else: - return - newurl = urlparse.urljoin(req.get_full_url(), newurl) - m = req.get_method() if (code in (301, 302, 303, 307) and m in ("GET", "HEAD") --- 418,421 ---- *************** *** 456,460 **** # request, although that might interact poorly with other # handlers that also use handler-specific request attributes ! new = self.redirect_request(req, fp, code, msg, headers) if new is None: return --- 446,450 ---- # request, although that might interact poorly with other # handlers that also use handler-specific request attributes ! new = self.redirect_request(req, fp, code, msg, headers, newurl) if new is None: return From jhylton@users.sourceforge.net Mon May 5 05:10:44 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun, 04 May 2003 21:10:44 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.24.8.5,1.24.8.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv23057 Modified Files: Tag: release22-maint urllib2.py Log Message: Backport better fix for newurl as suggested by Jim Jewett in SF bug #730963. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.24.8.5 retrieving revision 1.24.8.6 diff -C2 -d -r1.24.8.5 -r1.24.8.6 *** urllib2.py 5 May 2003 03:18:41 -0000 1.24.8.5 --- urllib2.py 5 May 2003 04:10:40 -0000 1.24.8.6 *************** *** 407,411 **** class HTTPRedirectHandler(BaseHandler): ! def redirect_request(self, req, fp, code, msg, headers): """Return a Request or None in response to a redirect. --- 407,411 ---- class HTTPRedirectHandler(BaseHandler): ! def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect. *************** *** 443,447 **** # request, although that might interact poorly with other # handlers that also use handler-specific request attributes ! new = self.redirect_request(req, fp, code, msg, headers) if new is None: return --- 443,447 ---- # request, although that might interact poorly with other # handlers that also use handler-specific request attributes ! new = self.redirect_request(req, fp, code, msg, headers, newurl) if new is None: return From loewis@users.sourceforge.net Mon May 5 06:05:33 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 May 2003 22:05:33 -0700 Subject: [Python-checkins] python/dist/src configure,1.394,1.395 configure.in,1.405,1.406 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv3050 Modified Files: configure configure.in Log Message: Patch #732234: Check for -Kthread. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.394 retrieving revision 1.395 diff -C2 -d -r1.394 -r1.395 *** configure 3 May 2003 12:10:46 -0000 1.394 --- configure 5 May 2003 05:05:26 -0000 1.395 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.404 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.405 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 3879,3882 **** --- 3879,3944 ---- fi + if test $ac_cv_kpthread = no + then + # -Kthread, if available, provides the right #defines + # and linker options to make pthread_create available + # Some compilers won't report that they do not support -Kthread, + # so we need to run a program to see whether it really made the + # function available. + echo "$as_me:$LINENO: checking whether $CC accepts -Kthread" >&5 + echo $ECHO_N "checking whether $CC accepts -Kthread... $ECHO_C" >&6 + if test "${ac_cv_kthread+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_save_cc="$CC" + CC="$CC -Kthread" + if test "$cross_compiling" = yes; then + ac_cv_kthread=no + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include + + void* routine(void* p){return NULL;} + + int main(){ + pthread_t p; + if(pthread_create(&p,NULL,routine,NULL)!=0) + return 1; + (void)pthread_detach(p); + return 0; + } + + _ACEOF + rm -f conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_kthread=yes + else + echo "$as_me: program exited with status $ac_status" >&5 + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ( exit $ac_status ) + ac_cv_kthread=no + fi + rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + fi + CC="$ac_save_cc" + fi + + echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5 + echo "${ECHO_T}$ac_cv_kthread" >&6 + fi + # checks for header files *************** *** 9129,9132 **** --- 9191,9196 ---- if test "$ac_cv_kpthread" = "yes" then CC="$CC -Kpthread" + elif test "$ac_cv_kthread" = "yes" + then CC="$CC -Kthread" fi echo "$as_me:$LINENO: checking for pthread_t" >&5 *************** *** 10134,10137 **** --- 10198,10210 ---- then CC="$CC -Kpthread" + cat >>confdefs.h <<\_ACEOF + #define WITH_THREAD 1 + _ACEOF + + posix_threads=yes + THREADOBJ="Python/thread.o" + elif test "$ac_cv_kthread" = "yes" + then + CC="$CC -Kthread" cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.405 retrieving revision 1.406 diff -C2 -d -r1.405 -r1.406 *** configure.in 3 May 2003 12:10:48 -0000 1.405 --- configure.in 5 May 2003 05:05:30 -0000 1.406 *************** *** 753,756 **** --- 753,787 ---- fi + if test $ac_cv_kpthread = no + then + # -Kthread, if available, provides the right #defines + # and linker options to make pthread_create available + # Some compilers won't report that they do not support -Kthread, + # so we need to run a program to see whether it really made the + # function available. + AC_MSG_CHECKING(whether $CC accepts -Kthread) + AC_CACHE_VAL(ac_cv_kthread, + [ac_save_cc="$CC" + CC="$CC -Kthread" + AC_TRY_RUN([ + #include + + void* routine(void* p){return NULL;} + + int main(){ + pthread_t p; + if(pthread_create(&p,NULL,routine,NULL)!=0) + return 1; + (void)pthread_detach(p); + return 0; + } + ], + ac_cv_kthread=yes, + ac_cv_kthread=no, + ac_cv_kthread=no) + CC="$ac_save_cc"]) + AC_MSG_RESULT($ac_cv_kthread) + fi + dnl # check for ANSI or K&R ("traditional") preprocessor dnl AC_MSG_CHECKING(for C preprocessor type) *************** *** 941,944 **** --- 972,977 ---- if test "$ac_cv_kpthread" = "yes" then CC="$CC -Kpthread" + elif test "$ac_cv_kthread" = "yes" + then CC="$CC -Kthread" fi AC_MSG_CHECKING(for pthread_t) *************** *** 1365,1368 **** --- 1398,1407 ---- then CC="$CC -Kpthread" + AC_DEFINE(WITH_THREAD) + posix_threads=yes + THREADOBJ="Python/thread.o" + elif test "$ac_cv_kthread" = "yes" + then + CC="$CC -Kthread" AC_DEFINE(WITH_THREAD) posix_threads=yes From loewis@users.sourceforge.net Mon May 5 06:13:21 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 04 May 2003 22:13:21 -0700 Subject: [Python-checkins] python/dist/src configure,1.395,1.396 configure.in,1.406,1.407 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv4882 Modified Files: configure configure.in Log Message: Patch #732284: Disable _XOPEN_SOURCE on UnixWare 7. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.395 retrieving revision 1.396 diff -C2 -d -r1.395 -r1.396 *** configure 5 May 2003 05:05:26 -0000 1.395 --- configure 5 May 2003 05:13:16 -0000 1.396 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.405 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.406 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1354,1357 **** --- 1354,1361 ---- # of union __?sigval. Reported by Stuart Bishop. SunOS/5.6) + define_xopen_source=no;; + # On UnixWare 7, u_short is never defined with _XOPEN_SOURCE, + # but used in struct sockaddr.sa_family. Reported by Tim Rice. + OpenUNIX/8.0| UnixWare/7.1.[13]) define_xopen_source=no;; esac Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.406 retrieving revision 1.407 diff -C2 -d -r1.406 -r1.407 *** configure.in 5 May 2003 05:05:30 -0000 1.406 --- configure.in 5 May 2003 05:13:18 -0000 1.407 *************** *** 130,133 **** --- 130,137 ---- SunOS/5.6) define_xopen_source=no;; + # On UnixWare 7, u_short is never defined with _XOPEN_SOURCE, + # but used in struct sockaddr.sa_family. Reported by Tim Rice. + OpenUNIX/8.0| UnixWare/7.1.@<:@13@:>@) + define_xopen_source=no;; esac From montanaro@users.sourceforge.net Mon May 5 15:16:45 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 05 May 2003 07:16:45 -0700 Subject: [Python-checkins] python/dist/src/Lib dbhash.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv553 Modified Files: dbhash.py Log Message: typo Index: dbhash.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/dbhash.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dbhash.py 5 Jun 2001 05:33:19 -0000 1.6 --- dbhash.py 5 May 2003 14:16:41 -0000 1.7 *************** *** 1,3 **** ! """Provide a (g)dbm-compatible interface to bsdhash.hashopen.""" import sys --- 1,3 ---- ! """Provide a (g)dbm-compatible interface to bsddb.hashopen.""" import sys From jhylton@users.sourceforge.net Mon May 5 17:13:59 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 May 2003 09:13:59 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.74,1.75 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30924/Lib Modified Files: httplib.py Log Message: SF bug 622042: Don't expect response body from HEAD request. Bug fix candidate. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** httplib.py 18 Apr 2003 10:39:51 -0000 1.74 --- httplib.py 5 May 2003 16:13:56 -0000 1.75 *************** *** 209,216 **** # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. ! def __init__(self, sock, debuglevel=0, strict=0): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.strict = strict self.msg = None --- 209,217 ---- # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details. ! def __init__(self, sock, debuglevel=0, strict=0, method=None): self.fp = sock.makefile('rb', 0) self.debuglevel = debuglevel self.strict = strict + self._method = method self.msg = None *************** *** 327,331 **** if (status == 204 or # No Content status == 304 or # Not Modified ! 100 <= status < 200): # 1xx codes self.length = 0 --- 328,333 ---- if (status == 204 or # No Content status == 304 or # Not Modified ! 100 <= status < 200 or # 1xx codes ! self._method == 'HEAD'): self.length = 0 *************** *** 498,501 **** --- 500,504 ---- self.__response = None self.__state = _CS_IDLE + self._method = None self._set_hostport(host, port) *************** *** 627,630 **** --- 630,635 ---- raise CannotSendRequest() + # Save the method we use, we need it later in the response phase + self._method = method if not url: url = '/' *************** *** 764,770 **** if self.debuglevel > 0: response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict) else: ! response = self.response_class(self.sock, strict=self.strict) response.begin() --- 769,777 ---- if self.debuglevel > 0: response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict, ! method=self._method) else: ! response = self.response_class(self.sock, strict=self.strict, ! method=self._method) response.begin() From jhylton@users.sourceforge.net Mon May 5 17:14:00 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 May 2003 09:14:00 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.234,1.235 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30924/Misc Modified Files: ACKS Log Message: SF bug 622042: Don't expect response body from HEAD request. Bug fix candidate. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.234 retrieving revision 1.235 diff -C2 -d -r1.234 -r1.235 *** ACKS 25 Apr 2003 05:48:32 -0000 1.234 --- ACKS 5 May 2003 16:13:58 -0000 1.235 *************** *** 262,265 **** --- 262,266 ---- Greg Humphreys Jeremy Hylton + Mihai Ibanescu Juan David Ibáñez Palomar Tony Ingraldi From jhylton@users.sourceforge.net Mon May 5 17:14:00 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 May 2003 09:14:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_httplib.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30924/Lib/test Modified Files: test_httplib.py Log Message: SF bug 622042: Don't expect response body from HEAD request. Bug fix candidate. Index: test_httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_httplib.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_httplib.py 23 Jan 2003 18:02:18 -0000 1.10 --- test_httplib.py 5 May 2003 16:13:57 -0000 1.11 *************** *** 79,81 **** --- 79,94 ---- raise AssertionError, "multiple headers not combined properly" + # test that the library doesn't attempt to read any data + # from a head request + conn = httplib.HTTPConnection("www.python.org") + conn.connect() + conn.request("HEAD", "/", headers={"Connection" : "keep-alive"}) + resp = conn.getresponse() + if resp.status != 200: + raise AssertionError, "Expected status 200, got %d" % resp.status + if resp.read() != "": + raise AssertionError, "Did not expect response from HEAD request" + resp.close() + conn.close() + test() From jhylton@users.sourceforge.net Mon May 5 17:46:29 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon, 05 May 2003 09:46:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12859 Modified Files: libtime.tex Log Message: Refer reader to platform library docs for specific semantics. Resolves SF bugs 697989, 697988, 697986. Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** libtime.tex 4 Feb 2003 15:12:06 -0000 1.55 --- libtime.tex 5 May 2003 16:46:26 -0000 1.56 *************** *** 6,12 **** ! This module provides various time-related functions. ! It is always available, but not all functions are available ! on all platforms. An explanation of some terminology and conventions is in order. --- 6,15 ---- ! This module provides various time-related functions. It is always ! available, but not all functions are available on all platforms. Most ! of the functions defined in this module call platform C library ! functions with the same name. It may sometimes be helpful to consult ! the platform documentation, because the semantics of these functions ! varies among platforms. An explanation of some terminology and conventions is in order. From doerwalter@users.sourceforge.net Mon May 5 21:37:35 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon, 05 May 2003 13:37:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grp.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11889/Lib/test Modified Files: test_grp.py Log Message: On Mac OS X pwd.getpwall() might return the tuples ('pgsql', '*', 252, []) and ('postgres', '*', 252, ['skip']), but pwd.getgrgid(252) might return ('pgsql', '', 252, ['skip']). Drop the test that tried to find a tuple similar to the one returned from pwd.getgrgid() among those for the same gid returned by pwd.getgrall(), as the only working definition of 'similar' seems to be 'has the same gid'. This check can be done more directly. This should fix SF bug #732783. Index: test_grp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grp.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** test_grp.py 1 May 2003 17:45:37 -0000 1.16 --- test_grp.py 5 May 2003 20:37:33 -0000 1.17 *************** *** 20,55 **** self.assert_(isinstance(value.gr_mem, list)) - def valueseq(self, value1, value2): - # are two grp tuples equal (don't compare passwords) - return value1.gr_name==value2.gr_name and \ - value1.gr_gid==value2.gr_gid and value1.gr_mem==value2.gr_mem - def test_values(self): entries = grp.getgrall() - entriesbygid = {} - entriesbyname = {} - - # we can't use the same strategy as in test_pwd, because - # we can't compare gr_passwd (Mac OS X returns - # "*" in getgrall() and "" in getgrgid()) for e in entries: self.check_value(e) - entriesbygid.setdefault(e.gr_gid, []).append(e) - entriesbyname.setdefault(e.gr_name, []).append(e) for e in entries: e2 = grp.getgrgid(e.gr_gid) self.check_value(e2) ! # make sure that at least one of the entries ! # for this gid compares equal to e2 ! self.assert_(max([self.valueseq(e2, x) \ ! for x in entriesbygid[e.gr_gid]])) e2 = grp.getgrnam(e.gr_name) self.check_value(e2) ! # make sure that at least one of the entries ! # for this name compares equal to e2 ! self.assert_(max([self.valueseq(e2, x) \ ! for x in entriesbyname[e.gr_name]])) def test_errors(self): --- 20,36 ---- self.assert_(isinstance(value.gr_mem, list)) def test_values(self): entries = grp.getgrall() for e in entries: self.check_value(e) for e in entries: e2 = grp.getgrgid(e.gr_gid) self.check_value(e2) ! self.assertEqual(e2.gr_gid, e.gr_gid) e2 = grp.getgrnam(e.gr_name) self.check_value(e2) ! self.assertEqual(e2.gr_name, e.gr_name) def test_errors(self): From tim_one@users.sourceforge.net Mon May 5 21:39:46 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 05 May 2003 13:39:46 -0700 Subject: [Python-checkins] python/dist/src/Objects longobject.c,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11556/python/Objects Modified Files: longobject.c Log Message: SF patch 730594: assert from longobject.c, line 1215. Some version of gcc in the "RTEMS port running on the Coldfire (m5200) processor" generates bad code for a loop in long_from_binary_base(), comparing the wrong half of an int to a short. The patch changes the decl of the short temp to be an int temp instead. This "simplifies" the code enough that gcc no longer blows it. Index: longobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/longobject.c,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** longobject.c 1 May 2003 21:31:53 -0000 1.159 --- longobject.c 5 May 2003 20:39:43 -0000 1.160 *************** *** 1202,1207 **** pdigit = z->ob_digit; while (--p >= start) { ! unsigned char ch = (unsigned char)*p; ! digit k; if (ch <= '9') --- 1202,1207 ---- pdigit = z->ob_digit; while (--p >= start) { ! int k; ! char ch = *p; if (ch <= '9') *************** *** 1213,1218 **** k = ch - 'A' + 10; } ! assert(k < base); ! accum |= k << bits_in_accum; bits_in_accum += bits_per_char; if (bits_in_accum >= SHIFT) { --- 1213,1218 ---- k = ch - 'A' + 10; } ! assert(k >= 0 && k < base); ! accum |= (twodigits)(k << bits_in_accum); bits_in_accum += bits_per_char; if (bits_in_accum >= SHIFT) { From rhettinger@users.sourceforge.net Mon May 5 22:31:54 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 05 May 2003 14:31:54 -0700 Subject: [Python-checkins] python/dist/src/Objects dictnotes.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8919 Modified Files: dictnotes.txt Log Message: Add notes from python-dev about readonly dictionaries. Index: dictnotes.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictnotes.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** dictnotes.txt 4 May 2003 21:25:19 -0000 1.2 --- dictnotes.txt 5 May 2003 21:31:51 -0000 1.3 *************** *** 198,199 **** --- 198,220 ---- the need to test for dummy entries on each probe. The preconditions for this strategy arise in symbol tables and in the builtin dictionary. + + + Readonly Dictionaries + --------------------- + Some dictionary use cases pass through a build stage and then move to a + more heavily exercised lookup stage with no further changes to the + dictionary. + + An idea that emerged on python-dev is to be able to convert a dictionary + to a read-only state. This can help prevent programming errors and also + provide knowledge that can be exploited for lookup optimization. + + The dictionary can be immediately rebuilt (eliminating dummy entries), + resized (to an appropriate level of sparseness), and the keys can be + jostled (to minimize collisions). The lookdict() routine can then + eliminate the test for dummy entries (saving about 1/4 of the time + spend in the collision resolution loop). + + An additional possibility is to insert links into the empty spaces + so that dictionary iteration can proceed in len(d) steps instead of + (mp->mask + 1) steps. From loewis@users.sourceforge.net Mon May 5 23:00:20 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 05 May 2003 15:00:20 -0700 Subject: [Python-checkins] python/dist/src configure,1.396,1.397 configure.in,1.407,1.408 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv21154 Modified Files: configure configure.in Log Message: Patch #732479: Fix typos. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.396 retrieving revision 1.397 diff -C2 -d -r1.396 -r1.397 *** configure 5 May 2003 05:13:16 -0000 1.396 --- configure 5 May 2003 22:00:01 -0000 1.397 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.406 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.407 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 12825,12828 **** --- 12825,12829 ---- #include "confdefs.h" + #include #include #include *************** *** 12878,12882 **** #include "confdefs.h" ! #include #ifdef F77_DUMMY_MAIN --- 12879,12883 ---- #include "confdefs.h" ! #include #ifdef F77_DUMMY_MAIN Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.407 retrieving revision 1.408 diff -C2 -d -r1.407 -r1.408 *** configure.in 5 May 2003 05:13:18 -0000 1.407 --- configure.in 5 May 2003 22:00:11 -0000 1.408 *************** *** 2004,2007 **** --- 2004,2008 ---- AC_TRY_COMPILE([ #include "confdefs.h" + #include #include #include *************** *** 2016,2020 **** AC_TRY_COMPILE([ #include "confdefs.h" ! #include ], void* p = setgroups, --- 2017,2021 ---- AC_TRY_COMPILE([ #include "confdefs.h" ! #include ], void* p = setgroups, From rhettinger@users.sourceforge.net Mon May 5 23:22:13 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 05 May 2003 15:22:13 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.144,2.145 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv30762 Modified Files: dictobject.c Log Message: SF patch #729395: Dictionary tuning * Increase dictionary growth rate resulting in more sparse dictionaries, fewer lookup collisions, increased memory use, and better cache performance. For dicts with over 50k entries, keep the current growth rate in case an application is suffering from tight memory constraints. * Set the most common case (no resize) to fall-through the test. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.144 retrieving revision 2.145 diff -C2 -d -r2.144 -r2.145 *** dictobject.c 3 May 2003 06:51:59 -0000 2.144 --- dictobject.c 5 May 2003 22:22:10 -0000 2.145 *************** *** 532,546 **** Py_INCREF(key); insertdict(mp, key, hash, value); ! /* If we added a key, we can safely resize. Otherwise skip this! ! * If fill >= 2/3 size, adjust size. Normally, this doubles the ! * size, but it's also possible for the dict to shrink (if ma_fill is ! * much larger than ma_used, meaning a lot of dict keys have been ! * deleted). */ ! if (mp->ma_used > n_used && mp->ma_fill*3 >= (mp->ma_mask+1)*2) { ! if (dictresize(mp, mp->ma_used*2) != 0) ! return -1; ! } ! return 0; } --- 532,552 ---- Py_INCREF(key); insertdict(mp, key, hash, value); ! /* If we added a key, we can safely resize. Otherwise just return! ! * If fill >= 2/3 size, adjust size. Normally, this doubles or ! * quaduples the size, but it's also possible for the dict to shrink ! * (if ma_fill is much larger than ma_used, meaning a lot of dict ! * keys have been * deleted). ! * ! * Quadrupling the size improves average dictionary sparseness ! * (reducing collisions) at the cost of some memory and iteration ! * speed (which loops over every possible entry). It also halves ! * the number of expensive resize operations in a growing dictionary. ! * ! * Very large dictionaries (over 50K items) use doubling instead. ! * This may help applications with severe memory constraints. */ ! if (!(mp->ma_used > n_used && mp->ma_fill*3 >= (mp->ma_mask+1)*2)) ! return 0; ! return dictresize(mp, mp->ma_used*(mp->ma_used>50000 ? 2 : 4)); } From doerwalter@users.sourceforge.net Tue May 6 09:57:43 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Tue, 06 May 2003 01:57:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_uu.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18131/Lib/test Modified Files: test_uu.py Log Message: Port test_uu.py to PyUnit. From SF patch #662807. Index: test_uu.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_uu.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_uu.py 9 Aug 2002 16:37:36 -0000 1.5 --- test_uu.py 6 May 2003 08:57:41 -0000 1.6 *************** *** 4,157 **** """ ! from test.test_support import verify, TestFailed, verbose, TESTFN ! import sys, os import uu from StringIO import StringIO ! teststr = "The smooth-scaled python crept over the sleeping dog\n" ! expected = """\ M5&AE('-M;V]T:\"US8V%L960@<'ET:&]N(&-R97!T(&]V97(@=&AE('-L965P (:6YG(&1O9PH """ - encoded1 = "begin 666 t1\n"+expected+"\n \nend\n" - if verbose: - print '1. encode file->file' - inp = StringIO(teststr) - out = StringIO() - uu.encode(inp, out, "t1") - verify(out.getvalue() == encoded1) - inp = StringIO(teststr) - out = StringIO() - uu.encode(inp, out, "t1", 0644) - verify(out.getvalue() == "begin 644 t1\n"+expected+"\n \nend\n") ! if verbose: ! print '2. decode file->file' ! inp = StringIO(encoded1) ! out = StringIO() ! uu.decode(inp, out) ! verify(out.getvalue() == teststr) ! inp = StringIO("""UUencoded files may contain many lines, ! even some that have 'begin' in them.\n"""+encoded1) ! out = StringIO() ! uu.decode(inp, out) ! verify(out.getvalue() == teststr) ! stdinsave = sys.stdin ! stdoutsave = sys.stdout ! try: ! if verbose: ! print '3. encode stdin->stdout' ! sys.stdin = StringIO(teststr) ! sys.stdout = StringIO() ! uu.encode("-", "-", "t1", 0666) ! verify(sys.stdout.getvalue() == encoded1) ! if verbose: ! print >>stdoutsave, '4. decode stdin->stdout' ! sys.stdin = StringIO(encoded1) ! sys.stdout = StringIO() ! uu.decode("-", "-") ! verify(sys.stdout.getvalue() == teststr) ! finally: ! sys.stdin = stdinsave ! sys.stdout = stdoutsave ! if verbose: ! print '5. encode file->file' ! tmpIn = TESTFN + "i" ! tmpOut = TESTFN + "o" ! try: ! fin = open(tmpIn, 'wb') ! fin.write(teststr) ! fin.close() ! fin = open(tmpIn, 'rb') ! fout = open(tmpOut, 'w') ! uu.encode(fin, fout, tmpIn, mode=0644) ! fin.close() ! fout.close() ! fout = open(tmpOut, 'r') ! s = fout.read() ! fout.close() ! verify(s == 'begin 644 ' + tmpIn + '\n' + expected + '\n \nend\n') ! os.unlink(tmpIn) ! if verbose: ! print '6. decode file-> file' ! uu.decode(tmpOut) ! fin = open(tmpIn, 'rb') ! s = fin.read() ! fin.close() ! verify(s == teststr) ! # XXX is there an xp way to verify the mode? ! finally: ! try: ! fin.close() ! except: ! pass ! try: ! fout.close() ! except: ! pass ! try: ! os.unlink(tmpIn) ! except: ! pass ! try: ! os.unlink(tmpOut) ! except: ! pass ! if verbose: ! print '7. error: truncated input' ! inp = StringIO("begin 644 t1\n"+expected) ! out = StringIO() ! try: ! uu.decode(inp, out) ! raise TestFailed("No exception thrown") ! except uu.Error, e: ! verify(str(e) == 'Truncated input file') ! if verbose: ! print '8. error: missing begin' ! inp = StringIO("") ! out = StringIO() ! try: ! uu.decode(inp, out) ! raise TestFailed("No exception thrown") ! except uu.Error, e: ! verify(str(e) == 'No valid begin line found in input file') ! # Test to verify that decode() will refuse to overwrite an existing file ! outfile = TESTFN + "out" ! inp = StringIO('Here is a message to be uuencoded') ! out = StringIO() ! uu.encode(inp, out, outfile) ! out.seek(0) ! try: ! if verbose: ! print '9. decode w/file not exists is okay' ! uu.decode(out) ! if not os.path.exists(outfile): ! raise TestFailed('uudecode w/ out_file=None failed') ! fp = open(outfile) ! data = fp.read() ! fp.close() ! if data <> inp.getvalue(): ! raise TestFailed('uudecode stored something weird') ! # Try to write it again, which should cause a failure ! if verbose: ! print '10. uudecode w/file exists fails' ! out.seek(0) ! try: ! uu.decode(out) ! except uu.Error: ! pass ! else: ! raise TestFailed('expected to get a "file exists" error') ! finally: ! try: ! os.unlink(outfile) ! except OSError: ! pass --- 4,172 ---- """ ! import unittest ! from test import test_support ! ! import sys, os, uu, cStringIO import uu from StringIO import StringIO ! plaintext = "The smooth-scaled python crept over the sleeping dog\n" ! ! encodedtext = """\ M5&AE('-M;V]T:\"US8V%L960@<'ET:&]N(&-R97!T(&]V97(@=&AE('-L965P (:6YG(&1O9PH """ ! encodedtextwrapped = "begin %03o %s\n" + encodedtext.replace("%", "%%") + "\n \nend\n" ! class UUTest(unittest.TestCase): ! def test_encode(self): ! inp = cStringIO.StringIO(plaintext) ! out = cStringIO.StringIO() ! uu.encode(inp, out, "t1") ! self.assertEqual(out.getvalue(), encodedtextwrapped % (0666, "t1")) ! inp = cStringIO.StringIO(plaintext) ! out = cStringIO.StringIO() ! uu.encode(inp, out, "t1", 0644) ! self.assertEqual(out.getvalue(), encodedtextwrapped % (0644, "t1")) ! def test_decode(self): ! inp = cStringIO.StringIO(encodedtextwrapped % (0666, "t1")) ! out = cStringIO.StringIO() ! uu.decode(inp, out) ! self.assertEqual(out.getvalue(), plaintext) ! inp = cStringIO.StringIO( ! "UUencoded files may contain many lines,\n" + ! "even some that have 'begin' in them.\n" + ! encodedtextwrapped % (0666, "t1") ! ) ! out = cStringIO.StringIO() ! uu.decode(inp, out) ! self.assertEqual(out.getvalue(), plaintext) ! def test_truncatedinput(self): ! inp = cStringIO.StringIO("begin 644 t1\n" + encodedtext) ! out = cStringIO.StringIO() ! try: ! uu.decode(inp, out) ! self.fail("No exception thrown") ! except uu.Error, e: ! self.assertEqual(str(e), "Truncated input file") ! def test_missingbegin(self): ! inp = cStringIO.StringIO("") ! out = cStringIO.StringIO() ! try: ! uu.decode(inp, out) ! self.fail("No exception thrown") ! except uu.Error, e: ! self.assertEqual(str(e), "No valid begin line found in input file") ! class UUStdIOTest(unittest.TestCase): ! def setUp(self): ! self.stdin = sys.stdin ! self.stdout = sys.stdout ! def tearDown(self): ! sys.stdin = self.stdin ! sys.stdout = self.stdout ! def test_encode(self): ! sys.stdin = cStringIO.StringIO(plaintext) ! sys.stdout = cStringIO.StringIO() ! uu.encode("-", "-", "t1", 0666) ! self.assertEqual( ! sys.stdout.getvalue(), ! encodedtextwrapped % (0666, "t1") ! ) ! ! def test_decode(self): ! sys.stdin = cStringIO.StringIO(encodedtextwrapped % (0666, "t1")) ! sys.stdout = cStringIO.StringIO() ! uu.decode("-", "-") ! self.assertEqual(sys.stdout.getvalue(), plaintext) ! ! class UUFileTest(unittest.TestCase): ! ! def _kill(self, f): ! # close and remove file ! try: ! f.close() ! except (SystemExit, KeyboardInterrupt): ! raise ! except: ! pass ! try: ! os.unlink(f.name) ! except (SystemExit, KeyboardInterrupt): ! raise ! except: ! pass ! ! def setUp(self): ! self.tmpin = test_support.TESTFN + "i" ! self.tmpout = test_support.TESTFN + "o" ! ! def tearDown(self): ! del self.tmpin ! del self.tmpout ! ! def test_encode(self): ! try: ! fin = open(self.tmpin, 'wb') ! fin.write(plaintext) ! fin.close() ! ! fin = open(self.tmpin, 'rb') ! fout = open(self.tmpout, 'w') ! uu.encode(fin, fout, self.tmpin, mode=0644) ! fin.close() ! fout.close() ! ! fout = open(self.tmpout, 'r') ! s = fout.read() ! fout.close() ! self.assertEqual(s, encodedtextwrapped % (0644, self.tmpin)) ! finally: ! self._kill(fin) ! self._kill(fout) ! ! def test_decode(self): ! try: ! f = open(self.tmpin, 'wb') ! f.write(encodedtextwrapped % (0644, self.tmpout)) ! f.close() ! ! f = open(self.tmpin, 'rb') ! uu.decode(f) ! f.close() ! ! f = open(self.tmpout, 'r') ! s = f.read() ! f.close() ! self.assertEqual(s, plaintext) ! # XXX is there an xp way to verify the mode? ! finally: ! self._kill(f) ! ! def test_decodetwice(self): ! # Verify that decode() will refuse to overwrite an existing file ! try: ! f = cStringIO.StringIO(encodedtextwrapped % (0644, self.tmpout)) ! ! f = open(self.tmpin, 'rb') ! uu.decode(f) ! f.close() ! ! f = open(self.tmpin, 'rb') ! self.assertRaises(uu.Error, uu.decode, f) ! f.close() ! finally: ! self._kill(f) ! ! def test_main(): ! test_support.run_unittest(UUTest, UUStdIOTest, UUFileTest) ! ! if __name__=="__main__": ! test_main() From rhettinger@users.sourceforge.net Tue May 6 10:01:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 May 2003 02:01:44 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.61,2.62 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv19382 Modified Files: funcobject.c Log Message: SF bug #692959: new.function ignores keyword arguments Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.61 retrieving revision 2.62 diff -C2 -d -r2.61 -r2.62 *** funcobject.c 8 Apr 2003 21:28:47 -0000 2.61 --- funcobject.c 6 May 2003 09:01:41 -0000 2.62 *************** *** 317,322 **** PyFunctionObject *newfunc; int nfree, nclosure; ! if (!PyArg_ParseTuple(args, "O!O!|OOO:function", &PyCode_Type, &code, &PyDict_Type, &globals, --- 317,325 ---- PyFunctionObject *newfunc; int nfree, nclosure; + static char *kwlist[] = {"code", "globals", "name", + "argdefs", "closure", 0}; ! if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!|OOO:function", ! kwlist, &PyCode_Type, &code, &PyDict_Type, &globals, From jackjansen@users.sourceforge.net Tue May 6 13:44:03 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 May 2003 05:44:03 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv13618 Modified Files: pimp.py Log Message: When doing a forced install of a package depending on a pseudo-package you got a strange error message. Fixed. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pimp.py 2 May 2003 20:27:40 -0000 1.19 --- pimp.py 6 May 2003 12:44:00 -0000 1.20 *************** *** 133,137 **** names = [member.name for member in skip if member.name[-1] != '/'] if names: ! return "Not all files were unpacked: %s" % " ".join(names) ARCHIVE_FORMATS = [ --- 133,137 ---- names = [member.name for member in skip if member.name[-1] != '/'] if names: ! return "Not all files were unpacked: %s" % " ".join(names) ARCHIVE_FORMATS = [ *************** *** 469,472 **** --- 469,477 ---- rv = [] if not self._dict.get('Download-URL'): + # For pseudo-packages that are already installed we don't + # return an error message + status, _ = self.installed() + if status == "yes": + return [] return [(None, "%s: This package cannot be installed automatically (no Download-URL field)" % From jackjansen@users.sourceforge.net Tue May 6 14:07:35 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 May 2003 06:07:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv23514 Modified Files: pimp.py Log Message: Allow for Version, Flavor and Download-URL not being set. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** pimp.py 6 May 2003 12:44:00 -0000 1.20 --- pimp.py 6 May 2003 13:07:32 -0000 1.21 *************** *** 381,389 **** def name(self): return self._dict['Name'] ! def version(self): return self._dict['Version'] ! def flavor(self): return self._dict['Flavor'] def description(self): return self._dict['Description'] def homepage(self): return self._dict.get('Home-page') ! def downloadURL(self): return self._dict['Download-URL'] def fullname(self): --- 381,389 ---- def name(self): return self._dict['Name'] ! def version(self): return self._dict.get('Version') ! def flavor(self): return self._dict.get('Flavor') def description(self): return self._dict['Description'] def homepage(self): return self._dict.get('Home-page') ! def downloadURL(self): return self._dict.get('Download-URL') def fullname(self): From jackjansen@users.sourceforge.net Tue May 6 15:28:35 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 06 May 2003 07:28:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyConsole.py,1.15,1.16 PyEdit.py,1.39,1.40 PythonIDEMain.py,1.34,1.35 Wapplication.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv28244 Modified Files: PyConsole.py PyEdit.py PythonIDEMain.py Wapplication.py Log Message: Fix for #731643: allow "lookup in documentation" to also work if the interactive window is frontmost. Index: PyConsole.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** PyConsole.py 6 Feb 2003 22:32:35 -0000 1.15 --- PyConsole.py 6 May 2003 14:28:30 -0000 1.16 *************** *** 237,241 **** prefs.save() ! class OutputTextWidget(W.EditText): --- 237,243 ---- prefs.save() ! def getselectedtext(self): ! return self.consoletext.getselectedtext() ! class OutputTextWidget(W.EditText): Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** PyEdit.py 25 Feb 2003 15:08:01 -0000 1.39 --- PyEdit.py 6 May 2003 14:28:31 -0000 1.40 *************** *** 169,172 **** --- 169,175 ---- def setselection(self, selstart, selend): self.editgroup.editor.setselection(selstart, selend) + + def getselectedtext(self): + return self.editgroup.editor.getselectedtext() def getfilename(self): Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** PythonIDEMain.py 2 May 2003 23:40:29 -0000 1.34 --- PythonIDEMain.py 6 May 2003 14:28:31 -0000 1.35 *************** *** 415,422 **** def _getsearchstring(self): ! import PyEdit ! editor = PyEdit.findeditor(None, fromtop=1) ! if editor: ! text = editor.getselectedtext() if text: return text --- 415,422 ---- def _getsearchstring(self): ! # First we get the frontmost window ! front = self.getfrontwindow() ! if front and hasattr(front, 'getselectedtext'): ! text = front.getselectedtext() if text: return text Index: Wapplication.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wapplication.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Wapplication.py 6 Feb 2003 22:32:35 -0000 1.21 --- Wapplication.py 6 May 2003 14:28:31 -0000 1.22 *************** *** 132,135 **** --- 132,141 ---- apply(handler, args) return 1 + + def getfrontwindow(self): + wid = MyFrontWindow() + if wid and self._windows.has_key(wid): + return self._windows[wid] + return None def appendwindow(self, wid, window): From montanaro@users.sourceforge.net Tue May 6 16:30:23 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 08:30:23 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.121,1.122 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv30258 Modified Files: Makefile.pre.in Log Message: add testall target - just adds -uall to the regrtest runs Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** Makefile.pre.in 17 Apr 2003 14:55:39 -0000 1.121 --- Makefile.pre.in 6 May 2003 15:30:20 -0000 1.122 *************** *** 523,526 **** --- 523,531 ---- $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) + testall: all platform + -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f + -$(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall + $(TESTPYTHON) $(TESTPROG) $(TESTOPTS) -uall + QUICKTESTOPTS= $(TESTOPTS) -x test_thread test_signal test_strftime \ test_unicodedata test_re test_sre test_select test_poll \ From montanaro@users.sourceforge.net Tue May 6 16:56:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 08:56:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10838 Modified Files: test_csv.py Log Message: add not-yet-supported Unicode test just so it doesn't get lost. Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_csv.py 1 May 2003 17:45:36 -0000 1.6 --- test_csv.py 6 May 2003 15:56:05 -0000 1.7 *************** *** 1,2 **** --- 1,3 ---- + # -*- coding: iso-8859-1 -*- # Copyright (C) 2001,2002 Python Software Foundation # csv package unit tests *************** *** 640,643 **** --- 641,663 ---- # if writer leaks during write, last delta should be 5 or more self.assertEqual(delta < 5, True) + + # commented out for now - csv module doesn't yet support Unicode + if 0: + from StringIO import StringIO + import csv + + class TestUnicode(unittest.TestCase): + def test_unicode_read(self): + import codecs + f = codecs.EncodedFile(StringIO("Martin von Löwis," + "Marc André Lemburg," + "Guido van Rossum," + "François Pinard\r\n"), + data_encoding='iso-8859-1') + reader = csv.reader(f) + self.assertEqual(list(reader), [[u"Martin von Löwis", + u"Marc André Lemburg", + u"Guido van Rossum", + u"François Pinardn"]]) def test_main(): From montanaro@users.sourceforge.net Tue May 6 17:17:30 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 09:17:30 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.122,1.123 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv20452 Modified Files: Makefile.pre.in Log Message: add Guido's reasoning behind running all tests twice Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** Makefile.pre.in 6 May 2003 15:30:20 -0000 1.122 --- Makefile.pre.in 6 May 2003 16:17:27 -0000 1.123 *************** *** 515,518 **** --- 515,525 ---- # Test the interpreter (twice, once without .pyc files, once with) + # In the past, we've had problems where bugs in the marshalling or + # elsewhere caused bytecode read from .pyc files to behave differently + # than bytecode generated directly from a .py source file. Sometimes + # the bytecode read from a .pyc file had the bug, somtimes the directly + # generated bytecode. This is sometimes a very shy bug needing a lot of + # sample data. + TESTOPTS= -l TESTPROG= $(srcdir)/Lib/test/regrtest.py From montanaro@users.sourceforge.net Tue May 6 21:36:30 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:36:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.138,1.139 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17228 Modified Files: regrtest.py Log Message: the new bsddb185 module is an expected skip on most platforms (this may not be needed - just being anal) Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.138 retrieving revision 1.139 diff -C2 -d -r1.138 -r1.139 *** regrtest.py 24 Apr 2003 19:05:41 -0000 1.138 --- regrtest.py 6 May 2003 20:36:24 -0000 1.139 *************** *** 556,559 **** --- 556,560 ---- """ test_al + test_bsddb185 test_bsddb3 test_cd *************** *** 591,594 **** --- 592,596 ---- """ test_al + test_bsddb185 test_cd test_cl *************** *** 610,613 **** --- 612,616 ---- test_atexit test_bsddb + test_bsddb185 test_bsddb3 test_bz2 *************** *** 652,655 **** --- 655,659 ---- test_al test_bsddb + test_bsddb185 test_cd test_cl *************** *** 672,675 **** --- 676,680 ---- test_al test_bsddb + test_bsddb185 test_cd test_cl *************** *** 693,696 **** --- 698,702 ---- test_asynchat test_bsddb + test_bsddb185 test_cd test_cl *************** *** 722,725 **** --- 728,732 ---- test_asynchat test_bsddb + test_bsddb185 test_cd test_cl *************** *** 782,785 **** --- 789,793 ---- test_al test_bsddb + test_bsddb185 test_cd test_cl *************** *** 801,804 **** --- 809,813 ---- test_al test_bsddb + test_bsddb185 test_cd test_cl *************** *** 825,828 **** --- 834,838 ---- """ test_al + test_bsddb185 test_cd test_cl *************** *** 848,851 **** --- 858,862 ---- """ test_al + test_bsddb185 test_bsddb3 test_cd *************** *** 869,872 **** --- 880,884 ---- test_al test_audioop + test_bsddb185 test_bsddb3 test_cd From montanaro@users.sourceforge.net Tue May 6 21:37:01 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:37:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb185.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17550 Added Files: test_bsddb185.py Log Message: test case for bsddb185 module --- NEW FILE: test_bsddb185.py --- from test.test_support import verbose, run_unittest, findfile import unittest import bsddb185 import anydbm import whichdb import os import tempfile class Bsddb185Tests(unittest.TestCase): def test_open_existing_hash(self): "verify we can open a file known to be a hash v2 file" # do we need to worry about big vs little endian? db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") db.close() def test_whichdb(self): "verify that whichdb correctly sniffs the known hash v2 file" self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") def test_anydbm_create(self): "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") anydbm.open(dbfile, "c").close() ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: os.unlink(dbfile) finally: os.rmdir(tmpdir) def test_main(): run_unittest(Bsddb185Tests) if __name__ == "__main__": test_main() From montanaro@users.sourceforge.net Tue May 6 21:37:28 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:37:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test 185test.db,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17620/Lib/test Added Files: 185test.db Log Message: Data file for bsddb185 test --- NEW FILE: 185test.db --- (This appears to be a binary file; contents omitted.) From montanaro@users.sourceforge.net Tue May 6 21:37:58 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:37:58 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb185.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18047 Modified Files: test_bsddb185.py Log Message: don't need to worry about file endianness Index: test_bsddb185.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb185.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_bsddb185.py 6 May 2003 20:36:57 -0000 1.1 --- test_bsddb185.py 6 May 2003 20:37:56 -0000 1.2 *************** *** 11,15 **** def test_open_existing_hash(self): "verify we can open a file known to be a hash v2 file" - # do we need to worry about big vs little endian? db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") --- 11,14 ---- From montanaro@users.sourceforge.net Tue May 6 21:38:55 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:38:55 -0700 Subject: [Python-checkins] python/dist/src/Modules bsddbmodule.c,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18646 Modified Files: bsddbmodule.c Log Message: add open function to bsddb185 module so the file format sniffing can be restricted to the whichdb module Index: bsddbmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/bsddbmodule.c,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** bsddbmodule.c 19 Nov 2002 08:09:52 -0000 1.38 --- bsddbmodule.c 6 May 2003 20:38:52 -0000 1.39 *************** *** 839,842 **** --- 839,844 ---- {"btopen", (PyCFunction)bsdbtopen, METH_VARARGS}, {"rnopen", (PyCFunction)bsdrnopen, METH_VARARGS}, + /* strictly for use by dbhhash!!! */ + {"open", (PyCFunction)bsdhashopen, METH_VARARGS}, {0, 0}, }; From montanaro@users.sourceforge.net Tue May 6 21:39:57 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:39:57 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19130 Modified Files: libbsddb.tex Log Message: add a note about the undocumented bsddb185 module Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libbsddb.tex 17 Nov 2002 11:09:50 -0000 1.8 --- libbsddb.tex 6 May 2003 20:39:55 -0000 1.9 *************** *** 87,90 **** --- 87,96 ---- \end{seealso} + \begin{notice} + Beginning in 2.3 some Unix versions of Python may have a \module{bsddb185} + module. This is present \emph{only} to allow backwards compatibility with + systems which ship with the old Berkeley DB 1.85 database library. The + \module{bsddb185} module should never be used directly in new code. + \end{notice} \subsection{Hash, BTree and Record Objects \label{bsddb-objects}} From montanaro@users.sourceforge.net Tue May 6 21:40:20 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:40:20 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libundoc.tex,1.84,1.85 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19329 Modified Files: libundoc.tex Log Message: add a note about the undocumented bsddb185 module Index: libundoc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libundoc.tex,v retrieving revision 1.84 retrieving revision 1.85 diff -C2 -d -r1.84 -r1.85 *** libundoc.tex 24 Apr 2003 15:24:46 -0000 1.84 --- libundoc.tex 6 May 2003 20:40:17 -0000 1.85 *************** *** 63,66 **** --- 63,72 ---- \end{description} + \item[\module{bsddb185}] + --- Backwards compatibility module for systems which still use the Berkeley + DB 1.85 module. It is normally only available on certain BSD Unix-based + systems. It should never be used directly. + \end{description} + \section{Multimedia} From montanaro@users.sourceforge.net Tue May 6 21:42:13 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:42:13 -0700 Subject: [Python-checkins] python/dist/src/Lib whichdb.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20191 Modified Files: whichdb.py Log Message: detect old version 2 hash files and return "bsddb185" as the appropriate module to load them Index: whichdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/whichdb.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** whichdb.py 2 Aug 2002 17:12:15 -0000 1.13 --- whichdb.py 6 May 2003 20:42:10 -0000 1.14 *************** *** 87,95 **** return "gdbm" ! # Check for BSD hash if magic in (0x00061561, 0x61150600): ! return "dbhash" ! # BSD hash v2 has a 12-byte NULL pad in front of the file type try: (magic,) = struct.unpack("=l", s16[-4:]) --- 87,96 ---- return "gdbm" ! # Check for old Berkeley db hash file format v2 if magic in (0x00061561, 0x61150600): ! return "bsddb185" ! # Later versions of Berkeley db hash file have a 12-byte pad in ! # front of the file type try: (magic,) = struct.unpack("=l", s16[-4:]) From montanaro@users.sourceforge.net Tue May 6 21:42:39 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:42:39 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.756,1.757 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20438 Modified Files: NEWS Log Message: add note about bsddb185 module Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.756 retrieving revision 1.757 diff -C2 -d -r1.756 -r1.757 *** NEWS 4 May 2003 04:16:51 -0000 1.756 --- NEWS 6 May 2003 20:42:37 -0000 1.757 *************** *** 22,25 **** --- 22,29 ---- Fixes SF bug #730685. + - the bsddb185 module is built in one restricted instance - + /usr/include/db.h exists and defines HASHVERSION to be 2. This is true + for many BSD-derived systems. + Library ------- From montanaro@users.sourceforge.net Tue May 6 21:43:37 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:43:37 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.162,1.163 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv20887 Modified Files: setup.py Log Message: build bsddb185 module in certain restricted circumstances Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.162 retrieving revision 1.163 diff -C2 -d -r1.162 -r1.163 *** setup.py 3 May 2003 08:45:51 -0000 1.162 --- setup.py 6 May 2003 20:43:34 -0000 1.163 *************** *** 288,291 **** --- 288,296 ---- inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) + # OSF/1 has some stuff in /usr/ccs/lib (like -ldb) + if platform[:4] == 'osf1': + platform = 'osf1' + lib_dirs += ['/usr/ccs/lib'] + # Check for MacOS X, which doesn't need libm.a at all math_libs = ['m'] *************** *** 560,563 **** --- 565,591 ---- dblibs = [] dblib_dir = None + + + # Look for Berkeley db 1.85. Note that it is built as a different + # module name so it can be included even when later versions are + # available. A very restrictive search is performed to avoid + # accidentally building this module with a later version of the + # underlying db library. May BSD-ish Unixes incorporate db 1.85 + # symbols into libc and place the include file in /usr/include. + f = "/usr/include/db.h" + if os.path.exists(f): + data = open(f).read() + m = re.search(r"#s*define\s+HASHVERSION\s+2\s*", data) + if m is not None: + # bingo - old version used hash file format version 2 + ### XXX this should be fixed to not be platform-dependent + ### but I don't have direct access to an osf1 platform and + ### seemed to be muffing the search somehow + libraries = platform == "osf1" and ['db'] or None + if libraries is not None: + exts.append(Extension('bsddb185', ['bsddbmodule.c'], + libraries=libraries)) + else: + exts.append(Extension('bsddb185', ['bsddbmodule.c'])) # The standard Unix dbm module: From montanaro@users.sourceforge.net Tue May 6 21:59:59 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue, 06 May 2003 13:59:59 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.163,1.164 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv28626a Modified Files: setup.py Log Message: p.strip(os.sep) can't have possibly worked. It would have stripped both leading and trailing '/' characters on Unix systems. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** setup.py 6 May 2003 20:43:34 -0000 1.163 --- setup.py 6 May 2003 20:59:57 -0000 1.164 *************** *** 60,65 **** for p in std_dirs: # Ensure path doesn't end with path separator ! if p.endswith(os.sep): ! p = p.strip(os.sep) if p == dirname: return [ ] --- 60,64 ---- for p in std_dirs: # Ensure path doesn't end with path separator ! p = p.rstrip(os.sep) if p == dirname: return [ ] *************** *** 69,74 **** for p in paths: # Ensure path doesn't end with path separator ! if p.endswith(os.sep): ! p = p.strip(os.sep) if p == dirname: return [p] --- 68,72 ---- for p in paths: # Ensure path doesn't end with path separator ! p = p.rstrip(os.sep) if p == dirname: return [p] From gward@users.sourceforge.net Wed May 7 01:03:15 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 06 May 2003 17:03:15 -0700 Subject: [Python-checkins] python/nondist/peps pep-0001.txt,1.42,1.43 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4374 Modified Files: pep-0001.txt Log Message: Grammar fix. Index: pep-0001.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0001.txt,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** pep-0001.txt 3 May 2003 16:01:32 -0000 1.42 --- pep-0001.txt 7 May 2003 00:03:13 -0000 1.43 *************** *** 51,55 **** The PEP process begins with a new idea for Python. It is highly recommended that a single PEP contain a single key proposal or new ! idea. The more focussed the PEP, the more successfully it tends to be. The PEP editor reserves the right to reject PEP proposals if they appear too unfocussed or too broad. If in doubt, split your PEP into --- 51,55 ---- The PEP process begins with a new idea for Python. It is highly recommended that a single PEP contain a single key proposal or new ! idea. The more focussed the PEP, the more successful it tends to be. The PEP editor reserves the right to reject PEP proposals if they appear too unfocussed or too broad. If in doubt, split your PEP into From rhettinger@users.sourceforge.net Wed May 7 01:49:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 May 2003 17:49:43 -0700 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.145,2.146 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv17525 Modified Files: dictobject.c Log Message: SF patch #729395: Dictionary tuning Adjust resize argument for dict.update() and dict.copy(). Extends the previous change to dict.__setitem__(). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.145 retrieving revision 2.146 diff -C2 -d -r2.145 -r2.146 *** dictobject.c 5 May 2003 22:22:10 -0000 2.145 --- dictobject.c 7 May 2003 00:49:40 -0000 2.146 *************** *** 1152,1156 **** */ if ((mp->ma_fill + other->ma_used)*3 >= (mp->ma_mask+1)*2) { ! if (dictresize(mp, (mp->ma_used + other->ma_used)*3/2) != 0) return -1; } --- 1152,1156 ---- */ if ((mp->ma_fill + other->ma_used)*3 >= (mp->ma_mask+1)*2) { ! if (dictresize(mp, (mp->ma_used + other->ma_used)*2) != 0) return -1; } *************** *** 1237,1241 **** return NULL; if (mp->ma_used > 0) { ! if (dictresize(copy, mp->ma_used*3/2) != 0) return NULL; for (i = 0; i <= mp->ma_mask; i++) { --- 1237,1241 ---- return NULL; if (mp->ma_used > 0) { ! if (dictresize(copy, mp->ma_used*2) != 0) return NULL; for (i = 0; i <= mp->ma_mask; i++) { From gward@users.sourceforge.net Wed May 7 01:54:45 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 06 May 2003 17:54:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18955 Modified Files: test_textwrap.py Log Message: SF #726446: ensure wrap() raises ValueError when width <= 0. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_textwrap.py 1 May 2003 17:45:51 -0000 1.19 --- test_textwrap.py 7 May 2003 00:54:42 -0000 1.20 *************** *** 263,266 **** --- 263,272 ---- "ball,", " ", "use", " ", "the", " ", "-b", " ", "option!"]) + def test_bad_width(self): + # Ensure that width <= 0 is caught. + text = "Whatever, it doesn't matter." + self.assertRaises(ValueError, wrap, text, 0) + self.assertRaises(ValueError, wrap, text, -1) + class LongWordTestCase (BaseTestCase): From gward@users.sourceforge.net Wed May 7 01:55:39 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 06 May 2003 17:55:39 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19191 Modified Files: textwrap.py Log Message: SF #726446: raise ValueError if width <= 0. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** textwrap.py 14 Feb 2003 01:14:15 -0000 1.24 --- textwrap.py 7 May 2003 00:55:35 -0000 1.25 *************** *** 198,201 **** --- 198,203 ---- """ lines = [] + if self.width <= 0: + raise ValueError("invalid width %r (must be > 0)" % self.width) while chunks: From gward@users.sourceforge.net Wed May 7 02:19:24 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 06 May 2003 18:19:24 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv27769 Modified Files: test_textwrap.py Log Message: SF #596434: add test_funky_parens() to probe some more of the tricky edge cases that David Goodger reported long ago (July 2002?). Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_textwrap.py 7 May 2003 00:54:42 -0000 1.20 --- test_textwrap.py 7 May 2003 01:19:22 -0000 1.21 *************** *** 225,233 **** self.check_split("--text--.", ["--text--."]) ! # My initial mis-interpretation of part of the bug report -- ! # These were always handled correctly, but it can't hurt to make ! # sure that they *stay* correct! self.check_split("--option", ["--option"]) self.check_split("--option-opt", ["--option-", "opt"]) def test_initial_whitespace(self): --- 225,249 ---- self.check_split("--text--.", ["--text--."]) ! # When I first read bug #596434, this is what I thought David ! # was talking about. I was wrong; these have always worked ! # fine. The real problem is tested in test_funky_parens() ! # below... self.check_split("--option", ["--option"]) self.check_split("--option-opt", ["--option-", "opt"]) + self.check_split("foo --option-opt bar", + ["foo", " ", "--option-", "opt", " ", "bar"]) + + def test_funky_parens (self): + # Second part of SF bug #596434: long option strings inside + # parentheses. + self.check_split("foo (--option) bar", + ["foo", " ", "(--option)", " ", "bar"]) + + # Related stuff -- make sure parens work in simpler contexts. + self.check_split("foo (bar) baz", + ["foo", " ", "(bar)", " ", "baz"]) + self.check_split("blah (ding dong), wubba", + ["blah", " ", "(ding", " ", "dong),", + " ", "wubba"]) def test_initial_whitespace(self): From gward@users.sourceforge.net Wed May 7 02:21:01 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Tue, 06 May 2003 18:21:01 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28249 Modified Files: textwrap.py Log Message: SF #596434: tweak wordsep_re so the definition of an em-dash is stricter: specifically, "--" must be preceded by a limited set of characters, not by any non-whitespace character. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** textwrap.py 7 May 2003 00:55:35 -0000 1.25 --- textwrap.py 7 May 2003 01:20:58 -0000 1.26 *************** *** 76,80 **** wordsep_re = re.compile(r'(\s+|' # any whitespace r'-*\w{2,}-(?=\w{2,})|' # hyphenated words ! r'(?<=\S)-{2,}(?=\w))') # em-dash # XXX will there be a locale-or-charset-aware version of --- 76,80 ---- wordsep_re = re.compile(r'(\s+|' # any whitespace r'-*\w{2,}-(?=\w{2,})|' # hyphenated words ! r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash # XXX will there be a locale-or-charset-aware version of From rhettinger@users.sourceforge.net Wed May 7 02:28:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 May 2003 18:28:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_types.py,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv29652/Lib/test Modified Files: test_types.py Log Message: SF bug #730296: Unexpected Changes in list Iterator Reverted a Py2.3b1 change to iterator in subclasses of list and tuple. They had been changed to use __getitem__ whenever it had been overriden in the subclass. This caused some usabilty and performance problems. Also, it was inconsistent with the rest of python where many container methods access the underlying object directly without first checking for an overridden getter. Users needing a change in iterator behavior should override it directly. Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** test_types.py 24 Apr 2003 16:52:45 -0000 1.50 --- test_types.py 7 May 2003 01:28:47 -0000 1.51 *************** *** 257,265 **** vereq(list(tuple(f())), range(1000)) ! # Verify that __getitem__ overrides are recognized by __iter__ class T(tuple): def __getitem__(self, key): return str(key) + '!!!' ! vereq(iter(T()).next(), '0!!!') print '6.5.3 Lists' --- 257,265 ---- vereq(list(tuple(f())), range(1000)) ! # Verify that __getitem__ overrides are not recognized by __iter__ class T(tuple): def __getitem__(self, key): return str(key) + '!!!' ! vereq(iter(T((1,2))).next(), 1) print '6.5.3 Lists' *************** *** 454,462 **** vereq(a, [0, 1, 1, 3, 2, 5, 3, 7, 4, 9]) ! # Verify that __getitem__ overrides are recognized by __iter__ class L(list): def __getitem__(self, key): return str(key) + '!!!' ! vereq(iter(L()).next(), '0!!!') --- 454,462 ---- vereq(a, [0, 1, 1, 3, 2, 5, 3, 7, 4, 9]) ! # Verify that __getitem__ overrides are not recognized by __iter__ class L(list): def __getitem__(self, key): return str(key) + '!!!' ! vereq(iter(L([1,2])).next(), 1) From rhettinger@users.sourceforge.net Wed May 7 02:28:49 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 May 2003 18:28:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.757,1.758 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29652/Misc Modified Files: NEWS Log Message: SF bug #730296: Unexpected Changes in list Iterator Reverted a Py2.3b1 change to iterator in subclasses of list and tuple. They had been changed to use __getitem__ whenever it had been overriden in the subclass. This caused some usabilty and performance problems. Also, it was inconsistent with the rest of python where many container methods access the underlying object directly without first checking for an overridden getter. Users needing a change in iterator behavior should override it directly. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.757 retrieving revision 1.758 diff -C2 -d -r1.757 -r1.758 *** NEWS 6 May 2003 20:42:37 -0000 1.757 --- NEWS 7 May 2003 01:28:47 -0000 1.758 *************** *** 16,19 **** --- 16,24 ---- It's writable again. + - Reverted a 2.3 beta 1 change to iterators for subclasses of list and + tuple. By default, the iterators now access data elements directly + instead of going through __getitem__. If __getitem__ access is + preferred, then __iter__ can be overriden. + Extension modules ----------------- From rhettinger@users.sourceforge.net Wed May 7 02:28:49 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 06 May 2003 18:28:49 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.151,2.152 tupleobject.c,2.80,2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv29652/Objects Modified Files: listobject.c tupleobject.c Log Message: SF bug #730296: Unexpected Changes in list Iterator Reverted a Py2.3b1 change to iterator in subclasses of list and tuple. They had been changed to use __getitem__ whenever it had been overriden in the subclass. This caused some usabilty and performance problems. Also, it was inconsistent with the rest of python where many container methods access the underlying object directly without first checking for an overridden getter. Users needing a change in iterator behavior should override it directly. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.151 retrieving revision 2.152 diff -C2 -d -r2.151 -r2.152 *** listobject.c 3 May 2003 10:53:08 -0000 2.151 --- listobject.c 7 May 2003 01:28:47 -0000 2.152 *************** *** 2383,2388 **** return NULL; } - if (seq->ob_type->tp_as_sequence->sq_item != (intargfunc)list_item) - return PySeqIter_New(seq); it = PyObject_GC_New(listiterobject, &PyListIter_Type); if (it == NULL) --- 2383,2386 ---- Index: tupleobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/tupleobject.c,v retrieving revision 2.80 retrieving revision 2.81 diff -C2 -d -r2.80 -r2.81 *** tupleobject.c 24 Apr 2003 20:59:52 -0000 2.80 --- tupleobject.c 7 May 2003 01:28:47 -0000 2.81 *************** *** 754,759 **** return NULL; } - if (seq->ob_type->tp_as_sequence->sq_item != (intargfunc)tupleitem) - return PySeqIter_New(seq); it = PyObject_GC_New(tupleiterobject, &PyTupleIter_Type); if (it == NULL) --- 754,757 ---- From jackjansen@users.sourceforge.net Wed May 7 09:58:13 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 07 May 2003 01:58:13 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv23308 Modified Files: build Log Message: Merged 1.2.2.1 fixes: - Don't generate README, but ask the user to provide it. - Create destination dir, if needed. - Updated for 2.3b1. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** build 22 Mar 2003 00:02:23 -0000 1.2 --- build 7 May 2003 08:58:11 -0000 1.3 *************** *** 6,12 **** # Script configs ! PYVERSION=2.3a2 PYVER=2.3 ! BUILDNUM=3 DOCLEANUP=no --- 6,12 ---- # Script configs ! PYVERSION=2.3b1 PYVER=2.3 ! BUILDNUM=1 DOCLEANUP=no *************** *** 41,44 **** --- 41,52 ---- pushd $BUILDROOT + # Ask the user whether s/he has edited Welcome.txt + read -p "Have you updated $RESOURCEDIR/Welcome.txt (Y/n)? " welcome + + if [ "$welcome" = "n" -o "$welcome" = "N" ]; then + echo "Please do so and retry" + exit + fi + # Check if we should build and install the docs, but only if it # doesn't appear to be done already. TODO: fix this path to be version independent *************** *** 86,99 **** python $PYTHONSRC/Mac/scripts/zappycfiles.py $INSTALLROOT/Library/Frameworks/Python.framework/Versions/$PYVER/Mac/Tools - # Make the welcome message - cat > $RESOURCEDIR/Welcome.txt < Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv18347 Modified Files: Welcome.txt Log Message: Merged 2.3b1 welcome message to the trunk. Index: Welcome.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/Welcome.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Welcome.txt 21 Mar 2003 23:52:36 -0000 1.1 --- Welcome.txt 7 May 2003 09:41:56 -0000 1.2 *************** *** 1,6 **** ! Welcome! ! This program will install Python 2.3a2 for Mac OS X as a Framework. ! Build number: 3 ! Build date: Thu Mar 20 18:54:52 PST 2003 --- 1,19 ---- ! This program will install MacPython 2.3b1 for Mac OS X. ! MacPython consists of the Python programming language interpreter, plus ! a set of programs to allow easy access to it for Mac users (an ! integrated development environment, a Python extension package manager), ! plus a set of pre-built extension modules that open up specific ! Macintosh technologies to Python programs (Carbon, AppleScript, ! Quicktime, more). ! The installer puts the applications in MacPython-2.3 in your ! Applications folder, command-line tools in /usr/local/bin and the ! underlying machinery in /Library/Frameworks/Python.framework. ! ! The PythonIDE application has a Help command that gets you started ! quickly with MacPython and contains references to other documentation. ! ! More information on MacPython can be found at ! http://www.cwi.nl/~jack/macpython.html, more information on Python in ! general at http://www.python.org. From akuchling@users.sourceforge.net Wed May 7 15:50:51 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 07 May 2003 07:50:51 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.9,1.10 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv12777 Modified Files: pep-0314.txt Log Message: Remove mention of 2.2 plans Add Download-URL Remove mention of separating lines in author field Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pep-0314.txt 29 Apr 2003 17:37:08 -0000 1.9 --- pep-0314.txt 7 May 2003 14:50:49 -0000 1.10 *************** *** 38,43 **** parseable by the rfc822.py module. The field names listed in the following section are used as the header names. There's no ! extension mechanism in this simple format; the Catalog and Distutils ! SIGs will aim at getting a more flexible format ready for Python 2.2. --- 38,42 ---- parseable by the rfc822.py module. The field names listed in the following section are used as the header names. There's no ! extension mechanism in this simple format. *************** *** 98,102 **** Platform: POSIX, Windows ! Summary --- 97,101 ---- Platform: POSIX, Windows ! Summary *************** *** 139,153 **** Home-page: http://www.example.com/~cschultz/bvote/ Author (optional) ! A string containing at a minimum the author's name. Contact ! information can also be added, separating each line with ! newlines. Example: ! Author: C. Schultz ! Universal Features Syndicate ! Los Angeles, CA Author-email --- 138,156 ---- Home-page: http://www.example.com/~cschultz/bvote/ + Download-URL + + A string containing the URL from which this version of the package + can be downloaded. (This means that the URL can't be something like + ".../package-latest.tgz", but instead must be "../package-0.45.tgz".) + Author (optional) ! A string containing the author's name at a minimum; additional ! contact information may be provided. Example: ! Author: C. Schultz, Universal Features Syndicate, ! Los Angeles, CA Author-email From montanaro@users.sourceforge.net Wed May 7 16:29:14 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 07 May 2003 08:29:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.180,1.181 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv30681 Modified Files: tut.tex Log Message: replace most uses of `...` by repr(...), noting that `...` is discouraged, but convenient in interactive sessions. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.180 retrieving revision 1.181 diff -C2 -d -r1.180 -r1.181 *** tut.tex 22 Apr 2003 14:30:53 -0000 1.180 --- tut.tex 7 May 2003 15:29:12 -0000 1.181 *************** *** 2766,2772 **** One question remains, of course: how do you convert values to strings? Luckily, Python has ways to convert any value to a string: pass it to ! the \function{repr()} or \function{str()} functions, or just write ! the value between reverse quotes (\code{``}, equivalent to ! \function{repr()}). The \function{str()} function is meant to return representations of --- 2766,2772 ---- One question remains, of course: how do you convert values to strings? Luckily, Python has ways to convert any value to a string: pass it to ! the \function{repr()} or \function{str()} functions. Reverse quotes ! (\code{``}) are equivalent to \function{repr()}, but their use is ! discouraged. The \function{str()} function is meant to return representations of *************** *** 2787,2812 **** >>> str(s) 'Hello, world.' ! >>> `s` "'Hello, world.'" >>> str(0.1) '0.1' ! >>> `0.1` '0.10000000000000001' >>> x = 10 * 3.25 >>> y = 200 * 200 ! >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s The value of x is 32.5, and y is 40000... ! >>> # Reverse quotes work on other types besides numbers: ! ... p = [x, y] ! >>> ps = repr(p) ! >>> ps ! '[32.5, 40000]' ! >>> # Converting a string adds string quotes and backslashes: ... hello = 'hello, world\n' ! >>> hellos = `hello` >>> print hellos 'hello, world\n' ! >>> # The argument of reverse quotes may be a tuple: ... `x, y, ('spam', 'eggs')` "(32.5, 40000, ('spam', 'eggs'))" --- 2787,2810 ---- >>> str(s) 'Hello, world.' ! >>> repr(s) "'Hello, world.'" >>> str(0.1) '0.1' ! >>> repr(0.1) '0.10000000000000001' >>> x = 10 * 3.25 >>> y = 200 * 200 ! >>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...' >>> print s The value of x is 32.5, and y is 40000... ! >>> # The repr() of a string adds string quotes and backslashes: ... hello = 'hello, world\n' ! >>> hellos = repr(hello) >>> print hellos 'hello, world\n' ! >>> # The argument to repr() may be any Python object: ! ... repr(x, y, ('spam', 'eggs')) ! "(32.5, 40000, ('spam', 'eggs'))" ! >>> # reverse quotes are convenient in interactive sessions: ... `x, y, ('spam', 'eggs')` "(32.5, 40000, ('spam', 'eggs'))" *************** *** 2818,2824 **** >>> import string >>> for x in range(1, 11): ! ... print string.rjust(`x`, 2), string.rjust(`x*x`, 3), ... # Note trailing comma on previous line ! ... print string.rjust(`x*x*x`, 4) ... 1 1 1 --- 2816,2822 ---- >>> import string >>> for x in range(1, 11): ! ... print string.rjust(repr(x), 2), string.rjust(repr(x*x), 3), ... # Note trailing comma on previous line ! ... print string.rjust(repr(x*x*x), 4) ... 1 1 1 *************** *** 3358,3362 **** ... self.value = value ... def __str__(self): ! ... return `self.value` ... >>> try: --- 3356,3360 ---- ... self.value = value ... def __str__(self): ! ... return repr(self.value) ... >>> try: From montanaro@users.sourceforge.net Wed May 7 16:29:56 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 07 May 2003 08:29:56 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.15,1.156.4.1.2.16 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv31046 Modified Files: Tag: release22-maint tut.tex Log Message: replace most uses of `...` by repr(...), noting that `...` is discouraged, but convenient in interactive sessions. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.15 retrieving revision 1.156.4.1.2.16 diff -C2 -d -r1.156.4.1.2.15 -r1.156.4.1.2.16 *** tut.tex 28 Oct 2002 19:30:45 -0000 1.156.4.1.2.15 --- tut.tex 7 May 2003 15:29:53 -0000 1.156.4.1.2.16 *************** *** 2748,2754 **** One question remains, of course: how do you convert values to strings? Luckily, Python has ways to convert any value to a string: pass it to ! the \function{repr()} or \function{str()} functions, or just write ! the value between reverse quotes (\code{``}, equivalent to ! \function{repr()}). The \function{str()} function is meant to return representations of --- 2748,2754 ---- One question remains, of course: how do you convert values to strings? Luckily, Python has ways to convert any value to a string: pass it to ! the \function{repr()} or \function{str()} functions. Reverse quotes ! (\code{``}) are equivalent to \function{repr()}, but their use is ! discouraged. The \function{str()} function is meant to return representations of *************** *** 2769,2794 **** >>> str(s) 'Hello, world.' ! >>> `s` "'Hello, world.'" >>> str(0.1) '0.1' ! >>> `0.1` '0.10000000000000001' >>> x = 10 * 3.25 >>> y = 200 * 200 ! >>> s = 'The value of x is ' + `x` + ', and y is ' + `y` + '...' >>> print s The value of x is 32.5, and y is 40000... ! >>> # Reverse quotes work on other types besides numbers: ! ... p = [x, y] ! >>> ps = repr(p) ! >>> ps ! '[32.5, 40000]' ! >>> # Converting a string adds string quotes and backslashes: ... hello = 'hello, world\n' ! >>> hellos = `hello` >>> print hellos 'hello, world\n' ! >>> # The argument of reverse quotes may be a tuple: ... `x, y, ('spam', 'eggs')` "(32.5, 40000, ('spam', 'eggs'))" --- 2769,2792 ---- >>> str(s) 'Hello, world.' ! >>> repr(s) "'Hello, world.'" >>> str(0.1) '0.1' ! >>> repr(0.1) '0.10000000000000001' >>> x = 10 * 3.25 >>> y = 200 * 200 ! >>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...' >>> print s The value of x is 32.5, and y is 40000... ! >>> # The repr() of a string adds string quotes and backslashes: ... hello = 'hello, world\n' ! >>> hellos = repr(hello) >>> print hellos 'hello, world\n' ! >>> # The argument to repr() may be any Python object: ! ... repr(x, y, ('spam', 'eggs')) ! "(32.5, 40000, ('spam', 'eggs'))" ! >>> # reverse quotes are convenient in interactive sessions: ... `x, y, ('spam', 'eggs')` "(32.5, 40000, ('spam', 'eggs'))" *************** *** 2800,2806 **** >>> import string >>> for x in range(1, 11): ! ... print string.rjust(`x`, 2), string.rjust(`x*x`, 3), ... # Note trailing comma on previous line ! ... print string.rjust(`x*x*x`, 4) ... 1 1 1 --- 2798,2804 ---- >>> import string >>> for x in range(1, 11): ! ... print string.rjust(repr(x), 2), string.rjust(repr(x*x), 3), ... # Note trailing comma on previous line ! ... print string.rjust(repr(x*x*x), 4) ... 1 1 1 *************** *** 3340,3344 **** ... self.value = value ... def __str__(self): ! ... return `self.value` ... >>> try: --- 3338,3342 ---- ... self.value = value ... def __str__(self): ! ... return repr(self.value) ... >>> try: From montanaro@users.sourceforge.net Wed May 7 16:38:50 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 07 May 2003 08:38:50 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.164,1.165 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv2976 Modified Files: setup.py Log Message: set platform properly for OSF/1 Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.164 retrieving revision 1.165 diff -C2 -d -r1.164 -r1.165 *** setup.py 6 May 2003 20:59:57 -0000 1.164 --- setup.py 7 May 2003 15:38:47 -0000 1.165 *************** *** 244,247 **** --- 244,249 ---- elif platform[:6] == 'atheos': platform = 'atheos' + elif platform[:4] == 'osf1': + platform = 'osf1' return platform *************** *** 287,292 **** # OSF/1 has some stuff in /usr/ccs/lib (like -ldb) ! if platform[:4] == 'osf1': ! platform = 'osf1' lib_dirs += ['/usr/ccs/lib'] --- 289,293 ---- # OSF/1 has some stuff in /usr/ccs/lib (like -ldb) ! if platform == 'osf1': lib_dirs += ['/usr/ccs/lib'] From thomas@xs4all.net Wed May 7 16:45:06 2003 From: thomas@xs4all.net (Thomas Wouters) Date: Wed, 7 May 2003 17:45:06 +0200 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.180,1.181 In-Reply-To: References: Message-ID: <20030507154506.GJ26254@xs4all.nl> On Wed, May 07, 2003 at 08:29:14AM -0700, montanaro@users.sourceforge.net wrote: > ! >>> # The argument to repr() may be any Python object: > ! ... repr(x, y, ('spam', 'eggs')) > ! "(32.5, 40000, ('spam', 'eggs'))" Close, but no cigar: >>> repr(x, y, ('spam', 'eggs')) Traceback (most recent call last): File "", line 1, in ? TypeError: repr() takes exactly one argument (3 given) >>> repr((x, y, ('spam', 'eggs'))) "(32.5, 40000, ('spam', 'eggs'))" This is what Fred meant in his 'it needs an additional set of parentheses' comment to the patch. -- Thomas Wouters Hi! I'm a .signature virus! copy me into your .signature file to help me spread! From skip@pobox.com Wed May 7 16:59:24 2003 From: skip@pobox.com (Skip Montanaro) Date: Wed, 7 May 2003 10:59:24 -0500 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.180,1.181 In-Reply-To: <20030507154506.GJ26254@xs4all.nl> References: <20030507154506.GJ26254@xs4all.nl> Message-ID: <16057.11612.877632.172234@montanaro.dyndns.org> Thomas> On Wed, May 07, 2003 at 08:29:14AM -0700, montanaro@users.sourceforge.net wrote: >> ! >>> # The argument to repr() may be any Python object: >> ! ... repr(x, y, ('spam', 'eggs')) >> ! "(32.5, 40000, ('spam', 'eggs'))" Thomas> Close, but no cigar: >>>> repr(x, y, ('spam', 'eggs')) Thomas> Traceback (most recent call last): Thomas> File "", line 1, in ? Thomas> TypeError: repr() takes exactly one argument (3 given) Whoops! Yeah, Fred said something about a missing paren, but I thought he meant missing right paren. I'll fix it in a jiff. Skip From montanaro@users.sourceforge.net Wed May 7 17:01:46 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 07 May 2003 09:01:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.181,1.182 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv15146 Modified Files: tut.tex Log Message: add missing parens - verified w/ interpreter - sorry to dismiss your comment Fred Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.181 retrieving revision 1.182 diff -C2 -d -r1.181 -r1.182 *** tut.tex 7 May 2003 15:29:12 -0000 1.181 --- tut.tex 7 May 2003 16:01:43 -0000 1.182 *************** *** 2804,2808 **** 'hello, world\n' >>> # The argument to repr() may be any Python object: ! ... repr(x, y, ('spam', 'eggs')) "(32.5, 40000, ('spam', 'eggs'))" >>> # reverse quotes are convenient in interactive sessions: --- 2804,2808 ---- 'hello, world\n' >>> # The argument to repr() may be any Python object: ! ... repr((x, y, ('spam', 'eggs'))) "(32.5, 40000, ('spam', 'eggs'))" >>> # reverse quotes are convenient in interactive sessions: From akuchling@users.sourceforge.net Wed May 7 17:21:59 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 07 May 2003 09:21:59 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv24589 Modified Files: pep-0314.txt Log Message: Fix field name; add Download-URL to list of changes Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0314.txt 7 May 2003 14:50:49 -0000 1.10 --- pep-0314.txt 7 May 2003 16:21:57 -0000 1.11 *************** *** 112,116 **** assume any maximum size for this field, though one hopes that people won't include their instruction manual as the ! long-description.) Example: --- 112,116 ---- assume any maximum size for this field, though one hopes that people won't include their instruction manual as the ! description.) Example: *************** *** 321,325 **** * Added the Classifiers field from PEP 301. ! * Added fields: Requires, Provides, Obsoletes, Conflicts. --- 321,325 ---- * Added the Classifiers field from PEP 301. ! * Added fields: Download-URL, Requires, Provides, Obsoletes, Conflicts. From montanaro@users.sourceforge.net Wed May 7 17:02:08 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 07 May 2003 09:02:08 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.156.4.1.2.16,1.156.4.1.2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv15343 Modified Files: Tag: release22-maint tut.tex Log Message: add missing parens - verified w/ interpreter - sorry to dismiss your comment Fred Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.156.4.1.2.16 retrieving revision 1.156.4.1.2.17 diff -C2 -d -r1.156.4.1.2.16 -r1.156.4.1.2.17 *** tut.tex 7 May 2003 15:29:53 -0000 1.156.4.1.2.16 --- tut.tex 7 May 2003 16:02:06 -0000 1.156.4.1.2.17 *************** *** 2786,2790 **** 'hello, world\n' >>> # The argument to repr() may be any Python object: ! ... repr(x, y, ('spam', 'eggs')) "(32.5, 40000, ('spam', 'eggs'))" >>> # reverse quotes are convenient in interactive sessions: --- 2786,2790 ---- 'hello, world\n' >>> # The argument to repr() may be any Python object: ! ... repr((x, y, ('spam', 'eggs'))) "(32.5, 40000, ('spam', 'eggs'))" >>> # reverse quotes are convenient in interactive sessions: From akuchling@users.sourceforge.net Wed May 7 17:34:55 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 07 May 2003 09:34:55 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv30141 Modified Files: pep-0314.txt Log Message: Describe Supported-Platform on its own Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0314.txt 7 May 2003 16:21:57 -0000 1.11 --- pep-0314.txt 7 May 2003 16:34:52 -0000 1.12 *************** *** 89,100 **** POSIX, MacOS, Windows, BeOS, PalmOS. - Binary distributions will use the Supported-Platform field in - their metadata to specify the OS and CPU for which the binary - package was compiled. The semantics of the Supported-Platform - are not specified in this PEP. - Example: Platform: POSIX, Windows Summary --- 89,107 ---- POSIX, MacOS, Windows, BeOS, PalmOS. Example: Platform: POSIX, Windows + + Supported-Platform + + Binary distributions containing a PKG-INFO file will use the + Supported-Platform field in their metadata to specify the OS and + CPU for which the binary package was compiled. The semantics of + the Supported-Platform field are not specified in this PEP. + + Example: + + Supported-Platform: RedHat 7.2 + Supported-Platform: i386-win32-2791 Summary From akuchling@users.sourceforge.net Wed May 7 17:53:31 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 07 May 2003 09:53:31 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.12,1.13 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4120 Modified Files: pep-0314.txt Log Message: Mention use of reST in description Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** pep-0314.txt 7 May 2003 16:34:52 -0000 1.12 --- pep-0314.txt 7 May 2003 16:53:28 -0000 1.13 *************** *** 116,123 **** A longer description of the package that can run to several ! paragraphs. (Software that deals with metadata should not ! assume any maximum size for this field, though one hopes that ! people won't include their instruction manual as the ! description.) Example: --- 116,128 ---- A longer description of the package that can run to several ! paragraphs. Software that deals with metadata should not assume ! any maximum size for this field, though people shouldn't include ! their instruction manual as the description. ! ! The contents of this field can be written using reStructuredText ! markup [1]. For programs that work with the metadata, ! supporting markup is optional; programs can also display the ! contents of the field as-is. This means that authors should be ! conservative in the markup they use. Example: *************** *** 125,129 **** Description: This module collects votes from beagles in order to determine their electoral wishes. ! Do NOT try to use this module with basset hounds; it makes them grumpy. --- 130,134 ---- Description: This module collects votes from beagles in order to determine their electoral wishes. ! Do *not* try to use this module with basset hounds; it makes them grumpy. *************** *** 231,235 **** Each entry is a string giving a single classification value ! for the package. Classifiers are described in PEP 301 [1]. Examples: --- 236,240 ---- Each entry is a string giving a single classification value ! for the package. Classifiers are described in PEP 301 [2]. Examples: *************** *** 339,348 **** Acknowledgements ! None yet. References ! [1] PEP 301 http://www.python.org/peps/pep-0301.html --- 344,356 ---- Acknowledgements ! Richard Jones suggested using reST for the Description field. References ! [1] reStructured text ! http://docutils.sourceforge.net/ ! ! [2] PEP 301 http://www.python.org/peps/pep-0301.html From akuchling@users.sourceforge.net Wed May 7 18:00:40 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 07 May 2003 10:00:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.144,1.145 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv6782 Modified Files: whatsnew23.tex Log Message: Add list.insert() change for negative positions Add ~ to MvL's last name Fix use of all-caps for a name Bump version number Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** whatsnew23.tex 30 Apr 2003 15:03:46 -0000 1.144 --- whatsnew23.tex 7 May 2003 17:00:35 -0000 1.145 *************** *** 4,8 **** \title{What's New in Python 2.3} ! \release{0.10} \author{A.M.\ Kuchling} \authoraddress{\email{amk@amk.ca}} --- 4,8 ---- \title{What's New in Python 2.3} ! \release{0.11} \author{A.M.\ Kuchling} \authoraddress{\email{amk@amk.ca}} *************** *** 301,306 **** \seepep{263}{Defining Python Source Code Encodings}{Written by ! Marc-Andr\'e Lemburg and Martin von L\"owis; implemented by SUZUKI ! Hisao and Martin von L\"owis.} \end{seealso} --- 301,306 ---- \seepep{263}{Defining Python Source Code Encodings}{Written by ! Marc-Andr\'e Lemburg and Martin von~L\"owis; implemented by Suzuki ! Hisao and Martin von~L\"owis.} \end{seealso} *************** *** 336,340 **** \seepep{277}{Unicode file name support for Windows NT}{Written by Neil ! Hodgson; implemented by Neil Hodgson, Martin von L\"owis, and Mark Hammond.} --- 336,340 ---- \seepep{277}{Unicode file name support for Windows NT}{Written by Neil ! Hodgson; implemented by Neil Hodgson, Martin von~L\"owis, and Mark Hammond.} *************** *** 1092,1095 **** --- 1092,1101 ---- Martelli.) + \item \code{list.insert(\var{pos}, \var{value})} used to + insert \var{value} at the front of the list when \var{pos} was + negative. The behaviour has now been changed to be consistent with + slice indexing, so when \var{pos} is -1 the value will be inserted + before the last element, and so forth. + \item Dictionaries have a new method, \method{pop(\var{key}\optional{, \var{default}})}, that returns the value corresponding to \var{key} *************** *** 1787,1791 **** \url{http://mail.python.org/pipermail/python-dev/2002-December/031107.html} % for a more detailed explanation of this change. (Implemented by ! Martin von L\"owis.) \item Calling Tcl methods through \module{_tkinter} no longer --- 1793,1797 ---- \url{http://mail.python.org/pipermail/python-dev/2002-December/031107.html} % for a more detailed explanation of this change. (Implemented by ! Martin von~L\"owis.) \item Calling Tcl methods through \module{_tkinter} no longer *************** *** 2329,2336 **** Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, ! Martin von L\"owis, Andrew MacIntyre, Lalo Martins, Gustavo Niemeyer, ! Neal Norwitz, Hans Nowak, Chris Reedy, Francesco Ricciardi, ! Vinay Sajip, Neil Schemenauer, ! Roman Suzi, Jason Tishler, Just van~Rossum. \end{document} --- 2335,2342 ---- Andrew Dalke, Scott David Daniels, Fred~L. Drake, Jr., Kelly Gerber, Raymond Hettinger, Michael Hudson, Chris Lambert, Detlef Lannert, ! Martin von~L\"owis, Andrew MacIntyre, Lalo Martins, Chad Netzer, ! Gustavo Niemeyer, Neal Norwitz, Hans Nowak, Chris Reedy, Francesco ! Ricciardi, Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason Tishler, ! Just van~Rossum. \end{document} From rhettinger@users.sourceforge.net Wed May 7 18:11:19 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 May 2003 10:11:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.182,1.183 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv11160 Modified Files: tut.tex Log Message: Update traceback message Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** tut.tex 7 May 2003 16:01:43 -0000 1.182 --- tut.tex 7 May 2003 17:11:15 -0000 1.183 *************** *** 851,855 **** Traceback (most recent call last): File "", line 1, in ? ! UnicodeError: ASCII encoding error: ordinal not in range(128) \end{verbatim} --- 851,855 ---- Traceback (most recent call last): File "", line 1, in ? ! UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128) \end{verbatim} From rhettinger@users.sourceforge.net Wed May 7 18:49:39 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 07 May 2003 10:49:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.183,1.184 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv25734 Modified Files: tut.tex Log Message: More message updates and minor fixes. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.183 retrieving revision 1.184 diff -C2 -d -r1.183 -r1.184 *** tut.tex 7 May 2003 17:11:15 -0000 1.183 --- tut.tex 7 May 2003 17:49:36 -0000 1.184 *************** *** 1468,1472 **** Traceback (most recent call last): File "", line 1, in ? ! TypeError: keyword parameter redefined \end{verbatim} --- 1468,1472 ---- Traceback (most recent call last): File "", line 1, in ? ! TypeError: function() got multiple values for keyword argument 'a' \end{verbatim} *************** *** 1876,1882 **** >>> [x**3 for x in range(5)] [0, 1, 8, 27, 64] ! >>> x ! 4 # the final value for range(5) ! >> \end{verbatim} --- 1876,1881 ---- >>> [x**3 for x in range(5)] [0, 1, 8, 27, 64] ! >>> x # the final value for range(5) ! 4 \end{verbatim} *************** *** 1890,1895 **** \begin{verbatim} ! >>> a ! [-1, 1, 66.6, 333, 333, 1234.5] >>> del a[0] >>> a --- 1889,1893 ---- \begin{verbatim} ! >>> a = [-1, 1, 66.6, 333, 333, 1234.5] >>> del a[0] >>> a *************** *** 2037,2041 **** ['guido', 'irv', 'jack'] >>> tel.has_key('guido') ! 1 \end{verbatim} --- 2035,2039 ---- ['guido', 'irv', 'jack'] >>> tel.has_key('guido') ! True \end{verbatim} *************** *** 2429,2433 **** C> print 'Yuck!' Yuck! ! C> \end{verbatim} --- 2427,2432 ---- C> print 'Yuck!' Yuck! ! C> ! \end{verbatim} *************** *** 3136,3140 **** Traceback (most recent call last): File "", line 1, in ? ! ZeroDivisionError: integer division or modulo >>> 4 + spam*3 Traceback (most recent call last): --- 3135,3139 ---- Traceback (most recent call last): File "", line 1, in ? ! ZeroDivisionError: integer division or modulo by zero >>> 4 + spam*3 Traceback (most recent call last): *************** *** 3144,3148 **** Traceback (most recent call last): File "", line 1, in ? ! TypeError: illegal argument type for built-in operation \end{verbatim} --- 3143,3147 ---- Traceback (most recent call last): File "", line 1, in ? ! TypeError: cannot concatenate 'str' and 'int' objects \end{verbatim} From dcjim@users.sourceforge.net Wed May 7 20:48:16 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Wed, 07 May 2003 12:48:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy2.c,NONE,1.1 noddy3.c,NONE,1.1 newtypes.tex,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv13294 Modified Files: newtypes.tex Added Files: noddy2.c noddy3.c Log Message: Rewrote the basic section of the chapter on defining new types. Changed the example to show how to create types the new way: - Use a class new method rather than a new function. - Use self->ob_type->tp_free in deallocators - Use attribute descriptors rather than set/getattr methods. - Make the type usable as a base type. I split the example into 3 parts: 1. The minimal new type 2. Adding attributes and methods. 3. Finer control over attributes. It's much simpler to define builtin types. These updates hopefully show this. I also made minor wording changes in two other places. I still need to update xxobject.c --- NEW FILE: noddy2.c --- #include #include "structmember.h" typedef struct { PyObject_HEAD PyObject *first; PyObject *last; int number; } Noddy; static void Noddy_dealloc(Noddy* self) { Py_XDECREF(self->first); Py_XDECREF(self->last); self->ob_type->tp_free(self); } static PyObject * Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Noddy *self; self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); return NULL; } self->number = 0; } return (PyObject *)self; } static PyObject * Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { PyObject *first=NULL, *last=NULL; static char *kwlist[] = {"first", "last", "number", NULL}; if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, &first, &last, &self->number)) return NULL; if (first) { Py_XDECREF(self->first); Py_INCREF(first); self->first = first; } if (last) { Py_XDECREF(self->last); Py_INCREF(last); self->last = last; } Py_INCREF(Py_None); return Py_None; } static PyMemberDef Noddy_members[] = { {"first", T_OBJECT_EX, offsetof(Noddy, first), 0, "first name"}, {"last", T_OBJECT_EX, offsetof(Noddy, last), 0, "last name"}, {"number", T_INT, offsetof(Noddy, number), 0, "noddy number"}, {NULL} /* Sentinel */ }; static PyObject * Noddy_name(Noddy* self) { static PyObject *format = NULL; PyObject *args, *result; if (format == NULL) { format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } if (self->first == NULL) { PyErr_SetString(PyExc_AttributeError, "first"); return NULL; } if (self->last == NULL) { PyErr_SetString(PyExc_AttributeError, "last"); return NULL; } args = Py_BuildValue("OO", self->first, self->last); if (args == NULL) return NULL; result = PyString_Format(format, args); Py_DECREF(args); return result; } static PyMethodDef Noddy_methods[] = { {"name", (PyCFunction)Noddy_name, METH_NOARGS, "Return the name, combining the first and last name" }, {NULL} /* Sentinel */ }; static PyTypeObject NoddyType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "noddy.Noddy", /*tp_name*/ sizeof(Noddy), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)Noddy_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "Noddy objects", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Noddy_methods, /* tp_methods */ Noddy_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Noddy_init, /* tp_init */ 0, /* tp_alloc */ Noddy_new, /* tp_new */ }; static PyMethodDef module_methods[] = { {NULL} /* Sentinel */ }; PyMODINIT_FUNC initnoddy2(void) { PyObject* m; if (PyType_Ready(&NoddyType) < 0) return; m = Py_InitModule3("noddy2", module_methods, "Example module that creates an extension type."); if (m == NULL) return; PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); } --- NEW FILE: noddy3.c --- #include #include "structmember.h" typedef struct { PyObject_HEAD PyObject *first; PyObject *last; int number; } Noddy; static void Noddy_dealloc(Noddy* self) { Py_XDECREF(self->first); Py_XDECREF(self->last); self->ob_type->tp_free(self); } static PyObject * Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { Noddy *self; self = (Noddy *)type->tp_alloc(type, 0); if (self != NULL) { self->first = PyString_FromString(""); if (self->first == NULL) { Py_DECREF(self); return NULL; } self->last = PyString_FromString(""); if (self->last == NULL) { Py_DECREF(self); return NULL; } self->number = 0; } return (PyObject *)self; } static PyObject * Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) { PyObject *first=NULL, *last=NULL; static char *kwlist[] = {"first", "last", "number", NULL}; if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, &first, &last, &self->number)) return NULL; if (first) { Py_DECREF(self->first); Py_INCREF(first); self->first = first; } if (last) { Py_DECREF(self->last); Py_INCREF(last); self->last = last; } Py_INCREF(Py_None); return Py_None; } static PyMemberDef Noddy_members[] = { {"number", T_INT, offsetof(Noddy, number), 0, "noddy number"}, {NULL} /* Sentinel */ }; static PyObject * Noddy_getfirst(Noddy *self, void *closure) { Py_INCREF(self->first); return self->first; } static int Noddy_setfirst(Noddy *self, PyObject *value, void *closure) { if (value == NULL) { PyErr_SetString(PyExc_TypeError, "Cannot delete the first attribute"); return -1; } if (! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "The first attribute value must be a string"); return -1; } Py_DECREF(self->first); Py_INCREF(value); self->first = value; return 0; } static PyObject * Noddy_getlast(Noddy *self, void *closure) { Py_INCREF(self->last); return self->last; } static int Noddy_setlast(Noddy *self, PyObject *value, void *closure) { if (value == NULL) { PyErr_SetString(PyExc_TypeError, "Cannot delete the last attribute"); return -1; } if (! PyString_Check(value)) { PyErr_SetString(PyExc_TypeError, "The last attribute value must be a string"); return -1; } Py_DECREF(self->last); Py_INCREF(value); self->last = value; return 0; } static PyGetSetDef Noddy_getseters[] = { {"first", (getter)Noddy_getfirst, (setter)Noddy_setfirst, "first name", NULL}, {"last", (getter)Noddy_getlast, (setter)Noddy_setlast, "last name", NULL}, {NULL} /* Sentinel */ }; static PyObject * Noddy_name(Noddy* self) { static PyObject *format = NULL; PyObject *args, *result; if (format == NULL) { format = PyString_FromString("%s %s"); if (format == NULL) return NULL; } args = Py_BuildValue("OO", self->first, self->last); if (args == NULL) return NULL; result = PyString_Format(format, args); Py_DECREF(args); return result; } static PyMethodDef Noddy_methods[] = { {"name", (PyCFunction)Noddy_name, METH_NOARGS, "Return the name, combining the first and last name" }, {NULL} /* Sentinel */ }; static PyTypeObject NoddyType = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ "noddy.Noddy", /*tp_name*/ sizeof(Noddy), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)Noddy_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash */ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ "Noddy objects", /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ Noddy_methods, /* tp_methods */ Noddy_members, /* tp_members */ Noddy_getseters, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ (initproc)Noddy_init, /* tp_init */ 0, /* tp_alloc */ Noddy_new, /* tp_new */ }; static PyMethodDef module_methods[] = { {NULL} /* Sentinel */ }; PyMODINIT_FUNC initnoddy3(void) { PyObject* m; if (PyType_Ready(&NoddyType) < 0) return; m = Py_InitModule3("noddy3", module_methods, "Example module that creates an extension type."); if (m == NULL) return; PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); } Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** newtypes.tex 8 Jan 2003 03:02:26 -0000 1.21 --- newtypes.tex 7 May 2003 19:48:13 -0000 1.22 *************** *** 3,6 **** --- 3,7 ---- \sectionauthor{Michael Hudson}{mwh@python.net} \sectionauthor{Dave Kuhlman}{dkuhlman@rexx.com} + \sectionauthor{Jim Fulton}{jim@zope.com} As mentioned in the last chapter, Python allows the writer of an *************** *** 39,51 **** \begin{verbatim} - static PyTypeObject noddy_NoddyType; - \end{verbatim} - - This names the type object that will be defining further down in the - file. It can't be defined here because its definition has to refer to - functions that have not yet been defined, but we need to be able to - refer to it, hence the declaration. - - \begin{verbatim} typedef struct { PyObject_HEAD --- 40,43 ---- *************** *** 74,152 **** \end{verbatim} - Next up is: - - \begin{verbatim} - static PyObject* - noddy_new_noddy(PyObject* self, PyObject* args) - { - noddy_NoddyObject* noddy; - - if (!PyArg_ParseTuple(args,":new_noddy")) - return NULL; - - noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); - - return (PyObject*)noddy; - } - \end{verbatim} - - This is in fact just a regular module function, as described in the - last chapter. The reason it gets special mention is that this is - where we create our Noddy object. Defining \ctype{PyTypeObject} - structures is all very well, but if there's no way to actually - \emph{create} one of the wretched things it is not going to do anyone - much good. - - Almost always, you create objects with a call of the form: - - \begin{verbatim} - PyObject_New(, &); - \end{verbatim} - - This allocates the memory and then initializes the object (sets - the reference count to one, makes the \member{ob_type} pointer point at - the right place and maybe some other stuff, depending on build options). - You \emph{can} do these steps separately if you have some reason to - --- but at this level we don't bother. - - Note that \cfunction{PyObject_New()} is a polymorphic macro rather - than a real function. The first parameter is the name of the C - structure that represents an object of our new type, and the return - value is a pointer to that type. This would be - \ctype{noddy_NoddyObject} in our example: - - \begin{verbatim} - noddy_NoddyObject *my_noddy; - - my_noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); - \end{verbatim} - - We cast the return value to a \ctype{PyObject*} because that's what - the Python runtime expects. This is safe because of guarantees about - the layout of structures in the C standard, and is a fairly common C - programming trick. One could declare \cfunction{noddy_new_noddy} to - return a \ctype{noddy_NoddyObject*} and then put a cast in the - definition of \cdata{noddy_methods} further down the file --- it - doesn't make much difference. - - Now a Noddy object doesn't do very much and so doesn't need to - implement many type methods. One you can't avoid is handling - deallocation, so we find - - \begin{verbatim} - static void - noddy_noddy_dealloc(PyObject* self) - { - PyObject_Del(self); - } - \end{verbatim} - - This is so short as to be self explanatory. This function will be - called when the reference count on a Noddy object reaches \code{0} (or - it is found as part of an unreachable cycle by the cyclic garbage - collector). \cfunction{PyObject_Del()} is what you call when you want - an object to go away. If a Noddy object held references to other - Python objects, one would decref them here. - Moving on, we come to the crunch --- the type object. --- 66,69 ---- *************** *** 154,176 **** static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) ! 0, /* ob_size */ ! "Noddy", /* tp_name */ ! sizeof(noddy_NoddyObject), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! noddy_noddy_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! 0, /* tp_getattr */ ! 0, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ }; \end{verbatim} Now if you go and look up the definition of \ctype{PyTypeObject} in ! \file{object.h} you'll see that it has many, many more fields that the definition above. The remaining fields will be filled with zeros by the C compiler, and it's common practice to not specify them --- 71,117 ---- static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "noddy.Noddy", /*tp_name*/ ! sizeof(noddy_NoddyObject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ ! 0, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! 0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash */ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ ! "Noddy objects", /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* 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 */ ! 0, /* tp_alloc */ ! PyType_GenericNew, /* tp_new */ }; \end{verbatim} Now if you go and look up the definition of \ctype{PyTypeObject} in ! \file{object.h} you'll see that it has many more fields that the definition above. The remaining fields will be filled with zeros by the C compiler, and it's common practice to not specify them *************** *** 191,197 **** as the type of a type object is ``type'', but this isn't strictly ! conforming C and some compilers complain. So instead we fill in the ! \member{ob_type} field of \cdata{noddy_NoddyType} at the earliest ! oppourtunity --- in \cfunction{initnoddy()}. \begin{verbatim} --- 132,137 ---- as the type of a type object is ``type'', but this isn't strictly ! conforming C and some compilers complain. Fortunately, this member ! will be filled in for us by \cfunction{PyType_Ready()}. \begin{verbatim} *************** *** 205,209 **** \begin{verbatim} ! "Noddy", /* tp_name */ \end{verbatim} --- 145,149 ---- \begin{verbatim} ! "noddy.Noddy", /* tp_name */ \end{verbatim} *************** *** 215,221 **** Traceback (most recent call last): File "", line 1, in ? ! TypeError: cannot add type "Noddy" to string \end{verbatim} \begin{verbatim} sizeof(noddy_NoddyObject), /* tp_basicsize */ --- 155,166 ---- Traceback (most recent call last): File "", line 1, in ? ! TypeError: cannot add type "noddy.Noddy" to string \end{verbatim} + Note that the name is a dotted name that includes both the module name + and the name of the type within the module. The module in this case is + \module{noddy} and the type is \class{Noddy}, so we set the type name + to \class{noddy.Noddy}. + \begin{verbatim} sizeof(noddy_NoddyObject), /* tp_basicsize */ *************** *** 232,266 **** Ignore this for now. Now we get into the type methods, the things that make your objects ! different from the others. Of course, the Noddy object doesn't ! implement many of these, but as mentioned above you have to implement ! the deallocation function. \begin{verbatim} ! noddy_noddy_dealloc, /* tp_dealloc */ \end{verbatim} ! From here, all the type methods are \NULL, so we'll go over them later ! --- that's for the next section! ! Everything else in the file should be familiar, except for this line in \cfunction{initnoddy}: \begin{verbatim} ! noddy_NoddyType.ob_type = &PyType_Type; \end{verbatim} ! This was alluded to above --- the \cdata{noddy_NoddyType} object should ! have type ``type'', but \code{\&PyType_Type} is not constant and so ! can't be used in its initializer. To work around this, we patch it up ! in the module initialization. That's it! All that remains is to build it; put the above code in a ! file called \file{noddymodule.c} and \begin{verbatim} from distutils.core import setup, Extension setup(name="noddy", version="1.0", ! ext_modules=[Extension("noddy", ["noddymodule.c"])]) \end{verbatim} --- 177,244 ---- Ignore this for now. + Skipping a number of type methods that we don't provide, we set the + class flags to \constant{Py_TPFLAGS_DEFAULT}. + + \begin{verbatim} + Py_TPFLAGS_DEFAULT, /*tp_flags*/ + \end{verbatim} + + All types should include this constant in their flags. It enables all + of the members defined by the current version of Python. + + We provide a doc string for the type in \member{tp_doc}. + + \begin{verbatim} + "Noddy objects", /* tp_doc */ + \end{verbatim} + Now we get into the type methods, the things that make your objects ! different from the others. We aren't going to implement any of these ! in this version of the module. We'll expand this example later to ! have more interesting behavior. ! ! For now, all we want to be able to do is to create new \class{Noddy} ! objects. To enable object creation, we have to provide a ! \member{tp_new} implementation. In this case, we can just use the ! default implementation provided by the API function ! \cfunction{PyType_GenericNew}. \begin{verbatim} ! PyType_GenericNew, /* tp_new */ \end{verbatim} ! All the other type methods are \NULL, so we'll go over them later ! --- that's for a later section! ! Everything else in the file should be familiar, except for some code in \cfunction{initnoddy}: \begin{verbatim} ! if (PyType_Ready(&noddy_NoddyType) < 0) ! return; \end{verbatim} ! This initializes the \class{Noddy} type, filing in a number of ! members, including \member{ob_type} that we initially set to \NULL. ! ! \begin{verbatim} ! PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType); ! \end{verbatim} ! ! This adds the type to the module dictionary. This allows us to create ! \class{Noddy} instances by calling the \class{Noddy} class: ! ! \begin{verbatim} ! import noddy ! mynoddy = noddy.Noddy() ! \end{verbatim} That's it! All that remains is to build it; put the above code in a ! file called \file{noddy.c} and \begin{verbatim} from distutils.core import setup, Extension setup(name="noddy", version="1.0", ! ext_modules=[Extension("noddy", ["noddy.c"])]) \end{verbatim} *************** *** 277,280 **** --- 255,676 ---- That wasn't so hard, was it? + Of course, the current Noddy type is pretty uninteresting. It has no + data and doesn't do anything. It can't even be subclasses. + + \subsection{Adding data and methods to the Basic example} + + Let's expend the basic example to add some data and methods. Let's + also make the type usable as a base class. We'll create + a new module, \module{noddy2} that adds these capabilities: + + \verbatiminput{noddy2.c} + + This version of the module has a number of changes. + + We've added an extra include: + + \begin{verbatim} + #include "structmember.h" + \end{verbatim} + + This include provides declarations that we use to handle attributes, + as described a bit later. + + The name of the \class{Noddy} object structure has been shortened to + \class{Noddy}. The type object name has been shortened to + \class{NoddyType}. + + The \class{Noddy} type now has three data attributes, \var{first}, + \var{last}, and \var{number}. The \var{first} and \var{last} + variables are Python strings containing first and last names. The + \var{number} attribute is an integer. + + The object structure is updated accordingly: + + \begin{verbatim} + typedef struct { + PyObject_HEAD + PyObject *first; + PyObject *last; + int number; + } Noddy; + \end{verbatim} + + Because we now have data to manage, we have to be more careful about + object allocation and deallocation. At a minimum, we need a + deallocation method: + + \begin{verbatim} + static void + Noddy_dealloc(Noddy* self) + { + Py_XDECREF(self->first); + Py_XDECREF(self->last); + self->ob_type->tp_free(self); + } + \end{verbatim} + + which is assigned to the \member{tp_dealloc} member: + + \begin{verbatim} + (destructor)Noddy_dealloc, /*tp_dealloc*/ + \end{verbatim} + + This method decrements the reference counts of the two Python + attributes. We use \cfunction{Py_XDECREF} here because the + \member{first} and \member{last} members could be \NULL. It then + calls the \member{tp_free} member of the object's type to free the + object's memory. Note that the object's type might not be + \class{NoddyType}, because the object may be an instance of a + subclass. + + We want to make sure that the first and last names are initialized to + empty strings, so we provide a new method: + + \begin{verbatim} + static PyObject * + Noddy_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + Noddy *self; + + self = (Noddy *)type->tp_alloc(type, 0); + if (self != NULL) { + self->first = PyString_FromString(""); + if (self->first == NULL) + { + Py_DECREF(self); + return NULL; + } + + self->last = PyString_FromString(""); + if (self->last == NULL) + { + Py_DECREF(self); + return NULL; + } + + self->number = 0; + } + + return (PyObject *)self; + } + \end{verbatim} + + and install it in the \member{tp_new} member: + + \begin{verbatim} + Noddy_new, /* tp_new */ + \end{verbatim} + + The new member is responsible for creating (as opposed to + initializing) objects of the type. It is exposed in Python as the + \method{__new__} method. See the paper titled ``Unifying types and + classes in Python'' for a detailed discussion of the \method{__new__} + method. One reason to implement a new method is to assure the initial + values of instance variables. In this case, we use the new method to + make sure that the initial values of the members \member{first} and + \member{last} are not \NULL. If we didn't care whether the initial + values were \NULL, we could have used \cfunction{PyType_GenericNew} as + our new method, as we did before. \cfunction{PyType_GenericNew} + initializes all of the instance variable members to NULLs. + + The new method is a static method that is passed the type being + instantiated and any arguments passed when the type was called, + and that returns the new object created. New methods always accept + positional and keyword arguments, but they often ignore the arguments, + leaving the argument handling to initializer methods. Note that if the + type supports subclassing, the type passed may not be the type being + defined. The new method calls the tp_alloc slot to allocate memory. + We don't fill the \member{tp_alloc} slot ourselves. Rather + \cfunction{PyType_Ready()} fills it for us by inheriting it from our + base class, which is \class{object} by default. Most types use the + default allocation. + + We provide an initialization function: + + \begin{verbatim} + static PyObject * + Noddy_init(Noddy *self, PyObject *args, PyObject *kwds) + { + PyObject *first=NULL, *last=NULL; + + static char *kwlist[] = {"first", "last", "number", NULL}; + + if (! PyArg_ParseTupleAndKeywords(args, kwds, "|OOi", kwlist, + &first, &last, + &self->number)) + return NULL; + + if (first) { + Py_XDECREF(self->first); + Py_INCREF(first); + self->first = first; + } + + if (last) { + Py_XDECREF(self->last); + Py_INCREF(last); + self->last = last; + } + + Py_INCREF(Py_None); + return Py_None; + } + \end{verbatim} + + by filling the \member{tp_init} slot. + + \begin{verbatim} + (initproc)Noddy_init, /* tp_init */ + \end{verbatim} + + The \member{tp_init} slot is exposed in Python as the + \method{__init__} method. It is used to initialize an object after + it's created. Unlike the new method, we can't guarantee that the + initializer is called. The initializer isn't called when unpickling + objects and it can be overridden. Our initializer accepts arguments + to provide initial values for our instance. Initializers always accept + positional and keyword arguments. + + We want to want to expose our instance variables as attributes. There + are a number of ways to do that. The simplest way is to define member + definitions: + + \begin{verbatim} + static PyMemberDef Noddy_members[] = { + {"first", T_OBJECT_EX, offsetof(Noddy, first), 0, + "first name"}, + {"last", T_OBJECT_EX, offsetof(Noddy, last), 0, + "last name"}, + {"number", T_INT, offsetof(Noddy, number), 0, + "noddy number"}, + {NULL} /* Sentinel */ + }; + \end{verbatim} + + and put the definitions in the \member{tp_members} slot: + + \begin{verbatim} + Noddy_members, /* tp_members */ + \end{verbatim} + + Each member definition has a member name, type, offset, access flags + and documentation string. See the ``Generic Attribute Management'' + section below for details. + + A disadvantage of this approach is that it doesn't provide a way to + restrict the types of objects that can be assigned to the Python + attributes. We expect the first and last names to be strings, but any + Python objects can be assigned. Further, the attributes can be + deleted, setting the C pointers to \NULL. Even though we can make + sure the members are initialized to non-\NULL values, the members can + be set to \NULL if the attributes are deleted. + + We define a single method, \method{name}, that outputs the objects + name as the concatenation of the first and last names. + + \begin{verbatim} + static PyObject * + Noddy_name(Noddy* self) + { + static PyObject *format = NULL; + PyObject *args, *result; + + if (format == NULL) { + format = PyString_FromString("%s %s"); + if (format == NULL) + return NULL; + } + + if (self->first == NULL) { + PyErr_SetString(PyExc_AttributeError, "first"); + return NULL; + } + + if (self->last == NULL) { + PyErr_SetString(PyExc_AttributeError, "last"); + return NULL; + } + + args = Py_BuildValue("OO", self->first, self->last); + if (args == NULL) + return NULL; + + result = PyString_Format(format, args); + Py_DECREF(args); + + return result; + } + \end{verbatim} + + The method is implemented as a C function that takes a \class{Noddy} (or + \class{Noddy} subclass) instance as the first argument. Methods + always take an instance as the first argument. Methods often take + positional and keyword arguments as well, but in this cased we don't + take any and don't need to accept a positional argument tuple or + keyword argument dictionary. This method is equivalent to the Python + method: + + \begin{verbatim} + def name(self): + return "%s %s" % (self.first, self.last) + \end{verbatim} + + Note that we have to check for the possibility that our \member{first} + and \member{last} members are \NULL. This is because they can be + deleted, in which case they are set to \NULL. It would be better to + prevent deletion of these attributes and to restrict the attribute + values to be strings. We'll see how to do that in the next section. + + Now that we've defined the method, we need to create an array of + method definitions: + + \begin{verbatim} + static PyMethodDef Noddy_methods[] = { + {"name", (PyCFunction)Noddy_name, METH_NOARGS, + "Return the name, combining the first and last name" + }, + {NULL} /* Sentinel */ + }; + \end{verbatim} + + and assign them to the \member{tp_methods} slot: + + \begin{verbatim} + Noddy_methods, /* tp_methods */ + \end{verbatim} + + Note that used the \constant{METH_NOARGS} flag to indicate that the + method is passed no arguments. + + Finally, we'll make our type usable as a base class. We've written + our methods carefully so far so that they don't make any assumptions + about the type of the object being created or used, so all we need to + do is to add the \constant{Py_TPFLAGS_BASETYPE} to our class flag + definition: + + \begin{verbatim} + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + \end{verbatim} + + We rename \cfunction{initnoddy} to \cfunction{initnoddy2} + and update the module name passed to \cfunction{Py_InitModule3}. + + Finally, we update our \file{setup.py} file to build the new module: + + \begin{verbatim} + from distutils.core import setup, Extension + setup(name="noddy", version="1.0", + ext_modules=[ + Extension("noddy", ["noddy.c"]), + Extension("noddy2", ["noddy2.c"]), + ]) + \end{verbatim} + + \subsection{Providing finer control over data attributes} + + In this section, we'll provide finer control over how the + \member{first} and \member{last} attributes are set in the + \class{Noddy} example. In the previous version of our module, the + instance variables \member{first} and \member{last} could be set to + non-string values or even deleted. We want to make sure that these + attributes always contain strings. + + \verbatiminput{noddy3.c} + + To provide greater control, over the \member{first} and \member{last} + attributes, we'll use custom getter and setter functions. Here are + the functions for getting and setting the \member{first} attribute: + + \begin{verbatim} + Noddy_getfirst(Noddy *self, void *closure) + { + Py_INCREF(self->first); + return self->first; + } + + static int + Noddy_setfirst(Noddy *self, PyObject *value, void *closure) + { + if (value == NULL) { + PyErr_SetString(PyExc_TypeError, "Cannot delete the first attribute"); + return -1; + } + + if (! PyString_Check(value)) { + PyErr_SetString(PyExc_TypeError, + "The first attribute value must be a string"); + return -1; + } + + Py_DECREF(self->first); + Py_INCREF(value); + self->first = value; + + return 0; + } + \end{verbatim} + + The getter function is passed a \class{Noddy} object and a + ``closure'', which is void pointer. In this case, the closure is + ignored. (The closure supports an advanced usage in which definition + data is passed to the getter and setter. This could, for example, be + used to allow a single set of getter and setter functions that decide + the attribute to get or set based on data in the closure.) + + The setter function is passed the \class{Noddy} object, the new value, + and the closure. The new value may be \NULL, in which case the + attribute is being deleted. In our setter, we raise an error if the + attribute is deleted or if the attribute value is not a string. + + We create an array of \ctype{PyGetSetDef} structures: + + \begin{verbatim} + static PyGetSetDef Noddy_getseters[] = { + {"first", + (getter)Noddy_getfirst, (setter)Noddy_setfirst, + "first name", + NULL}, + {"last", + (getter)Noddy_getlast, (setter)Noddy_setlast, + "last name", + NULL}, + {NULL} /* Sentinel */ + }; + \end{verbatim} + + and register it in the \member{tp_getset} slot: + + \begin{verbatim} + Noddy_getseters, /* tp_getset */ + \end{verbatim} + + to register out attribute getters and setters. + + The last item in a \ctype{PyGetSetDef} structure is the closure + mentioned above. In this case, we aren't using the closure, so we just + pass \NULL. + + We also remove the member definitions for these attributes: + + \begin{verbatim} + static PyMemberDef Noddy_members[] = { + {"number", T_INT, offsetof(Noddy, number), 0, + "noddy number"}, + {NULL} /* Sentinel */ + }; + \end{verbatim} + + With these changes, we can assure that the \member{first} and + \member{last} members are never NULL so we can remove checks for \NULL + values in almost all cases. This means that most of the + \cfunction{Py_XDECREF} calls can be converted to \cfunction{Py_DECREF} + calls. The only place we can't change these calls is in the + deallocator, where there is the possibility that the initialization of + these members failed in the constructor. + + We also rename the module initialization function and module name in + the initialization function, as we did before, and we add an extra + definition to the \file{setup.py} file. \section{Type Methods *************** *** 354,358 **** { free(obj->obj_UnderlyingDatatypePtr); ! PyObject_DEL(obj); } \end{verbatim} --- 750,754 ---- { free(obj->obj_UnderlyingDatatypePtr); ! obj->ob_type->tp_free(self); } \end{verbatim} *************** *** 397,401 **** Py_DECREF(self->my_callback); } ! PyObject_DEL(obj); } \end{verbatim} --- 793,797 ---- Py_DECREF(self->my_callback); } ! obj->ob_type->tp_free(self); } \end{verbatim} *************** *** 717,721 **** The \member{tp_compare} handler is called when comparisons are needed ! are the object does not implement the specific rich comparison method which matches the requested comparison. (It is always used if defined and the \cfunction{PyObject_Compare()} or \cfunction{PyObject_Cmp()} --- 1113,1117 ---- The \member{tp_compare} handler is called when comparisons are needed ! and the object does not implement the specific rich comparison method which matches the requested comparison. (It is always used if defined and the \cfunction{PyObject_Compare()} or \cfunction{PyObject_Cmp()} *************** *** 773,780 **** which depend on several handler routines from the type implementation, the older protocols have been defined as optional blocks of handlers ! referenced by the type object, while newer protocols have been added ! using additional slots in the main type object, with a flag bit being ! set to indicate that the slots are present. (The flag bit does not ! indicate that the slot values are non-\NULL.) \begin{verbatim} --- 1169,1178 ---- which depend on several handler routines from the type implementation, the older protocols have been defined as optional blocks of handlers ! referenced by the type object. For newer protocols there are ! additional slots in the main type object, with a flag bit being set to ! indicate that the slots are present and should be checked by the ! interpreter. (The flag bit does not indicate that the slot values are ! non-\NULL. The flag may be set to indicate the presense of a slot, ! but a slot may still be unfilled.) \begin{verbatim} From goodger@users.sourceforge.net Wed May 7 22:35:10 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Wed, 07 May 2003 14:35:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.13,1.14 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv31741 Modified Files: pep-0314.txt Log Message: all one word Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** pep-0314.txt 7 May 2003 16:53:28 -0000 1.13 --- pep-0314.txt 7 May 2003 21:35:05 -0000 1.14 *************** *** 349,353 **** References ! [1] reStructured text http://docutils.sourceforge.net/ --- 349,353 ---- References ! [1] reStructuredText http://docutils.sourceforge.net/ From bcannon@users.sourceforge.net Wed May 7 23:02:19 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed, 07 May 2003 15:02:19 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtest.tex,NONE,1.1 lib.tex,1.220,1.221 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11116/Doc/lib Modified Files: lib.tex Added Files: libtest.tex Log Message: Library documentation for the 'test' package. Still needs to be checked by Fred. --- NEW FILE: libtest.tex --- \section{\module{test} --- Regression tests package for Python} \declaremodule{standard}{test} \sectionauthor{Brett Cannon}{brett@python.org} \modulesynopsis{Regression tests package containing the testing suite for Python.} The \module{test} package contains all regression tests for Python as well as the modules \module{test_support} and \module{regrtest.py}. \module{test_support} is used to enhance your tests while \module{regrtest.py} drives the testing suite. Each module in the \module{test} package whose name starts with \code{'test_'} is a testing suite for a specific module or feature. All new tests should be written using the \module{unittest} module; using \module{unittest} is not required but makes the tests more flexible and maintenance of the tests easier. Some older tests are written to use \module{doctest} and a ``traditional'' testing style; these styles of tests will not be covered. \begin{seealso} \seemodule{unittest}{Writing PyUnit regression tests.} \seemodule{doctest}{Tests embedded in documentation strings.} \end{seealso} \subsection{test_support \label{test_support-docs}} The \module{test_support} module contains functions for assisting with writing regression tests. The \module{test_support} module defines the following exceptions: \begin{excdesc}{TestFailed} Exception to be raised when a test fails. \end{excdesc} \begin{excdesc}{TestSkipped} Subclass of \exception{TestFailed}. Raised when a test is skipped. This occurs when a needed resource (such as a network connection) is not available at the time of testing. \end{excdesc} \begin{excdesc}{ResourceDenied} Subclass of \exception{TestSkipped}. Raised when a resource (such as a network connection) is not available. Raised by the \function{requires} function. \end{excdesc} The \module{test_support} module defines the following constants: \begin{datadesc}{verbose} \constant{True} when verbose output is enabled. Should be checked when more detailed information is desired about a running test. \var{verbose} is set by \module{regrtest.py}. \end{datadesc} \begin{datadesc}{have_unicode} \constant{True} when Unicode support is available. \end{datadesc} \begin{datadesc}{is_jython} \constant{True} if the running interpreter is Jython. \end{datadesc} \begin{datadesc}{TESTFN} Set to the path that a temporary file may be created at. Any temporary that is created should be closed and unlinked (removed). \end{datadesc} The \module{test_support} module defines the following functions: \begin{funcdesc}{forget}{module_name} Removes the module named \var{module_name} from \module{sys.modules} and deletes any byte-compiled files of the module. \end{funcdesc} \begin{funcdesc}{is_resource_enabled}{resource} Returns \constant{True} if \var{resource} is enabled and available. The list of available resources is only set when \module{regrtest.py} is executing the tests. \end{funcdest} \begin{funcdesc}{requires}{resource\optional{, msg}} Raises \exception{ResourceDenied} if \var{resource} is not available. \var{msg} is the argument to \exception{ResourceDenied} if it is raised. Always returns true if called by a function whose \var{__name__} is \code{"__main__"}. Used when tests are executed by \module{regrtest.py}. \end{funcdesc} \begin{funcdesc}{findfile}{filename} Return the path to the file named \var{filename}. If no match is found \var{filename} is returned. This does not equal a failure since it could be the path to the file. \end{funcdesc} \begin{funcdesc}{run_unittest}{*classes} Execute \class{unittest.TestCase} subclasses passed to the function. The function scans the classes for methods starting with the name \code{"test_"} and executes the tests individually. This is the preferred way to execute tests. \end{datadesc} \begin{funcdesc}{run_suite}{suite\optional{, testclass=None}} Execute the \class{unittest.TestSuite} instance, \var{suite}. The optional argument \var{testclass} accepts one of the test classes in the suite so as to print out more detailed information on where the testing suite originated from. \end{funcdesc} \subsection{Writing Unit Tests for the \module{test} package \label{writing-tests}} It is preferred that tests for the \module{test} package use the \module{unittest} module and follow a few guidelines. One is to have the name of all the test methods start with \code{"test_"} as well as the module's name. This is needed so that the methods are recognized by the test driver as test methods. Also, no documentation string for the method should be included. A comment (such as \var{# Tests function returns only True or False}) should be used to provide documentation for test methods. This is done because documentation strings get printed out if they exist and thus what test is being run is not stated. A basic boilerplate is often used: \begin{verbatim} import unittest from test import test_support class MyTestCase1(unittest.TestCase): # Only use setUp() and tearDown() if necessary def setUp(self): ... code to execute in preparation for tests ... def tearDown(self): ... code to execute to clean up after tests ... def test_feature_one(self): # Test feature one. ... testing code ... def test_feature_two(self): # Test feature two. ... testing code ... ... more test methods ... class MyTestCase2(unittest.TestCase): ... same structure as MyTestCase1 ... ... more test classes ... def test_main(): test_support.run_unittest(MyTestCase1, MyTestCase2, ... list other tests ... ) if __name__ == '__main__': test_main() \end{verbatim} This boilerplate code allows the testing suite to be run by \module{regrtest.py} as well as on its own as a script. The goal for regression testing is to try to break code. This leads to a few guidelines to be followed: \begin{itemize} \item The testing suite should exercise all classes, functions, and constants. This includes not just the external API that is to be presented to the outside world but also "private" code. \item Whitebox testing (examining the code being tested when the tests are being written) is preferred. Blackbox testing (testing only the published user interface) is not complete enough to make sure all boundary and edge cases are tested. \item Make sure all possible values are tested including invalid ones. This makes sure that not only all valid values are acceptable but also that improper values are handled correctly. \item Exhaust as many code paths as possible. Test where branching occurs and thus tailor input to make sure as many different paths through the code are taken. \item Add an explicit test for any bugs discovered for the tested code. This will make sure that the error does not crop up again if the code is changed in the future. \item Make sure to clean up after your tests (such as close and remove all temporary files). \item Import as few modules as possible and do it as soon as possible. This minimizes external dependencies of tests and also minimizes possible anomalous behavior from side-effects of importing a module. \item Try to maximize code reuse. On occasion tests will vary by something as small as what type of input they take. Minimize code duplication by subclassing a basic test class with a class that specifies the input: \begin{verbatim} class TestFuncAcceptsSequences(unittest.TestCase): func = mySuperWhammyFunction def test_func(self): self.func(self.arg) class AcceptLists(TestFuncAcceptsSequences): arg = [1,2,3] class AcceptStrings(TestFuncAcceptsSequences): arg = 'abc' class AcceptTuples(TestFuncAcceptsSequences): arg = (1,2,3) \end{verbatim} \end{itemize} \begin{seealso} \seetitle{Test Driven Development}{A book by Kent Beck on writing tests before code} \end{seealso} \subsection{Running tests Using \module{regrtest.py} \label{regrtest}} \module{regrtest.py} is the script used to drive Python's regression test suite. Running the script by itself automatically starts running all regression tests in the \module{test} package. It does this by finding all modules in the package whose name starts with \code{test_}, importing them, and executing the function \function{test_main} if present. The names of tests to execute may also be passed to the script. Specifying a single regression test (\code{python regrtest.py test_spam.py}) will minimize output and only print whether the test passed or failed and thus minimize output. Running \module{regrtest.py} directly allows what resources are available for tests to use to be set. You do this by using the \code{-u} command-line option. Run \code{python regrtest.py -uall} to turn on all resources; specifying \code{all} as an option for \code{-u} enables all possible resources. If all but one resource is desired (a more common case), a comma-separated list of resources that are not desired may be listed after \code{all}. The command \code{python regrtest.py -uall,-audio,-largefile} will run \module{regrtest.py} with all resources except the audio and largefile resources. For a list of all resources and more command-line options, run \code{python regrtest.py -h}. Some other ways to execute the regression tests depend on what platform the tests are being executed on. On \UNIX{}, you can run \code{make test} at the top-level directory where Python was built. On Windows, executing \code{rt.bat} from your PCBuild directory will run all regression tests. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.220 retrieving revision 1.221 diff -C2 -d -r1.220 -r1.221 *** lib.tex 18 Apr 2003 21:04:33 -0000 1.220 --- lib.tex 7 May 2003 22:02:16 -0000 1.221 *************** *** 119,122 **** --- 119,123 ---- \input{libdoctest} \input{libunittest} + \input{libtest} \input{libmath} \input{libcmath} From gward@users.sourceforge.net Thu May 8 02:38:55 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 18:38:55 -0700 Subject: [Python-checkins] python/dist/src/Lib optparse.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv27439 Modified Files: optparse.py Log Message: Update to Optik 1.4.1+: adds __all__ (Optik SF bug #728563). Index: optparse.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/optparse.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** optparse.py 24 Apr 2003 16:02:42 -0000 1.4 --- optparse.py 8 May 2003 01:38:52 -0000 1.5 *************** *** 5,9 **** Originally distributed as Optik; see http://optik.sourceforge.net/ . ! If you have problems with this module, please do not files bugs, patches, or feature requests with Python; instead, use Optik's SourceForge project page: --- 5,9 ---- Originally distributed as Optik; see http://optik.sourceforge.net/ . ! If you have problems with this module, please do not file bugs, patches, or feature requests with Python; instead, use Optik's SourceForge project page: *************** *** 17,22 **** # it is automatically generated from the Optik source code. ! __version__ = "1.4.1" __copyright__ = """ --- 17,39 ---- # it is automatically generated from the Optik source code. + __version__ = "1.4.1+" ! __all__ = ['Option', ! 'SUPPRESS_HELP', ! 'SUPPRESS_USAGE', ! 'STD_HELP_OPTION', ! 'STD_VERSION_OPTION', ! 'Values', ! 'OptionContainer', ! 'OptionGroup', ! 'OptionParser', ! 'HelpFormatter', ! 'IndentedHelpFormatter', ! 'TitledHelpFormatter', ! 'OptParseError', ! 'OptionError', ! 'OptionConflictError', ! 'OptionValueError', ! 'BadOptionError'] __copyright__ = """ From gward@users.sourceforge.net Thu May 8 02:58:07 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 18:58:07 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32627 Modified Files: textwrap.py Log Message: SF patch #598163 (Ville Vainio, vvainio@users.sourceforge.net): add dedent() function, to remove indentation from multiline strings (eg. triple-quoted strings). Differs from inspect.getdoc() by not special-casing the first line (often a sensible approach for non-docstring multiline strings). This should make this function more general (symmetric 'indent' also possible), and more fitting for the textwrap module. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** textwrap.py 7 May 2003 01:20:58 -0000 1.26 --- textwrap.py 8 May 2003 01:58:05 -0000 1.27 *************** *** 307,308 **** --- 307,350 ---- w = TextWrapper(width=width, **kwargs) return w.fill(text) + + + # -- Loosely related functionality ------------------------------------- + + def dedent(text): + """dedent(text : string) -> string + + Remove any whitespace than can be uniformly removed from the left + of every line in `text`. + + This can be used e.g. to make triple-quoted strings line up with + the left edge of screen/whatever, while still presenting it in the + source code in indented form. + + For example: + + def test(): + # end first line with \ to avoid the empty line! + s = '''\ + Hey + there + ''' + print repr(s) # prints ' Hey\n there\n ' + print repr(dedent(s)) # prints 'Hey\nthere\n' + """ + lines = text.expandtabs().split('\n') + margin = None + for line in lines: + content = len(line.lstrip()) + if not content: + continue + indent = len(line) - content + if margin is None: + margin = indent + else: + margin = min(margin, indent) + + if margin is not None: + for i in range(len(lines)): + lines[i] = lines[i][margin:] + + return '\n'.join(lines) From gward@users.sourceforge.net Thu May 8 02:58:28 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 18:58:28 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_textwrap.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv32729 Modified Files: test_textwrap.py Log Message: Add DedentTestCase to test dedent() function. Index: test_textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_textwrap.py 7 May 2003 01:19:22 -0000 1.21 --- test_textwrap.py 8 May 2003 01:58:26 -0000 1.22 *************** *** 12,16 **** from test import test_support ! from textwrap import TextWrapper, wrap, fill --- 12,16 ---- from test import test_support ! from textwrap import TextWrapper, wrap, fill, dedent *************** *** 324,328 **** - class IndentTestCases(BaseTestCase): --- 324,327 ---- *************** *** 374,379 **** def test_main(): ! test_support.run_unittest(WrapTestCase, LongWordTestCase, IndentTestCases) if __name__ == '__main__': --- 373,444 ---- + # Despite the similar names, DedentTestCase is *not* the inverse + # of IndentTestCase! + class DedentTestCase(unittest.TestCase): + + def test_dedent_nomargin(self): + # No lines indented. + text = "Hello there.\nHow are you?\nOh good, I'm glad." + self.assertEquals(dedent(text), text) + + # Similar, with a blank line. + text = "Hello there.\n\nBoo!" + self.assertEquals(dedent(text), text) + + # Some lines indented, but overall margin is still zero. + text = "Hello there.\n This is indented." + self.assertEquals(dedent(text), text) + + # Again, add a blank line. + text = "Hello there.\n\n Boo!\n" + self.assertEquals(dedent(text), text) + + def test_dedent_even(self): + # All lines indented by two spaces. + text = " Hello there.\n How are ya?\n Oh good." + expect = "Hello there.\nHow are ya?\nOh good." + self.assertEquals(dedent(text), expect) + + # Same, with blank lines. + text = " Hello there.\n\n How are ya?\n Oh good.\n" + expect = "Hello there.\n\nHow are ya?\nOh good.\n" + self.assertEquals(dedent(text), expect) + + # Now indent one of the blank lines. + text = " Hello there.\n \n How are ya?\n Oh good.\n" + expect = "Hello there.\n\nHow are ya?\nOh good.\n" + self.assertEquals(dedent(text), expect) + + def test_dedent_uneven(self): + # Lines indented unevenly. + text = '''\ + def foo(): + while 1: + return foo + ''' + expect = '''\ + def foo(): + while 1: + return foo + ''' + self.assertEquals(dedent(text), expect) + + # Uneven indentation with a blank line. + text = " Foo\n Bar\n\n Baz\n" + expect = "Foo\n Bar\n\n Baz\n" + self.assertEquals(dedent(text), expect) + + # Uneven indentation with a whitespace-only line. + text = " Foo\n Bar\n \n Baz\n" + expect = "Foo\n Bar\n\n Baz\n" + self.assertEquals(dedent(text), expect) + + + def test_main(): ! test_support.run_unittest(WrapTestCase, ! LongWordTestCase, ! IndentTestCases, ! DedentTestCase) if __name__ == '__main__': From gward@users.sourceforge.net Thu May 8 03:02:53 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 19:02:53 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1561 Modified Files: textwrap.py Log Message: Minor clarification of dedent(). Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** textwrap.py 8 May 2003 01:58:05 -0000 1.27 --- textwrap.py 8 May 2003 02:02:50 -0000 1.28 *************** *** 335,342 **** margin = None for line in lines: ! content = len(line.lstrip()) if not content: continue ! indent = len(line) - content if margin is None: margin = indent --- 335,342 ---- margin = None for line in lines: ! content = line.lstrip() if not content: continue ! indent = len(line) - len(content) if margin is None: margin = indent *************** *** 344,348 **** margin = min(margin, indent) ! if margin is not None: for i in range(len(lines)): lines[i] = lines[i][margin:] --- 344,348 ---- margin = min(margin, indent) ! if margin is not None and margin > 0: for i in range(len(lines)): lines[i] = lines[i][margin:] From gward@users.sourceforge.net Thu May 8 03:09:52 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 19:09:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv3249 Modified Files: libtextwrap.tex Log Message: SF patch #598163 (Ville Vainio, vvainio@users.sourceforge.net): document dedent() function. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libtextwrap.tex 3 Jul 2002 05:08:48 -0000 1.4 --- libtextwrap.tex 8 May 2003 02:09:49 -0000 1.5 *************** *** 11,18 **** The \module{textwrap} module provides two convenience functions, \function{wrap()} and \function{fill()}, as well as ! \class{TextWrapper}, the class that does all the work. If you're just ! wrapping or filling one or two text strings, the convenience functions ! should be good enough; otherwise, you should use an instance of ! \class{TextWrapper} for efficiency. \begin{funcdesc}{wrap}{text\optional{, width\optional{, \moreargs}}} --- 11,18 ---- The \module{textwrap} module provides two convenience functions, \function{wrap()} and \function{fill()}, as well as ! \class{TextWrapper}, the class that does all the work, and a utility function ! \function{dedent()}. If you're just wrapping or filling one or two ! text strings, the convenience functions should be good enough; otherwise, ! you should use an instance of \class{TextWrapper} for efficiency. \begin{funcdesc}{wrap}{text\optional{, width\optional{, \moreargs}}} *************** *** 42,45 **** --- 42,70 ---- strings, it will be more efficient for you to create your own \class{TextWrapper} object. + + An additional utility function, \function{dedent()}, is provided to + remove indentation from strings that have unwanted whitespace to the + left of the text. + + \begin{funcdesc}{dedent}{text} + Remove any whitespace than can be uniformly removed from the left + of every line in \var{text}. + + This is typically used to make triple-quoted strings line up with + the left edge of screen/whatever, while still presenting it in the + source code in indented form. + + For example: + \begin{verbatim} + def test(): + # end first line with \ to avoid the empty line! + s = '''\ + Hey + there + ''' + print repr(s) # prints ' Hey\n there\n ' + print repr(dedent(s)) # prints 'Hey\nthere\n' + \end{verbatim} + \end{funcdesc} \begin{classdesc}{TextWrapper}{...} From gward@users.sourceforge.net Thu May 8 03:12:37 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 19:12:37 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtextwrap.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv3866/Doc/lib Modified Files: libtextwrap.tex Log Message: Clarify the dedent() example a bit by indenting the input lines unevenly. Index: libtextwrap.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtextwrap.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libtextwrap.tex 8 May 2003 02:09:49 -0000 1.5 --- libtextwrap.tex 8 May 2003 02:12:35 -0000 1.6 *************** *** 60,68 **** # end first line with \ to avoid the empty line! s = '''\ ! Hey ! there ''' ! print repr(s) # prints ' Hey\n there\n ' ! print repr(dedent(s)) # prints 'Hey\nthere\n' \end{verbatim} \end{funcdesc} --- 60,68 ---- # end first line with \ to avoid the empty line! s = '''\ ! hello ! world ''' ! print repr(s) # prints ' hello\n world\n ' ! print repr(dedent(s)) # prints 'hello\n world\n' \end{verbatim} \end{funcdesc} From gward@users.sourceforge.net Thu May 8 03:12:37 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 07 May 2003 19:12:37 -0700 Subject: [Python-checkins] python/dist/src/Lib textwrap.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3866/Lib Modified Files: textwrap.py Log Message: Clarify the dedent() example a bit by indenting the input lines unevenly. Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** textwrap.py 8 May 2003 02:02:50 -0000 1.28 --- textwrap.py 8 May 2003 02:12:35 -0000 1.29 *************** *** 326,334 **** # end first line with \ to avoid the empty line! s = '''\ ! Hey ! there ''' ! print repr(s) # prints ' Hey\n there\n ' ! print repr(dedent(s)) # prints 'Hey\nthere\n' """ lines = text.expandtabs().split('\n') --- 326,334 ---- # end first line with \ to avoid the empty line! s = '''\ ! hello ! world ''' ! print repr(s) # prints ' hello\n world\n ' ! print repr(dedent(s)) # prints 'hello\n world\n' """ lines = text.expandtabs().split('\n') From bwarsaw@users.sourceforge.net Thu May 8 04:33:18 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 07 May 2003 20:33:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/email _parseaddr.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv26772 Modified Files: _parseaddr.py Log Message: parsedate_tz(): Be slightly more lenient when there's no day of the week. Patch given by Daniel Berlin in SF bug # 732761. Also closes SF bug # 727719. Backport candidate. Index: _parseaddr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_parseaddr.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _parseaddr.py 17 Mar 2003 18:35:42 -0000 1.5 --- _parseaddr.py 8 May 2003 03:33:15 -0000 1.6 *************** *** 55,61 **** else: i = data[0].rfind(',') ! if i < 0: ! return None ! data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') --- 55,60 ---- else: i = data[0].rfind(',') ! if i >= 0: ! data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') From bwarsaw@users.sourceforge.net Thu May 8 04:34:04 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 07 May 2003 20:34:04 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv26895 Modified Files: test_email.py Log Message: A couple of new parsedate test cases. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** test_email.py 24 Apr 2003 15:58:47 -0000 1.49 --- test_email.py 8 May 2003 03:34:01 -0000 1.50 *************** *** 1878,1881 **** --- 1878,1891 ---- Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) + def test_parsedate_no_dayofweek(self): + eq = self.assertEqual + eq(Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'), + (2003, 2, 25, 13, 47, 26, 0, 0, 0, -28800)) + + def test_parsedate_compact_no_dayofweek(self): + eq = self.assertEqual + eq(Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'), + (2003, 2, 5, 13, 47, 26, 0, 0, 0, -28800)) + def test_parseaddr_empty(self): self.assertEqual(Utils.parseaddr('<>'), ('', '')) From bwarsaw@users.sourceforge.net Thu May 8 04:35:00 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 07 May 2003 20:35:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv27099 Modified Files: __init__.py Log Message: Bump version number Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** __init__.py 30 Mar 2003 20:47:48 -0000 1.27 --- __init__.py 8 May 2003 03:34:58 -0000 1.28 *************** *** 5,9 **** """ ! __version__ = '2.5.1' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.2' __all__ = [ From bwarsaw@users.sourceforge.net Thu May 8 05:00:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 07 May 2003 21:00:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/email/test test_email.py,1.17.2.6,1.17.2.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email/test In directory sc8-pr-cvs1:/tmp/cvs-serv863/Lib/email/test Modified Files: Tag: release22-maint test_email.py Log Message: Backporting email 2.5.2 fixes. Index: test_email.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/test/test_email.py,v retrieving revision 1.17.2.6 retrieving revision 1.17.2.7 diff -C2 -d -r1.17.2.6 -r1.17.2.7 *** test_email.py 21 Mar 2003 21:09:32 -0000 1.17.2.6 --- test_email.py 8 May 2003 04:00:05 -0000 1.17.2.7 *************** *** 834,842 **** m = '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); ! Wed, 16 Oct 2002 07:41:11 -0700''' msg = email.message_from_string(m) eq(msg.as_string(), '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with ! Microsoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 ''') --- 834,842 ---- m = '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with Microsoft SMTPSVC(5.0.2195.4905); ! \tWed, 16 Oct 2002 07:41:11 -0700''' msg = email.message_from_string(m) eq(msg.as_string(), '''\ Received: from siimage.com ([172.25.1.3]) by zima.siliconimage.com with ! \tMicrosoft SMTPSVC(5.0.2195.4905); Wed, 16 Oct 2002 07:41:11 -0700 ''') *************** *** 852,856 **** eq(msg.as_string(), """\ List: List-Unsubscribe: , ! List: List-Unsubscribe: , --- 852,856 ---- eq(msg.as_string(), """\ List: List-Unsubscribe: , ! \t List: List-Unsubscribe: , *************** *** 1868,1871 **** --- 1868,1881 ---- self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'), Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) + + def test_parsedate_no_dayofweek(self): + eq = self.assertEqual + eq(Utils.parsedate_tz('25 Feb 2003 13:47:26 -0800'), + (2003, 2, 25, 13, 47, 26, 0, 0, 0, -28800)) + + def test_parsedate_compact_no_dayofweek(self): + eq = self.assertEqual + eq(Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800'), + (2003, 2, 5, 13, 47, 26, 0, 0, 0, -28800)) def test_parseaddr_empty(self): From bwarsaw@users.sourceforge.net Thu May 8 05:00:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 07 May 2003 21:00:08 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Message.py,1.9.6.3,1.9.6.4 __init__.py,1.4.10.6,1.4.10.7 _parseaddr.py,1.5.2.1,1.5.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv863/Lib/email Modified Files: Tag: release22-maint Message.py __init__.py _parseaddr.py Log Message: Backporting email 2.5.2 fixes. Index: Message.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v retrieving revision 1.9.6.3 retrieving revision 1.9.6.4 diff -C2 -d -r1.9.6.3 -r1.9.6.4 *** Message.py 21 Mar 2003 21:09:31 -0000 1.9.6.3 --- Message.py 8 May 2003 04:00:04 -0000 1.9.6.4 *************** *** 103,106 **** --- 103,110 ---- Optional `unixfrom' when True, means include the Unix From_ envelope header. + + This is a convenience method and may not generate the message exactly + as you intend. For more flexibility, use the flatten() method of a + Generator instance. """ from email.Generator import Generator Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.4.10.6 retrieving revision 1.4.10.7 diff -C2 -d -r1.4.10.6 -r1.4.10.7 *** __init__.py 4 Apr 2003 02:47:07 -0000 1.4.10.6 --- __init__.py 8 May 2003 04:00:05 -0000 1.4.10.7 *************** *** 5,9 **** """ ! __version__ = '2.5.1' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.2' __all__ = [ Index: _parseaddr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/_parseaddr.py,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** _parseaddr.py 21 Mar 2003 21:09:31 -0000 1.5.2.1 --- _parseaddr.py 8 May 2003 04:00:05 -0000 1.5.2.2 *************** *** 55,61 **** else: i = data[0].rfind(',') ! if i < 0: ! return None ! data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') --- 55,60 ---- else: i = data[0].rfind(',') ! if i >= 0: ! data[0] = data[0][i+1:] if len(data) == 3: # RFC 850 date, deprecated stuff = data[0].split('-') From mwh@python.net Thu May 8 11:26:53 2003 From: mwh@python.net (Michael Hudson) Date: Thu, 08 May 2003 11:26:53 +0100 Subject: [Python-checkins] python/dist/src/Doc/ext noddy2.c,NONE,1.1 noddy3.c,NONE,1.1 newtypes.tex,1.21,1.22 In-Reply-To: (dcjim@users.sourceforge.net's message of "Wed, 07 May 2003 12:48:16 -0700") References: Message-ID: <2mu1c568eq.fsf@starship.python.net> dcjim@users.sourceforge.net writes: > Update of /cvsroot/python/python/dist/src/Doc/ext > In directory sc8-pr-cvs1:/tmp/cvs-serv13294 > > Modified Files: > newtypes.tex > Added Files: > noddy2.c noddy3.c > Log Message: > Rewrote the basic section of the chapter on defining new types. As the original author of this section, thank you! Do you mention anywhere that this only works for 2.2 and up? That might be an idea. Also: [...] > That wasn't so hard, was it? > > + Of course, the current Noddy type is pretty uninteresting. It has no > + data and doesn't do anything. It can't even be subclasses. ^^^^^^^^^^ Cheers, M. -- I'll write on my monitor fifty times 'I must not post self-indulgent wibble nobody is interested in to ucam.chat just because I'm bored and I can't find the bug I'm supposed to fix'. -- Steve Kitson, ucam.chat From dcjim@users.sourceforge.net Thu May 8 11:32:13 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Thu, 08 May 2003 03:32:13 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv21147 Modified Files: newtypes.tex Log Message: Fixed a typo in an example dealloc routine that calls it's "self" argument "obj" rather than "self". Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** newtypes.tex 7 May 2003 19:48:13 -0000 1.22 --- newtypes.tex 8 May 2003 10:32:10 -0000 1.23 *************** *** 750,754 **** { free(obj->obj_UnderlyingDatatypePtr); ! obj->ob_type->tp_free(self); } \end{verbatim} --- 750,754 ---- { free(obj->obj_UnderlyingDatatypePtr); ! obj->ob_type->tp_free(obj); } \end{verbatim} From dcjim@users.sourceforge.net Thu May 8 11:35:10 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Thu, 08 May 2003 03:35:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv22899 Modified Files: newtypes.tex Log Message: Fixed small typo Pointed out by Michael Hudson. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** newtypes.tex 8 May 2003 10:32:10 -0000 1.23 --- newtypes.tex 8 May 2003 10:35:07 -0000 1.24 *************** *** 256,260 **** Of course, the current Noddy type is pretty uninteresting. It has no ! data and doesn't do anything. It can't even be subclasses. \subsection{Adding data and methods to the Basic example} --- 256,260 ---- Of course, the current Noddy type is pretty uninteresting. It has no ! data and doesn't do anything. It can't even be subclassed. \subsection{Adding data and methods to the Basic example} From jim@zope.com Thu May 8 11:40:42 2003 From: jim@zope.com (Jim Fulton) Date: Thu, 08 May 2003 06:40:42 -0400 Subject: [Python-checkins] python/dist/src/Doc/ext noddy2.c,NONE,1.1 noddy3.c,NONE,1.1 newtypes.tex,1.21,1.22 In-Reply-To: <2mu1c568eq.fsf@starship.python.net> References: <2mu1c568eq.fsf@starship.python.net> Message-ID: <3EBA342A.7020006@zope.com> Michael Hudson wrote: > dcjim@users.sourceforge.net writes: > > >>Update of /cvsroot/python/python/dist/src/Doc/ext >>In directory sc8-pr-cvs1:/tmp/cvs-serv13294 >> >>Modified Files: >> newtypes.tex >>Added Files: >> noddy2.c noddy3.c >>Log Message: >>Rewrote the basic section of the chapter on defining new types. > > > As the original author of this section, thank you! You're welcome. :) My main reason for doing this was to learn the material myself. (I had the luxury of sitting next to Guido as I did it and bugging him with questions. :) > Do you mention anywhere that this only works for 2.2 and up? That > might be an idea. OK, I'll add that in the introduction. It was *already* dependent on Python 2.3 due to the use of PyMODINIT_FUNC as the type of the init function. I'm not sure why this is needed rather than void. Maybe I should change this so it works with Python 2.2. I'll talk to Guido and Fred about this. > Also: > > [...] > >> That wasn't so hard, was it? >> >>+ Of course, the current Noddy type is pretty uninteresting. It has no >>+ data and doesn't do anything. It can't even be subclasses. > > ^^^^^^^^^^ Fixed. Thanks. Jim -- Jim Fulton mailto:jim@zope.com Python Powered! CTO (703) 361-1714 http://www.python.org Zope Corporation http://www.zope.com http://www.zope.org From mwh@python.net Thu May 8 11:54:21 2003 From: mwh@python.net (Michael Hudson) Date: Thu, 08 May 2003 11:54:21 +0100 Subject: [Python-checkins] python/dist/src/Doc/ext noddy2.c,NONE,1.1 noddy3.c,NONE,1.1 newtypes.tex,1.21,1.22 In-Reply-To: <3EBA342A.7020006@zope.com> (Jim Fulton's message of "Thu, 08 May 2003 06:40:42 -0400") References: <2mu1c568eq.fsf@starship.python.net> <3EBA342A.7020006@zope.com> Message-ID: <2mr879674y.fsf@starship.python.net> [Ccing python-dev because of the last paragraph] Jim Fulton writes: > Michael Hudson wrote: >> dcjim@users.sourceforge.net writes: >> >>>Update of /cvsroot/python/python/dist/src/Doc/ext >>>In directory sc8-pr-cvs1:/tmp/cvs-serv13294 >>> >>>Modified Files: >>> newtypes.tex Added Files: >>> noddy2.c noddy3.c Log Message: >>>Rewrote the basic section of the chapter on defining new types. >> As the original author of this section, thank you! > > You're welcome. :) > > My main reason for doing this was to learn the material myself. > (I had the luxury of sitting next to Guido as I did it and bugging > him with questions. :) That would help :-) >> Do you mention anywhere that this only works for 2.2 and up? That >> might be an idea. > > OK, I'll add that in the introduction. It was *already* dependent on > Python 2.3 due to the use of PyMODINIT_FUNC as the type of the init > function. Yes. That wasn't me, and whoever changed it didn't keep the .c file in sync with the bits of it quoted in the .tex file, grumble. > I'm not sure why this is needed rather than void. Maybe I should change this > so it works with Python 2.2. I'll talk to Guido and Fred about this. The Py_MODINIT()/DL_IMPORT() thing is an annoying incompatibility-causer ... perhaps something to deal with this could be added to pymemcompat.h? (in which case it's misnamed...) Cheers, M. -- ARTHUR: Ford, you're turning into a penguin, stop it. -- The Hitch-Hikers Guide to the Galaxy, Episode 2 From tim_one@users.sourceforge.net Thu May 8 19:14:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 May 2003 11:14:01 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.758,1.759 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9444/python/Misc Modified Files: NEWS Log Message: Leading "C:" no longer hardcoded in the default installation directory. After removing that, two testers on machines where C: is not the system drive reported that the installer suggested their system drive instead of C:, and that's what they wanted it to do. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.758 retrieving revision 1.759 diff -C2 -d -r1.758 -r1.759 *** NEWS 7 May 2003 01:28:47 -0000 1.758 --- NEWS 8 May 2003 18:13:59 -0000 1.759 *************** *** 63,66 **** --- 63,76 ---- ------- + - The installer always suggested that Python be installed on the C: + drive, due to a hardcoded "C:" generated by the Wise installation + wizard. People with machines where C: is not the system drive + usually want Python installed on whichever drive is their system drive + instead. We removed the hardcoded "C:", and two testers on machines + where C: is not the system drive report that the installer now + suggests their system drive. Note that you can always select the + directory you want in the "Select Destination Directory" dialog -- + that's what it's for. + Mac --- From tim_one@users.sourceforge.net Thu May 8 19:14:01 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 08 May 2003 11:14:01 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.122,1.123 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv9444/python/PCbuild Modified Files: python20.wse Log Message: Leading "C:" no longer hardcoded in the default installation directory. After removing that, two testers on machines where C: is not the system drive reported that the installer suggested their system drive instead of C:, and that's what they wanted it to do. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** python20.wse 24 Apr 2003 21:52:16 -0000 1.122 --- python20.wse 8 May 2003 18:13:59 -0000 1.123 *************** *** 204,212 **** end item: Remark ! Text=Note from Tim: doesn't seem to be a way to get the true boot drive, the Wizard hardcodes "C". end item: Set Variable Variable=MAINDIR ! Value=C:\%MAINDIR% Flags=00001100 end --- 204,221 ---- end item: Remark ! Text=Note from Tim: The Wizard hardcod "C:" at the start of the replacement text for MAINDIR. ! end ! item: Remark ! Text=That's not appropriate if the system drive doesn't happen to be C:. ! end ! item: Remark ! Text=I removed the "C:", and that did the right thing for two people who tested it on non-C: machines, ! end ! item: Remark ! Text=but it's unclear whether it will always do the right thing. end item: Set Variable Variable=MAINDIR ! Value=\%MAINDIR% Flags=00001100 end From jvr@users.sourceforge.net Fri May 9 08:53:20 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 00:53:20 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.264,1.265 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21435 Modified Files: socketmodule.c Log Message: [ 731644] & [ 604210 ] Release the GIL around getaddrinfo(), yet protect access with lock on those platforms that getaddrinfo() isn't (known to be) thread-safe. Thanks to MvL for mentoring this patch. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.264 retrieving revision 1.265 diff -C2 -d -r1.264 -r1.265 *** socketmodule.c 3 May 2003 10:12:45 -0000 1.264 --- socketmodule.c 9 May 2003 07:53:18 -0000 1.265 *************** *** 141,145 **** #endif ! #ifdef USE_GETHOSTBYNAME_LOCK # include "pythread.h" #endif --- 141,160 ---- #endif ! /* On systems on which getaddrinfo() is believed to not be thread-safe, ! protect access with a lock. */ ! #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ ! defined(__NetBSD__) ! #define USE_GETADDRINFO_LOCK ! #endif ! ! #ifdef USE_GETADDRINFO_LOCK ! #define ACQUIRE_GETADDRINFO_LOCK PyThread_acquire_lock(netdb_lock, 1); ! #define RELEASE_GETADDRINFO_LOCK PyThread_release_lock(netdb_lock); ! #else ! #define ACQUIRE_GETADDRINFO_LOCK ! #define RELEASE_GETADDRINFO_LOCK ! #endif ! ! #if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK) # include "pythread.h" #endif *************** *** 620,626 **** /* Lock to allow python interpreter to continue, but only allow one ! thread to be in gethostbyname */ ! #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_type_lock gethostbyname_lock; #endif --- 635,641 ---- /* Lock to allow python interpreter to continue, but only allow one ! thread to be in gethostbyname or getaddrinfo */ ! #if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK) ! PyThread_type_lock netdb_lock; #endif *************** *** 647,651 **** --- 662,674 ---- hints.ai_socktype = SOCK_DGRAM; /*dummy*/ hints.ai_flags = AI_PASSIVE; + Py_BEGIN_ALLOW_THREADS + ACQUIRE_GETADDRINFO_LOCK error = getaddrinfo(NULL, "0", &hints, &res); + Py_END_ALLOW_THREADS + /* We assume that those thread-unsafe getaddrinfo() versions + *are* safe regarding their return value, ie. that a + subsequent call to getaddrinfo() does not destroy the + outcome of the first call. */ + RELEASE_GETADDRINFO_LOCK if (error) { set_gaierror(error); *************** *** 711,714 **** --- 734,739 ---- memset(&hints, 0, sizeof(hints)); hints.ai_family = af; + Py_BEGIN_ALLOW_THREADS + ACQUIRE_GETADDRINFO_LOCK error = getaddrinfo(name, NULL, &hints, &res); #if defined(__digital__) && defined(__unix__) *************** *** 720,723 **** --- 745,750 ---- } #endif + Py_END_ALLOW_THREADS + RELEASE_GETADDRINFO_LOCK /* see comment in setipaddr() */ if (error) { set_gaierror(error); *************** *** 2411,2415 **** #else /* not HAVE_GETHOSTBYNAME_R */ #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_acquire_lock(gethostbyname_lock, 1); #endif h = gethostbyname(name); --- 2438,2442 ---- #else /* not HAVE_GETHOSTBYNAME_R */ #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_acquire_lock(netdb_lock, 1); #endif h = gethostbyname(name); *************** *** 2424,2428 **** sa->sa_family); #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_release_lock(gethostbyname_lock); #endif return ret; --- 2451,2455 ---- sa->sa_family); #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_release_lock(netdb_lock); #endif return ret; *************** *** 2507,2511 **** #else /* not HAVE_GETHOSTBYNAME_R */ #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_acquire_lock(gethostbyname_lock, 1); #endif h = gethostbyaddr(ap, al, af); --- 2534,2538 ---- #else /* not HAVE_GETHOSTBYNAME_R */ #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_acquire_lock(netdb_lock, 1); #endif h = gethostbyaddr(ap, al, af); *************** *** 2514,2518 **** ret = gethost_common(h, (struct sockaddr *)&addr, sizeof(addr), af); #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_release_lock(gethostbyname_lock); #endif return ret; --- 2541,2545 ---- ret = gethost_common(h, (struct sockaddr *)&addr, sizeof(addr), af); #ifdef USE_GETHOSTBYNAME_LOCK ! PyThread_release_lock(netdb_lock); #endif return ret; *************** *** 2967,2971 **** --- 2994,3002 ---- hints.ai_protocol = protocol; hints.ai_flags = flags; + Py_BEGIN_ALLOW_THREADS + ACQUIRE_GETADDRINFO_LOCK error = getaddrinfo(hptr, pptr, &hints, &res0); + Py_END_ALLOW_THREADS + RELEASE_GETADDRINFO_LOCK /* see comment in setipaddr() */ if (error) { set_gaierror(error); *************** *** 3036,3040 **** --- 3067,3075 ---- hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; /* make numeric port happy */ + Py_BEGIN_ALLOW_THREADS + ACQUIRE_GETADDRINFO_LOCK error = getaddrinfo(hostp, pbuf, &hints, &res); + Py_END_ALLOW_THREADS + RELEASE_GETADDRINFO_LOCK /* see comment in setipaddr() */ if (error) { set_gaierror(error); *************** *** 3941,3946 **** /* Initialize gethostbyname lock */ ! #ifdef USE_GETHOSTBYNAME_LOCK ! gethostbyname_lock = PyThread_allocate_lock(); #endif } --- 3976,3981 ---- /* Initialize gethostbyname lock */ ! #if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK) ! netdb_lock = PyThread_allocate_lock(); #endif } From jvr@users.sourceforge.net Fri May 9 09:03:48 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 01:03:48 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.265,1.266 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25206 Modified Files: socketmodule.c Log Message: Addition to [731644]: also use the lock when using the getaddrinfo emulation (ie. when HAVE_GETADDRINFO isn't defined). Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.265 retrieving revision 1.266 diff -C2 -d -r1.265 -r1.266 *** socketmodule.c 9 May 2003 07:53:18 -0000 1.265 --- socketmodule.c 9 May 2003 08:03:44 -0000 1.266 *************** *** 142,148 **** /* On systems on which getaddrinfo() is believed to not be thread-safe, ! protect access with a lock. */ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ ! defined(__NetBSD__) #define USE_GETADDRINFO_LOCK #endif --- 142,148 ---- /* On systems on which getaddrinfo() is believed to not be thread-safe, ! (this includes the getaddrinfo emulation) protect access with a lock. */ #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ ! defined(__NetBSD__) || !defined(HAVE_GETADDRINFO) #define USE_GETADDRINFO_LOCK #endif From jvr@users.sourceforge.net Fri May 9 09:12:04 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 01:12:04 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.266,1.267 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv27696 Modified Files: socketmodule.c Log Message: Yet another addition to [731644]: only use the lock if thread-support is enabled. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.266 retrieving revision 1.267 diff -C2 -d -r1.266 -r1.267 *** socketmodule.c 9 May 2003 08:03:44 -0000 1.266 --- socketmodule.c 9 May 2003 08:12:00 -0000 1.267 *************** *** 143,148 **** /* On systems on which getaddrinfo() is believed to not be thread-safe, (this includes the getaddrinfo emulation) protect access with a lock. */ ! #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \ ! defined(__NetBSD__) || !defined(HAVE_GETADDRINFO) #define USE_GETADDRINFO_LOCK #endif --- 143,148 ---- /* On systems on which getaddrinfo() is believed to not be thread-safe, (this includes the getaddrinfo emulation) protect access with a lock. */ ! #if defined(WITH_THREAD) && (defined(__APPLE__) || defined(__FreeBSD__) || \ ! defined(__OpenBSD__) || defined(__NetBSD__) || !defined(HAVE_GETADDRINFO)) #define USE_GETADDRINFO_LOCK #endif From loewis@users.sourceforge.net Fri May 9 09:19:50 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 09 May 2003 01:19:50 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.759,1.760 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30645/Misc Modified Files: NEWS Log Message: Patch #734118: Add {get|set}busywaitinterval. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.759 retrieving revision 1.760 diff -C2 -d -r1.759 -r1.760 *** NEWS 8 May 2003 18:13:59 -0000 1.759 --- NEWS 9 May 2003 08:19:47 -0000 1.760 *************** *** 24,27 **** --- 24,29 ---- ----------------- + - _tkinter.{get|set}busywaitinterval was added. + - itertools.islice() now accepts stop=None as documented. Fixes SF bug #730685. From loewis@users.sourceforge.net Fri May 9 09:19:51 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 09 May 2003 01:19:51 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.157,1.158 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30645/Modules Modified Files: _tkinter.c Log Message: Patch #734118: Add {get|set}busywaitinterval. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** _tkinter.c 3 May 2003 09:45:12 -0000 1.157 --- _tkinter.c 9 May 2003 08:19:48 -0000 1.158 *************** *** 319,322 **** --- 319,324 ---- /**** Utils ****/ + static int Tkinter_busywaitinterval = 20; + #ifdef WITH_THREAD #ifndef MS_WINDOWS *************** *** 2520,2524 **** if(tcl_lock)PyThread_release_lock(tcl_lock); if (result == 0) ! Sleep(20); Py_END_ALLOW_THREADS } --- 2522,2526 ---- if(tcl_lock)PyThread_release_lock(tcl_lock); if (result == 0) ! Sleep(Tkinter_busywaitinterval); Py_END_ALLOW_THREADS } *************** *** 2832,2835 **** --- 2834,2873 ---- } + static PyObject * + Tkinter_setbusywaitinterval(PyObject *self, PyObject *args) + { + int new_val; + if (!PyArg_ParseTuple(args, "i:setbusywaitinterval", &new_val)) + return NULL; + if (new_val < 0) { + PyErr_SetString(PyExc_ValueError, + "busywaitinterval must be >= 0"); + return NULL; + } + Tkinter_busywaitinterval = new_val; + Py_INCREF(Py_None); + return Py_None; + } + + static char setbusywaitinterval_doc[] = + "setbusywaitinterval(n) -> None\n\ + \n\ + Set the busy-wait interval in milliseconds between successive\n\ + calls to Tcl_DoOneEvent in a threaded Python interpreter.\n\ + It should be set to a divisor of the maximum time between\n\ + frames in an animation."; + + static PyObject * + Tkinter_getbusywaitinterval(PyObject *self, PyObject *args) + { + return PyInt_FromLong(Tkinter_busywaitinterval); + } + + static char getbusywaitinterval_doc[] = + "getbusywaitinterval() -> int\n\ + \n\ + Return the current busy-wait interval between successive\n\ + calls to Tcl_DoOneEvent in a threaded Python interpreter."; + static PyMethodDef moduleMethods[] = { *************** *** 2844,2847 **** --- 2882,2889 ---- {"dooneevent", Tkapp_DoOneEvent, METH_VARARGS}, {"quit", Tkapp_Quit, METH_VARARGS}, + {"setbusywaitinterval",Tkinter_setbusywaitinterval, METH_VARARGS, + setbusywaitinterval_doc}, + {"getbusywaitinterval",(PyCFunction)Tkinter_getbusywaitinterval, + METH_NOARGS, getbusywaitinterval_doc}, {NULL, NULL} }; *************** *** 2896,2900 **** if(tcl_lock)PyThread_release_lock(tcl_lock); if (result == 0) ! Sleep(20); Py_END_ALLOW_THREADS #else --- 2938,2942 ---- if(tcl_lock)PyThread_release_lock(tcl_lock); if (result == 0) ! Sleep(Tkinter_busywaitinterval); Py_END_ALLOW_THREADS #else From jvr@users.sourceforge.net Fri May 9 09:27:35 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 01:27:35 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv822 Modified Files: PyEdit.py Log Message: dead code removal Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** PyEdit.py 6 May 2003 14:28:31 -0000 1.40 --- PyEdit.py 9 May 2003 08:27:33 -0000 1.41 *************** *** 27,37 **** - try: - import Wthreading - except ImportError: - haveThreading = 0 - else: - haveThreading = Wthreading.haveThreading - _scriptuntitledcounter = 1 _wordchars = string.ascii_letters + string.digits + "_" --- 27,30 ---- *************** *** 660,672 **** cwdindex = None try: ! if haveThreading: ! self._thread = Wthreading.Thread(os.path.basename(file), ! self._exec_threadwrapper, pytext, globals, locals, file, self.debugging, ! modname, self.profiling) ! self.setthreadstate((1, 1)) ! self._thread.start() ! else: ! execstring(pytext, globals, locals, file, self.debugging, ! modname, self.profiling) finally: if self.path: --- 653,658 ---- cwdindex = None try: ! execstring(pytext, globals, locals, file, self.debugging, ! modname, self.profiling) finally: if self.path: *************** *** 1205,1216 **** try: if debugging: ! if haveThreading: ! lock = Wthreading.Lock() ! lock.acquire() ! PyDebugger.startfromhere() ! lock.release() ! else: ! PyDebugger.startfromhere() ! elif not haveThreading: if hasattr(MacOS, 'EnableAppswitch'): MacOS.EnableAppswitch(0) --- 1191,1196 ---- try: if debugging: ! PyDebugger.startfromhere() ! else: if hasattr(MacOS, 'EnableAppswitch'): MacOS.EnableAppswitch(0) *************** *** 1230,1236 **** exec code in globals, locals finally: ! if not haveThreading: ! if hasattr(MacOS, 'EnableAppswitch'): ! MacOS.EnableAppswitch(-1) except W.AlertError, detail: raise W.AlertError, detail --- 1210,1215 ---- exec code in globals, locals finally: ! if hasattr(MacOS, 'EnableAppswitch'): ! MacOS.EnableAppswitch(-1) except W.AlertError, detail: raise W.AlertError, detail *************** *** 1241,1248 **** sys.stderr.write("Script exited with status code: %s\n" % repr(arg.code)) except: - if haveThreading: - import continuation - lock = Wthreading.Lock() - lock.acquire() if debugging: sys.settrace(None) --- 1220,1223 ---- *************** *** 1251,1256 **** else: tracebackwindow.traceback(1, filename) - if haveThreading: - lock.release() if debugging: sys.settrace(None) --- 1226,1229 ---- From jvr@users.sourceforge.net Fri May 9 09:34:01 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 01:34:01 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv3414 Modified Files: PyEdit.py Log Message: more dead code removal Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** PyEdit.py 9 May 2003 08:27:33 -0000 1.41 --- PyEdit.py 9 May 2003 08:33:58 -0000 1.42 *************** *** 109,114 **** self.run_with_interpreter = self.settings.get("run_with_interpreter", 0) self.run_with_cl_interpreter = self.settings.get("run_with_cl_interpreter", 0) - self._threadstate = (0, 0) - self._thread = None def readwindowsettings(self): --- 109,112 ---- *************** *** 507,519 **** def run(self): ! if self._threadstate == (0, 0): ! self._run() ! else: ! lock = Wthreading.Lock() ! lock.acquire() ! self._thread.postException(KeyboardInterrupt) ! if self._thread.isBlocked(): ! self._thread.start() ! lock.release() def _run(self): --- 505,509 ---- def run(self): ! self._run() def _run(self): *************** *** 566,577 **** def runselection(self): ! if self._threadstate == (0, 0): ! self._runselection() ! elif self._threadstate == (1, 1): ! self._thread.block() ! self.setthreadstate((1, 2)) ! elif self._threadstate == (1, 2): ! self._thread.start() ! self.setthreadstate((1, 1)) def _runselection(self): --- 556,560 ---- def runselection(self): ! self._runselection() def _runselection(self): *************** *** 625,641 **** klass.__dict__.update(globals[classname].__dict__) globals[classname] = klass - - def setthreadstate(self, state): - oldstate = self._threadstate - if oldstate[0] <> state[0]: - self.runbutton.settitle(runButtonLabels[state[0]]) - if oldstate[1] <> state[1]: - self.runselbutton.settitle(runSelButtonLabels[state[1]]) - self._threadstate = state - - def _exec_threadwrapper(self, *args, **kwargs): - apply(execstring, args, kwargs) - self.setthreadstate((0, 0)) - self._thread = None def execstring(self, pytext, globals, locals, file, modname): --- 608,611 ---- From jvr@users.sourceforge.net Fri May 9 09:58:04 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 01:58:04 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyEdit.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv11643 Modified Files: PyEdit.py Log Message: add explicit support for cancelling a running script (CFM-based MacPython had this built-in) Index: PyEdit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyEdit.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** PyEdit.py 9 May 2003 08:33:58 -0000 1.42 --- PyEdit.py 9 May 2003 08:58:02 -0000 1.43 *************** *** 620,632 **** os.chdir(dir) sys.path.insert(0, dir) ! else: ! cwdindex = None try: execstring(pytext, globals, locals, file, self.debugging, modname, self.profiling) finally: if self.path: os.chdir(savedir) del sys.path[0] def getenvironment(self): --- 620,655 ---- os.chdir(dir) sys.path.insert(0, dir) ! self._scriptDone = False ! if sys.platform == "darwin": ! # On MacOSX, MacPython doesn't poll for command-period ! # (cancel), so to enable the user to cancel a running ! # script, we have to spawn a thread which does the ! # polling. It will send a SIGINT to the main thread ! # (in which the script is running) when the user types ! # command-period. ! from threading import Thread ! t = Thread(target=self._userCancelledMonitor, ! name="UserCancelledMonitor") ! t.start() try: execstring(pytext, globals, locals, file, self.debugging, modname, self.profiling) finally: + self._scriptDone = True if self.path: os.chdir(savedir) del sys.path[0] + + def _userCancelledMonitor(self): + import time + from signal import SIGINT + while not self._scriptDone: + if Evt.CheckEventQueueForUserCancel(): + # Send a SIGINT signal to ourselves. + # This gets delivered to the main thread, + # cancelling the running script. + os.kill(os.getpid(), SIGINT) + break + time.sleep(0.25) def getenvironment(self): From loewis@users.sourceforge.net Fri May 9 09:59:20 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 09 May 2003 01:59:20 -0700 Subject: [Python-checkins] python/dist/src/Tools/i18n msgfmt.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/i18n In directory sc8-pr-cvs1:/tmp/cvs-serv11784/Tools/i18n Modified Files: msgfmt.py Log Message: Declare encoding. Use unsigned long constants. Fixes #728277. Index: msgfmt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/i18n/msgfmt.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** msgfmt.py 2 Mar 2001 16:53:54 -0000 1.2 --- msgfmt.py 9 May 2003 08:59:17 -0000 1.3 *************** *** 1,4 **** #! /usr/bin/env python ! # Written by Martin v. Löwis --- 1,4 ---- #! /usr/bin/env python ! # -*- coding: iso-8859-1 -*- # Written by Martin v. Löwis *************** *** 83,88 **** voffsets += [l2, o2+valuestart] offsets = koffsets + voffsets ! output = struct.pack("iiiiiii", ! 0x950412de, # Magic 0, # Version len(keys), # # of entries --- 83,88 ---- voffsets += [l2, o2+valuestart] offsets = koffsets + voffsets ! output = struct.pack("Iiiiiii", ! 0x950412deL, # Magic 0, # Version len(keys), # # of entries From loewis@users.sourceforge.net Fri May 9 10:05:22 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Fri, 09 May 2003 02:05:22 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.165,1.166 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv13648 Modified Files: setup.py Log Message: Only look for krb5.h if ssl.h was found. Fixes bug reported in comment to #728322. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.165 retrieving revision 1.166 diff -C2 -d -r1.165 -r1.166 *** setup.py 7 May 2003 15:38:47 -0000 1.165 --- setup.py 9 May 2003 09:05:19 -0000 1.166 *************** *** 448,455 **** ] ) ! krb5_h = find_file('krb5.h', inc_dirs, ! ['/usr/kerberos/include']) ! if krb5_h: ! ssl_incs += krb5_h ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, ['/usr/local/ssl/lib', --- 448,456 ---- ] ) ! if ssl_incs is not None: ! krb5_h = find_file('krb5.h', inc_dirs, ! ['/usr/kerberos/include']) ! if krb5_h: ! ssl_incs += krb5_h ssl_libs = find_library_file(self.compiler, 'ssl',lib_dirs, ['/usr/local/ssl/lib', From jackjansen@users.sourceforge.net Fri May 9 11:15:23 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 03:15:23 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts ConfigurePython.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv6706 Modified Files: ConfigurePython.py Log Message: Suppress wartning on macfs import. Index: ConfigurePython.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/ConfigurePython.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ConfigurePython.py 8 Jan 2003 16:27:43 -0000 1.42 --- ConfigurePython.py 9 May 2003 10:15:18 -0000 1.43 *************** *** 10,13 **** --- 10,15 ---- import sys import os + import warnings + warnings.filterwarnings("ignore", "macfs.*", DeprecationWarning, __name__) import macfs import MacOS From mwh@users.sourceforge.net Fri May 9 11:45:22 2003 From: mwh@users.sourceforge.net (mwh@users.sourceforge.net) Date: Fri, 09 May 2003 03:45:22 -0700 Subject: [Python-checkins] python/dist/src/Modules fcntlmodule.c,2.39,2.40 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16635 Modified Files: fcntlmodule.c Log Message: Simple fix for [ 733781 ] fcntl fails to build on old RH Linux Index: fcntlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/fcntlmodule.c,v retrieving revision 2.39 retrieving revision 2.40 diff -C2 -d -r2.39 -r2.40 *** fcntlmodule.c 3 May 2003 09:14:53 -0000 2.39 --- fcntlmodule.c 9 May 2003 10:45:20 -0000 2.40 *************** *** 557,561 **** --- 557,564 ---- INS(I_STR); INS(I_SWROPT); + #ifdef I_GWROPT + /* despite the comment above, old-ish glibcs miss a couple... */ INS(I_GWROPT); + #endif INS(I_SENDFD); INS(I_RECVFD); *************** *** 566,570 **** --- 569,575 ---- INS(I_CANPUT); INS(I_SETCLTIME); + #ifdef I_GETCLTIME INS(I_GETCLTIME); + #endif INS(I_LINK); INS(I_UNLINK); From jvr@users.sourceforge.net Fri May 9 12:47:25 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 04:47:25 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PyConsole.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv7637 Modified Files: PyConsole.py Log Message: also support cmd-. in the interactive window Index: PyConsole.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PyConsole.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** PyConsole.py 6 May 2003 14:28:30 -0000 1.16 --- PyConsole.py 9 May 2003 11:47:23 -0000 1.17 *************** *** 79,87 **** if hasattr(MacOS, 'EnableAppswitch'): saveyield = MacOS.EnableAppswitch(0) ! self.pyinteractive.executeline(text, self, self._namespace) if hasattr(MacOS, 'EnableAppswitch'): MacOS.EnableAppswitch(saveyield) selstart, selend = self.getselection() self._inputstart = selstart def domenu_save_as(self, *args): --- 79,111 ---- if hasattr(MacOS, 'EnableAppswitch'): saveyield = MacOS.EnableAppswitch(0) ! self._scriptDone = False ! if sys.platform == "darwin": ! # see identical construct in PyEdit.py ! from threading import Thread ! t = Thread(target=self._userCancelledMonitor, ! name="UserCancelledMonitor") ! t.start() ! try: ! self.pyinteractive.executeline(text, self, self._namespace) ! finally: ! self._scriptDone = True if hasattr(MacOS, 'EnableAppswitch'): MacOS.EnableAppswitch(saveyield) selstart, selend = self.getselection() self._inputstart = selstart + + def _userCancelledMonitor(self): + # XXX duplicate code from PyEdit.py + import time, os + from signal import SIGINT + from Carbon import Evt + while not self._scriptDone: + if Evt.CheckEventQueueForUserCancel(): + # Send a SIGINT signal to ourselves. + # This gets delivered to the main thread, + # cancelling the running script. + os.kill(os.getpid(), SIGINT) + break + time.sleep(0.25) def domenu_save_as(self, *args): From jackjansen@users.sourceforge.net Fri May 9 15:45:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 07:45:06 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.106,1.107 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv23932 Modified Files: Makefile.deps Log Message: Documented the new autoGIL module. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** Makefile.deps 18 Apr 2003 21:45:26 -0000 1.106 --- Makefile.deps 9 May 2003 14:45:04 -0000 1.107 *************** *** 363,366 **** --- 363,367 ---- mac/libmacic.tex \ mac/libframework.tex \ + mac/libautogil.tex \ mac/libminiae.tex \ mac/libscrap.tex From jackjansen@users.sourceforge.net Fri May 9 15:45:06 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 07:45:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/mac libautogil.tex,NONE,1.1 mac.tex,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv23932/mac Modified Files: mac.tex Added Files: libautogil.tex Log Message: Documented the new autoGIL module. --- NEW FILE: libautogil.tex --- \section{\module{autoGIL} --- Global Interpreter Lock handling in event loops} \declaremodule{extension}{autoGIL} \platform{Mac} \modulesynopsis{Global Interpreter Lock handling in event loops.} \moduleauthor{Just van Rossum}{just@letterror.com} The \module{autoGIL} module provides a function \function{installAutoGIL} that automatically locks and unlocks Python's Global Interpreter Lock when running an event loop. \begin{excdesc}{AutoGILError} Raised if the observer callback cannot be installed, for example because the current thread does not have a run loop. \end{excdesc} \begin{funcdesc}{installAutoGIL}{} Install an observer callback in the event loop (CFRunLoop) for the current thread, that will lock and unlock the Global Interpreter Lock (GIL) at appropriate times, allowing other Python threads to run while the event loop is idle. Availability: OSX 10.1 or later. \end{funcdesc} Index: mac.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/mac.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** mac.tex 11 Apr 2003 15:35:27 -0000 1.11 --- mac.tex 9 May 2003 14:45:04 -0000 1.12 *************** *** 58,61 **** --- 58,62 ---- \input{libmacui} \input{libframework} + \input{libautogil} \input{scripting} From jvr@users.sourceforge.net Fri May 9 16:01:28 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Fri, 09 May 2003 08:01:28 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.760,1.761 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31787/Misc Modified Files: NEWS Log Message: added note about autoGIL Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.760 retrieving revision 1.761 diff -C2 -d -r1.760 -r1.761 *** NEWS 9 May 2003 08:19:47 -0000 1.760 --- NEWS 9 May 2003 15:01:25 -0000 1.761 *************** *** 78,81 **** --- 78,85 ---- --- + - There's a new module called "autoGIL", which offers a mechanism to + automatically release the Global Interpreter Lock when an event loop + goes to sleep, allowing other threads to run. It's currently only + supported on OSX, in the Mach-O version. What's New in Python 2.3 beta 1? From fdrake@users.sourceforge.net Fri May 9 16:04:59 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 May 2003 08:04:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libundoc.tex,1.85,1.86 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv959 Modified Files: libundoc.tex Log Message: - remove bogus \end{description} - fix two typos Index: libundoc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libundoc.tex,v retrieving revision 1.85 retrieving revision 1.86 diff -C2 -d -r1.85 -r1.86 *** libundoc.tex 6 May 2003 20:40:17 -0000 1.85 --- libundoc.tex 9 May 2003 15:04:56 -0000 1.86 *************** *** 56,65 **** \begin{description} \item[\module{ntpath}] ! --- Implementation on \module{os.path} on Win32, Win64, WinCE, and OS/2 platforms. \item[\module{posixpath}] ! --- Implementation on \module{os.path} on \POSIX. ! \end{description} \item[\module{bsddb185}] --- 56,64 ---- \begin{description} \item[\module{ntpath}] ! --- Implementation of \module{os.path} on Win32, Win64, WinCE, and OS/2 platforms. \item[\module{posixpath}] ! --- Implementation of \module{os.path} on \POSIX. \item[\module{bsddb185}] From jackjansen@users.sourceforge.net Fri May 9 16:08:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 08:08:41 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv409 Modified Files: Makefile.pre.in Log Message: Pass DIRMODE and FILEMODE to Mac/OSX/Makefile on framework builds (and honor them). Use this when building the MacOSX binary installer to get group-writeable files. Ths fix works for directories and executables, not for files just yet, because of bug #735274. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** Makefile.pre.in 6 May 2003 16:17:27 -0000 1.123 --- Makefile.pre.in 9 May 2003 15:08:38 -0000 1.124 *************** *** 854,858 **** frameworkinstallmaclib: $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \ ! BUILDPYTHON=./$(BUILDPYTHON) \ srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) --- 854,858 ---- frameworkinstallmaclib: $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \ ! BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) *************** *** 860,864 **** frameworkinstallapps: $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ ! BUILDPYTHON=./$(BUILDPYTHON) \ srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. --- 860,864 ---- frameworkinstallapps: $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ ! BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. *************** *** 866,869 **** --- 866,870 ---- frameworkinstallunixtools: $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ + DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. From jackjansen@users.sourceforge.net Fri May 9 16:08:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 08:08:41 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv409/Mac/OSX Modified Files: Makefile Log Message: Pass DIRMODE and FILEMODE to Mac/OSX/Makefile on framework builds (and honor them). Use this when building the MacOSX binary installer to get group-writeable files. Ths fix works for directories and executables, not for files just yet, because of bug #735274. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Makefile 17 Mar 2003 15:45:38 -0000 1.39 --- Makefile 9 May 2003 15:08:39 -0000 1.40 *************** *** 23,31 **** # Items more-or-less copied from the main Makefile DIRMODE=755 INSTALL=/usr/bin/install -c INSTALL_SYMLINK=ln -fs INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} ! INSTALL_DATA= ${INSTALL} -m 644 LN=ln STRIPFLAG=-s --- 23,32 ---- # Items more-or-less copied from the main Makefile DIRMODE=755 + FILEMODE=644 INSTALL=/usr/bin/install -c INSTALL_SYMLINK=ln -fs INSTALL_PROGRAM=${INSTALL} INSTALL_SCRIPT= ${INSTALL_PROGRAM} ! INSTALL_DATA= ${INSTALL} -m ${FILEMODE} LN=ln STRIPFLAG=-s From jackjansen@users.sourceforge.net Fri May 9 16:08:41 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 08:08:41 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist build,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv409/Mac/OSX/Dist Modified Files: build Log Message: Pass DIRMODE and FILEMODE to Mac/OSX/Makefile on framework builds (and honor them). Use this when building the MacOSX binary installer to get group-writeable files. Ths fix works for directories and executables, not for files just yet, because of bug #735274. Index: build =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/build,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** build 7 May 2003 08:58:11 -0000 1.3 --- build 9 May 2003 15:08:39 -0000 1.4 *************** *** 71,75 **** $PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x make ! make frameworkinstall if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then --- 71,75 ---- $PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x make ! make DIRMODE=775 EXEMODE=775 FILEMODE=664 frameworkinstall if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then From jackjansen@users.sourceforge.net Fri May 9 16:09:52 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 09 May 2003 08:09:52 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist/resources postflight,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources In directory sc8-pr-cvs1:/tmp/cvs-serv3123/resources Modified Files: postflight Log Message: Pydoc also needs its #! line massaged. Fixes #733199. Index: postflight =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Dist/resources/postflight,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** postflight 29 Apr 2003 21:48:46 -0000 1.3 --- postflight 9 May 2003 15:09:50 -0000 1.4 *************** *** 68,72 **** ! # The link in the app bundles needs updated. installed_python=$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python for app in BuildApplet IDLE PackageManager PythonIDE; do --- 68,72 ---- ! # The link in the app bundles and in pydoc need updating. installed_python=$DEST/Library/Frameworks/Python.framework/Versions/$PYVER/Resources/Python.app/Contents/MacOS/python for app in BuildApplet IDLE PackageManager PythonIDE; do *************** *** 80,83 **** q xyzzy ! done --- 80,89 ---- q xyzzy ! ed -s $DEST/Library/Frameworks/Python.framework/Versions/$PYVER/bin/pydoc << xyzzy ! 1c ! #!$installed_python ! . ! w ! q ! xyzzy done From jhylton@users.sourceforge.net Fri May 9 17:06:45 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 09 May 2003 09:06:45 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils msvccompiler.py,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv4990/Lib/distutils Modified Files: msvccompiler.py Log Message: Variant of SF patch 614770: MSVC 7 support distutils now looks for the compiler version in sys.version, falling back to MSVC 6 if the version isn't listed (Python 2.2 and lower). Add helper routines for reading the registry. Refactor many module functions into methods of the compiler to avoid passing lots of state as arguments. Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** msvccompiler.py 31 Jan 2003 20:40:15 -0000 1.53 --- msvccompiler.py 9 May 2003 16:06:42 -0000 1.54 *************** *** 2,6 **** Contains MSVCCompiler, an implementation of the abstract CCompiler class ! for the Microsoft Visual Studio.""" # Written by Perry Stoll --- 2,7 ---- Contains MSVCCompiler, an implementation of the abstract CCompiler class ! for the Microsoft Visual Studio. ! """ # Written by Perry Stoll *************** *** 13,17 **** import sys, os, string - from types import * from distutils.errors import \ DistutilsExecError, DistutilsPlatformError, \ --- 14,17 ---- *************** *** 49,172 **** if _can_read_reg: ! HKEY_CLASSES_ROOT = hkey_mod.HKEY_CLASSES_ROOT ! HKEY_LOCAL_MACHINE = hkey_mod.HKEY_LOCAL_MACHINE ! HKEY_CURRENT_USER = hkey_mod.HKEY_CURRENT_USER ! HKEY_USERS = hkey_mod.HKEY_USERS ! ! ! ! def get_devstudio_versions (): ! """Get list of devstudio versions from the Windows registry. Return a ! list of strings containing version numbers; the list will be ! empty if we were unable to access the registry (eg. couldn't import ! a registry-access module) or the appropriate registry keys weren't ! found.""" ! if not _can_read_reg: ! return [] ! K = 'Software\\Microsoft\\Devstudio' L = [] ! for base in (HKEY_CLASSES_ROOT, ! HKEY_LOCAL_MACHINE, ! HKEY_CURRENT_USER, ! HKEY_USERS): try: ! k = RegOpenKeyEx(base,K) ! i = 0 ! while 1: ! try: ! p = RegEnumKey(k,i) ! if p[0] in '123456789' and p not in L: ! L.append(p) ! except RegError: ! break ! i = i + 1 except RegError: ! pass ! L.sort() ! L.reverse() return L ! # get_devstudio_versions () ! ! ! def get_msvc_paths (path, version='6.0', platform='x86'): ! """Get a list of devstudio directories (include, lib or path). Return ! a list of strings; will be empty list if unable to access the ! registry or appropriate registry keys not found.""" ! ! if not _can_read_reg: ! return [] ! L = [] ! if path=='lib': ! path= 'Library' ! path = string.upper(path + ' Dirs') ! K = ('Software\\Microsoft\\Devstudio\\%s\\' + ! 'Build System\\Components\\Platforms\\Win32 (%s)\\Directories') % \ ! (version,platform) ! for base in (HKEY_CLASSES_ROOT, ! HKEY_LOCAL_MACHINE, ! HKEY_CURRENT_USER, ! HKEY_USERS): try: ! k = RegOpenKeyEx(base,K) ! i = 0 ! while 1: ! try: ! (p,v,t) = RegEnumValue(k,i) ! if string.upper(p) == path: ! V = string.split(v,';') ! for v in V: ! if hasattr(v, "encode"): ! try: ! v = v.encode("mbcs") ! except UnicodeError: ! pass ! if v == '' or v in L: continue ! L.append(v) ! break ! i = i + 1 ! except RegError: ! break except RegError: ! pass ! return L ! ! # get_msvc_paths() ! def find_exe (exe, version_number): ! """Try to find an MSVC executable program 'exe' (from version ! 'version_number' of MSVC) in several places: first, one of the MSVC ! program search paths from the registry; next, the directories in the ! PATH environment variable. If any of those work, return an absolute ! path that is known to exist. If none of them work, just return the ! original program name, 'exe'.""" ! for p in get_msvc_paths ('path', version_number): ! fn = os.path.join (os.path.abspath(p), exe) ! if os.path.isfile(fn): ! return fn ! # didn't find it; try existing path ! for p in string.split (os.environ['Path'],';'): ! fn = os.path.join(os.path.abspath(p),exe) ! if os.path.isfile(fn): ! return fn ! return exe # last desperate hope ! def set_path_env_var (name, version_number): ! """Set environment variable 'name' to an MSVC path type value obtained ! from 'get_msvc_paths()'. This is equivalent to a SET command prior ! to execution of spawned commands.""" ! p = get_msvc_paths (name, version_number) ! if p: ! os.environ[name] = string.join (p,';') class MSVCCompiler (CCompiler) : --- 49,162 ---- if _can_read_reg: ! HKEYS = (hkey_mod.HKEY_USERS, ! hkey_mod.HKEY_CURRENT_USER, ! hkey_mod.HKEY_LOCAL_MACHINE, ! hkey_mod.HKEY_CLASSES_ROOT) ! def read_keys(base, key): ! """Return list of registry keys.""" ! try: ! handle = RegOpenKeyEx(base, key) ! except RegError: ! return None L = [] ! i = 0 ! while 1: try: ! k = RegEnumKey(handle, i) except RegError: ! break ! L.append(k) ! i = i + 1 return L ! def read_values(base, key): ! """Return dict of registry keys and values. ! All names are converted to lowercase. ! """ ! try: ! handle = RegOpenKeyEx(base, key) ! except RegError: ! return None ! d = {} ! i = 0 ! while 1: try: ! name, value, type = RegEnumValue(handle, i) except RegError: ! break ! name = name.lower() ! d[convert_mbcs(name)] = convert_mbcs(value) ! i = i + 1 ! return d + def convert_mbcs(s): + enc = getattr(s, "encode", None) + if enc is not None: + try: + s = enc("mbcs") + except UnicodeError: + pass + return s ! class MacroExpander: ! def __init__(self, version): ! self.macros = {} ! self.load_macros(version) ! def set_macro(self, macro, path, key): ! for base in HKEYS: ! d = read_values(base, path) ! if d: ! self.macros["$(%s)" % macro] = d[key] ! break ! ! def load_macros(self, version): ! vsbase = r"Software\Microsoft\VisualStudio\%s.0" % version ! self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir") ! self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir") ! net = r"Software\Microsoft\.NETFramework" ! self.set_macro("FrameworkDir", net, "installroot") ! self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") ! p = r"Software\Microsoft\NET Framework Setup\Product" ! for base in HKEYS: ! try: ! h = RegOpenKeyEx(base, p) ! except RegError: ! continue ! key = RegEnumKey(h, 0) ! d = read_values(base, r"%s\%s" % (p, key)) ! self.macros["$(FrameworkVersion)"] = d["version"] + def sub(self, s): + for k, v in self.macros.items(): + s = string.replace(s, k, v) + return s ! def get_build_version(): ! """Return the version of MSVC that was used to build Python. ! For Python 2.3 and up, the version number is included in ! sys.version. For earlier versions, assume the compiler is MSVC 6. ! """ + prefix = "MSC v." + i = string.find(sys.version, prefix) + if i == -1: + return 6 + i += len(prefix) + s, rest = sys.version[i:].split(" ", 1) + n = int(s[:-2]) + if n == 12: + return 6 + elif n == 13: + return 7 + # else we don't know what version of the compiler this is + return None + class MSVCCompiler (CCompiler) : *************** *** 200,236 **** exe_extension = '.exe' ! ! def __init__ (self, ! verbose=0, ! dry_run=0, ! force=0): ! CCompiler.__init__ (self, verbose, dry_run, force) ! versions = get_devstudio_versions () ! if versions: ! version = versions[0] # highest version ! self.cc = find_exe("cl.exe", version) ! self.linker = find_exe("link.exe", version) ! self.lib = find_exe("lib.exe", version) ! self.rc = find_exe("rc.exe", version) # resource compiler ! self.mc = find_exe("mc.exe", version) # message compiler ! set_path_env_var ('lib', version) ! set_path_env_var ('include', version) ! path=get_msvc_paths('path', version) ! try: ! for p in string.split(os.environ['path'],';'): ! path.append(p) ! except KeyError: ! pass ! os.environ['path'] = string.join(path,';') ! else: ! # devstudio not found in the registry ! self.cc = "cl.exe" ! self.linker = "link.exe" ! self.lib = "lib.exe" ! self.rc = "rc.exe" ! self.mc = "mc.exe" self.preprocess_options = None --- 190,218 ---- exe_extension = '.exe' ! def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) ! self.__version = get_build_version() ! if self.__version == 7: ! self.__root = r"Software\Microsoft\VisualStudio" ! self.__macros = MacroExpander(self.__version) ! else: ! self.__root = r"Software\Microsoft\Devstudio" ! self.__paths = self.get_msvc_paths("path") ! self.cc = self.find_exe("cl.exe") ! self.linker = self.find_exe("link.exe") ! self.lib = self.find_exe("lib.exe") ! self.rc = self.find_exe("rc.exe") # resource compiler ! self.mc = self.find_exe("mc.exe") # message compiler ! self.set_path_env_var('lib') ! self.set_path_env_var('include') ! # extend the MSVC path with the current path ! try: ! for p in string.split(os.environ['path'], ';'): ! self.__paths.append(p) ! except KeyError: ! pass ! os.environ['path'] = string.join(self.__paths, ';') self.preprocess_options = None *************** *** 501,503 **** # find_library_file () ! # class MSVCCompiler --- 483,549 ---- # find_library_file () ! # Helper methods for using the MSVC registry settings ! ! def find_exe(self, exe): ! """Return path to an MSVC executable program. ! ! Tries to find the program in several places: first, one of the ! MSVC program search paths from the registry; next, the directories ! in the PATH environment variable. If any of those work, return an ! absolute path that is known to exist. If none of them work, just ! return the original program name, 'exe'. ! """ ! ! for p in self.__paths: ! fn = os.path.join(os.path.abspath(p), exe) ! if os.path.isfile(fn): ! return fn ! ! # didn't find it; try existing path ! for p in string.split(os.environ['Path'],';'): ! fn = os.path.join(os.path.abspath(p),exe) ! if os.path.isfile(fn): ! return fn ! ! return exe ! ! def get_msvc_paths(self, path, platform='x86'): ! """Get a list of devstudio directories (include, lib or path). ! ! Return a list of strings. The list will be empty if unable to ! access the registry or appropriate registry keys not found. ! """ ! ! if not _can_read_reg: ! return [] ! ! path = path + " dirs" ! if self.__version == 7: ! key = (r"%s\7.0\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories" ! % (self.__root,)) ! else: ! key = (r"%s\6.0\Build System\Components\Platforms" ! ! for base in HKEYS: ! d = read_values(base, key) ! if d: ! if self.__version == 7: ! return string.split(self.__macros.sub(d[path]), ";") ! else: ! return string.split(d[path], ";") ! return [] ! ! def set_path_env_var(self, name): ! """Set environment variable 'name' to an MSVC path type value. ! ! This is equivalent to a SET command prior to execution of spawned ! commands. ! """ ! ! if name == "lib": ! p = self.get_msvc_paths("library") ! else: ! p = self.get_msvc_paths(name) ! if p: ! os.environ[name] = string.join(p, ';') ! From jhylton@users.sourceforge.net Fri May 9 17:08:25 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 09 May 2003 09:08:25 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.235,1.236 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv5609 Modified Files: ACKS Log Message: help with MSVC 7 support in distutils Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.235 retrieving revision 1.236 diff -C2 -d -r1.235 -r1.236 *** ACKS 5 May 2003 16:13:58 -0000 1.235 --- ACKS 9 May 2003 16:08:22 -0000 1.236 *************** *** 19,22 **** --- 19,23 ---- Anders Andersen Erik Andersén + John Anderson Oliver Andrich Ross Andrus From jhylton@users.sourceforge.net Fri May 9 17:55:31 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 09 May 2003 09:55:31 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils msvccompiler.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv25518/Lib/distutils Modified Files: msvccompiler.py Log Message: Replace line somehow deleted before last checkin. Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** msvccompiler.py 9 May 2003 16:06:42 -0000 1.54 --- msvccompiler.py 9 May 2003 16:55:28 -0000 1.55 *************** *** 524,527 **** --- 524,528 ---- else: key = (r"%s\6.0\Build System\Components\Platforms" + r"\Win32 (%s)\Directories" % (self.__root, platform)) for base in HKEYS: From fdrake@users.sourceforge.net Fri May 9 19:18:50 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 May 2003 11:18:50 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30665 Modified Files: liboptparse.tex Log Message: Make this format again. Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** liboptparse.tex 3 May 2003 21:22:58 -0000 1.7 --- liboptparse.tex 9 May 2003 18:18:46 -0000 1.8 *************** *** 279,290 **** The interesting stuff, of course, is what comes after the option strings. For now, we'll only cover four of the things you can put ! there: \var{action}, \var{type}, \var{dest} (destination), and ! \var{help}. ! \subsubsection{The \var{store} action\label{optparse-store-action}} The action tells \module{optparse} what to do when it sees one of the option strings for this option on the command-line. For example, the ! action \var{store} means: take the next argument (or the remainder of the current argument), ensure that it is of the correct type, and store it to your chosen destination. --- 279,291 ---- The interesting stuff, of course, is what comes after the option strings. For now, we'll only cover four of the things you can put ! there: \emph{action}, \emph{type}, \emph{dest} (destination), and ! \emph{help}. ! \subsubsection{The \emph{store} action% ! \label{optparse-store-action}} The action tells \module{optparse} what to do when it sees one of the option strings for this option on the command-line. For example, the ! action \emph{store} means: take the next argument (or the remainder of the current argument), ensure that it is of the correct type, and store it to your chosen destination. *************** *** 361,365 **** section~\ref{optparse-adding-types}, ``Adding new types.'' ! \subsubsection{Other \var{store_*} actions\label{optparse-other-store-actions}} Flag options---set a variable to true or false when a particular --- 362,367 ---- section~\ref{optparse-adding-types}, ``Adding new types.'' ! \subsubsection{Other \emph{store_*} actions% ! \label{optparse-other-store-actions}} Flag options---set a variable to true or false when a particular From montanaro@users.sourceforge.net Fri May 9 19:21:04 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 09 May 2003 11:21:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtimeit.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv31520 Modified Files: libtimeit.tex Log Message: add a note about accessing user-defined functions with an import statement in the setup parameter Index: libtimeit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtimeit.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** libtimeit.tex 9 Apr 2003 04:06:37 -0000 1.2 --- libtimeit.tex 9 May 2003 18:21:02 -0000 1.3 *************** *** 194,195 **** --- 194,212 ---- 3.15 usec/pass \end{verbatim} + + To give the \module{timeit} module access to functions you + define, you can pass a \code{setup} parameter which contains an import + statement: + + \begin{verbatim} + def test(): + "Stupid test function" + L = [] + for i in range(100): + L.append(i) + + if __name__=='__main__': + from timeit import Timer + t = Timer("test()", "from __main__ import test") + print t.timeit() + \end{verbatim} From jhylton@users.sourceforge.net Fri May 9 19:29:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 09 May 2003 11:29:23 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.76,1.337.2.4.2.77 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv3148/Misc Modified Files: Tag: release22-maint NEWS Log Message: Backport fixes to make more types collectable. classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.76 retrieving revision 1.337.2.4.2.77 diff -C2 -d -r1.337.2.4.2.76 -r1.337.2.4.2.77 *** NEWS 30 Apr 2003 19:24:59 -0000 1.337.2.4.2.76 --- NEWS 9 May 2003 18:29:19 -0000 1.337.2.4.2.77 *************** *** 89,92 **** --- 89,95 ---- - Fixed sundry memory leaks. + - More objects participate in garbage collection: classmethod, + staticmethod, and cPickle Pickler and Unpickler. (SF #735247) + - Improve the robustness of the methods for random distributions so they can work with generators producing a full range of values From jhylton@users.sourceforge.net Fri May 9 19:29:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 09 May 2003 11:29:23 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.50.4.1,2.50.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv3148/Objects Modified Files: Tag: release22-maint funcobject.c Log Message: Backport fixes to make more types collectable. classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.50.4.1 retrieving revision 2.50.4.2 diff -C2 -d -r2.50.4.1 -r2.50.4.2 *** funcobject.c 18 Mar 2002 03:05:35 -0000 2.50.4.1 --- funcobject.c 9 May 2003 18:29:21 -0000 2.50.4.2 *************** *** 461,468 **** --- 461,486 ---- cm_dealloc(classmethod *cm) { + _PyObject_GC_UNTRACK((PyObject *)cm); Py_XDECREF(cm->cm_callable); cm->ob_type->tp_free((PyObject *)cm); } + static int + cm_traverse(classmethod *cm, visitproc visit, void *arg) + { + if (!cm->cm_callable) + return 0; + return visit(cm->cm_callable, arg); + } + + static int + cm_clear(classmethod *cm) + { + Py_XDECREF(cm->cm_callable); + cm->cm_callable = NULL; + + return 0; + } + static PyObject * cm_descr_get(PyObject *self, PyObject *obj, PyObject *type) *************** *** 536,543 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ classmethod_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 554,561 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, classmethod_doc, /* tp_doc */ ! (traverseproc)cm_traverse, /* tp_traverse */ ! (inquiry)cm_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 555,559 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 573,577 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; *************** *** 595,602 **** --- 613,638 ---- sm_dealloc(staticmethod *sm) { + _PyObject_GC_UNTRACK((PyObject *)sm); Py_XDECREF(sm->sm_callable); sm->ob_type->tp_free((PyObject *)sm); } + static int + sm_traverse(staticmethod *sm, visitproc visit, void *arg) + { + if (!sm->sm_callable) + return 0; + return visit(sm->sm_callable, arg); + } + + static int + sm_clear(staticmethod *sm) + { + Py_XDECREF(sm->sm_callable); + sm->sm_callable = NULL; + + return 0; + } + static PyObject * sm_descr_get(PyObject *self, PyObject *obj, PyObject *type) *************** *** 665,672 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ staticmethod_doc, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 701,708 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, staticmethod_doc, /* tp_doc */ ! (traverseproc)sm_traverse, /* tp_traverse */ ! (inquiry)sm_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 684,688 **** PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 720,724 ---- PyType_GenericAlloc, /* tp_alloc */ PyType_GenericNew, /* tp_new */ ! _PyObject_GC_Del, /* tp_free */ }; From jhylton@users.sourceforge.net Fri May 9 19:29:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri, 09 May 2003 11:29:23 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.73.2.1.2.4,2.73.2.1.2.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv3148/Modules Modified Files: Tag: release22-maint cPickle.c Log Message: Backport fixes to make more types collectable. classmethod, staticmethod, cPickle.Pickler, cPickle.UNpickler Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.73.2.1.2.4 retrieving revision 2.73.2.1.2.5 diff -C2 -d -r2.73.2.1.2.4 -r2.73.2.1.2.5 *** cPickle.c 20 Mar 2003 18:31:13 -0000 2.73.2.1.2.4 --- cPickle.c 9 May 2003 18:29:20 -0000 2.73.2.1.2.5 *************** *** 1,50 **** - /* - * cPickle.c,v 1.71 1999/07/11 13:30:34 jim Exp - * - * Copyright (c) 1996-1998, Digital Creations, Fredericksburg, VA, USA. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the disclaimer that follows. - * - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions, and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * o Neither the name of Digital Creations nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * - * THIS SOFTWARE IS PROVIDED BY DIGITAL CREATIONS AND CONTRIBUTORS *AS - * IS* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DIGITAL - * CREATIONS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - * DAMAGE. - * - # - # If you have questions regarding this software, contact: - # - # Digital Creations, L.C. - # 910 Princess Ann Street - # Fredericksburge, Virginia 22401 - # - # info@digicool.com - # - # (540) 371-6909 - */ - static char cPickle_module_documentation[] = "C implementation and optimization of the Python pickle module\n" --- 1,2 ---- *************** *** 2303,2307 **** Picklerobject *self; ! UNLESS (self = PyObject_New(Picklerobject, &Picklertype)) return NULL; --- 2255,2259 ---- Picklerobject *self; ! UNLESS (self = PyObject_GC_New(Picklerobject, &Picklertype)) return NULL; *************** *** 2404,2407 **** --- 2356,2360 ---- static void Pickler_dealloc(Picklerobject *self) { + PyObject_GC_UnTrack(self); Py_XDECREF(self->write); Py_XDECREF(self->memo); *************** *** 2417,2421 **** } ! PyObject_Del(self); } --- 2370,2412 ---- } ! PyObject_GC_Del(self); ! } ! ! static int ! Pickler_traverse(Picklerobject *self, visitproc visit, void *arg) ! { ! int err; ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->write); ! VISIT(self->memo); ! VISIT(self->fast_memo); ! VISIT(self->arg); ! VISIT(self->file); ! VISIT(self->pers_func); ! VISIT(self->inst_pers_func); ! VISIT(self->dispatch_table); ! #undef VISIT ! return 0; ! } ! ! static int ! Pickler_clear(Picklerobject *self) ! { ! #define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL; ! CLEAR(self->write); ! CLEAR(self->memo); ! CLEAR(self->fast_memo); ! CLEAR(self->arg); ! CLEAR(self->file); ! CLEAR(self->pers_func); ! CLEAR(self->inst_pers_func); ! CLEAR(self->dispatch_table); ! #undef CLEAR ! return 0; } *************** *** 2533,2540 **** 0, /* set below */ /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ Picklertype__doc__, /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ --- 2524,2531 ---- 0, /* set below */ /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, Picklertype__doc__, /* tp_doc */ ! (traverseproc)Pickler_traverse, /* tp_traverse */ ! (inquiry)Pickler_clear, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ *************** *** 4222,4226 **** Unpicklerobject *self; ! UNLESS (self = PyObject_New(Unpicklerobject, &Unpicklertype)) return NULL; --- 4213,4217 ---- Unpicklerobject *self; ! UNLESS (self = PyObject_GC_New(Unpicklerobject, &Unpicklertype)) return NULL; *************** *** 4309,4312 **** --- 4300,4304 ---- static void Unpickler_dealloc(Unpicklerobject *self) { + PyObject_GC_UnTrack((PyObject *)self); Py_XDECREF(self->readline); Py_XDECREF(self->read); *************** *** 4327,4333 **** } ! PyObject_Del(self); } static PyObject * --- 4319,4363 ---- } ! PyObject_GC_Del(self); ! } ! ! static int ! Unpickler_traverse(Unpicklerobject *self, visitproc visit, void *arg) ! { ! int err; ! ! #define VISIT(SLOT) \ ! if (SLOT) { \ ! err = visit((PyObject *)(SLOT), arg); \ ! if (err) \ ! return err; \ ! } ! VISIT(self->readline); ! VISIT(self->read); ! VISIT(self->file); ! VISIT(self->memo); ! VISIT(self->stack); ! VISIT(self->pers_func); ! VISIT(self->arg); ! VISIT(self->last_string); ! #undef VISIT ! return 0; } + static int + Unpickler_clear(Unpicklerobject *self) + { + #define CLEAR(SLOT) Py_XDECREF(SLOT); SLOT = NULL + CLEAR(self->readline); + CLEAR(self->read); + CLEAR(self->file); + CLEAR(self->memo); + CLEAR(self->stack); + CLEAR(self->pers_func); + CLEAR(self->arg); + CLEAR(self->last_string); + #undef CLEAR + return 0; + } static PyObject * *************** *** 4513,4537 **** static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cPickle.Unpickler", /*tp_name*/ ! sizeof(Unpicklerobject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ ! /* methods */ ! (destructor)Unpickler_dealloc, /*tp_dealloc*/ ! (printfunc)0, /*tp_print*/ ! (getattrfunc)Unpickler_getattr, /*tp_getattr*/ ! (setattrfunc)Unpickler_setattr, /*tp_setattr*/ ! (cmpfunc)0, /*tp_compare*/ ! (reprfunc)0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! (hashfunc)0, /*tp_hash*/ ! (ternaryfunc)0, /*tp_call*/ ! (reprfunc)0, /*tp_str*/ ! ! /* Space for future expansion */ ! 0L,0L,0L,0L, ! Unpicklertype__doc__ /* Documentation string */ }; --- 4543,4569 ---- static PyTypeObject Unpicklertype = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "cPickle.Unpickler", /*tp_name*/ ! sizeof(Unpicklerobject), /*tp_basicsize*/ ! 0, ! (destructor)Unpickler_dealloc, /* tp_dealloc */ ! 0, /* tp_print */ ! (getattrfunc)Unpickler_getattr, /* tp_getattr */ ! (setattrfunc)Unpickler_setattr, /* tp_setattr */ ! 0, /* tp_compare */ ! 0, /* tp_repr */ ! 0, /* tp_as_number */ ! 0, /* tp_as_sequence */ ! 0, /* tp_as_mapping */ ! 0, /* tp_hash */ ! 0, /* tp_call */ ! 0, /* tp_str */ ! 0, /* tp_getattro */ ! 0, /* tp_setattro */ ! 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, ! Unpicklertype__doc__, /* tp_doc */ ! (traverseproc)Unpickler_traverse, /* tp_traverse */ ! (inquiry)Unpickler_clear, /* tp_clear */ }; From fdrake@users.sourceforge.net Fri May 9 20:10:15 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri, 09 May 2003 12:10:15 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libtest.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21428 Modified Files: libtest.tex Log Message: Make this format again. Index: libtest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtest.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libtest.tex 7 May 2003 22:02:17 -0000 1.1 --- libtest.tex 9 May 2003 19:10:12 -0000 1.2 *************** *** 30,40 **** ! \subsection{test_support \label{test_support-docs}} ! ! The \module{test_support} module contains functions for assisting with writing ! regression tests. ! The \module{test_support} module defines the following exceptions: \begin{excdesc}{TestFailed} --- 30,41 ---- ! \subsection{\module[test.testsupport]{test.test_support} --- ! --- Utility functions for tests} ! \declaremodule[test.testsupport]{standard}{test.test_support} + The \module{test.test_support} module contains functions for assisting + with writing regression tests. ! The \module{test.test_support} module defines the following exceptions: \begin{excdesc}{TestFailed} *************** *** 90,94 **** The list of available resources is only set when \module{regrtest.py} is executing the tests. ! \end{funcdest} \begin{funcdesc}{requires}{resource\optional{, msg}} --- 91,95 ---- The list of available resources is only set when \module{regrtest.py} is executing the tests. ! \end{funcdesc} \begin{funcdesc}{requires}{resource\optional{, msg}} *************** *** 111,115 **** \code{"test_"} and executes the tests individually. This is the preferred way to execute tests. ! \end{datadesc} \begin{funcdesc}{run_suite}{suite\optional{, testclass=None}} --- 112,116 ---- \code{"test_"} and executes the tests individually. This is the preferred way to execute tests. ! \end{funcdesc} \begin{funcdesc}{run_suite}{suite\optional{, testclass=None}} *************** *** 122,129 **** ! \subsection{Writing Unit Tests for the \module{test} package \label{writing-tests}} It is preferred that tests for the \module{test} package use the ! \module{unittest} module and follow a few guidelines. One is to have the name of all the test methods start with \code{"test_"} as well as the module's name. --- 123,131 ---- ! \subsection{Writing Unit Tests for the \module{test} package% ! \label{writing-tests}} It is preferred that tests for the \module{test} package use the ! \refmodule{unittest} module and follow a few guidelines. One is to have the name of all the test methods start with \code{"test_"} as well as the module's name. *************** *** 132,136 **** Also, no documentation string for the method should be included. A comment (such as ! \var{# Tests function returns only True or False}) should be used to provide documentation for test methods. This is done because documentation strings get printed out if they exist and --- 134,138 ---- Also, no documentation string for the method should be included. A comment (such as ! \code{\# Tests function returns only True or False}) should be used to provide documentation for test methods. This is done because documentation strings get printed out if they exist and From rhettinger@users.sourceforge.net Sat May 10 04:30:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 09 May 2003 20:30:15 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.761,1.762 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv22320/Misc Modified Files: NEWS Log Message: Added a tool for making a rough check of LaTeX documents. It checks for known commands, forward slashes, unbalanced or mismatched delimters, and unbalanced or mismatched begin/end blocks. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.761 retrieving revision 1.762 diff -C2 -d -r1.761 -r1.762 *** NEWS 9 May 2003 15:01:25 -0000 1.761 --- NEWS 10 May 2003 03:30:13 -0000 1.762 *************** *** 45,48 **** --- 45,51 ---- ----------- + - texcheck.py is a new script for making a rough validation of Python LaTeX + files. + Build ----- From rhettinger@users.sourceforge.net Sat May 10 04:30:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 09 May 2003 20:30:15 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts texcheck.py,NONE,1.1 README,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv22320/Tools/scripts Modified Files: README Added Files: texcheck.py Log Message: Added a tool for making a rough check of LaTeX documents. It checks for known commands, forward slashes, unbalanced or mismatched delimters, and unbalanced or mismatched begin/end blocks. --- NEW FILE: texcheck.py --- """ TeXcheck.py -- rough syntax checking on Python style LaTeX documents. Written by Raymond D. Hettinger Copyright (c) 2003 Python Software Foundation. All rights reserved. Designed to catch common markup errors including: * Unbalanced or mismatched parenthesis, brackets, and braces. * Unbalanced of mismatched \begin and \end blocks. * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. Command line usage: python texcheck.py [-h] [-k keyword] foobar.tex Options: -m Munge parenthesis and brackets. [0,n) would normally mismatch. -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. -f: Forward-slash warnings suppressed. -d: Delimiter check only (useful for non-LaTeX files). -h: Help -s lineno: Start at lineno (useful for skipping complex sections). -v: Verbose. Shows current delimiter and unclosed delimiters. """ # Todo: # Add tableiii/lineiii cross-checking # Add braces matching import re import sets import sys import getopt from itertools import izip, count, islice cmdstr = r""" \section \module \declaremodule \modulesynopsis \moduleauthor \sectionauthor \versionadded \code \class \method \begin \optional \var \ref \end \subsection \lineiii \hline \label \indexii \textrm \ldots \keyword \stindex \index \item \note \withsubitem \ttindex \footnote \citetitle \samp \opindex \noindent \exception \strong \dfn \ctype \obindex \character \indexiii \function \bifuncindex \refmodule \refbimodindex \subsubsection \nodename \member \chapter \emph \ASCII \UNIX \regexp \program \production \token \productioncont \term \grammartoken \lineii \seemodule \file \EOF \documentclass \usepackage \title \input \maketitle \ifhtml \fi \url \Cpp \tableofcontents \kbd \programopt \envvar \refstmodindex \cfunction \constant \NULL \moreargs \cfuncline \cdata \textasciicircum \n \ABC \setindexsubitem \versionchanged \deprecated \seetext \newcommand \POSIX \pep \warning \rfc \verbatiminput \methodline \textgreater \seetitle \lineiv \funclineni \ulink \manpage \funcline \dataline \unspecified \textbackslash \mimetype \mailheader \seepep \textunderscore \longprogramopt \infinity \plusminus \shortversion \version \refmodindex \seerfc \makeindex \makemodindex \renewcommand \indexname \appendix """ def matchclose(c_lineno, c_symbol, openers, pairmap): "Verify that closing delimiter matches most recent opening delimiter" try: o_lineno, o_symbol = openers.pop() except IndexError: msg = "Delimiter mismatch. On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol) raise Exception, msg if o_symbol in pairmap.get(c_symbol, [c_symbol]): return msg = "Opener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno) raise Exception, msg def checkit(source, opts, morecmds=[]): """Check the LaTex formatting in a sequence of lines. Opts is a mapping of options to option values if any: -m munge parenthesis and brackets -f forward slash warnings to be skipped -d delimiters only checking -v verbose listing on delimiters -s lineno: linenumber to start scan (default is 1). Morecmds is a sequence of LaTex commands (without backslashes) that are to be considered valid in the scan. """ texcmd = re.compile(r'\\[A-Za-z]+') validcmds = sets.Set(cmdstr.split()) for cmd in morecmds: validcmds.add('\\' + cmd) openers = [] # Stack of pending open delimiters if '-m' in opts: pairmap = {']':'[(', ')':'(['} # Munged openers else: pairmap = {']':'[', ')':'('} # Normal opener for a given closer openpunct = sets.Set('([') # Set of valid openers delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') startline = int(opts.get('-s', '1')) lineno = 0 for lineno, line in izip(count(startline), islice(source, startline-1, None)): line = line.rstrip() if '-f' not in opts and '/' in line: # Warn whenever forward slashes encountered line = line.rstrip() print 'Warning, forward slash on line %d: %s' % (lineno, line) if '-d' not in opts: # Validate commands nc = line.find(r'\newcommand') if nc != -1: start = line.find('{', nc) end = line.find('}', start) validcmds.add(line[start+1:end]) for cmd in texcmd.findall(line): if cmd not in validcmds: print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) # Check balancing of open/close markers (parens, brackets, etc) for begend, name, punct in delimiters.findall(line): if '-v' in opts: print lineno, '|', begend, name, punct, if begend == 'begin' and '-d' not in opts: openers.append((lineno, name)) elif punct in openpunct: openers.append((lineno, punct)) elif begend == 'end' and '-d' not in opts: matchclose(lineno, name, openers, pairmap) elif punct in pairmap: matchclose(lineno, punct, openers, pairmap) if '-v' in opts: print ' --> ', openers for lineno, symbol in openers: print "Unmatched open delimiter '%s' on line %d", (symbol, lineno) print 'Done checking %d lines.' % (lineno,) return 0 def main(args=None): if args is None: args = sys.argv[1:] optitems, arglist = getopt.getopt(args, "k:mfdhs:v") opts = dict(optitems) if '-h' in opts or args==[]: print __doc__ return 0 if len(arglist) < 1: print 'Please specify a file to be checked' return 1 morecmds = [v for k,v in optitems if k=='-k'] try: f = open(arglist[0]) except IOError: print 'Cannot open file %s.' % arglist[0] return 2 return(checkit(f, opts, morecmds)) if __name__ == '__main__': sys.exit(main()) Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/README,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** README 3 Feb 2003 15:09:32 -0000 1.10 --- README 10 May 2003 03:30:13 -0000 1.11 *************** *** 44,47 **** --- 44,48 ---- tabnanny.py Check for ambiguous indentation (Tim Peters) tabpolice.py Check for ambiguous indentation (GvR) + texcheck.py Validate Python LaTeX formatting (Raymond Hettinger) texi2html.py Convert GNU texinfo files into HTML treesync.py Synchronize source trees (very ideosyncratic) From rhettinger@users.sourceforge.net Sat May 10 04:35:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 09 May 2003 20:35:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libarray.tex,1.34,1.35 libftplib.tex,1.35,1.36 liboptparse.tex,1.8,1.9 libos.tex,1.123,1.124 libtimeit.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24497 Modified Files: libarray.tex libftplib.tex liboptparse.tex libos.tex libtimeit.tex Log Message: Fixed spacing and unbalanced brackets or parenthesis. Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** libarray.tex 4 Apr 2002 14:02:45 -0000 1.34 --- libarray.tex 10 May 2003 03:35:37 -0000 1.35 *************** *** 230,233 **** about Numerical Python. (A PDF version of the NumPy manual is available at ! \url{http://numpy.sourceforge.net/numdoc/numdoc.pdf}.} \end{seealso} --- 230,233 ---- about Numerical Python. (A PDF version of the NumPy manual is available at ! \url{http://numpy.sourceforge.net/numdoc/numdoc.pdf}).} \end{seealso} Index: libftplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libftplib.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** libftplib.tex 28 Dec 2001 20:54:28 -0000 1.35 --- libftplib.tex 10 May 2003 03:35:37 -0000 1.36 *************** *** 161,165 **** Retrieve a file or directory listing in \ASCII{} transfer mode. \var{command} should be an appropriate \samp{RETR} command (see ! \method{retrbinary()} or a \samp{LIST} command (usually just the string \code{'LIST'}). The \var{callback} function is called for each line, with the trailing CRLF stripped. The default \var{callback} prints --- 161,165 ---- Retrieve a file or directory listing in \ASCII{} transfer mode. \var{command} should be an appropriate \samp{RETR} command (see ! \method{retrbinary()}) or a \samp{LIST} command (usually just the string \code{'LIST'}). The \var{callback} function is called for each line, with the trailing CRLF stripped. The default \var{callback} prints *************** *** 281,285 **** \begin{methoddesc}{close}{} Close the connection unilaterally. This should not be applied to an ! already closed connection (such as after a successful call to \method{quit()}. After this call the \class{FTP} instance should not be used any more (after a call to \method{close()} or --- 281,285 ---- \begin{methoddesc}{close}{} Close the connection unilaterally. This should not be applied to an ! already closed connection such as after a successful call to \method{quit()}. After this call the \class{FTP} instance should not be used any more (after a call to \method{close()} or Index: liboptparse.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** liboptparse.tex 9 May 2003 18:18:46 -0000 1.8 --- liboptparse.tex 10 May 2003 03:35:37 -0000 1.9 *************** *** 963,966 **** --- 963,967 ---- help="Input file to read data from"), make_option("--secret", help=SUPPRESS_HELP) + ]) \end{verbatim} Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** libos.tex 28 Apr 2003 19:15:10 -0000 1.123 --- libos.tex 10 May 2003 03:35:37 -0000 1.124 *************** *** 454,458 **** If you're starting with a Python file object \var{f}, first do ! \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, to ensure that all internal buffers associated with \var{f} are written to disk. --- 454,458 ---- If you're starting with a Python file object \var{f}, first do ! \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno())}, to ensure that all internal buffers associated with \var{f} are written to disk. *************** *** 885,889 **** \member{st_ino} (inode number), \member{st_dev} (device), ! \member{st_nlink} (number of hard links, \member{st_uid} (user ID of owner), \member{st_gid} (group ID of owner), --- 885,889 ---- \member{st_ino} (inode number), \member{st_dev} (device), ! \member{st_nlink} (number of hard links), \member{st_uid} (user ID of owner), \member{st_gid} (group ID of owner), Index: libtimeit.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtimeit.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libtimeit.tex 9 May 2003 18:21:02 -0000 1.3 --- libtimeit.tex 10 May 2003 03:35:37 -0000 1.4 *************** *** 53,57 **** \end{methoddesc} ! \begin{methoddesc}{repeat}{\optional{repeat\code{=3}\optional{, number\code{=1000000}}}} Call \method{timeit()} a few times. --- 53,57 ---- \end{methoddesc} ! \begin{methoddesc}{repeat}{\optional{repeat\code{=3} \optional{, number\code{=1000000}}}} Call \method{timeit()} a few times. From rhettinger@users.sourceforge.net Sat May 10 05:21:10 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 09 May 2003 21:21:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdatetime.tex,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv3838 Modified Files: libdatetime.tex Log Message: Fix missing parenthesis. Index: libdatetime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdatetime.tex,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** libdatetime.tex 7 Feb 2003 22:50:26 -0000 1.44 --- libdatetime.tex 10 May 2003 04:21:08 -0000 1.45 *************** *** 903,907 **** \begin{methoddesc}{isoweekday}{} Return the day of the week as an integer, where Monday is 1 and ! Sunday is 7. The same as \code{self.date().isoweekday)}. See also \method{weekday()}, \method{isocalendar()}. \end{methoddesc} --- 903,907 ---- \begin{methoddesc}{isoweekday}{} Return the day of the week as an integer, where Monday is 1 and ! Sunday is 7. The same as \code{self.date().isoweekday()}. See also \method{weekday()}, \method{isocalendar()}. \end{methoddesc} From rhettinger@users.sourceforge.net Sat May 10 06:37:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 09 May 2003 22:37:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test___all__.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23026 Modified Files: test___all__.py Log Message: All two more modules with __all__. Index: test___all__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test___all__.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** test___all__.py 2 May 2003 09:36:07 -0000 1.32 --- test___all__.py 10 May 2003 05:37:13 -0000 1.33 *************** *** 81,84 **** --- 81,85 ---- self.check_all("copy") self.check_all("copy_reg") + self.check_all("csv") self.check_all("dbhash") self.check_all("difflib") *************** *** 122,125 **** --- 123,127 ---- self.check_all("ntpath") self.check_all("opcode") + self.check_all("optparse") self.check_all("os") self.check_all("os2emxpath") From loewis@users.sourceforge.net Sat May 10 08:08:52 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:08:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10809/Doc/lib Modified Files: libstdtypes.tex Log Message: Patch #612627: Add encoding attribute to file objects, and determine the terminal encoding on Windows and Unix. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** libstdtypes.tex 30 Apr 2003 16:44:36 -0000 1.123 --- libstdtypes.tex 10 May 2003 07:08:50 -0000 1.124 *************** *** 1373,1376 **** --- 1373,1390 ---- \end{memberdesc} + \begin{memberdesc}[file]{encoding} + The encoding that this file uses. When Unicode strings are written + to a file, they will be converted to byte strings using this encoding. + In addition, when the file is connected to a terminal, the attribute + gives the encoding that the terminal is likely to use (that + information might be incorrect if the user has misconfigured the + terminal). The attribute is read-only and may not be present on + all file-like objects. It may also be \code{None}, in which case + the file uses the system default encoding for converting Unicode + strings. + + \versionadded{2.3} + \end{memberdesc} + \begin{memberdesc}[file]{mode} The I/O mode for the file. If the file was created using the From loewis@users.sourceforge.net Sat May 10 08:08:52 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:08:52 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.177,2.178 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv10809/Objects Modified Files: fileobject.c Log Message: Patch #612627: Add encoding attribute to file objects, and determine the terminal encoding on Windows and Unix. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.177 retrieving revision 2.178 diff -C2 -d -r2.177 -r2.178 *** fileobject.c 4 May 2003 04:16:52 -0000 2.177 --- fileobject.c 10 May 2003 07:08:50 -0000 2.178 *************** *** 117,120 **** --- 117,121 ---- Py_DECREF(f->f_name); Py_DECREF(f->f_mode); + Py_DECREF(f->f_encoding); #ifdef Py_USING_UNICODE if (wname) *************** *** 134,138 **** f->f_skipnextlf = 0; #endif ! if (f->f_name == NULL || f->f_mode == NULL) return NULL; --- 135,141 ---- f->f_skipnextlf = 0; #endif ! Py_INCREF(Py_None); ! f->f_encoding = Py_None; ! if (f->f_name == NULL || f->f_mode == NULL) return NULL; *************** *** 303,306 **** --- 306,324 ---- } + /* Set the encoding used to output Unicode strings. + Returh 1 on success, 0 on failure. */ + + int + PyFile_SetEncoding(PyObject *f, const char *enc) + { + PyFileObject *file = (PyFileObject*)f; + PyObject *str = PyString_FromString(enc); + if (!str) + return 0; + Py_DECREF(file->f_encoding); + file->f_encoding = str; + return 1; + } + static PyObject * err_closed(void) *************** *** 324,327 **** --- 342,346 ---- Py_XDECREF(f->f_name); Py_XDECREF(f->f_mode); + Py_XDECREF(f->f_encoding); drop_readahead(f); f->ob_type->tp_free((PyObject *)f); *************** *** 1668,1671 **** --- 1687,1692 ---- {"name", T_OBJECT, OFF(f_name), RO, "file name"}, + {"encoding", T_OBJECT, OFF(f_encoding), RO, + "file encoding"}, /* getattr(f, "closed") is implemented without this table */ {NULL} /* Sentinel */ *************** *** 1852,1855 **** --- 1873,1878 ---- Py_INCREF(not_yet_string); ((PyFileObject *)self)->f_mode = not_yet_string; + Py_INCREF(Py_None); + ((PyFileObject *)self)->f_encoding = Py_None; } return self; *************** *** 2035,2043 **** --- 2058,2083 ---- else if (PyFile_Check(f)) { FILE *fp = PyFile_AsFile(f); + PyObject *enc = ((PyFileObject*)f)->f_encoding; + int result; if (fp == NULL) { err_closed(); return -1; } + #ifdef Py_USING_UNICODE + if (PyUnicode_Check(v) && enc != Py_None) { + char *cenc = PyString_AS_STRING(enc); + value = PyUnicode_AsEncodedString(v, cenc, "strict"); + if (value == NULL) + return -1; + } else { + value = v; + Py_INCREF(value); + } + result = PyObject_Print(value, fp, flags); + Py_DECREF(value); + return result; + #else return PyObject_Print(v, fp, flags); + #endif } writer = PyObject_GetAttrString(f, "write"); From loewis@users.sourceforge.net Sat May 10 08:08:52 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:08:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv10809/Doc/api Modified Files: concrete.tex Log Message: Patch #612627: Add encoding attribute to file objects, and determine the terminal encoding on Windows and Unix. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** concrete.tex 23 Apr 2003 20:38:41 -0000 1.24 --- concrete.tex 10 May 2003 07:08:50 -0000 1.25 *************** *** 2030,2033 **** --- 2030,2039 ---- \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyFile_Encoding}{PyFileObject *p, char *enc} + Set the file's encoding for Unicode output to \var{enc}. Return + 1 on success and 0 on failure. + \versionadded{2.3} + \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyFile_SoftSpace}{PyObject *p, int newflag} This function exists for internal use by the interpreter. Sets the From loewis@users.sourceforge.net Sat May 10 08:08:52 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:08:52 -0700 Subject: [Python-checkins] python/dist/src/Include fileobject.h,2.31,2.32 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv10809/Include Modified Files: fileobject.h Log Message: Patch #612627: Add encoding attribute to file objects, and determine the terminal encoding on Windows and Unix. Index: fileobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/fileobject.h,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** fileobject.h 12 Aug 2002 07:21:56 -0000 2.31 --- fileobject.h 10 May 2003 07:08:50 -0000 2.32 *************** *** 25,28 **** --- 25,29 ---- int f_skipnextlf; /* Skip next \n */ #endif + PyObject *f_encoding; } PyFileObject; *************** *** 34,37 **** --- 35,39 ---- PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); + PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, int (*)(FILE *)); From loewis@users.sourceforge.net Sat May 10 08:08:52 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:08:52 -0700 Subject: [Python-checkins] python/dist/src/Python sysmodule.c,2.118,2.119 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv10809/Python Modified Files: sysmodule.c Log Message: Patch #612627: Add encoding attribute to file objects, and determine the terminal encoding on Windows and Unix. Index: sysmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/sysmodule.c,v retrieving revision 2.118 retrieving revision 2.119 diff -C2 -d -r2.118 -r2.119 *** sysmodule.c 3 May 2003 09:14:54 -0000 2.118 --- sysmodule.c 10 May 2003 07:08:50 -0000 2.119 *************** *** 37,40 **** --- 37,49 ---- #endif + #ifdef MS_WINDOWS + #include + #endif + + #ifdef HAVE_LANGINFO_H + #include + #include + #endif + PyObject * PySys_GetObject(char *name) *************** *** 882,885 **** --- 891,900 ---- PyObject *sysin, *sysout, *syserr; char *s; + #ifdef MS_WINDOWS + char buf[10]; + #endif + #if defined(HAVE_LANGINFO_H) && defined(CODESET) + char *oldloc, *codeset; + #endif m = Py_InitModule3("sys", sys_methods, sys_doc); *************** *** 891,894 **** --- 906,937 ---- if (PyErr_Occurred()) return NULL; + #ifdef MS_WINDOWS + if(isatty(_fileno(stdin))){ + sprintf(buf, "cp%d", GetConsoleCP()); + if (!PyFile_SetEncoding(sysin, buf)) + return NULL; + } + if(isatty(_fileno(stdout))) { + sprintf(buf, "cp%d", GetConsoleOutputCP()); + if (!PyFile_SetEncoding(sysout, buf)) + return NULL; + } + #endif + + #if defined(HAVE_LANGINFO_H) && defined(CODESET) + oldloc = setlocale(LC_CTYPE, 0); + setlocale(LC_CTYPE, ""); + codeset = nl_langinfo(CODESET); + setlocale(LC_CTYPE, oldloc); + if(codeset && isatty(fileno(stdin))){ + if (!PyFile_SetEncoding(sysin, codeset)) + return NULL; + } + if(codeset && isatty(fileno(stdout))) { + if (!PyFile_SetEncoding(sysout, codeset)) + return NULL; + } + #endif + PyDict_SetItemString(sysdict, "stdin", sysin); PyDict_SetItemString(sysdict, "stdout", sysout); From loewis@users.sourceforge.net Sat May 10 08:10:15 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:10:15 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.762,1.763 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv11239/Misc Modified Files: NEWS Log Message: Patch #612627: Add encoding attribute to file objects, and determine the terminal encoding on Windows and Unix. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.762 retrieving revision 1.763 diff -C2 -d -r1.762 -r1.763 *** NEWS 10 May 2003 03:30:13 -0000 1.762 --- NEWS 10 May 2003 07:10:12 -0000 1.763 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - The encoding attribute has been added for file objects, and set to + the terminal encoding on Unix and Windows. + - The softspace attribute of file objects became read-only by oversight. It's writable again. From loewis@users.sourceforge.net Sat May 10 08:36:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:57 -0700 Subject: [Python-checkins] python/dist/src/Lib site.py,1.49,1.50 socket.py,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Lib Modified Files: site.py socket.py Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** site.py 16 Apr 2003 13:12:21 -0000 1.49 --- site.py 10 May 2003 07:36:54 -0000 1.50 *************** *** 163,167 **** for prefix in prefixes: if prefix: ! if sys.platform == 'os2emx': sitedirs = [os.path.join(prefix, "Lib", "site-packages")] elif os.sep == '/': --- 163,167 ---- for prefix in prefixes: if prefix: ! if sys.platform in ('os2emx', 'riscos'): sitedirs = [os.path.join(prefix, "Lib", "site-packages")] elif os.sep == '/': Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** socket.py 29 Apr 2003 19:50:25 -0000 1.39 --- socket.py 10 May 2003 07:36:54 -0000 1.40 *************** *** 97,101 **** __all__.append("errorTab") - del os, sys --- 97,100 ---- *************** *** 139,142 **** --- 138,144 ---- 'sendall', 'setblocking', 'settimeout', 'gettimeout', 'shutdown') + + if sys.platform == "riscos": + _socketmethods = _socketmethods + ('sleeptaskw',) class _closedsocket(object): From loewis@users.sourceforge.net Sat May 10 08:36:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-riscos riscospath.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-riscos In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Lib/plat-riscos Modified Files: riscospath.py Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: riscospath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-riscos/riscospath.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** riscospath.py 14 Feb 2003 19:35:30 -0000 1.9 --- riscospath.py 10 May 2003 07:36:55 -0000 1.10 *************** *** 16,20 **** curdir = '@' pardir = '^' ! extsep = '.' sep = '.' pathsep = ',' --- 16,20 ---- curdir = '@' pardir = '^' ! extsep = '/' sep = '.' pathsep = ',' From loewis@users.sourceforge.net Sat May 10 08:36:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:58 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.229,2.230 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Objects Modified Files: typeobject.c Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.229 retrieving revision 2.230 diff -C2 -d -r2.229 -r2.230 *** typeobject.c 23 Apr 2003 12:07:22 -0000 2.229 --- typeobject.c 10 May 2003 07:36:55 -0000 2.230 *************** *** 5087,5091 **** list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ ! specific = type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional --- 5087,5091 ---- list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ ! specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional From loewis@users.sourceforge.net Sat May 10 08:36:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:58 -0700 Subject: [Python-checkins] python/dist/src/Parser grammar.c,2.21,2.22 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Parser Modified Files: grammar.c Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: grammar.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/grammar.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** grammar.c 17 Apr 2003 14:55:41 -0000 2.21 --- grammar.c 10 May 2003 07:36:56 -0000 2.22 *************** *** 10,13 **** --- 10,17 ---- #include "grammar.h" + #ifdef RISCOS + #include + #endif + extern int Py_DebugFlag; From loewis@users.sourceforge.net Sat May 10 08:36:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:58 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.283,2.284 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Python Modified Files: compile.c Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.283 retrieving revision 2.284 diff -C2 -d -r2.283 -r2.284 *** compile.c 3 May 2003 10:53:08 -0000 2.283 --- compile.c 10 May 2003 07:36:56 -0000 2.284 *************** *** 421,425 **** } } ! code = PyString_FromStringAndSize(codestr, codelen); PyMem_Free(codestr); return code; --- 421,425 ---- } } ! code = PyString_FromStringAndSize((char *)codestr, codelen); PyMem_Free(codestr); return code; From loewis@users.sourceforge.net Sat May 10 08:36:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:57 -0700 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c,1.267,1.268 timemodule.c,2.136,2.137 zipimport.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Modules Modified Files: socketmodule.c timemodule.c zipimport.c Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.267 retrieving revision 1.268 diff -C2 -d -r1.267 -r1.268 *** socketmodule.c 9 May 2003 08:12:00 -0000 1.267 --- socketmodule.c 10 May 2003 07:36:55 -0000 1.268 *************** *** 222,228 **** # include # else ! # include # define NO_DUP int h_errno; /* not used */ # endif --- 222,230 ---- # include # else ! # include ! # include # define NO_DUP int h_errno; /* not used */ + # define INET_ADDRSTRLEN 16 # endif *************** *** 465,468 **** --- 467,482 ---- #endif + #if defined(RISCOS) + if (_inet_error.errnum != NULL) { + PyObject *v; + v = Py_BuildValue("(is)", errno, _inet_err()); + if (v != NULL) { + PyErr_SetObject(socket_error, v); + Py_DECREF(v); + } + return NULL; + } + #endif + return PyErr_SetFromErrno(socket_error); } *************** *** 549,554 **** ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block); #endif /* MS_WINDOWS */ ! #endif /* __BEOS__ */ #endif /* RISCOS */ Py_END_ALLOW_THREADS --- 563,571 ---- ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block); #endif /* MS_WINDOWS */ ! #else /* RISCOS */ ! block = !block; ! socketioctl(s->sock_fd, FIONBIO, (u_long*)&block); #endif /* RISCOS */ + #endif /* __BEOS__ */ Py_END_ALLOW_THREADS *************** *** 1212,1220 **** static PyObject * ! sock_sleeptaskw(PySocketSockObject *s,PyObject *args) { int block; ! int delay_flag; ! if (!PyArg_Parse(args, "i", &block)) return NULL; Py_BEGIN_ALLOW_THREADS --- 1229,1237 ---- static PyObject * ! sock_sleeptaskw(PySocketSockObject *s,PyObject *arg) { int block; ! block = PyInt_AsLong(arg); ! if (block == -1 && PyErr_Occurred()) return NULL; Py_BEGIN_ALLOW_THREADS *************** *** 2057,2061 **** shutdown_doc}, #ifdef RISCOS ! {"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_VARARGS, sleeptaskw_doc}, #endif --- 2074,2078 ---- shutdown_doc}, #ifdef RISCOS ! {"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_O, sleeptaskw_doc}, #endif *************** *** 2859,2864 **** char* ip; int retval; char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))]; ! if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) { return NULL; --- 2876,2884 ---- char* ip; int retval; + #ifdef ENABLE_IPV6 char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))]; ! #else ! char packed[sizeof(struct in_addr)]; ! #endif if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) { return NULL; *************** *** 2876,2882 **** --- 2896,2904 ---- return PyString_FromStringAndSize(packed, sizeof(struct in_addr)); + #ifdef ENABLE_IPV6 } else if (af == AF_INET6) { return PyString_FromStringAndSize(packed, sizeof(struct in6_addr)); + #endif } else { PyErr_SetString(socket_error, "unknown address family"); *************** *** 2897,2901 **** --- 2919,2927 ---- int len; const char* retval; + #ifdef ENABLE_IPV6 char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1]; + #else + char ip[INET_ADDRSTRLEN + 1]; + #endif /* Guarantee NUL-termination for PyString_FromString() below */ *************** *** 2912,2915 **** --- 2938,2942 ---- return NULL; } + #ifdef ENABLE_IPV6 } else if (af == AF_INET6) { if (len != sizeof(struct in6_addr)) { *************** *** 2918,2921 **** --- 2945,2949 ---- return NULL; } + #endif } else { PyErr_Format(PyExc_ValueError, *************** *** 3236,3240 **** taskwindow = r.r[0]; ! return 0; } --- 3264,3268 ---- taskwindow = r.r[0]; ! return 1; } Index: timemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v retrieving revision 2.136 retrieving revision 2.137 diff -C2 -d -r2.136 -r2.137 *** timemodule.c 10 Apr 2003 16:03:22 -0000 2.136 --- timemodule.c 10 May 2003 07:36:55 -0000 2.137 *************** *** 79,82 **** --- 79,86 ---- #endif + #ifdef RISCOS + extern int riscos_sleep(double); + #endif + /* Forward declarations */ static int floatsleep(double); *************** *** 945,949 **** Py_BEGIN_ALLOW_THREADS /* This sleep *CAN BE* interrupted. */ ! if ( sleep(secs) ) return -1; Py_END_ALLOW_THREADS --- 949,953 ---- Py_BEGIN_ALLOW_THREADS /* This sleep *CAN BE* interrupted. */ ! if ( riscos_sleep(secs) ) return -1; Py_END_ALLOW_THREADS Index: zipimport.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** zipimport.c 8 Apr 2003 20:07:15 -0000 1.13 --- zipimport.c 10 May 2003 07:36:55 -0000 1.14 *************** *** 92,95 **** --- 92,96 ---- prefix = NULL; for (;;) { + #ifndef RISCOS struct stat statbuf; int rv; *************** *** 103,106 **** --- 104,116 ---- break; } + #else + if (object_exists(buf)) { + /* it exists */ + if (isfile(buf)) + /* it's a file */ + path = buf; + break; + } + #endif /* back up one path element */ p = strrchr(buf, SEP); From loewis@users.sourceforge.net Sat May 10 08:36:57 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:57 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.139,1.140 test_bz2.py,1.14,1.15 test_exceptions.py,1.18,1.19 test_import.py,1.17,1.18 test_normalization.py,1.6,1.7 test_select.py,1.15,1.16 test_shelve.py,1.5,1.6 test_support.py,1.53,1.54 test_tarfile.py,1.8,1.9 test_zipimport.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Lib/test Modified Files: regrtest.py test_bz2.py test_exceptions.py test_import.py test_normalization.py test_select.py test_shelve.py test_support.py test_tarfile.py test_zipimport.py Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.139 retrieving revision 1.140 diff -C2 -d -r1.139 -r1.140 *** regrtest.py 6 May 2003 20:36:24 -0000 1.139 --- regrtest.py 10 May 2003 07:36:55 -0000 1.140 *************** *** 727,732 **** --- 727,734 ---- test_al test_asynchat + test_atexit test_bsddb test_bsddb185 + test_bsddb3 test_cd test_cl Index: test_bz2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bz2.py,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** test_bz2.py 1 May 2003 17:45:34 -0000 1.14 --- test_bz2.py 10 May 2003 07:36:55 -0000 1.15 *************** *** 12,16 **** from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor ! has_cmdline_bunzip2 = sys.platform not in ("win32", "os2emx") class BaseTest(unittest.TestCase): --- 12,16 ---- from bz2 import BZ2File, BZ2Compressor, BZ2Decompressor ! has_cmdline_bunzip2 = sys.platform not in ("win32", "os2emx", "riscos") class BaseTest(unittest.TestCase): Index: test_exceptions.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_exceptions.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_exceptions.py 30 Jul 2002 23:26:01 -0000 1.18 --- test_exceptions.py 10 May 2003 07:36:55 -0000 1.19 *************** *** 4,8 **** from types import ClassType import warnings ! import sys, traceback print '5. Built-in exceptions' --- 4,8 ---- from types import ClassType import warnings ! import sys, traceback, os print '5. Built-in exceptions' *************** *** 186,190 **** co = tb.tb_frame.f_code assert co.co_name == "test_capi1" ! assert co.co_filename.endswith('test_exceptions.py') else: print "Expected exception" --- 186,190 ---- co = tb.tb_frame.f_code assert co.co_name == "test_capi1" ! assert co.co_filename.endswith('test_exceptions'+os.extsep+'py') else: print "Expected exception" *************** *** 198,202 **** co = tb.tb_frame.f_code assert co.co_name == "__init__" ! assert co.co_filename.endswith('test_exceptions.py') co2 = tb.tb_frame.f_back.f_code assert co2.co_name == "test_capi2" --- 198,202 ---- co = tb.tb_frame.f_code assert co.co_name == "__init__" ! assert co.co_filename.endswith('test_exceptions'+os.extsep+'py') co2 = tb.tb_frame.f_back.f_code assert co2.co_name == "test_capi2" Index: test_import.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_import.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** test_import.py 23 Jul 2002 19:03:55 -0000 1.17 --- test_import.py 10 May 2003 07:36:55 -0000 1.18 *************** *** 79,83 **** def test_module_with_large_stack(module): # create module w/list of 65000 elements to test bug #561858 ! filename = module + '.py' # create a file with a list of 65000 elements --- 79,83 ---- def test_module_with_large_stack(module): # create module w/list of 65000 elements to test bug #561858 ! filename = module + os.extsep + 'py' # create a file with a list of 65000 elements *************** *** 103,108 **** # cleanup del sys.path[-1] ! for ext in '.pyc', '.pyo': ! fname = module + ext if os.path.exists(fname): os.unlink(fname) --- 103,108 ---- # cleanup del sys.path[-1] ! for ext in 'pyc', 'pyo': ! fname = module + os.extsep + ext if os.path.exists(fname): os.unlink(fname) Index: test_normalization.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_normalization.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_normalization.py 22 Apr 2003 18:15:05 -0000 1.6 --- test_normalization.py 10 May 2003 07:36:55 -0000 1.7 *************** *** 4,8 **** from unicodedata import normalize ! TESTDATAFILE = "NormalizationTest.txt" # This search allows using a build directory just inside the source --- 4,8 ---- from unicodedata import normalize ! TESTDATAFILE = "NormalizationTest" + os.extsep + "txt" # This search allows using a build directory just inside the source Index: test_select.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_select.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_select.py 23 Jul 2002 19:04:00 -0000 1.15 --- test_select.py 10 May 2003 07:36:55 -0000 1.16 *************** *** 43,47 **** def test(): import sys ! if sys.platform[:3] in ('win', 'mac', 'os2'): if verbose: print "Can't test select easily on", sys.platform --- 43,47 ---- def test(): import sys ! if sys.platform[:3] in ('win', 'mac', 'os2', 'riscos'): if verbose: print "Can't test select easily on", sys.platform Index: test_shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_shelve.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_shelve.py 1 May 2003 17:45:48 -0000 1.5 --- test_shelve.py 10 May 2003 07:36:55 -0000 1.6 *************** *** 7,11 **** class TestCase(unittest.TestCase): ! fn = "shelftemp.db" def test_ascii_file_shelf(self): --- 7,11 ---- class TestCase(unittest.TestCase): ! fn = "shelftemp" + os.extsep + "db" def test_ascii_file_shelf(self): Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** test_support.py 4 May 2003 21:15:27 -0000 1.53 --- test_support.py 10 May 2003 07:36:55 -0000 1.54 *************** *** 57,61 **** for dirname in sys.path: try: ! os.unlink(os.path.join(dirname, modname + '.pyc')) except os.error: pass --- 57,61 ---- for dirname in sys.path: try: ! os.unlink(os.path.join(dirname, modname + os.extsep + 'pyc')) except os.error: pass *************** *** 64,68 **** # is exited) but there is a .pyo file. try: ! os.unlink(os.path.join(dirname, modname + '.pyo')) except os.error: pass --- 64,68 ---- # is exited) but there is a .pyo file. try: ! os.unlink(os.path.join(dirname, modname + os.extsep + 'pyo')) except os.error: pass *************** *** 119,123 **** # Jython disallows @ in module names TESTFN = '$test' ! elif os.name != 'riscos': TESTFN = '@test' # Unicode name only used if TEST_FN_ENCODING exists for the platform. --- 119,125 ---- # Jython disallows @ in module names TESTFN = '$test' ! elif os.name == 'riscos': ! TESTFN = 'testfile' ! else: TESTFN = '@test' # Unicode name only used if TEST_FN_ENCODING exists for the platform. *************** *** 130,135 **** TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. TESTFN_ENCODING=sys.getfilesystemencoding() - else: - TESTFN = 'test' # Make sure we can write to TESTFN, try in /tmp if we can't --- 132,135 ---- Index: test_tarfile.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tarfile.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_tarfile.py 1 May 2003 17:45:51 -0000 1.8 --- test_tarfile.py 10 May 2003 07:36:55 -0000 1.9 *************** *** 22,28 **** return test_support.findfile(path) ! testtar = path("testtar.tar") ! tempdir = path("testtar.dir") ! tempname = path("testtar.tmp") membercount = 10 --- 22,28 ---- return test_support.findfile(path) ! testtar = path("testtar" + os.extsep + "tar") ! tempdir = path("testtar" + os.extsep + "dir") ! tempname = path("testtar" + os.extsep + "tmp") membercount = 10 *************** *** 30,34 **** if not comp: return testtar ! return "%s.%s" % (testtar, comp) def dirname(): --- 30,34 ---- if not comp: return testtar ! return "%s%s%s" % (testtar, os.extsep, comp) def dirname(): Index: test_zipimport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_zipimport.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_zipimport.py 1 May 2003 17:45:56 -0000 1.8 --- test_zipimport.py 10 May 2003 07:36:55 -0000 1.9 *************** *** 38,42 **** TESTPACK = "ziptestpackage" TESTPACK2 = "ziptestpackage2" ! TEMP_ZIP = os.path.abspath("junk95142.zip") class UncompressedZipImportTestCase(ImportHooksBaseTestCase): --- 38,42 ---- TESTPACK = "ziptestpackage" TESTPACK2 = "ziptestpackage2" ! TEMP_ZIP = os.path.abspath("junk95142" + os.extsep + "zip") class UncompressedZipImportTestCase(ImportHooksBaseTestCase): From loewis@users.sourceforge.net Sat May 10 08:36:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:58 -0700 Subject: [Python-checkins] python/dist/src/RISCOS/support !Boot,1.2,1.3 !Run,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/support In directory sc8-pr-cvs1:/tmp/cvs-serv17284/RISCOS/support Modified Files: !Boot !Run Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: !Boot =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/support/!Boot,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** !Boot 24 Oct 2001 20:13:15 -0000 1.2 --- !Boot 10 May 2003 07:36:56 -0000 1.3 *************** *** 7,12 **** .AddToPath Python$Path PythonApp:Lib.plat-riscos .AddToPath Python$Path PythonApp:Lib.site-packages ! set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit | -display set File$Type_ae5 Python ! set Alias$Python Run .python22 %*0 \ No newline at end of file --- 7,22 ---- .AddToPath Python$Path PythonApp:Lib.plat-riscos .AddToPath Python$Path PythonApp:Lib.site-packages ! set Alias$@RunType_ae5 TaskWindow |"python %%*0|" -name |"Python|" -quit -wimpslot 1248k | -display set File$Type_ae5 Python ! ! | load modules for 32 bit compatibility ! RMEnsure UtilityModule 3.10 Error This application requires RISC OS 3.10 or later ! RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 RMLoad System:Modules.CallASWI ! RMEnsure UtilityModule 3.70 RMEnsure CallASWI 0.02 Error This application requires CallASWI 0.02 or later ! RMEnsure FPEmulator 4.03 RMLoad System:Modules.FPEmulator ! RMEnsure FPEmulator 4.03 Error This application requires FPEmulator 4.03 or later ! RMEnsure SharedCLibrary 5.17 RMLoad System:Modules.CLib ! RMEnsure SharedCLibrary 5.34 Error This application requires SharedCLibrary 5.34 or later ! ! set Alias$Python Run .python23 %*0 \ No newline at end of file Index: !Run =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/support/!Run,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** !Run 10 Apr 2001 22:03:33 -0000 1.1 --- !Run 10 May 2003 07:36:56 -0000 1.2 *************** *** 1,2 **** .!Boot ! TaskWindow "python" -name "Python" -quit -display \ No newline at end of file --- 1,2 ---- .!Boot ! TaskWindow "python" -name "Python" -quit -display -wimpslot 1248k \ No newline at end of file From loewis@users.sourceforge.net Sat May 10 08:37:26 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:37:26 -0700 Subject: [Python-checkins] python/dist/src/Include pyport.h,2.60,2.61 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Include Modified Files: pyport.h Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: pyport.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pyport.h,v retrieving revision 2.60 retrieving revision 2.61 diff -C2 -d -r2.60 -r2.61 *** pyport.h 29 Mar 2003 10:04:54 -0000 2.60 --- pyport.h 10 May 2003 07:36:54 -0000 2.61 *************** *** 148,151 **** --- 148,152 ---- #ifdef RISCOS #include + #include "unixstuff.h" #endif From loewis@users.sourceforge.net Sat May 10 08:36:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:58 -0700 Subject: [Python-checkins] python/dist/src/RISCOS/Modules riscosmodule.c,1.6,1.7 swimodule.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv17284/RISCOS/Modules Modified Files: riscosmodule.c swimodule.c Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: riscosmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/Modules/riscosmodule.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** riscosmodule.c 13 Jun 2002 20:33:02 -0000 1.6 --- riscosmodule.c 10 May 2003 07:36:56 -0000 1.7 *************** *** 7,10 **** --- 7,12 ---- #include "unixstuff.h" + #include + #include "Python.h" #include "structseq.h" *************** *** 369,372 **** --- 371,552 ---- }; + static int + ins(PyObject *module, char *symbol, long value) + { + return PyModule_AddIntConstant(module, symbol, value); + } + + + static int + all_ins(PyObject *d) + { + #ifdef F_OK + if (ins(d, "F_OK", (long)F_OK)) return -1; + #endif + #ifdef R_OK + if (ins(d, "R_OK", (long)R_OK)) return -1; + #endif + #ifdef W_OK + if (ins(d, "W_OK", (long)W_OK)) return -1; + #endif + #ifdef X_OK + if (ins(d, "X_OK", (long)X_OK)) return -1; + #endif + #ifdef NGROUPS_MAX + if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; + #endif + #ifdef TMP_MAX + if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; + #endif + #ifdef WCONTINUED + if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1; + #endif + #ifdef WNOHANG + if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; + #endif + #ifdef WUNTRACED + if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1; + #endif + #ifdef O_RDONLY + if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1; + #endif + #ifdef O_WRONLY + if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1; + #endif + #ifdef O_RDWR + if (ins(d, "O_RDWR", (long)O_RDWR)) return -1; + #endif + #ifdef O_NDELAY + if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1; + #endif + #ifdef O_NONBLOCK + if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1; + #endif + #ifdef O_APPEND + if (ins(d, "O_APPEND", (long)O_APPEND)) return -1; + #endif + #ifdef O_DSYNC + if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1; + #endif + #ifdef O_RSYNC + if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1; + #endif + #ifdef O_SYNC + if (ins(d, "O_SYNC", (long)O_SYNC)) return -1; + #endif + #ifdef O_NOCTTY + if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1; + #endif + #ifdef O_CREAT + if (ins(d, "O_CREAT", (long)O_CREAT)) return -1; + #endif + #ifdef O_EXCL + if (ins(d, "O_EXCL", (long)O_EXCL)) return -1; + #endif + #ifdef O_TRUNC + if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1; + #endif + #ifdef O_BINARY + if (ins(d, "O_BINARY", (long)O_BINARY)) return -1; + #endif + #ifdef O_TEXT + if (ins(d, "O_TEXT", (long)O_TEXT)) return -1; + #endif + #ifdef O_LARGEFILE + if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1; + #endif + + /* MS Windows */ + #ifdef O_NOINHERIT + /* Don't inherit in child processes. */ + if (ins(d, "O_NOINHERIT", (long)O_NOINHERIT)) return -1; + #endif + #ifdef _O_SHORT_LIVED + /* Optimize for short life (keep in memory). */ + /* MS forgot to define this one with a non-underscore form too. */ + if (ins(d, "O_SHORT_LIVED", (long)_O_SHORT_LIVED)) return -1; + #endif + #ifdef O_TEMPORARY + /* Automatically delete when last handle is closed. */ + if (ins(d, "O_TEMPORARY", (long)O_TEMPORARY)) return -1; + #endif + #ifdef O_RANDOM + /* Optimize for random access. */ + if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1; + #endif + #ifdef O_SEQUENTIAL + /* Optimize for sequential access. */ + if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1; + #endif + + /* GNU extensions. */ + #ifdef O_DIRECT + /* Direct disk access. */ + if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1; + #endif + #ifdef O_DIRECTORY + /* Must be a directory. */ + if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1; + #endif + #ifdef O_NOFOLLOW + /* Do not follow links. */ + if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1; + #endif + + /* These come from sysexits.h */ + #ifdef EX_OK + if (ins(d, "EX_OK", (long)EX_OK)) return -1; + #endif /* EX_OK */ + #ifdef EX_USAGE + if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1; + #endif /* EX_USAGE */ + #ifdef EX_DATAERR + if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1; + #endif /* EX_DATAERR */ + #ifdef EX_NOINPUT + if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1; + #endif /* EX_NOINPUT */ + #ifdef EX_NOUSER + if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1; + #endif /* EX_NOUSER */ + #ifdef EX_NOHOST + if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1; + #endif /* EX_NOHOST */ + #ifdef EX_UNAVAILABLE + if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1; + #endif /* EX_UNAVAILABLE */ + #ifdef EX_SOFTWARE + if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1; + #endif /* EX_SOFTWARE */ + #ifdef EX_OSERR + if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1; + #endif /* EX_OSERR */ + #ifdef EX_OSFILE + if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1; + #endif /* EX_OSFILE */ + #ifdef EX_CANTCREAT + if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1; + #endif /* EX_CANTCREAT */ + #ifdef EX_IOERR + if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1; + #endif /* EX_IOERR */ + #ifdef EX_TEMPFAIL + if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1; + #endif /* EX_TEMPFAIL */ + #ifdef EX_PROTOCOL + if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1; + #endif /* EX_PROTOCOL */ + #ifdef EX_NOPERM + if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1; + #endif /* EX_NOPERM */ + #ifdef EX_CONFIG + if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1; + #endif /* EX_CONFIG */ + #ifdef EX_NOTFOUND + if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1; + #endif /* EX_NOTFOUND */ + + return 0; + } *************** *** 377,384 **** m = Py_InitModule("riscos", riscos_methods); d = PyModule_GetDict(m); ! /* Initialize riscos.error exception */ ! PyDict_SetItemString(d, "error", PyExc_OSError); PyStructSequence_InitType(&StatResultType, &stat_result_desc); --- 557,568 ---- m = Py_InitModule("riscos", riscos_methods); + + if (all_ins(m)) + return; + d = PyModule_GetDict(m); ! Py_INCREF(PyExc_OSError); ! PyModule_AddObject(m, "error", PyExc_OSError); PyStructSequence_InitType(&StatResultType, &stat_result_desc); Index: swimodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/Modules/swimodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** swimodule.c 24 Oct 2001 20:13:15 -0000 1.2 --- swimodule.c 10 May 2003 07:36:56 -0000 1.3 *************** *** 12,15 **** --- 12,18 ---- functions etc * Added "errnum" attribute to swi.error, so one can now check to see what the error number was + + 1.02 03 March 2002 Dietmar Schwertberger + * Added string, integer, integers, tuple and tuples */ *************** *** 413,422 **** } static PyMethodDef SwiMethods[]= ! { { "swi",swi_swi,1}, ! { "block",PyBlock_New,1}, ! { "register",PyRegister,1}, ! { NULL,NULL} /* Sentinel */ }; void initswi() --- 416,567 ---- } + static PyObject *swi_string(PyObject *self, PyObject *arg) + { char *s; + int l=-1; + if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&s, &l)) return NULL; + if (l==-1) + l = strlen(s); + return PyString_FromStringAndSize((char*)s, l); + } + + static char swi_string__doc__[] = + "string(address[, length]) -> string\n\ + Read a null terminated string from the given address."; + + + static PyObject *swi_integer(PyObject *self, PyObject *arg) + { int *i; + + if(!PyArg_ParseTuple(arg,"i",(unsigned int *)&i)) + return NULL; + return PyInt_FromLong(*i); + } + + static char swi_integer__doc__[] = + "integer(address) -> string\n\ + Read an integer from the given address."; + + + static PyObject *swi_integers(PyObject *self, PyObject *arg) + { int *i; + int c=-1; + PyObject *result, *result1; + + if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&i, &c)) return NULL; + result=PyList_New(0); + if (result) { + while ( c>0 || (c==-1 && *i) ) { + result1 = PyInt_FromLong((long)*i); + if (!result1) { + Py_DECREF(result); + return NULL; + } + if (PyList_Append(result, result1)!=0) { + Py_DECREF(result); + Py_DECREF(result1); + return NULL; + }; + i++; + if (c!=-1) + c--; + } + } + return result; + } + + static char swi_integers__doc__[] = + "integers(address[, count]) -> string\n\ + Either read a null terminated list of integers or\n\ + a list of given length from the given address."; + + + static PyObject *swi_tuples(PyObject *self, PyObject *arg) + { + unsigned char *i; /* points to current */ + int c=-1, l=4, j, zero; /* count, length, index */ + PyObject *result, *result1, *result11; + + if(!PyArg_ParseTuple(arg,"i|ii",(unsigned int *)&i, &l, &c)) return NULL; + result=PyList_New(0); + if (result) { + while (c) { + result1 = PyTuple_New(l); + if (!result1) { + Py_DECREF(result); + return NULL; + } + zero = (c==-1); /* check for zeros? */ + for(j=0;j string\n\ + Either read a null terminated list of byte tuples or\n\ + a list of given length from the given address."; + + + static PyObject *swi_tuple(PyObject *self, PyObject *arg) + { + unsigned char *i; /* points to current */ + int c=1, j; + PyObject *result, *result1; + + if(!PyArg_ParseTuple(arg,"i|i",(unsigned int *)&i, &c)) return NULL; + result = PyTuple_New(c); + if (!result) + return NULL; + for(j=0;j tuple\n\ + Read count bytes from given address."; + + static PyMethodDef SwiMethods[]= ! { { "swi", swi_swi,1}, ! { "block", PyBlock_New,1}, ! { "register", PyRegister,1}, ! { "string", swi_string,METH_VARARGS, swi_string__doc__}, ! { "integer", swi_integer,METH_VARARGS, swi_integer__doc__}, ! { "integers", swi_integers,METH_VARARGS, swi_integers__doc__}, ! { "tuples", swi_tuples,METH_VARARGS, swi_tuples__doc__}, ! { "tuple", swi_tuple,METH_VARARGS, swi_tuple__doc__}, ! { NULL,NULL,0,NULL} /* Sentinel */ }; + void initswi() From loewis@users.sourceforge.net Sat May 10 08:36:58 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 00:36:58 -0700 Subject: [Python-checkins] python/dist/src/RISCOS Makefile,1.5,1.6 pyconfig.h,1.6,1.7 sleep.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/RISCOS In directory sc8-pr-cvs1:/tmp/cvs-serv17284/RISCOS Modified Files: Makefile pyconfig.h sleep.c Log Message: Patch #734231: Update RiscOS support. In particular, correct riscospath.extsep, and use os.extsep throughout. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/Makefile,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Makefile 14 Jun 2002 20:41:17 -0000 1.5 --- Makefile 10 May 2003 07:36:56 -0000 1.6 *************** *** 8,19 **** DLKLIB = $(LIBSROOT).dlk ZLIB = $(LIBSROOT).zlib EXPAT = $(LIBSROOT).expat.lib ! OBJSCAN = objscan ! MAKEDLK = makedlk # change from time to time (don't forget to change !Boot also) ! TARGET=Python22 ! BUILD=25 --- 8,20 ---- DLKLIB = $(LIBSROOT).dlk ZLIB = $(LIBSROOT).zlib + BZLIB = $(LIBSROOT).bzlib EXPAT = $(LIBSROOT).expat.lib ! OBJSCAN = $(DLKLIB).objscan ! MAKEDLK = $(DLKLIB).makedlk # change from time to time (don't forget to change !Boot also) ! TARGET=Python23 ! BUILD=40 *************** *** 62,73 **** @.^.Lib.audioop/pyd\ @.^.Lib.binascii/pyd\ @.^.Lib.cmath/pyd\ @.^.Lib.cPickle/pyd\ @.^.Lib.cStringIO/pyd\ @.^.Lib.errno/pyd\ @.^.Lib.imageop/pyd\ @.^.Lib.math/pyd\ @.^.Lib.md5/pyd\ - @.^.Lib.new/pyd\ @.^.Lib.operator/pyd\ @.^.Lib.parser/pyd\ --- 63,76 ---- @.^.Lib.audioop/pyd\ @.^.Lib.binascii/pyd\ + @.^.Lib.bz2/pyd\ @.^.Lib.cmath/pyd\ @.^.Lib.cPickle/pyd\ @.^.Lib.cStringIO/pyd\ + @.^.Lib.datetime/pyd\ @.^.Lib.errno/pyd\ @.^.Lib.imageop/pyd\ + @.^.Lib.itertools/pyd\ @.^.Lib.math/pyd\ @.^.Lib.md5/pyd\ @.^.Lib.operator/pyd\ @.^.Lib.parser/pyd\ *************** *** 94,98 **** @.^.Lib._sre/pyd\ @.^.Lib.xxsubtype/pyd\ ! @.^.Lib._symtable/pyd --- 97,104 ---- @.^.Lib._sre/pyd\ @.^.Lib.xxsubtype/pyd\ ! @.^.Lib._symtable/pyd\ ! @.^.Lib._random/pyd\ ! @.^.Lib.zipimport/pyd\ ! @.^.Lib._csv/pyd *************** *** 126,130 **** @.^.Python.o.bltinmodule\ @.^.Python.o.exceptions\ - @.^.Python.o.hypot\ @.^.Python.o.codecs\ @.^.Python.o.symtable\ --- 132,135 ---- *************** *** 146,149 **** --- 151,155 ---- @.^.Objects.o.rangeobject\ @.^.Objects.o.object\ + @.^.Objects.o.obmalloc\ @.^.Objects.o.moduleobject\ @.^.Objects.o.methodobject\ *************** *** 151,154 **** --- 157,161 ---- @.^.Objects.o.listobject\ @.^.Objects.o.intobject\ + @.^.Objects.o.boolobject\ @.^.Objects.o.iterobject\ @.^.Objects.o.funcobject\ *************** *** 156,159 **** --- 163,167 ---- @.^.Objects.o.floatobject\ @.^.Objects.o.fileobject\ + @.^.Objects.o.enumobject\ @.^.Objects.o.dictobject\ @.^.Objects.o.complexobject\ *************** *** 245,252 **** --- 253,266 ---- $(MAKEDLK) -d @.^.Lib.cStringIO/pyd -s s.linktab -o @.^.Modules.o.cStringIO -e initcStringIO + @.^.Lib._csv/pyd: @.^.Modules.o._csv s.linktab + $(MAKEDLK) -d @.^.Lib._csv/pyd -s s.linktab -o @.^.Modules.o._csv -e init_csv + @.^.Lib.plat-riscos.drawf/pyd: Modules.o.drawfmodule #s.linktab $(LINK) -aof -o Modules.o.drawflink Modules.o.drawfmodule $(OSLIB).o.OSLIB32 $(MAKEDLK) -d @.^.Lib.plat-riscos.drawf/pyd -s s.linktab -o Modules.o.drawflink -e initdrawf + @.^.Lib.datetime/pyd: @.^.Modules.o.datetimemodule s.linktab + $(MAKEDLK) -d @.^.Lib.datetime/pyd -s s.linktab -o @.^.Modules.o.datetimemodule -e initdatetime + @.^.Lib.errno/pyd: @.^.Modules.o.errnomodule #s.linktab $(MAKEDLK) -d @.^.Lib.errno/pyd -s s.linktab -o @.^.Modules.o.errnomodule -e initerrno *************** *** 255,258 **** --- 269,275 ---- $(MAKEDLK) -d @.^.Lib.imageop/pyd -s s.linktab -o @.^.Modules.o.imageop -e initimageop + @.^.Lib.itertools/pyd: @.^.Modules.o.itertoolsmodule s.linktab + $(MAKEDLK) -d @.^.Lib.itertools/pyd -s s.linktab -o @.^.Modules.o.itertoolsmodule -e inititertools + @.^.Lib.math/pyd: @.^.Modules.o.mathmodule s.linktab $(MAKEDLK) -d @.^.Lib.math/pyd -s s.linktab -o @.^.Modules.o.mathmodule -e initmath *************** *** 325,328 **** --- 342,348 ---- $(MAKEDLK) -d @.^.Lib.xxsubtype/pyd -s s.linktab -o @.^.Modules.o.xxsubtype -e initxxsubtype + @.^.Lib._random/pyd: @.^.Modules.o._randommodule s.linktab + $(MAKEDLK) -d @.^.Lib._random/pyd -s s.linktab -o @.^.Modules.o._randommodule -e init_random + @.^.Lib._symtable/pyd: @.^.Modules.o.symtablemodule s.linktab $(MAKEDLK) -d @.^.Lib._symtable/pyd -s s.linktab -o @.^.Modules.o.symtablemodule -e init_symtable *************** *** 333,337 **** # @.^.Lib.select/pyd: @.^.Modules.o.selectmodule s.linktab ! $(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(TCPIPLIB).o.socklib $(MAKEDLK) -d @.^.Lib.select/pyd -s s.linktab -o @.^.Modules.o.selectlink -e initselect --- 353,357 ---- # @.^.Lib.select/pyd: @.^.Modules.o.selectmodule s.linktab ! $(LINK) -aof -o @.^.Modules.o.selectlink @.^.Modules.o.selectmodule $(TCPIPLIB).o.socklib5 $(MAKEDLK) -d @.^.Lib.select/pyd -s s.linktab -o @.^.Modules.o.selectlink -e initselect *************** *** 340,344 **** @.^.Lib._socket/pyd: @.^.Modules.o.socketmodule s.linktab ! $(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.socklib $(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket --- 360,364 ---- @.^.Lib._socket/pyd: @.^.Modules.o.socketmodule s.linktab ! $(LINK) -aof -o @.^.Modules.o._socketlink @.^.Modules.o.socketmodule $(TCPIPLIB).o.inetlib $(TCPIPLIB).o.unixlib $(TCPIPLIB).o.socklib5 $(MAKEDLK) -d @.^.Lib._socket/pyd -s s.linktab -o @.^.Modules.o._socketlink -e init_socket *************** *** 354,357 **** --- 374,383 ---- $(CC) -I$(ZLIB) -o $@ @.^.Modules.c.zlibmodule + @.^.Lib.bz2/pyd: @.^.Modules.o.bz2module s.linktab + $(LINK) -aof -o @.^.Modules.o.bz2link @.^.Modules.o.bz2module $(BZLIB).bzlib + $(MAKEDLK) -d @.^.Lib.bz2/pyd -s s.linktab -o @.^.Modules.o.bz2link -e initbz2 + + @.^.Modules.o.bz2module: @.^.Modules.c.bz2module + $(CC) -I$(BZLIB) -o $@ @.^.Modules.c.bz2module @.^.Lib.time/pyd: @.^.Modules.o.timemodule s.linktab @.o.sleep *************** *** 370,373 **** --- 396,403 ---- @.^.Modules.o.pyexpat: @.^.Modules.c.pyexpat $(CCEXPAT) -o $@ @.^.Modules.c.pyexpat + + @.^.Lib.zipimport/pyd: @.^.Modules.o.zipimport s.linktab + $(LINK) -aof -o @.^.Modules.o.zipimportlink @.^.Modules.o.zipimport o.unixstuff $(OSLIB).o.OSLib32 + $(MAKEDLK) -d @.^.Lib.zipimport/pyd -s s.linktab -o @.^.Modules.o.zipimportlink -e initzipimport Index: pyconfig.h =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/pyconfig.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pyconfig.h 23 Nov 2002 09:13:40 -0000 1.6 --- pyconfig.h 10 May 2003 07:36:56 -0000 1.7 *************** *** 144,148 **** /* Define this if you have the type long long */ ! #undef HAVE_LONG_LONG /* Define if your compiler supports function prototypes */ --- 144,148 ---- /* Define this if you have the type long long */ ! #define HAVE_LONG_LONG /* Define if your compiler supports function prototypes */ *************** *** 245,248 **** --- 245,251 ---- #undef WITH_DL_DLD + /* Define if you want to read files with foreign newlines. */ + #define WITH_UNIVERSAL_NEWLINES 1 + /* Define if you want documentation strings in extension modules */ #define WITH_DOC_STRINGS 1 *************** *** 254,258 **** /* Define if you want to compile in Python-specific mallocs */ ! #undef WITH_PYMALLOC /* Define if you want to produce an OpenStep/Rhapsody framework --- 257,261 ---- /* Define if you want to compile in Python-specific mallocs */ ! #define WITH_PYMALLOC 1 /* Define if you want to produce an OpenStep/Rhapsody framework *************** *** 292,296 **** /* The number of bytes in a long long. */ ! #undef SIZEOF_LONG_LONG /* The number of bytes in a short. */ --- 295,299 ---- /* The number of bytes in a long long. */ ! #define SIZEOF_LONG_LONG 8 /* The number of bytes in a short. */ *************** *** 397,401 **** /* Define if you have the getpeername function. */ ! #undef HAVE_GETPEERNAME /* Define if you have the getpgid function. */ --- 400,404 ---- /* Define if you have the getpeername function. */ ! #define HAVE_GETPEERNAME /* Define if you have the getpgid function. */ *************** *** 424,428 **** /* Define if you have the hypot function. */ ! #undef HAVE_HYPOT /* Define if you have the inet_pton function. */ --- 427,431 ---- /* Define if you have the hypot function. */ ! #define HAVE_HYPOT /* Define if you have the inet_pton function. */ Index: sleep.c =================================================================== RCS file: /cvsroot/python/python/dist/src/RISCOS/sleep.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** sleep.c 24 Oct 2001 20:12:29 -0000 1.2 --- sleep.c 10 May 2003 07:36:56 -0000 1.3 *************** *** 8,16 **** ! int sleep(double delay) { os_t starttime, endtime, time; /* monotonic times (centiseconds) */ int *pollword, ret; ! bool claimed; /* calculate end time */ --- 8,16 ---- ! int riscos_sleep(double delay) { os_t starttime, endtime, time; /* monotonic times (centiseconds) */ int *pollword, ret; ! osbool claimed; /* calculate end time */ From rhettinger@users.sourceforge.net Sat May 10 08:40:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 May 2003 00:40:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.130,1.131 libstdtypes.tex,1.124,1.125 liburllib2.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18606 Modified Files: libfuncs.tex libstdtypes.tex liburllib2.tex Log Message: Missing parenthesis found by texcheck.py Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.130 retrieving revision 1.131 diff -C2 -d -r1.130 -r1.131 *** libfuncs.tex 22 Apr 2003 14:52:08 -0000 1.130 --- libfuncs.tex 10 May 2003 07:40:56 -0000 1.131 *************** *** 714,718 **** \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, fdel\optional{, doc}}}}} Return a property attribute for new-style classes (classes that ! derive from \function{object}. \var{fget} is a function for getting an attribute value, likewise --- 714,718 ---- \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, fdel\optional{, doc}}}}} Return a property attribute for new-style classes (classes that ! derive from \function{object}). \var{fget} is a function for getting an attribute value, likewise Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** libstdtypes.tex 10 May 2003 07:08:50 -0000 1.124 --- libstdtypes.tex 10 May 2003 07:40:56 -0000 1.125 *************** *** 1090,1094 **** \ttindex{popitem()} \ttindex{iteritems()} ! \ttindex{iterkeys)} \ttindex{itervalues()}} --- 1090,1094 ---- \ttindex{popitem()} \ttindex{iteritems()} ! \ttindex{iterkeys()} \ttindex{itervalues()}} *************** *** 1451,1455 **** possible (you can write \code{\var{m}.__dict__['a'] = 1}, which defines \code{\var{m}.a} to be \code{1}, but you can't write ! \code{\var{m}.__dict__ = \{\}}. Modules built into the interpreter are written like this: --- 1451,1455 ---- possible (you can write \code{\var{m}.__dict__['a'] = 1}, which defines \code{\var{m}.a} to be \code{1}, but you can't write ! \code{\var{m}.__dict__ = \{\}}). Modules built into the interpreter are written like this: Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** liburllib2.tex 25 Apr 2003 15:27:33 -0000 1.8 --- liburllib2.tex 10 May 2003 07:40:56 -0000 1.9 *************** *** 298,302 **** Arguments, return values and exceptions raised are the same as those of \function{urlopen()} (which simply calls the \method{open()} method ! on the default installed \class{OpenerDirector}. \end{methoddesc} --- 298,302 ---- Arguments, return values and exceptions raised are the same as those of \function{urlopen()} (which simply calls the \method{open()} method ! on the default installed \class{OpenerDirector}). \end{methoddesc} From rhettinger@users.sourceforge.net Sat May 10 08:41:57 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 May 2003 00:41:57 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts texcheck.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv18887 Modified Files: texcheck.py Log Message: Add table level validation and made minor fix-ups. Index: texcheck.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/texcheck.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** texcheck.py 10 May 2003 03:30:13 -0000 1.1 --- texcheck.py 10 May 2003 07:41:55 -0000 1.2 *************** *** 23,30 **** """ - # Todo: - # Add tableiii/lineiii cross-checking - # Add braces matching - import re import sets --- 23,26 ---- *************** *** 54,58 **** \longprogramopt \infinity \plusminus \shortversion \version \refmodindex \seerfc \makeindex \makemodindex \renewcommand ! \indexname \appendix """ --- 50,55 ---- \longprogramopt \infinity \plusminus \shortversion \version \refmodindex \seerfc \makeindex \makemodindex \renewcommand ! \indexname \appendix \protect \indexiv \mbox \textasciitilde ! \platform \seeurl \leftmargin \labelwidth \localmoduletable """ *************** *** 69,73 **** def checkit(source, opts, morecmds=[]): ! """Check the LaTex formatting in a sequence of lines. Opts is a mapping of options to option values if any: --- 66,70 ---- def checkit(source, opts, morecmds=[]): ! """Check the LaTeX formatting in a sequence of lines. Opts is a mapping of options to option values if any: *************** *** 78,82 **** -s lineno: linenumber to start scan (default is 1). ! Morecmds is a sequence of LaTex commands (without backslashes) that are to be considered valid in the scan. """ --- 75,79 ---- -s lineno: linenumber to start scan (default is 1). ! Morecmds is a sequence of LaTeX commands (without backslashes) that are to be considered valid in the scan. """ *************** *** 98,101 **** --- 95,104 ---- delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') + tablestart = re.compile(r'\\begin{(?:long)?table([iv]+)}') + tableline = re.compile(r'\\line([iv]+){') + tableend = re.compile(r'\\end{(?:long)?table([iv]+)}') + tablelevel = '' + tablestartline = 0 + startline = int(opts.get('-s', '1')) lineno = 0 *************** *** 135,140 **** print ' --> ', openers for lineno, symbol in openers: ! print "Unmatched open delimiter '%s' on line %d", (symbol, lineno) print 'Done checking %d lines.' % (lineno,) return 0 --- 138,154 ---- print ' --> ', openers + # Check table levels (make sure lineii only inside lineiii) + m = tablestart.search(line) + if m: + tablelevel = m.group(1) + tablestartline = lineno + m = tableline.search(line) + if m and m.group(1) != tablelevel: + print r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline) + if tableend.search(line): + tablelevel = '' + for lineno, symbol in openers: ! print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno) print 'Done checking %d lines.' % (lineno,) return 0 From rhettinger@users.sourceforge.net Sat May 10 09:51:31 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 May 2003 01:51:31 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.40,1.41 libexcs.tex,1.49,1.50 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2270 Modified Files: libdis.tex libexcs.tex Log Message: Fix unbalanced parethesis. Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** libdis.tex 30 Aug 2002 13:09:48 -0000 1.40 --- libdis.tex 10 May 2003 08:51:26 -0000 1.41 *************** *** 512,516 **** \begin{opcodedesc}{LOAD_ATTR}{namei} ! Replaces TOS with \code{getattr(TOS, co_names[\var{namei}]}. \end{opcodedesc} --- 512,516 ---- \begin{opcodedesc}{LOAD_ATTR}{namei} ! Replaces TOS with \code{getattr(TOS, co_names[\var{namei}])}. \end{opcodedesc} Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** libexcs.tex 2 Sep 2002 13:14:30 -0000 1.49 --- libexcs.tex 10 May 2003 08:51:28 -0000 1.50 *************** *** 190,194 **** % XXXJH xrefs here Interrupts typed when a built-in function \function{input()} or ! \function{raw_input()}) is waiting for input also raise this exception. \end{excdesc} --- 190,194 ---- % XXXJH xrefs here Interrupts typed when a built-in function \function{input()} or ! \function{raw_input()} is waiting for input also raise this exception. \end{excdesc} From rhettinger@users.sourceforge.net Sat May 10 10:04:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 10 May 2003 02:04:40 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts texcheck.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv5383 Modified Files: texcheck.py Log Message: Minor fixups. Index: texcheck.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/texcheck.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** texcheck.py 10 May 2003 07:41:55 -0000 1.2 --- texcheck.py 10 May 2003 09:04:37 -0000 1.3 *************** *** 9,12 **** --- 9,13 ---- * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. + * Table line size mismatches (only \lineii used in a tableii). Command line usage: *************** *** 138,142 **** print ' --> ', openers ! # Check table levels (make sure lineii only inside lineiii) m = tablestart.search(line) if m: --- 139,143 ---- print ' --> ', openers ! # Check table levels (make sure lineii only inside tableii) m = tablestart.search(line) if m: *************** *** 149,155 **** tablelevel = '' for lineno, symbol in openers: print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno) ! print 'Done checking %d lines.' % (lineno,) return 0 --- 150,157 ---- tablelevel = '' + lastline = lineno for lineno, symbol in openers: print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno) ! print 'Done checking %d lines.' % (lastline,) return 0 From fdrake@users.sourceforge.net Sat May 10 20:46:42 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat, 10 May 2003 12:46:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.131,1.132 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv19321 Modified Files: libfuncs.tex Log Message: - object is a class type, not a function - when marking a function, the trailing () should be included consistently Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.131 retrieving revision 1.132 diff -C2 -d -r1.131 -r1.132 *** libfuncs.tex 10 May 2003 07:40:56 -0000 1.131 --- libfuncs.tex 10 May 2003 19:46:39 -0000 1.132 *************** *** 307,311 **** \function{enumerate()} returns a tuple containing a count (from zero) and the corresponding value obtained from iterating over ! \var{iterable}. \function{enumerate} is useful for obtaining an indexed series: \code{(0, seq[0])}, \code{(1, seq[1])}, \code{(2, seq[2])}, \ldots. --- 307,311 ---- \function{enumerate()} returns a tuple containing a count (from zero) and the corresponding value obtained from iterating over ! \var{iterable}. \function{enumerate()} is useful for obtaining an indexed series: \code{(0, seq[0])}, \code{(1, seq[1])}, \code{(2, seq[2])}, \ldots. *************** *** 712,718 **** \end{funcdesc} ! \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, fdel\optional{, doc}}}}} Return a property attribute for new-style classes (classes that ! derive from \function{object}). \var{fget} is a function for getting an attribute value, likewise --- 712,719 ---- \end{funcdesc} ! \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, ! fdel\optional{, doc}}}}} Return a property attribute for new-style classes (classes that ! derive from \class{object}). \var{fget} is a function for getting an attribute value, likewise From loewis@users.sourceforge.net Sun May 11 06:53:43 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 10 May 2003 22:53:43 -0700 Subject: [Python-checkins] python/dist/src configure,1.397,1.398 configure.in,1.408,1.409 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv10381 Modified Files: configure configure.in Log Message: Update patch #732284: Correct versions of OpenUNIX, UnixWare, add OpenServer. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.397 retrieving revision 1.398 diff -C2 -d -r1.397 -r1.398 *** configure 5 May 2003 22:00:01 -0000 1.397 --- configure 11 May 2003 05:53:39 -0000 1.398 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.407 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.408 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 1355,1361 **** SunOS/5.6) define_xopen_source=no;; ! # On UnixWare 7, u_short is never defined with _XOPEN_SOURCE, # but used in struct sockaddr.sa_family. Reported by Tim Rice. ! OpenUNIX/8.0| UnixWare/7.1.[13]) define_xopen_source=no;; esac --- 1355,1365 ---- SunOS/5.6) define_xopen_source=no;; ! # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, ! # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.[0-3]) ! define_xopen_source=no;; ! # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, # but used in struct sockaddr.sa_family. Reported by Tim Rice. ! SCO_SV/3.2) define_xopen_source=no;; esac Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.408 retrieving revision 1.409 diff -C2 -d -r1.408 -r1.409 *** configure.in 5 May 2003 22:00:11 -0000 1.408 --- configure.in 11 May 2003 05:53:41 -0000 1.409 *************** *** 130,136 **** SunOS/5.6) define_xopen_source=no;; ! # On UnixWare 7, u_short is never defined with _XOPEN_SOURCE, # but used in struct sockaddr.sa_family. Reported by Tim Rice. ! OpenUNIX/8.0| UnixWare/7.1.@<:@13@:>@) define_xopen_source=no;; esac --- 130,140 ---- SunOS/5.6) define_xopen_source=no;; ! # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, ! # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. ! OpenUNIX/8.0.0| UnixWare/7.1.@<:@0-3@:>@) ! define_xopen_source=no;; ! # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, # but used in struct sockaddr.sa_family. Reported by Tim Rice. ! SCO_SV/3.2) define_xopen_source=no;; esac From bcannon@users.sourceforge.net Sun May 11 07:23:38 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat, 10 May 2003 23:23:38 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv17013/Lib Modified Files: _strptime.py Log Message: Beefed up timezone support. UTC and GMT are now always recognized timezones with values of 0. Also now check time.daylight to see if time.tzname[1] should be used in timezone checking. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _strptime.py 28 Apr 2003 21:30:11 -0000 1.16 --- _strptime.py 11 May 2003 06:23:36 -0000 1.17 *************** *** 284,290 **** # Set self.__timezone by using time.tzname. # ! # Empty string used for matching when timezone is not used/needed such ! # as with UTC. ! self.__timezone = self.__pad(time.tzname, 0) def __calc_lang(self): --- 284,294 ---- # Set self.__timezone by using time.tzname. # ! # Empty string used for matching when timezone is not used/needed. ! time_zones = ["UTC", "GMT"] ! if time.daylight: ! time_zones.extend(time.tzname) ! else: ! time_zones.append(time.tzname[0]) ! self.__timezone = self.__pad(time_zones, 0) def __calc_lang(self): *************** *** 491,504 **** julian = int(found_dict['j']) elif group_key == 'Z': found_zone = found_dict['Z'].lower() if locale_time.timezone[0] == locale_time.timezone[1]: pass #Deals with bad locale setup where timezone info is # the same; first found on FreeBSD 4.4. ! elif locale_time.timezone[0].lower() == found_zone: tz = 0 - elif locale_time.timezone[1].lower() == found_zone: - tz = 1 elif locale_time.timezone[2].lower() == found_zone: ! tz = -1 # Cannot pre-calculate datetime_date() since can change in Julian #calculation and thus could have different value for the day of the week --- 495,512 ---- julian = int(found_dict['j']) elif group_key == 'Z': + # Since -1 is default value only need to worry about setting tz if + # it can be something other than -1. found_zone = found_dict['Z'].lower() if locale_time.timezone[0] == locale_time.timezone[1]: pass #Deals with bad locale setup where timezone info is # the same; first found on FreeBSD 4.4. ! elif found_zone in ("utc", "gmt"): tz = 0 elif locale_time.timezone[2].lower() == found_zone: ! tz = 0 ! elif time.daylight: ! if locale_time.timezone[3].lower() == found_zone: ! tz = 1 ! # Cannot pre-calculate datetime_date() since can change in Julian #calculation and thus could have different value for the day of the week From bcannon@users.sourceforge.net Sun May 11 07:23:38 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat, 10 May 2003 23:23:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_strptime.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17013/Lib/test Modified Files: test_strptime.py Log Message: Beefed up timezone support. UTC and GMT are now always recognized timezones with values of 0. Also now check time.daylight to see if time.tzname[1] should be used in timezone checking. Index: test_strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_strptime.py 1 May 2003 17:45:50 -0000 1.13 --- test_strptime.py 11 May 2003 06:23:36 -0000 1.14 *************** *** 59,65 **** def test_timezone(self): # Make sure timezone is correct ! if time.strftime("%Z", self.time_tuple): ! self.compare_against_time(self.LT_ins.timezone, '%Z', 8, ! "Testing against timezone failed") def test_date_time(self): --- 59,67 ---- def test_timezone(self): # Make sure timezone is correct ! timezone = time.strftime("%Z", self.time_tuple) ! if timezone: ! self.failUnless(timezone in self.LT_ins.timezone, ! "timezone %s not found in %s" % ! (timezone, self.LT_ins.timezone)) def test_date_time(self): *************** *** 294,302 **** # Check for equal timezone names deals with bad locale info when this # occurs; first found in FreeBSD 4.4. time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") locale_time = _strptime.LocaleTime() ! if locale_time.timezone[0] != locale_time.timezone[1]: self.failUnless(strp_output[8] == time_tuple[8], "timezone check failed; '%s' -> %s != %s" % --- 296,311 ---- # Check for equal timezone names deals with bad locale info when this # occurs; first found in FreeBSD 4.4. + strp_output = _strptime.strptime("UTC", "%Z") + self.failUnlessEqual(strp_output.tm_isdst, 0) + strp_output = _strptime.strptime("GMT", "%Z") + self.failUnlessEqual(strp_output.tm_isdst, 0) + if time.daylight: + strp_output = _strptime.strptime(time.tzname[1], "%Z") + self.failUnlessEqual(strp_output[8], 1) time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") locale_time = _strptime.LocaleTime() ! if time.tzname[0] != time.tzname[1]: self.failUnless(strp_output[8] == time_tuple[8], "timezone check failed; '%s' -> %s != %s" % *************** *** 305,309 **** self.failUnless(strp_output[8] == -1, "LocaleTime().timezone has duplicate values but " ! "timzone value not set to 0") def test_date_time(self): --- 314,318 ---- self.failUnless(strp_output[8] == -1, "LocaleTime().timezone has duplicate values but " ! "timzone value not set to -1") def test_date_time(self): From loewis@users.sourceforge.net Sun May 11 21:25:38 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 11 May 2003 13:25:38 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.763,1.764 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv16661/Misc Modified Files: NEWS Log Message: Patch #718286: Support DESTDIR. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.763 retrieving revision 1.764 diff -C2 -d -r1.763 -r1.764 *** NEWS 10 May 2003 07:10:12 -0000 1.763 --- NEWS 11 May 2003 20:25:35 -0000 1.764 *************** *** 54,57 **** --- 54,60 ---- ----- + - Setting DESTDIR during 'make install' now allows to specify a + different root directory. + C API ----- From loewis@users.sourceforge.net Sun May 11 21:25:39 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 11 May 2003 13:25:39 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.124,1.125 README,1.171,1.172 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv16661 Modified Files: Makefile.pre.in README Log Message: Patch #718286: Support DESTDIR. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** Makefile.pre.in 9 May 2003 15:08:38 -0000 1.124 --- Makefile.pre.in 11 May 2003 20:25:33 -0000 1.125 *************** *** 564,568 **** if test $$i != X; then \ echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ ! $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ fi; \ done --- 564,568 ---- if test $$i != X; then \ echo $(INSTALL_SHARED) $$i $(DESTSHARED)/`basename $$i`; \ ! $(INSTALL_SHARED) $$i $(DESTDIR)$(DESTSHARED)/`basename $$i`; \ fi; \ done *************** *** 571,577 **** @for i in $(DESTDIRS); \ do \ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ --- 571,577 ---- @for i in $(DESTDIRS); \ do \ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ *************** *** 581,589 **** # Install the interpreter (by creating a hard link to python$(VERSION)) bininstall: altbininstall ! -if test -f $(BINDIR)/$(PYTHON) -o -h $(BINDIR)/$(PYTHON); \ ! then rm -f $(BINDIR)/$(PYTHON); \ else true; \ fi ! (cd $(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)) # Install the interpreter with $(VERSION) affixed --- 581,589 ---- # Install the interpreter (by creating a hard link to python$(VERSION)) bininstall: altbininstall ! -if test -f $(DESTDIR)$(BINDIR)/$(PYTHON) -o -h $(DESTDIR)$(BINDIR)/$(PYTHON); \ ! then rm -f $(DESTDIR)$(BINDIR)/$(PYTHON); \ else true; \ fi ! (cd $(DESTDIR)$(BINDIR); $(LN) python$(VERSION)$(EXE) $(PYTHON)) # Install the interpreter with $(VERSION) affixed *************** *** 598,613 **** @for i in $(BINDIR) $(LIBDIR); \ do \ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ done ! $(INSTALL_PROGRAM) $(BUILDPYTHON) $(BINDIR)/python$(VERSION)$(EXE) if test -f libpython$(VERSION)$(SO); then \ if test "$(SO)" = .dll; then \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(BINDIR); \ else \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(LIBDIR)/$(INSTSONAME); \ fi; \ else true; \ --- 598,613 ---- @for i in $(BINDIR) $(LIBDIR); \ do \ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ done ! $(INSTALL_PROGRAM) $(BUILDPYTHON) $(DESTDIR)$(BINDIR)/python$(VERSION)$(EXE) if test -f libpython$(VERSION)$(SO); then \ if test "$(SO)" = .dll; then \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(BINDIR); \ else \ ! $(INSTALL_SHARED) libpython$(VERSION)$(SO) $(DESTDIR)$(LIBDIR)/$(INSTSONAME); \ fi; \ else true; \ *************** *** 618,629 **** @for i in $(MANDIR) $(MANDIR)/man1; \ do \ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ done $(INSTALL_DATA) $(srcdir)/Misc/python.man \ ! $(MANDIR)/man1/python.1 # Install the library --- 618,629 ---- @for i in $(MANDIR) $(MANDIR)/man1; \ do \ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ done $(INSTALL_DATA) $(srcdir)/Misc/python.man \ ! $(DESTDIR)$(MANDIR)/man1/python.1 # Install the library *************** *** 650,656 **** @for i in $(SCRIPTDIR) $(LIBDEST); \ do \ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ --- 650,656 ---- @for i in $(SCRIPTDIR) $(LIBDEST); \ do \ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ *************** *** 661,667 **** if test ! -d $$a; then continue; else true; fi; \ b=$(LIBDEST)/$$d; \ ! if test ! -d $$b; then \ echo "Creating directory $$b"; \ ! $(INSTALL) -d -m $(DIRMODE) $$b; \ else true; \ fi; \ --- 661,667 ---- if test ! -d $$a; then continue; else true; fi; \ b=$(LIBDEST)/$$d; \ ! if test ! -d $(DESTDIR)$$b; then \ echo "Creating directory $$b"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$b; \ else true; \ fi; \ *************** *** 670,677 **** do \ if test -x $$i; then \ ! $(INSTALL_SCRIPT) $$i $(LIBDEST); \ echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ else \ ! $(INSTALL_DATA) $$i $(LIBDEST); \ echo $(INSTALL_DATA) $$i $(LIBDEST); \ fi; \ --- 670,677 ---- do \ if test -x $$i; then \ ! $(INSTALL_SCRIPT) $$i $(DESTDIR)$(LIBDEST); \ echo $(INSTALL_SCRIPT) $$i $(LIBDEST); \ else \ ! $(INSTALL_DATA) $$i $(DESTDIR)$(LIBDEST); \ echo $(INSTALL_DATA) $$i $(LIBDEST); \ fi; \ *************** *** 693,717 **** if test -x $$i; then \ echo $(INSTALL_SCRIPT) $$i $$b; \ ! $(INSTALL_SCRIPT) $$i $$b; \ else \ echo $(INSTALL_DATA) $$i $$b; \ ! $(INSTALL_DATA) $$i $$b; \ fi;; \ esac; \ done; \ done ! $(INSTALL_DATA) $(srcdir)/LICENSE $(LIBDEST)/LICENSE.txt ! PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -tt $(LIBDEST)/compileall.py \ ! -x 'badsyntax|site-packages' $(LIBDEST) ! PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -tt -O $(LIBDEST)/compileall.py \ ! -x 'badsyntax|site-packages' $(LIBDEST) ! PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -t $(LIBDEST)/compileall.py \ ! -x badsyntax $(LIBDEST)/site-packages ! PYTHONPATH=$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -t -O $(LIBDEST)/compileall.py \ ! -x badsyntax $(LIBDEST)/site-packages # Create the PLATDIR source directory, if one wasn't distributed.. --- 693,717 ---- if test -x $$i; then \ echo $(INSTALL_SCRIPT) $$i $$b; \ ! $(INSTALL_SCRIPT) $$i $(DESTDIR)$$b; \ else \ echo $(INSTALL_DATA) $$i $$b; \ ! $(INSTALL_DATA) $$i $(DESTDIR)$$b; \ fi;; \ esac; \ done; \ done ! $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt ! PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ ! -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) ! PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ ! -x 'badsyntax|site-packages' $(DESTDIR)$(LIBDEST) ! PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ ! -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages ! PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ! ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ ! -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages # Create the PLATDIR source directory, if one wasn't distributed.. *************** *** 730,736 **** @for i in $(INCLDIRSTOMAKE); \ do \ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ --- 730,736 ---- @for i in $(INCLDIRSTOMAKE); \ do \ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ *************** *** 739,745 **** do \ echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ ! $(INSTALL_DATA) $$i $(INCLUDEPY); \ done ! $(INSTALL_DATA) pyconfig.h $(CONFINCLUDEPY)/pyconfig.h # Install the library and miscellaneous stuff needed for extending/embedding --- 739,745 ---- do \ echo $(INSTALL_DATA) $$i $(INCLUDEPY); \ ! $(INSTALL_DATA) $$i $(DESTDIR)$(INCLUDEPY); \ done ! $(INSTALL_DATA) pyconfig.h $(DESTDIR)$(CONFINCLUDEPY)/pyconfig.h # Install the library and miscellaneous stuff needed for extending/embedding *************** *** 749,755 **** @for i in $(LIBDIR) $(LIBP) $(LIBPL); \ do \ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ --- 749,755 ---- @for i in $(LIBDIR) $(LIBP) $(LIBPL); \ do \ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ *************** *** 758,765 **** if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ if test "$(SO)" = .dll; then \ ! $(INSTALL_DATA) $(LDLIBRARY) $(LIBPL) ; \ else \ ! $(INSTALL_DATA) $(LIBRARY) $(LIBPL)/$(LIBRARY) ; \ ! $(RANLIB) $(LIBPL)/$(LIBRARY) ; \ fi; \ else \ --- 758,765 ---- if test "$(PYTHONFRAMEWORKDIR)" = no-framework; then \ if test "$(SO)" = .dll; then \ ! $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ else \ ! $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ ! $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ fi; \ else \ *************** *** 767,790 **** fi; \ fi ! $(INSTALL_DATA) Modules/config.c $(LIBPL)/config.c ! $(INSTALL_DATA) Modules/$(MAINOBJ) $(LIBPL)/$(MAINOBJ) ! $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(LIBPL)/config.c.in ! $(INSTALL_DATA) Makefile $(LIBPL)/Makefile ! $(INSTALL_DATA) Modules/Setup $(LIBPL)/Setup ! $(INSTALL_DATA) Modules/Setup.local $(LIBPL)/Setup.local ! $(INSTALL_DATA) Modules/Setup.config $(LIBPL)/Setup.config ! $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(LIBPL)/makesetup ! $(INSTALL_SCRIPT) $(srcdir)/install-sh $(LIBPL)/install-sh @if [ -s Modules/python.exp -a \ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ echo; echo "Installing support files for building shared extension modules on AIX:"; \ $(INSTALL_DATA) Modules/python.exp \ ! $(LIBPL)/python.exp; \ echo; echo "$(LIBPL)/python.exp"; \ $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \ ! $(LIBPL)/makexp_aix; \ echo "$(LIBPL)/makexp_aix"; \ $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \ ! $(LIBPL)/ld_so_aix; \ echo "$(LIBPL)/ld_so_aix"; \ echo; echo "See Misc/AIX-NOTES for details."; \ --- 767,790 ---- fi; \ fi ! $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c ! $(INSTALL_DATA) Modules/$(MAINOBJ) $(DESTDIR)$(LIBPL)/$(MAINOBJ) ! $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.c.in ! $(INSTALL_DATA) Makefile $(DESTDIR)$(LIBPL)/Makefile ! $(INSTALL_DATA) Modules/Setup $(DESTDIR)$(LIBPL)/Setup ! $(INSTALL_DATA) Modules/Setup.local $(DESTDIR)$(LIBPL)/Setup.local ! $(INSTALL_DATA) Modules/Setup.config $(DESTDIR)$(LIBPL)/Setup.config ! $(INSTALL_SCRIPT) $(srcdir)/Modules/makesetup $(DESTDIR)$(LIBPL)/makesetup ! $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh @if [ -s Modules/python.exp -a \ "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \ echo; echo "Installing support files for building shared extension modules on AIX:"; \ $(INSTALL_DATA) Modules/python.exp \ ! $(DESTDIR)$(LIBPL)/python.exp; \ echo; echo "$(LIBPL)/python.exp"; \ $(INSTALL_SCRIPT) $(srcdir)/Modules/makexp_aix \ ! $(DESTDIR)$(LIBPL)/makexp_aix; \ echo "$(LIBPL)/makexp_aix"; \ $(INSTALL_SCRIPT) $(srcdir)/Modules/ld_so_aix \ ! $(DESTDIR)$(LIBPL)/ld_so_aix; \ echo "$(LIBPL)/ld_so_aix"; \ echo; echo "See Misc/AIX-NOTES for details."; \ *************** *** 793,801 **** @case "$(MACHDEP)" in beos*) \ echo; echo "Installing support files for building shared extension modules on BeOS:"; \ ! $(INSTALL_DATA) Misc/BeOS-NOTES $(LIBPL)/README; \ echo; echo "$(LIBPL)/README"; \ ! $(INSTALL_SCRIPT) Modules/ar_beos $(LIBPL)/ar_beos; \ echo "$(LIBPL)/ar_beos"; \ ! $(INSTALL_SCRIPT) Modules/ld_so_beos $(LIBPL)/ld_so_beos; \ echo "$(LIBPL)/ld_so_beos"; \ echo; echo "See Misc/BeOS-NOTES for details."; \ --- 793,801 ---- @case "$(MACHDEP)" in beos*) \ echo; echo "Installing support files for building shared extension modules on BeOS:"; \ ! $(INSTALL_DATA) Misc/BeOS-NOTES $(DESTDIR)$(LIBPL)/README; \ echo; echo "$(LIBPL)/README"; \ ! $(INSTALL_SCRIPT) Modules/ar_beos $(DESTDIR)$(LIBPL)/ar_beos; \ echo "$(LIBPL)/ar_beos"; \ ! $(INSTALL_SCRIPT) Modules/ld_so_beos $(DESTDIR)$(LIBPL)/ld_so_beos; \ echo "$(LIBPL)/ld_so_beos"; \ echo; echo "See Misc/BeOS-NOTES for details."; \ *************** *** 809,813 **** --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ ! --install-platlib=$(DESTSHARED) # Here are a couple of targets for MacOSX again, to install a full --- 809,814 ---- --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ ! --install-platlib=$(DESTSHARED) \ ! --root=/$(DESTDIR) # Here are a couple of targets for MacOSX again, to install a full *************** *** 834,838 **** fi @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ ! if test ! -d $$i; then \ echo "Creating directory $$i"; \ $(INSTALL) -d -m $(DIRMODE) $$i; \ --- 835,839 ---- fi @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ ! if test ! -d $(DESTDIR)$$i; then \ echo "Creating directory $$i"; \ $(INSTALL) -d -m $(DIRMODE) $$i; \ *************** *** 876,880 **** --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ ! --install-platlib=$(DESTSHARED) # This installs a few of the useful scripts in Tools/scripts --- 877,882 ---- --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ ! --install-platlib=$(DESTSHARED) \ ! --root=/$(DESTDIR) # This installs a few of the useful scripts in Tools/scripts *************** *** 883,887 **** ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ --prefix=$(prefix) \ ! --install-scripts=$(BINDIR) # Build the toplevel Makefile --- 885,890 ---- ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ --prefix=$(prefix) \ ! --install-scripts=$(BINDIR) \ ! --root=/$(DESTDIR) # Build the toplevel Makefile Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.171 retrieving revision 1.172 diff -C2 -d -r1.171 -r1.172 *** README 2 May 2003 15:27:59 -0000 1.171 --- README 11 May 2003 20:25:34 -0000 1.172 *************** *** 879,882 **** --- 879,886 ---- (defaults to the --prefix directory) is given. + If DESTDIR is set, it will be taken as the root directory of the + installation, and files will be installed into $(DESTDIR)$(prefix), + $(DESTDIR)$(exec_prefix), etc. + All subdirectories created will have Python's version number in their name, e.g. the library modules are installed in From loewis@users.sourceforge.net Sun May 11 21:28:05 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 11 May 2003 13:28:05 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv17564 Modified Files: Makefile.pre.in Log Message: Patch #735613: Pass install-purelib to idleinstall. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** Makefile.pre.in 11 May 2003 20:25:33 -0000 1.125 --- Makefile.pre.in 11 May 2003 20:28:02 -0000 1.126 *************** *** 876,879 **** --- 876,880 ---- --check-tkinter \ --prefix=$(prefix) \ + --install-purelib=$(LIBDEST) \ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ From rhettinger@users.sourceforge.net Mon May 12 04:23:54 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 11 May 2003 20:23:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib liblocale.tex,1.32,1.33 libmimetools.tex,1.23,1.24 libpyexpat.tex,1.20,1.21 librepr.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18211 Modified Files: liblocale.tex libmimetools.tex libpyexpat.tex librepr.tex Log Message: Fix minor typos. Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** liblocale.tex 18 Apr 2003 22:04:33 -0000 1.32 --- liblocale.tex 12 May 2003 03:23:51 -0000 1.33 *************** *** 427,432 **** If, when coding a module for general use, you need a locale independent version of an operation that is affected by the locale ! (e.g. \function{string.lower()}, or certain formats used with ! \function{time.strftime()})), you will have to find a way to do it without using the standard library routine. Even better is convincing yourself that using locale settings is okay. Only as a last resort --- 427,432 ---- If, when coding a module for general use, you need a locale independent version of an operation that is affected by the locale ! (such as \function{string.lower()}, or certain formats used with ! \function{time.strftime()}), you will have to find a way to do it without using the standard library routine. Even better is convincing yourself that using locale settings is okay. Only as a last resort Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libmimetools.tex 25 Sep 2002 22:13:27 -0000 1.23 --- libmimetools.tex 12 May 2003 03:23:51 -0000 1.24 *************** *** 89,93 **** \begin{methoddesc}{getparam}{name} Return the \var{value} of the first parameter (as returned by ! \method{getplist()} of the form \samp{\var{name}=\var{value}} for the given \var{name}. If \var{value} is surrounded by quotes of the form `\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed. --- 89,93 ---- \begin{methoddesc}{getparam}{name} Return the \var{value} of the first parameter (as returned by ! \method{getplist()}) of the form \samp{\var{name}=\var{value}} for the given \var{name}. If \var{value} is surrounded by quotes of the form `\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed. Index: libpyexpat.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpyexpat.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** libpyexpat.tex 3 Dec 2002 22:57:37 -0000 1.20 --- libpyexpat.tex 12 May 2003 03:23:51 -0000 1.21 *************** *** 581,585 **** \begin{datadescni}{XML_ERROR_BAD_CHAR_REF} A character reference referred to a character which is illegal in XML ! (for example, character \code{0}, or `\code{\&\#0;}'. \end{datadescni} --- 581,585 ---- \begin{datadescni}{XML_ERROR_BAD_CHAR_REF} A character reference referred to a character which is illegal in XML ! (for example, character \code{0}, or `\code{\&\#0;}'). \end{datadescni} Index: librepr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librepr.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** librepr.tex 10 Oct 2000 17:03:45 -0000 1.3 --- librepr.tex 12 May 2003 03:23:51 -0000 1.4 *************** *** 97,101 **** with a name based on the type name. In the method name, \var{type} is replaced by ! \code{string.join(string.split(type(\var{obj}).__name__, '_')}. Dispatch to these methods is handled by \method{repr1()}. Type-specific methods which need to recursively format a value --- 97,101 ---- with a name based on the type name. In the method name, \var{type} is replaced by ! \code{string.join(string.split(type(\var{obj}).__name__, '_'))}. Dispatch to these methods is handled by \method{repr1()}. Type-specific methods which need to recursively format a value From bcannon@users.sourceforge.net Mon May 12 08:29:45 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 12 May 2003 00:29:45 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1764/Lib Modified Files: urllib2.py Log Message: Change Request.add_header to call string.capitalize in order to normalize headers and not have any dependency on case. Closes patch #649742. Also changed all instances of dict.items to dict.iteritems where appropriate. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** urllib2.py 5 May 2003 04:09:13 -0000 1.42 --- urllib2.py 12 May 2003 07:29:42 -0000 1.43 *************** *** 194,198 **** self.data = data self.headers = {} ! self.headers.update(headers) def __getattr__(self, attr): --- 194,199 ---- self.data = data self.headers = {} ! for key, value in headers.iteritems(): ! self.add_header(key, value) def __getattr__(self, attr): *************** *** 249,253 **** def add_header(self, key, val): # useful for something like authentication ! self.headers[key] = val class OpenerDirector: --- 250,254 ---- def add_header(self, key, val): # useful for something like authentication ! self.headers[key.capitalize()] = val class OpenerDirector: *************** *** 479,483 **** assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies ! for type, url in proxies.items(): setattr(self, '%s_open' % type, lambda r, proxy=url, type=type, meth=self.proxy_open: \ --- 480,484 ---- assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies ! for type, url in proxies.iteritems(): setattr(self, '%s_open' % type, lambda r, proxy=url, type=type, meth=self.proxy_open: \ *************** *** 564,568 **** domains = self.passwd.get(realm, {}) authuri = self.reduce_uri(authuri) ! for uris, authinfo in domains.items(): for uri in uris: if self.is_suburi(uri, authuri): --- 565,569 ---- domains = self.passwd.get(realm, {}) authuri = self.reduce_uri(authuri) ! for uris, authinfo in domains.iteritems(): for uri in uris: if self.is_suburi(uri, authuri): *************** *** 806,810 **** if name not in req.headers: h.putheader(*args) ! for k, v in req.headers.items(): h.putheader(k, v) # httplib will attempt to connect() here. be prepared --- 807,811 ---- if name not in req.headers: h.putheader(*args) ! for k, v in req.headers.iteritems(): h.putheader(k, v) # httplib will attempt to connect() here. be prepared *************** *** 1013,1017 **** t = time.time() if self.soonest <= t: ! for k, v in self.timeout.items(): if v < t: self.cache[k].close() --- 1014,1018 ---- t = time.time() if self.soonest <= t: ! for k, v in self.timeout.iteritems(): if v < t: self.cache[k].close() *************** *** 1022,1026 **** # then check the size if len(self.cache) == self.max_conns: ! for k, v in self.timeout.items(): if v == self.soonest: del self.cache[k] --- 1023,1027 ---- # then check the size if len(self.cache) == self.max_conns: ! for k, v in self.timeout.iteritems(): if v == self.soonest: del self.cache[k] From bcannon@users.sourceforge.net Mon May 12 08:31:55 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 12 May 2003 00:31:55 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3742/Lib Modified Files: urllib2.py Log Message: Remove assert that checked if a parameter was an instance of Request. Closes patch #639139. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** urllib2.py 12 May 2003 07:29:42 -0000 1.43 --- urllib2.py 12 May 2003 07:31:53 -0000 1.44 *************** *** 320,324 **** if data is not None: req.add_data(data) - assert isinstance(req, Request) # really only care about interface result = self._call_chain(self.handle_open, 'default', --- 320,323 ---- From fdrake@users.sourceforge.net Mon May 12 14:50:14 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 12 May 2003 06:50:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.102,1.103 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv8132 Modified Files: ref3.tex Log Message: Add a specific mention of the term "operator overloading" and add an index entry. Suggested to python-docs. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** ref3.tex 20 Mar 2003 18:17:16 -0000 1.102 --- ref3.tex 12 May 2003 13:50:11 -0000 1.103 *************** *** 940,944 **** A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by ! defining methods with special names. For instance, if a class defines a method named \method{__getitem__()}, and \code{x} is an instance of this class, then \code{x[i]} is equivalent to --- 940,947 ---- A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by ! defining methods with special names.\indexii{operator}{overloading} ! This is Python's approach to \dfn{operator overloading}, allowing ! classes to define their own behavior with respect to language ! operators. For instance, if a class defines a method named \method{__getitem__()}, and \code{x} is an instance of this class, then \code{x[i]} is equivalent to From fdrake@users.sourceforge.net Mon May 12 14:50:43 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 12 May 2003 06:50:43 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref3.tex,1.82.4.8,1.82.4.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv8291 Modified Files: Tag: release22-maint ref3.tex Log Message: Add a specific mention of the term "operator overloading" and add an index entry. Suggested to python-docs. Index: ref3.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref3.tex,v retrieving revision 1.82.4.8 retrieving revision 1.82.4.9 diff -C2 -d -r1.82.4.8 -r1.82.4.9 *** ref3.tex 20 Mar 2003 18:22:50 -0000 1.82.4.8 --- ref3.tex 12 May 2003 13:50:41 -0000 1.82.4.9 *************** *** 895,899 **** A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by ! defining methods with special names. For instance, if a class defines a method named \method{__getitem__()}, and \code{x} is an instance of this class, then \code{x[i]} is equivalent to --- 895,902 ---- A class can implement certain operations that are invoked by special syntax (such as arithmetic operations or subscripting and slicing) by ! defining methods with special names.\indexii{operator}{overloading} ! This is Python's approach to \dfn{operator overloading}, allowing ! classes to define their own behavior with respect to language ! operators. For instance, if a class defines a method named \method{__getitem__()}, and \code{x} is an instance of this class, then \code{x[i]} is equivalent to From skip@pobox.com Mon May 12 16:07:55 2003 From: skip@pobox.com (Skip Montanaro) Date: Mon, 12 May 2003 10:07:55 -0500 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 In-Reply-To: References: Message-ID: <16063.47307.667615.396616@montanaro.dyndns.org> bcannon> Change Request.add_header to call string.capitalize in order to bcannon> normalize headers and not have any dependency on case. Closes bcannon> patch #649742. bcannon> ! self.headers[key.capitalize()] = val Maybe use key.title() instead? >>> "content-type".capitalize() 'Content-type' >>> "content-type".title() 'Content-Type' Skip From dcjim@users.sourceforge.net Mon May 12 18:42:58 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Mon, 12 May 2003 10:42:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv27702 Modified Files: noddy.c Log Message: Updated simple example. This should have been checked in the other day, but I missfired in CVS. Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** noddy.c 31 Jul 2002 06:17:46 -0000 1.4 --- noddy.c 12 May 2003 17:42:56 -0000 1.5 *************** *** 1,6 **** #include - static PyTypeObject noddy_NoddyType; - typedef struct { PyObject_HEAD --- 1,4 ---- *************** *** 8,55 **** } noddy_NoddyObject; - static PyObject* - noddy_new_noddy(PyObject* self, PyObject* args) - { - noddy_NoddyObject* noddy; - - noddy = PyObject_New(noddy_NoddyObject, &noddy_NoddyType); - - /* Initialize type-specific fields here. */ - - return (PyObject*)noddy; - } - - static void - noddy_noddy_dealloc(PyObject* self) - { - /* Free any external resources here; - * if the instance owns references to any Python - * objects, call Py_DECREF() on them here. - */ - PyObject_Del(self); - } - static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) ! 0, ! "Noddy", ! sizeof(noddy_NoddyObject), ! 0, ! noddy_noddy_dealloc, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! 0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash */ }; static PyMethodDef noddy_methods[] = { - {"new_noddy", noddy_new_noddy, METH_NOARGS, - "Create a new Noddy object."}, - {NULL} /* Sentinel */ }; --- 6,52 ---- } noddy_NoddyObject; static PyTypeObject noddy_NoddyType = { PyObject_HEAD_INIT(NULL) ! 0, /*ob_size*/ ! "noddy.Noddy", /*tp_name*/ ! sizeof(noddy_NoddyObject), /*tp_basicsize*/ ! 0, /*tp_itemsize*/ ! 0, /*tp_dealloc*/ ! 0, /*tp_print*/ ! 0, /*tp_getattr*/ ! 0, /*tp_setattr*/ ! 0, /*tp_compare*/ ! 0, /*tp_repr*/ ! 0, /*tp_as_number*/ ! 0, /*tp_as_sequence*/ ! 0, /*tp_as_mapping*/ ! 0, /*tp_hash */ ! 0, /*tp_call*/ ! 0, /*tp_str*/ ! 0, /*tp_getattro*/ ! 0, /*tp_setattro*/ ! 0, /*tp_as_buffer*/ ! Py_TPFLAGS_DEFAULT, /*tp_flags*/ ! "Noddy objects", /* tp_doc */ ! 0, /* tp_traverse */ ! 0, /* tp_clear */ ! 0, /* tp_richcompare */ ! 0, /* tp_weaklistoffset */ ! 0, /* tp_iter */ ! 0, /* tp_iternext */ ! 0, /* 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 */ ! 0, /* tp_alloc */ ! PyType_GenericNew, /* tp_new */ }; static PyMethodDef noddy_methods[] = { {NULL} /* Sentinel */ }; *************** *** 58,66 **** initnoddy(void) { ! noddy_NoddyType.ob_type = &PyType_Type; ! if (PyType_Ready(&noddy_NoddyType)) return; ! Py_InitModule3("noddy", noddy_methods ! "Example module that creates an extension type."); } --- 55,66 ---- initnoddy(void) { ! PyObject* m; ! ! if (PyType_Ready(&noddy_NoddyType) < 0) return; ! m = Py_InitModule3("noddy", noddy_methods, ! "Example module that creates an extension type."); ! ! PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType); } From tim_one@users.sourceforge.net Mon May 12 20:16:55 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 May 2003 12:16:55 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.284,2.285 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv2959/Python Modified Files: compile.c Log Message: cmp_type(): The grammar stopped allowing '=' as a comparison operator about a decade ago. Put the code still allowing for it in cmp_type() out of its lonely misery. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.284 retrieving revision 2.285 diff -C2 -d -r2.284 -r2.285 *** compile.c 10 May 2003 07:36:56 -0000 2.284 --- compile.c 12 May 2003 19:16:52 -0000 2.285 *************** *** 2369,2373 **** { REQ(n, comp_op); ! /* comp_op: '<' | '>' | '=' | '>=' | '<=' | '<>' | '!=' | '==' | 'in' | 'not' 'in' | 'is' | 'is' not' */ if (NCH(n) == 1) { --- 2369,2373 ---- { REQ(n, comp_op); ! /* comp_op: '<' | '>' | '>=' | '<=' | '<>' | '!=' | '==' | 'in' | 'not' 'in' | 'is' | 'is' not' */ if (NCH(n) == 1) { *************** *** 2376,2381 **** case LESS: return PyCmp_LT; case GREATER: return PyCmp_GT; ! case EQEQUAL: /* == */ ! case EQUAL: return PyCmp_EQ; case LESSEQUAL: return PyCmp_LE; case GREATEREQUAL: return PyCmp_GE; --- 2376,2380 ---- case LESS: return PyCmp_LT; case GREATER: return PyCmp_GT; ! case EQEQUAL: return PyCmp_EQ; case LESSEQUAL: return PyCmp_LE; case GREATEREQUAL: return PyCmp_GE; From tim_one@users.sourceforge.net Mon May 12 20:29:39 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 May 2003 12:29:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_tokenize.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv9377/Lib/test Modified Files: test_tokenize.py Log Message: Close the file after tokenizing it. Because the open file object was bound to a module global, the file object remained opened throughout the test suite run. Index: test_tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tokenize.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_tokenize.py 23 Jul 2002 19:04:08 -0000 1.7 --- test_tokenize.py 12 May 2003 19:29:36 -0000 1.8 *************** *** 4,9 **** if verbose: print 'starting...' ! file = open(findfile('tokenize_tests'+os.extsep+'py')) ! tokenize.tokenize(file.readline) if verbose: print 'finished' --- 4,12 ---- if verbose: print 'starting...' ! ! f = file(findfile('tokenize_tests'+os.extsep+'py')) ! tokenize.tokenize(f.readline) ! f.close() ! if verbose: print 'finished' From tim_one@users.sourceforge.net Mon May 12 20:42:06 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 May 2003 12:42:06 -0700 Subject: [Python-checkins] python/dist/src/Lib/test tokenize_tests.txt,NONE,1.1 test_tokenize.py,1.8,1.9 tokenize_tests.py,1.7,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13959/Lib/test Modified Files: test_tokenize.py Added Files: tokenize_tests.txt Removed Files: tokenize_tests.py Log Message: Effectively renamed tokenize_tests.py to have a txt extension instead. This file isn't meant to be executed, it's data input for test_tokenize.py. The problem with the .py extension is that it uses "non-standard" indentation, and it's good to test that, but reindent.py keeps wanting to fix it. But fixing the indentation causes the expected-output file to change, since exact line and column numbers are part of the tokenize.tokenize() output getting tested. --- NEW FILE: tokenize_tests.txt --- # Tests for the 'tokenize' module. # Large bits stolen from test_grammar.py. # Comments "#" #' #" #\ # # abc '''# #''' x = 1 # # Balancing continuation a = (3, 4, 5, 6) y = [3, 4, 5] z = {'a':5, 'b':6} x = (len(`y`) + 5*x - a[ 3 ] - x + len({ } ) ) # Backslash means line continuation: x = 1 \ + 1 # Backslash does not means continuation in comments :\ x = 0 # Ordinary integers 0xff <> 255 0377 <> 255 2147483647 != 017777777777 -2147483647-1 != 020000000000 037777777777 != -1 0xffffffff != -1 # Long integers x = 0L x = 0l x = 0xffffffffffffffffL x = 0xffffffffffffffffl x = 077777777777777777L x = 077777777777777777l x = 123456789012345678901234567890L x = 123456789012345678901234567890l # Floating-point numbers x = 3.14 x = 314. x = 0.314 # XXX x = 000.314 x = .314 x = 3e14 x = 3E14 x = 3e-14 x = 3e+14 x = 3.e14 x = .3e14 x = 3.1e4 # String literals x = ''; y = ""; x = '\''; y = "'"; x = '"'; y = "\""; x = "doesn't \"shrink\" does it" y = 'doesn\'t "shrink" does it' x = "does \"shrink\" doesn't it" y = 'does "shrink" doesn\'t it' x = """ The "quick" brown fox jumps over the 'lazy' dog. """ y = '\nThe "quick"\nbrown fox\njumps over\nthe \'lazy\' dog.\n' y = ''' The "quick" brown fox jumps over the 'lazy' dog. '''; y = "\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the 'lazy' dog.\n\ "; y = '\n\ The \"quick\"\n\ brown fox\n\ jumps over\n\ the \'lazy\' dog.\n\ '; x = r'\\' + R'\\' x = r'\'' + '' y = r''' foo bar \\ baz''' + R''' foo''' y = r"""foo bar \\ baz """ + R'''spam ''' x = u'abc' + U'ABC' y = u"abc" + U"ABC" x = ur'abc' + Ur'ABC' + uR'ABC' + UR'ABC' y = ur"abc" + Ur"ABC" + uR"ABC" + UR"ABC" x = ur'\\' + UR'\\' x = ur'\'' + '' y = ur''' foo bar \\ baz''' + UR''' foo''' y = Ur"""foo bar \\ baz """ + uR'''spam ''' # Indentation if 1: x = 2 if 1: x = 2 if 1: while 0: if 0: x = 2 x = 2 if 0: if 2: while 0: if 1: x = 2 # Operators def d22(a, b, c=1, d=2): pass def d01v(a=1, *restt, **restd): pass (x, y) <> ({'a':1}, {'b':2}) # comparison if 1 < 1 > 1 == 1 >= 1 <= 1 <> 1 != 1 in 1 not in 1 is 1 is not 1: pass # binary x = 1 & 1 x = 1 ^ 1 x = 1 | 1 # shift x = 1 << 1 >> 1 # additive x = 1 - 1 + 1 - 1 + 1 # multiplicative x = 1 / 1 * 1 % 1 # unary x = ~1 ^ 1 & 1 | 1 & 1 ^ -1 x = -1*1/1 + 1*1 - ---1*1 # selector import sys, time x = sys.modules['time'].time() Index: test_tokenize.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_tokenize.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_tokenize.py 12 May 2003 19:29:36 -0000 1.8 --- test_tokenize.py 12 May 2003 19:42:04 -0000 1.9 *************** *** 5,9 **** print 'starting...' ! f = file(findfile('tokenize_tests'+os.extsep+'py')) tokenize.tokenize(f.readline) f.close() --- 5,9 ---- print 'starting...' ! f = file(findfile('tokenize_tests' + os.extsep + 'txt')) tokenize.tokenize(f.readline) f.close() --- tokenize_tests.py DELETED --- From tim_one@users.sourceforge.net Mon May 12 20:42:07 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 May 2003 12:42:07 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.123,1.124 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv13959/PCbuild Modified Files: python20.wse Log Message: Effectively renamed tokenize_tests.py to have a txt extension instead. This file isn't meant to be executed, it's data input for test_tokenize.py. The problem with the .py extension is that it uses "non-standard" indentation, and it's good to test that, but reindent.py keeps wanting to fix it. But fixing the indentation causes the expected-output file to change, since exact line and column numbers are part of the tokenize.tokenize() output getting tested. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** python20.wse 8 May 2003 18:13:59 -0000 1.123 --- python20.wse 12 May 2003 19:42:04 -0000 1.124 *************** *** 2358,2361 **** --- 2358,2367 ---- Flags=0000000000000010 end + item: Install File + Source=..\lib\test\*.txt + Destination=%MAINDIR%\Lib\test + Description=Python Test files + Flags=0000000000000010 + end item: Remark end From tim_one@users.sourceforge.net Mon May 12 21:19:39 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 May 2003 13:19:39 -0700 Subject: [Python-checkins] python/dist/src/Lib httplib.py,1.75,1.76 textwrap.py,1.29,1.30 xmlrpclib.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1225/Lib Modified Files: httplib.py textwrap.py xmlrpclib.py Log Message: Whitespace normalization. Index: httplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v retrieving revision 1.75 retrieving revision 1.76 diff -C2 -d -r1.75 -r1.76 *** httplib.py 5 May 2003 16:13:56 -0000 1.75 --- httplib.py 12 May 2003 20:19:36 -0000 1.76 *************** *** 769,773 **** if self.debuglevel > 0: response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict, method=self._method) else: --- 769,773 ---- if self.debuglevel > 0: response = self.response_class(self.sock, self.debuglevel, ! strict=self.strict, method=self._method) else: Index: textwrap.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/textwrap.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** textwrap.py 8 May 2003 02:12:35 -0000 1.29 --- textwrap.py 12 May 2003 20:19:36 -0000 1.30 *************** *** 319,323 **** This can be used e.g. to make triple-quoted strings line up with the left edge of screen/whatever, while still presenting it in the ! source code in indented form. For example: --- 319,323 ---- This can be used e.g. to make triple-quoted strings line up with the left edge of screen/whatever, while still presenting it in the ! source code in indented form. For example: Index: xmlrpclib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/xmlrpclib.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** xmlrpclib.py 25 Apr 2003 00:26:51 -0000 1.26 --- xmlrpclib.py 12 May 2003 20:19:36 -0000 1.27 *************** *** 572,576 **** self.encoding = encoding self.allow_none = allow_none ! dispatch = {} --- 572,576 ---- self.encoding = encoding self.allow_none = allow_none ! dispatch = {} *************** *** 613,617 **** write("") dispatch[NoneType] = dump_nil ! def dump_int(self, value, write): # in case ints are > 32 bits --- 613,617 ---- write("") dispatch[NoneType] = dump_nil ! def dump_int(self, value, write): # in case ints are > 32 bits *************** *** 785,789 **** self._value = 0 dispatch["nil"] = end_nil ! def end_boolean(self, data): if data == "0": --- 785,789 ---- self._value = 0 dispatch["nil"] = end_nil ! def end_boolean(self, data): if data == "0": *************** *** 1295,1299 **** self.__verbose = verbose self.__allow_none = allow_none ! def __request(self, methodname, params): # call a method on the remote server --- 1295,1299 ---- self.__verbose = verbose self.__allow_none = allow_none ! def __request(self, methodname, params): # call a method on the remote server *************** *** 1341,1345 **** # server = ServerProxy("http://localhost:8000") # local server ! server = ServerProxy("http://betty.userland.com") print server --- 1341,1345 ---- # server = ServerProxy("http://localhost:8000") # local server ! server = ServerProxy("http://betty.userland.com") print server From tim_one@users.sourceforge.net Mon May 12 21:19:41 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon, 12 May 2003 13:19:41 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bool.py,1.12,1.13 test_socket.py,1.64,1.65 test_types.py,1.51,1.52 test_urllib.py,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv1225/Lib/test Modified Files: test_bool.py test_socket.py test_types.py test_urllib.py Log Message: Whitespace normalization. Index: test_bool.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bool.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_bool.py 1 May 2003 17:45:32 -0000 1.12 --- test_bool.py 12 May 2003 20:19:36 -0000 1.13 *************** *** 326,328 **** if __name__ == "__main__": test_main() - --- 326,327 ---- Index: test_socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_socket.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** test_socket.py 1 May 2003 17:45:49 -0000 1.64 --- test_socket.py 12 May 2003 20:19:37 -0000 1.65 *************** *** 333,337 **** self.assertEquals('\xff\x00\xff\x00', g('255.0.255.0')) self.assertEquals('\xaa\xaa\xaa\xaa', g('170.170.170.170')) ! def testIPv6toString(self): if not hasattr(socket, 'inet_pton'): --- 333,337 ---- self.assertEquals('\xff\x00\xff\x00', g('255.0.255.0')) self.assertEquals('\xaa\xaa\xaa\xaa', g('170.170.170.170')) ! def testIPv6toString(self): if not hasattr(socket, 'inet_pton'): *************** *** 352,356 **** f('45ef:76cb:1a:56ef:afeb:bac:1924:aeae') ) ! def testStringToIPv4(self): if not hasattr(socket, 'inet_ntop'): --- 352,356 ---- f('45ef:76cb:1a:56ef:afeb:bac:1924:aeae') ) ! def testStringToIPv4(self): if not hasattr(socket, 'inet_ntop'): *************** *** 363,367 **** self.assertEquals('255.255.255.255', f('\xff\xff\xff\xff')) self.assertEquals('1.2.3.4', f('\x01\x02\x03\x04')) ! self.assertEquals('1.0.1.0', g('\x01\x00\x01\x00')) self.assertEquals('170.85.170.85', g('\xaa\x55\xaa\x55')) --- 363,367 ---- self.assertEquals('255.255.255.255', f('\xff\xff\xff\xff')) self.assertEquals('1.2.3.4', f('\x01\x02\x03\x04')) ! self.assertEquals('1.0.1.0', g('\x01\x00\x01\x00')) self.assertEquals('170.85.170.85', g('\xaa\x55\xaa\x55')) Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** test_types.py 7 May 2003 01:28:47 -0000 1.51 --- test_types.py 12 May 2003 20:19:37 -0000 1.52 *************** *** 259,264 **** # Verify that __getitem__ overrides are not recognized by __iter__ class T(tuple): ! def __getitem__(self, key): ! return str(key) + '!!!' vereq(iter(T((1,2))).next(), 1) --- 259,264 ---- # Verify that __getitem__ overrides are not recognized by __iter__ class T(tuple): ! def __getitem__(self, key): ! return str(key) + '!!!' vereq(iter(T((1,2))).next(), 1) *************** *** 456,461 **** # Verify that __getitem__ overrides are not recognized by __iter__ class L(list): ! def __getitem__(self, key): ! return str(key) + '!!!' vereq(iter(L([1,2])).next(), 1) --- 456,461 ---- # Verify that __getitem__ overrides are not recognized by __iter__ class L(list): ! def __getitem__(self, key): ! return str(key) + '!!!' vereq(iter(L([1,2])).next(), 1) Index: test_urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_urllib.py 1 May 2003 17:45:53 -0000 1.13 --- test_urllib.py 12 May 2003 20:19:37 -0000 1.14 *************** *** 140,144 **** class QuotingTests(unittest.TestCase): """Tests for urllib.quote() and urllib.quote_plus() ! According to RFC 2396 ("Uniform Resource Identifiers), to escape a character you write it as '%' + <2 character US-ASCII hex value>. The Python --- 140,144 ---- class QuotingTests(unittest.TestCase): """Tests for urllib.quote() and urllib.quote_plus() ! According to RFC 2396 ("Uniform Resource Identifiers), to escape a character you write it as '%' + <2 character US-ASCII hex value>. The Python *************** *** 147,151 **** The various character sets specified are: ! Reserved characters : ";/?:@&=+$," Have special meaning in URIs and must be escaped if not being used for --- 147,151 ---- The various character sets specified are: ! Reserved characters : ";/?:@&=+$," Have special meaning in URIs and must be escaped if not being used for *************** *** 161,165 **** Unwise : "{}|\^[]`" Must be escaped ! """ --- 161,165 ---- Unwise : "{}|\^[]`" Must be escaped ! """ *************** *** 207,211 **** self.assertEqual(hexescape(char), result, "using quote_plus(): " ! "%s should be escapes to %s, not %s" % (char, hexescape(char), result)) del should_quote --- 207,211 ---- self.assertEqual(hexescape(char), result, "using quote_plus(): " ! "%s should be escapes to %s, not %s" % (char, hexescape(char), result)) del should_quote *************** *** 239,243 **** class UnquotingTests(unittest.TestCase): """Tests for unquote() and unquote_plus() ! See the doc string for quoting_Tests for details on quoting and such. --- 239,243 ---- class UnquotingTests(unittest.TestCase): """Tests for unquote() and unquote_plus() ! See the doc string for quoting_Tests for details on quoting and such. *************** *** 280,284 **** self.assertEqual(expect, result, "using unquote_plus(): %s != %s" % (expect, result)) ! def test_unquoting_plus(self): # Test difference between unquote() and unquote_plus() --- 280,284 ---- self.assertEqual(expect, result, "using unquote_plus(): %s != %s" % (expect, result)) ! def test_unquoting_plus(self): # Test difference between unquote() and unquote_plus() *************** *** 298,310 **** def help_inputtype(self, given, test_type): """Helper method for testing different input types. ! 'given' must lead to only the pairs: * 1st, 1 * 2nd, 2 * 3rd, 3 ! Test cannot assume anything about order. Docs make no guarantee and have possible dictionary input. ! """ expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] --- 298,310 ---- def help_inputtype(self, given, test_type): """Helper method for testing different input types. ! 'given' must lead to only the pairs: * 1st, 1 * 2nd, 2 * 3rd, 3 ! Test cannot assume anything about order. Docs make no guarantee and have possible dictionary input. ! """ expect_somewhere = ["1st=1", "2nd=2", "3rd=3"] *************** *** 405,409 **** "url2pathname() failed; %s != %s" % (expect, result)) ! --- 405,409 ---- "url2pathname() failed; %s != %s" % (expect, result)) ! From drifty@alum.berkeley.edu Mon May 12 22:27:54 2003 From: drifty@alum.berkeley.edu (Brett C.) Date: Mon, 12 May 2003 14:27:54 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 In-Reply-To: <16063.47307.667615.396616@montanaro.dyndns.org> References: <16063.47307.667615.396616@montanaro.dyndns.org> Message-ID: <3EC011DA.2090603@ocf.berkeley.edu> Skip Montanaro wrote: > bcannon> Change Request.add_header to call string.capitalize in order to > bcannon> normalize headers and not have any dependency on case. Closes > bcannon> patch #649742. > > bcannon> ! self.headers[key.capitalize()] = val > > Maybe use key.title() instead? > > >>> "content-type".capitalize() > 'Content-type' > >>> "content-type".title() > 'Content-Type' > So the original reason of doing 'capitalize' is because farther down in urllib2 there is a check to see if "Content-type" is set and it is specifically in that case. It really is a judgment call since the RFC doesn't even keep the case consistent. So moving to 'title' would be fine but the lines in urllib2.py that check for the existence of 'Content-type' and 'Content-length' would need to be changed. -Brett From fdrake@users.sourceforge.net Mon May 12 22:38:53 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 12 May 2003 14:38:53 -0700 Subject: [Python-checkins] python/dist/src/Include abstract.h,2.42.6.1,2.42.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv18392 Modified Files: Tag: release22-maint abstract.h Log Message: Fix broken API descriptions in comments. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.42.6.1 retrieving revision 2.42.6.2 diff -C2 -d -r2.42.6.1 -r2.42.6.2 *** abstract.h 5 Jan 2002 10:52:38 -0000 2.42.6.1 --- abstract.h 12 May 2003 21:38:50 -0000 2.42.6.2 *************** *** 351,358 **** Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are provided ! as PyObject * values; 'n' specifies the number of arguments ! present. Returns the result of the call on success, or NULL ! on failure. This is the equivalent of the Python expression: ! apply(o,args). */ --- 351,357 ---- Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are provided ! as PyObject * values, terminated by a NULL. Returns the ! result of the call on success, or NULL on failure. This is ! the equivalent of the Python expression: apply(o,args). */ *************** *** 363,370 **** /* Call the method named m of object o with a variable number of ! C arguments. The C arguments are provided as PyObject * values; ! 'n' specifies the number of arguments present. Returns the ! result of the call on success, or NULL on failure. This is the ! equivalent of the Python expression: o.method(args). */ --- 362,369 ---- /* Call the method named m of object o with a variable number of ! C arguments. The C arguments are provided as PyObject * ! values, terminated by NULL. Returns the result of the call ! on success, or NULL on failure. This is the equivalent of ! the Python expression: o.method(args). */ From fdrake@users.sourceforge.net Mon May 12 22:41:41 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon, 12 May 2003 14:41:41 -0700 Subject: [Python-checkins] python/dist/src/Include abstract.h,2.47,2.48 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv20101 Modified Files: abstract.h Log Message: Fix broken API descriptions in comments. Index: abstract.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/abstract.h,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** abstract.h 28 Feb 2003 05:11:03 -0000 2.47 --- abstract.h 12 May 2003 21:41:39 -0000 2.48 *************** *** 351,358 **** Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are provided ! as PyObject * values; 'n' specifies the number of arguments ! present. Returns the result of the call on success, or NULL ! on failure. This is the equivalent of the Python expression: ! apply(o,args). */ --- 351,357 ---- Call a callable Python object, callable_object, with a variable number of C arguments. The C arguments are provided ! as PyObject * values, terminated by a NULL. Returns the ! result of the call on success, or NULL on failure. This is ! the equivalent of the Python expression: apply(o,args). */ *************** *** 363,370 **** /* Call the method named m of object o with a variable number of ! C arguments. The C arguments are provided as PyObject * values; ! 'n' specifies the number of arguments present. Returns the ! result of the call on success, or NULL on failure. This is the ! equivalent of the Python expression: o.method(args). */ --- 362,369 ---- /* Call the method named m of object o with a variable number of ! C arguments. The C arguments are provided as PyObject * ! values, terminated by NULL. Returns the result of the call ! on success, or NULL on failure. This is the equivalent of ! the Python expression: o.method(args). */ From guido@python.org Mon May 12 22:53:02 2003 From: guido@python.org (Guido van Rossum) Date: Mon, 12 May 2003 17:53:02 -0400 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 In-Reply-To: Your message of "Mon, 12 May 2003 14:27:54 PDT." <3EC011DA.2090603@ocf.berkeley.edu> References: <16063.47307.667615.396616@montanaro.dyndns.org> <3EC011DA.2090603@ocf.berkeley.edu> Message-ID: <200305122153.h4CLr2904919@odiug.zope.com> > Skip Montanaro wrote: > > bcannon> Change Request.add_header to call string.capitalize in order to > > bcannon> normalize headers and not have any dependency on case. Closes > > bcannon> patch #649742. > > > > bcannon> ! self.headers[key.capitalize()] = val > > > > Maybe use key.title() instead? > > > > >>> "content-type".capitalize() > > 'Content-type' > > >>> "content-type".title() > > 'Content-Type' > > > > So the original reason of doing 'capitalize' is because farther down in > urllib2 there is a check to see if "Content-type" is set and it is > specifically in that case. It really is a judgment call since the RFC > doesn't even keep the case consistent. > > So moving to 'title' would be fine but the lines in urllib2.py that > check for the existence of 'Content-type' and 'Content-length' would > need to be changed. But if the headers object were truly case-insensitive this wouldn't be necessary. I think anything short of a case-insensitive directory is brittle here... --Guido van Rossum (home page: http://www.python.org/~guido/) From skip@pobox.com Mon May 12 23:18:36 2003 From: skip@pobox.com (Skip Montanaro) Date: Mon, 12 May 2003 17:18:36 -0500 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 In-Reply-To: <200305122153.h4CLr2904919@odiug.zope.com> References: <16063.47307.667615.396616@montanaro.dyndns.org> <3EC011DA.2090603@ocf.berkeley.edu> <200305122153.h4CLr2904919@odiug.zope.com> Message-ID: <16064.7612.967645.24353@montanaro.dyndns.org> I should have elaborated a bit more in my comment. Clearly .capitalize(), .title(), .lower() and .upper() will all work equally well as long as you apply them consistently during dictionary writes and key compares. .title() seems more "natural" to me only because headers seem to most frequently be capitalized in its fashion. It's not a big deal. Really. ;-) Skip From bcannon@users.sourceforge.net Mon May 12 23:40:00 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 12 May 2003 15:40:00 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.236,1.237 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv16038/Misc Modified Files: ACKS Log Message: John J. Lee contributed two urllib2 patches. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.236 retrieving revision 1.237 diff -C2 -d -r1.236 -r1.237 *** ACKS 9 May 2003 16:08:22 -0000 1.236 --- ACKS 12 May 2003 22:39:57 -0000 1.237 *************** *** 319,322 **** --- 319,323 ---- Christopher Lee Inyeol Lee + John J. Lee Luc Lefebvre Kip Lehman From rhettinger@users.sourceforge.net Tue May 13 00:33:30 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 12 May 2003 16:33:30 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts texcheck.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv1476 Modified Files: texcheck.py Log Message: * Added separate checks for matching braces. * Added more LaTex cmds from the docs. * Blocked forward-slash warnings with delimiters-only option. * Put help message on shorter line to fit an 80 char screen. Index: texcheck.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/texcheck.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** texcheck.py 10 May 2003 09:04:37 -0000 1.3 --- texcheck.py 12 May 2003 23:33:28 -0000 1.4 *************** *** 15,20 **** Options: ! -m Munge parenthesis and brackets. [0,n) would normally mismatch. ! -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. -f: Forward-slash warnings suppressed. -d: Delimiter check only (useful for non-LaTeX files). --- 15,20 ---- Options: ! -m Munge parenthesis and brackets. [0,n) would normally mismatch. ! -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. -f: Forward-slash warnings suppressed. -d: Delimiter check only (useful for non-LaTeX files). *************** *** 53,56 **** --- 53,61 ---- \indexname \appendix \protect \indexiv \mbox \textasciitilde \platform \seeurl \leftmargin \labelwidth \localmoduletable + \LaTeX \copyright \memberline \backslash \pi \centerline + \caption \vspace \textwidth \menuselection \textless + \makevar \csimplemacro \menuselection \bfcode \sub \release + \email \kwindex \refexmodindex \filenq \e \menuselection + \exindex \linev \newsgroup \verbatim \setshortversion """ *************** *** 86,91 **** validcmds.add('\\' + cmd) - openers = [] # Stack of pending open delimiters - if '-m' in opts: pairmap = {']':'[(', ')':'(['} # Munged openers --- 91,94 ---- *************** *** 95,98 **** --- 98,105 ---- delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') + braces = re.compile(r'({)|(})') + + openers = [] # Stack of pending open delimiters + bracestack = [] # Stack of pending open braces tablestart = re.compile(r'\\begin{(?:long)?table([iv]+)}') *************** *** 108,112 **** line = line.rstrip() ! if '-f' not in opts and '/' in line: # Warn whenever forward slashes encountered line = line.rstrip() --- 115,119 ---- line = line.rstrip() ! if '/' in line and '-f' not in opts and '-d' not in opts: # Warn whenever forward slashes encountered line = line.rstrip() *************** *** 124,128 **** print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) ! # Check balancing of open/close markers (parens, brackets, etc) for begend, name, punct in delimiters.findall(line): if '-v' in opts: --- 131,135 ---- print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) ! # Check balancing of open/close parenthesis and brackets for begend, name, punct in delimiters.findall(line): if '-v' in opts: *************** *** 139,142 **** --- 146,161 ---- print ' --> ', openers + # Balance opening and closing braces + for open, close in braces.findall(line): + if open == '{': + bracestack.append(lineno) + if close == '}': + try: + bracestack.pop() + except IndexError: + print r'Warning, unmatched } on line %s.' % (lineno,) + if '-v' in opts: + print ' --> ', bracestack + # Check table levels (make sure lineii only inside tableii) m = tablestart.search(line) *************** *** 153,156 **** --- 172,177 ---- for lineno, symbol in openers: print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno) + for lineno in bracestack: + print "Unmatched { on line %d" % (lineno,) print 'Done checking %d lines.' % (lastline,) return 0 From bcannon@users.sourceforge.net Tue May 13 03:50:38 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 12 May 2003 19:50:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcgi.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9438/Doc/lib Modified Files: libcgi.tex Log Message: Fix and add reference to urllib.urlencode for parse_qsl? functions. Index: libcgi.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcgi.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** libcgi.tex 24 Apr 2003 16:22:47 -0000 1.39 --- libcgi.tex 13 May 2003 02:50:36 -0000 1.40 *************** *** 332,335 **** --- 332,339 ---- are silently ignored. If true, errors raise a ValueError exception. + + Use the \function{\refmodule{urllib}.urlencode()} function to convert + such dictionaries into query strings. + \end{funcdesc} *************** *** 353,357 **** exception. ! Use the \function{\refmodule{cgi}.urlencode()} function to convert such lists of pairs into query strings. \end{funcdesc} --- 357,361 ---- exception. ! Use the \function{\refmodule{urllib}.urlencode()} function to convert such lists of pairs into query strings. \end{funcdesc} From anthonybaxter@users.sourceforge.net Tue May 13 04:07:19 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 12 May 2003 20:07:19 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref - New directory Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv14441/distutilsref Log Message: Directory /cvsroot/python/python/nondist/sandbox/distutilsref added to the repository From anthonybaxter@users.sourceforge.net Tue May 13 04:07:58 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 12 May 2003 20:07:58 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv14570 Added Files: distref.tex Log Message: distutils reference -- work in progress. --- NEW FILE: distref.tex --- \section{\module{distutils} --- Building and installing Python modules, reference.} \sectionauthor {Anthony Baxter}{anthony@interlink.com.au} \sectionauthor {Greg Ward}{gward@python.net} The \module{distutils} package provides support for building and installing additional modules into a Python installation. The new modules may be either 100\%{}-pure Python, or may be extension modules written in C, or may be collections of Python packages which include modules coded in both Python and C. \localmoduletable \section{The simple interface} \declaremodule{standard}{distutils.core} \modulesynopsis{The core Distutils functionality} The \module{distutils.core} module is the only module that needs to be installed to use the Distutils. It provides the \function{setup()} (which is called from the setup script). Indirectly provides the \class{distutils.dist.Distribution} and \class{distutils.cmd.Command} class. \begin{funcdesc}{setup}{arguments} The basic do-everything function that does most everything you could ever ask for from a Distutils method. See XXXXX The setup function takes a large number of arguments. These are laid out in the following table. \begin{tableiii}{c|l|l}{argument name}{argument name}{value}{notes} \lineiii{name}{The name of the package}{a string} \lineiii{version}{The version number of the package}{See \module{distutils.Version}} \lineiii{description}{A single line describing the package}{a string} \lineiii{long_description}{Longer description of the package}{a string} \lineiii{author}{The name of the package author}{a string} \lineiii{author_email}{The email address of the package author}{a string} \lineiii{maintainer}{The name of the current maintainer, if different from the author}{a string} \lineiii{maintainer_email}{The email address of the current maintainer, if different from the author}{} \lineiii{url}{A URL for the package (homepage)}{a URL} \lineiii{download_url}{A URL to download the package}{a URL} \lineiii{packages}{A list of python packages that distutils will manipulate}{a list of strings} \lineiii{py_modules}{A list of python modules that distutils will manipulate}{a list of strings} \lineiii{scripts}{A list of standalone script files to be built and installed}{a list of strings} \lineiii{ext_modules}{A list of python extensions to be built. A list of instances of \class{distutils.core.Extension}} \lineiii{classifiers}{A list of Trove categories for the package} {XXX link to better definition} \lineiii{distclass}{}{} \lineiii{script_name}{}{} \lineiii{script_args}{}{} \lineiii{options}{}{} \lineiii{license}{The license for the package}{} \lineiii{keywords}{}{} \lineiii{platforms}{}{} \end{tableiii} In addition, the \module{distutils.core} module exposed a number of other classes that live elsewhere. \begin{itemize} \item The \class{Distribution} from \module{distutils.dist} \item The \class{Command} from \module{distutils.cmd} \item The \class{Extension} from \module{distutils.extension} \end{itemize} A short description of each of these follows, but see the relevant module for the full reference. \end{funcdesc} \begin{funcdesc}{run_setup}{script_name, script_args=None, stop_after='run'} Run a setup script in a somewhat controlled environment, and return the \class{distutils.dist.Distribution} instance that drives things. This is useful if you need to find out the distribution meta-data (passed as keyword args from \var{script} to \function{setup()}), or the contents of the config files or command-line. \var{script_name} is a file that will be run with \function{execfile()} \var{sys.argv[0]} will be replaced with \var{script} for the duration of the call. \var{script_args} is a list of strings; if supplied, \var{sys.argv[1:]} will be replaced by \var{script_args} for the duration of the call. \var{stop_after} tells \function{setup()} when to stop processing; possible values: \begin{tableii}{c|l}{value}{value}{description} \lineii{init}{Stop after the \class{Distribution} instance has been created and populated with the keyword arguments to 'setup()'} \lineii{config}{Stop after config files have been parsed (and their data stored in the \class{Distribution} instance)} \lineii{commandline}{Stop after the command-line (\var{sys.argv[1:]} or \var{script_args}) have been parsed (and the data stored in the \class{Distribution})} \lineii{run}{Stop after all commands have been run (the same as if \function{setup()} had been called in the usual way. This is the default value.} \end{tableii} \end{funcdesc} \section{The more complex interface} Most people will never need anything other than the \function{setup()} function from \module{distutils.core}. For people looking to extend Distutils functionality, or do something a little more complex, there's a whole host of additional modules and functionality provided. \declaremodule{standard}{distutils.ccompiler} \modulesynopsis{Abstract CCompiler class} This module provides the abstract base class for the CCompiler classes. A CCompiler instance can be used for all the compile and link steps needed to build a single project. Methods are provided to set options for the compiler -- macro definitions, include directories, link path, libraries and the like. This module provides the following functions. \begin{funcdesc}{gen_lib_options}{compiler, library_dirs, runtime_library_dirs, libraries} Generate linker options for searching library directories and linking with specific libraries. \var{libraries} and \var{library_dirs} are, respectively, lists of library names (not filenames!) and search directories. Returns a list of command-line options suitable for use with some compiler (depending on the two format strings passed in). \end{funcdesc} \begin{funcdesc}{gen_preprocess_options}{macros, include_dirs} Generate C pre-processor options (-D, -U, -I) as used by at least two types of compilers: the typical Unix compiler and Visual C++. \var{macros} is the usual thing, a list of 1- or 2-tuples, where \var{(name,)} means undefine (-U) macro \var{name}, and \var{(name,value)} means define (-D) macro \var{name} to \var{value}. \var{include_dirs} is just a list of directory names to be added to the header file search path (-I). Returns a list of command-line options suitable for either Unix compilers or Visual C++. \end{funcdesc} \begin{funcdesc}{get_default_compiler}{osname, platform} Determine the default compiler to use for the given platform. \var{osname} should be one of the standard Python OS names (i.e. the ones returned by \var{os.name}) and \var{platform} the common value returned by \var{sys.platform} for the platform in question. The default values are \var{os.name} and \var{sys.platform} in case the parameters are not given. \end{funcdesc} \begin{funcdesc}{new_compiler}{plat=None, compiler=None, verbose=0, dry_run=0, force=0} Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults to \var{os.name' (eg. \var{posix}, \var{nt}), and \var{compiler} defaults to the default compiler for that platform. Currently only \var{posix} and \var{nt} are supported, and the default compilers are "traditional Unix interface" (\class{UnixCCompiler} class) and Visual C++ (\class{MSVCCompiler} class). Note that it's perfectly possible to ask for a Unix compiler object under Windows, and a Microsoft compiler object under Unix -- if you supply a value for \var{compiler}, \var{plat} is ignored. \end{funcdesc} \begin{funcdesc}{show_compilers}{} Print list of available compilers (used by the "--help-compiler" options to "build", "build_ext", "build_clib"). \end{funcdesc} \begin{classdesc}{CCompiler}{verbose=0, dry_run=0, force=0} The abstract base class \class{CCompiler} defines the interface that must be implemented by real compiler classes. The class also has some utility methods used by several compiler classes. The basic idea behind a compiler abstraction class is that each instance can be used for all the compile/link steps in building a single project. Thus, attributes common to all of those compile and link steps -- include directories, macros to define, libraries to link against, etc. -- are attributes of the compiler instance. To allow for variability in how individual files are treated, most of those attributes may be varied on a per-compilation or per-link basis. The constructor for each subclass creates an instance of the Compiler object. Flags are \var{verbose} (show verbose output), \var{dry_run} (don't actually execute the steps) and \var{force} (rebuild everything, regardless of dependencies). All of these flags default to 0 (off). Note that you probably don't want to instantiate CCompiler or one of it's subclasses directly - use the \function{distutils.CCompiler.new_compiler} factory function instead. The following methods allow you to manually alter compiler options for the instance of the Compiler class. \begin{methoddesc}{add_include_dir}{dir} Add \var{dir} to the list of directories that will be searched for header files. The compiler is instructed to search directories in the order in which they are supplied by successive calls to \method{add_include_dir()}. \end{methoddesc} \begin{methoddesc}{set_include_dirs}{dirs} Set the list of directories that will be searched to \var{dirs} (a list of strings). Overrides any preceding calls to \method{add_include_dir()}; subsequent calls to \var{add_include_dir()} add to the list passed to \var{set_include_dirs()}. This does not affect any list of standard include directories that the compiler may search by default. \end{methoddesc} \begin{methoddesc}{add_library}{libname} Add \var{libname} to the list of libraries that will be included in all links driven by this compiler object. Note that \var{libname} should *not* be the name of a file containing a library, but the name of the library itself: the actual filename will be inferred by the linker, the compiler, or the compiler class (depending on the platform). The linker will be instructed to link against libraries in the order they were supplied to \method{add_library()} and/or \method{set_libraries()}. It is perfectly valid to duplicate library names; the linker will be instructed to link against libraries as many times as they are mentioned. \end{methoddesc} \begin{methoddesc}{set_libraries}{libnames} Set the list of libraries to be included in all links driven by this compiler object to \var{libnames} (a list of strings). This does not affect any standard system libraries that the linker may include by default. \end{methoddesc} \begin{methoddesc}{add_library_dir}{dir} Add \var{dir} to the list of directories that will be searched for libraries specified to \method{add_library()} and \method{set_libraries()}. The linker will be instructed to search for libraries in the order they are supplied to \method{add_library_dir()} and/or \method{set_library_dirs()}. \end{methoddesc} \begin{methoddesc}{set_library_dirs}{dirs} Set the list of library search directories to \var{dirs} (a list of strings). This does not affect any standard library search path that the linker may search by default. \end{methoddesc} \begin{methoddesc}{add_runtime_library_dir}{dir} Add \var{dir} to the list of directories that will be searched for shared libraries at runtime. \end{methoddesc} \begin{methoddesc}{set_runtime_library_dirs}{dirs} Set the list of directories to search for shared libraries at runtime to \var{dirs} (a list of strings). This does not affect any standard search path that the runtime linker may search by default. \end{methoddesc} \begin{methoddesc}{define_macro}{name\option{, value=None}} Define a preprocessor macro for all compilations driven by this compiler object. The optional parameter \var{value} should be a string; if it is not supplied, then the macro will be defined without an explicit value and the exact outcome depends on the compiler used (XXX true? does ANSI say anything about this?) \end{methoddesc} \begin{methoddesc}{undefine_macro}{name} Undefine a preprocessor macro for all compilations driven by this compiler object. If the same macro is defined by \method{define_macro()} and undefined by \method{undefine_macro()} the last call takes precedence (including multiple redefinitions or undefinitions). If the macro is redefined/undefined on a per-compilation basis (ie. in the call to \method{compile()}), then that takes precedence. \end{methoddesc} \begin{methoddesc}{add_link_object}{object} Add \var{object} to the list of object files (or analogues, such as explicitly named library files or the output of "resource compilers") to be included in every link driven by this compiler object. \end{methoddesc} \begin{methoddesc}{set_link_objects}{objects} Set the list of object files (or analogues) to be included in every link to \var{objects}. This does not affect any standard object files that the linker may include by default (such as system libraries). \end{methoddesc} The following methods implement methods for autodetection of compiler options, providing some functionality similar to GNU autoconf. \begin{methoddesc}{detect_language}{sources} Detect the language of a given file, or list of files. Uses the instance attributes \var{language_map} (a dictionary), and \var{language_order} (a list) to do the job. \end{methoddesc} \begin{methoddesc}{find_library_file}{dirs, lib\optional{, debug=0}} Search the specified list of directories for a static or shared library file \var{lib} and return the full path to that file. If \var{debug} is true, look for a debugging version (if that makes sense on the current platform). Return None if \var{lib} wasn't found in any of the specified directories. \end{methoddesc} \begin{methoddesc}{has_function}{funcname \optional{, includes=None, include_dirs=None, libraries=None, library_dirs=None}} Return a boolean indicating whether \var{funcname} is supported on the current platform. The optional arguments can be used to augment the compilation environment by providing additional include files and paths and libraries and paths. \end{methoddesc} \begin{methoddesc}{library_dir_option}{dir} Return the compiler option to add \var{dir} to the list of directories searched for libraries. \end{methoddesc} \begin{methoddesc}{library_option}{lib} Return the compiler option to add \var{dir} to the list of libraries linked into the shared library or executable. \end{methoddesc} \begin{methoddesc}{runtime_library_dir_option}{dir} Return the compiler option to add \var{dir} to the list of directories searched for runtime libraries. \end{methoddesc} \begin{methoddesc}{set_executables}{**args} Define the executables (and options for them) that will be run to perform the various stages of compilation. The exact set of executables that may be specified here depends on the compiler class (via the 'executables' class attribute), but most will have: \begin{tableii}{l|l}{attribute}{attribute}{description} \lineii{compiler}{the C/C++ compiler} \lineii{linker_so}{linker used to create shared objects and libraries} \lineii{linker_exe}{linker used to create binary executables} \lineii{archiver}{static library creator} \end{tableii} On platforms with a command-line (Unix, DOS/Windows), each of these is a string that will be split into executable name and (optional) list of arguments. (Splitting the string is done similarly to how Unix shells operate: words are delimited by spaces, but quotes and backslashes can override this. See \function{distutils.util.split_quoted()}.) \end{methoddesc} The following methods invoke stages in the build process. \begin{methoddesc}{compile}{sources\optional{, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None}} Compile one or more source files. Generates object files (e.g. transforms a .c file to a .o file. \var{sources} must be a list of filenames, most likely C/C++ files, but in reality anything that can be handled by a particular compiler and compiler class (eg. \class{MSVCCompiler} can handle resource files in \var{sources}). Return a list of object filenames, one per source filename in \var{sources}. Depending on the implementation, not all source files will necessarily be compiled, but all corresponding object filenames will be returned. If \var{output_dir} is given, object files will be put under it, while retaining their original path component. That is, \var{foo/bar.c} normally compiles to \var{foo/bar.o} (for a Unix implementation); if \var{output_dir} is \var{build}, then it would compile to \var{build/foo/bar.o}. \var{macros}, if given, must be a list of macro definitions. A macro definition is either a \var{(name, value)} 2-tuple or a \var{(name,)} 1-tuple. The former defines a macro; if the value is None, the macro is defined without an explicit value. The 1-tuple case undefines a macro. Later definitions/redefinitions/undefinitions take precedence. \var{include_dirs}, if given, must be a list of strings, the directories to add to the default include file search path for this compilation only. \var{debug} is a boolean; if true, the compiler will be instructed to output debug symbols in (or alongside) the object file(s). \var{extra_preargs} and \var{extra_postargs} are implementation- dependent. On platforms that have the notion of a command-line (e.g. Unix, DOS/Windows), they are most likely lists of strings: extra command-line arguments to prepand/append to the compiler command line. On other platforms, consult the implementation class documentation. In any event, they are intended as an escape hatch for those occasions when the abstract compiler framework doesn't cut the mustard. \var{depends}, if given, is a list of filenames that all targets depend on. If a source file is older than any file in depends, then the source file will be recompiled. This supports dependency tracking, but only at a coarse granularity. Raises \exception{CompileError} on failure. \end{methoddesc} \begin{methoddesc}{create_static_lib}{objects, output_libname\optional{, output_dir=None, debug=0, target_lang=None}} Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as \var{objects}, the extra object files supplied to \method{add_link_object()} and/or \method{set_link_objects()}, the libraries supplied to \method{add_library()' and/or \method{set_libraries()}, and the libraries supplied as \var{libraries} (if any). \var{output_libname} should be a library name, not a filename; the filename will be inferred from the library name. \var{output_dir} is the directory where the library file will be put. XXX defaults to what? \var{debug} is a boolean; if true, debugging information will be included in the library (note that on most platforms, it is the compile step where this matters: the \var{debug} flag is included here just for consistency). \var{target_lang} is the target language for which the given objects are being compiled. This allows specific linkage time treatment of certain languages. Raises \exception{LibError} on failure. \end{methoddesc} \begin{methoddesc}{link}{target_desc, objects, output_filename\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None}} Link a bunch of stuff together to create an executable or shared library file. The "bunch of stuff" consists of the list of object files supplied as \var{objects}. \var{output_filename} should be a filename. If \var{output_dir} is supplied, \var{output_filename' is relative to it (i.e. \var{output_filename} can provide directory components if needed). \var{libraries} is a list of libraries to link against. These are library names, not filenames, since they're translated into filenames in a platform-specific way (eg. "foo" becomes "libfoo.a" on Unix and "foo.lib" on DOS/Windows). However, they can include a directory component, which means the linker will look in that specific directory rather than searching all the normal locations. \var{library_dirs}, if supplied, should be a list of directories to search for libraries that were specified as bare library names (ie. no directory component). These are on top of the system default and those supplied to \method{add_library_dir()} and/or \method{set_library_dirs()}. \var{runtime_library_dirs} is a list of directories that will be embedded into the shared library and used to search for other shared libraries that *it* depends on at run-time. (This may only be relevant on Unix.) \var{export_symbols} is a list of symbols that the shared library will export. (This appears to be relevant only on Windows.) \var{debug} is as for \method{compile()} and \method{create_static_lib()}, with the slight distinction that it actually matters on most platforms (as opposed to \method{create_static_lib()}, which includes a \var{debug} flag mostly for form's sake). \var{extra_preargs} and \var{extra_postargs} are as for \method{compile()} (except of course that they supply command-line arguments for the particular linker being used). \var{target_lang} is the target language for which the given objects are being compiled. This allows specific linkage time treatment of certain languages. Raises \exception{LinkError} on failure. \end{methoddesc} \begin{methoddesc}{link_executable}{objects, output_progname\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, target_lang=None}} Link an executable. \var{output_progname} is the name of the file executable, while \var{objects} are a list of object filenames to link in. Other arguments are as for the \method{link} method. \end{methoddesc} \begin{methoddesc}{link_shared_lib}{objects, output_libname\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None}} Link a shared library. \var{output_libname} is the name of the output library, while \var{objects} is a list of object filenames to link in. Other arguments are as for the \method{link} method. \end{methoddesc} \begin{methoddesc}{link_shared_object}{objects, output_filename\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None}} Link a shared object. \var{output_filename} is the name of the shared object that will be created, while \var{objects} is a list of object filenames to link in. Other arguments are as for the \method{link} method. \end{methoddesc} \begin{methoddesc}{preprocess}{source\optional{, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None}} Preprocess a single C/C++ source file, named in \var{source}. Output will be written to file named \var{output_file}, or \var{stdout} if \var{output_file} not supplied. \var{macros} is a list of macro definitions as for \method{compile()}, which will augment the macros set with \method{define_macro()} and \method{undefine_macro()}. \var{include_dirs} is a list of directory names that will be added to the default list, in the same way as \method{add_include_dir()}. Raises \exception{PreprocessError} on failure. \end{methoddesc} The following utility methods are defined by the \class{CCompiler} class, for use by the various concrete subclasses. \begin{methoddesc}{executable_filename}{basename\optional{, strip_dir=0, output_dir=''}} Returns the filename of the executable for the given \var{basename}. Typically for non-Windows platforms this is the same as the basename, while Windows will get a '.exe' added. \end{methoddesc} \begin{methoddesc}{library_filename}{libname\optional{, lib_type='static', strip_dir=0, output_dir=''}} Returns the filename for the given library name on the current platform. On unix a library with \var{lib_type} of 'static' will typically be of the form "liblibname.a", while a \var{lib_type} of 'dynamic' will be of the form "liblibname.so". \end{methoddesc} \begin{methoddesc}{object_filenames}{source_filenames\optional{, strip_dir=0, output_dir=''}} Returns the name of the object files for the given source files. \var{source_filenames} should be a list of filenames. \end{methoddesc} \begin{methoddesc}{shared_object_filename}{basename\optional{, strip_dir=0, output_dir=''}} Returns the name of a shared object file for the given file name \var{basename}. \end{methoddesc} \begin{methoddesc}{execute}{func, args\optional{, msg=None, level=1}} Invokes \function{distutils.util.execute()} This method invokes a python function \var{func} with the given arguments \var{args}, after logging and taking into account the \var{dry_run} flag. XXX see also. \end{methoddesc} \begin{methoddesc}{spawn}{cmd} Invokes \function{distutils.util.spawn()}. This invokes an external process to run the given command. XXX see also. \end{methoddesc} \begin{methoddesc}{mkpath}{name\optional{, mode=511}} Invokes \function{distutils.dir_util.mkpath()}. This creates a directory and any missing ancestor directories. XXX see also. \end{methoddesc} \begin{methoddesc}{move_file}{src, dst} Invokes \method{distutils.file_util.move_file()}. Renames \var{src} to \var{dst}. XXX see also. \end{methoddesc} \begin{methoddesc}{announce}{msg\optional{, level=1}} Write a message using \function{distutils.log.debug()}. XXX see also. \end{methoddesc} \begin{methoddesc}{warn}{msg} Write a warning message \var{msg} to standard error. \end{methoddesc} \begin{methoddesc}{debug_print}{msg} If the \var{debug} flag is set on this \class{CCompiler} instance, print \var{msg} to standard output, otherwise do nothing. \end{methoddesc} \end{classdesc} \subsection{Compiler-specific modules} The following modules implement concrete subclasses of the abstract CCompiler class. They should not be instantiated directly, but should be created using \function{distutils.ccompiler.new_compiler()} factory function. \declaremodule{distutils.unixccompiler} \modulesynopsis{Unix C Compiler} This module provides the \class{UnixCCompiler} class, a subclass of \class{CCompiler} that handles the "typical" Unix-style command-line C compiler: \begin{itemize} \item macros defined with -Dname[=value] \item macros undefined with -Uname \item include search directories specified with -Idir \item libraries specified with -lllib \item library search directories specified with -Ldir \item compile handled by 'cc' (or similar) executable with -c option: compiles .c to .o \item link static library handled by 'ar' command (possibly with 'ranlib') \item link shared library handled by 'cc -shared' \end{itemize} \declaremodule{distutils.msvccompiler} \modulesynopsis{Microsoft Compiler} This module provides \class{MSVCCompiler}, an implementation of the abstract \class{CCompiler} class for Microsoft Visual Studio. It should also work using the freely available compiler provided as part of the .Net SDK download. XXX download link. \declaremodule{distutils.bcppcompiler} This module provides \class{BorlandCCompiler}, an subclass of the abstract \class{CCompiler} class for the Borland C++ compiler. \declaremodule{distutils.cygwinccompiler} This module provides the \class{CygwinCCompiler} class, a subclass of \class{UnixCCompiler} that handles the Cygwin port of the GNU C compiler to Windows. It also contains the Mingw32CCompiler class which handles the mingw32 port of GCC (same as cygwin in no-cygwin mode). \declaremodule{distutils.emxccompiler} This module provides the EMXCCompiler class, a subclass of \class{UnixCCompiler} that handles the EMX port of the GNU C compiler to OS/2. \declaremodule{distutils.mwerkscompiler} Contains \class{MWerksCompiler}, an implementation of the abstract CCompiler class for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on Windows. \subsection{Utility modules} The following modules all provide general utility functions. Haven't been documented yet. \declaremodule{standard}{distutils.util} \modulesynopsis{ } \declaremodule{standard}{distutils.archive_util} \modulesynopsis{ } \declaremodule{standard}{distutils.dep_util} \modulesynopsis{ } \declaremodule{standard}{distutils.dir_util} \modulesynopsis{ } \declaremodule{standard}{distutils.file_util} \modulesynopsis{ } \subsection{Ungrouped modules} The following haven't been moved into a more appropriate section yet. \declaremodule{standard}{distutils.debug} \modulesynopsis{ } \declaremodule{standard}{distutils.dist} \modulesynopsis{ } \declaremodule{standard}{distutils.errors} \modulesynopsis{ } \declaremodule{standard}{distutils.extension} \modulesynopsis{ } \declaremodule{standard}{distutils.fancy_getopt} \modulesynopsis{ } \declaremodule{standard}{distutils.filelist} \modulesynopsis{ } \declaremodule{standard}{distutils.log} \modulesynopsis{ } \declaremodule{standard}{distutils.magic} \modulesynopsis{ } \declaremodule{standard}{distutils.spawn} \modulesynopsis{ } \declaremodule{standard}{distutils.sysconfig} \modulesynopsis{ } \declaremodule{standard}{distutils.text_file} \modulesynopsis{ } \declaremodule{standard}{distutils.version} \modulesynopsis{implements classes that represent module version numbers. } \subsection{Distutils Commands} This part of Distutils implements the various Distutils commands, such as 'build', 'install' &c. \declaremodule{standard}{distutils.cmd} \modulesynopsis{This module provides the abstract base class Command. This class is subclassed by the modules in the distutils.command subpackage. } \declaremodule{standard}{distutils.command} \modulesynopsis{This subpackage contains one module for each standard Distutils command.} \subsubsection{Individual Distutils commands} \declaremodule{standard}{distutils.command.bdist} \modulesynopsis{Build a binary installer for a package} \declaremodule{standard}{distutils.command.bdist_packager} \modulesynopsis{Abstract base class for packagers} \declaremodule{standard}{distutils.command.bdist_dumb} \modulesynopsis{Build a "dumb" installer - a simple archive of files} %\declaremodule{standard}{distutils.command.bdist_pkgtool} %\modulesynopsis{ } %\declaremodule{standard}{distutils.command.bdist_sdux} %\modulesynopsis{ } \declaremodule{standard}{distutils.command.bdist_rpm} \modulesynopsis{Build a binary distribution as a Redhat RPM and SRPM} \declaremodule{standard}{distutils.command.bdist_wininst} \modulesynopsis{Build a Windows installer} \declaremodule{standard}{distutils.command.sdist} \modulesynopsis{Build a source distribution} \declaremodule{standard}{distutils.command.build} \modulesynopsis{Build all files of a package} \declaremodule{standard}{distutils.command.build_clib} \modulesynopsis{Build any C libraries in a package} \declaremodule{standard}{distutils.command.build_ext} \modulesynopsis{Build any extensions in a package} \declaremodule{standard}{distutils.command.build_py} \modulesynopsis{Build the .py/.pyc files of a package} \declaremodule{standard}{distutils.command.build_scripts} \modulesynopsis{Build the scripts of a package} \declaremodule{standard}{distutils.command.clean} \modulesynopsis{Clean a package build area} \declaremodule{standard}{distutils.command.config} \modulesynopsis{Perform package configuration} \declaremodule{standard}{distutils.command.install} \modulesynopsis{Install a package} \declaremodule{standard}{distutils.command.install_data} \modulesynopsis{Install data files from a package} \declaremodule{standard}{distutils.command.install_headers} \modulesynopsis{Install C/C++ header files from a package} \declaremodule{standard}{distutils.command.install_lib} \modulesynopsis{Install library files from a package} \declaremodule{standard}{distutils.command.install_scripts} \modulesynopsis{Install script files from a package} \declaremodule{standard}{distutils.command.register} \modulesynopsis{Register a module with the Python Package Index} \subsubsection{Creating a new Distutils command} This section will go through the steps to create a new Distutils command. From bcannon@users.sourceforge.net Tue May 13 07:43:01 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 12 May 2003 23:43:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb185.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv8507/Lib/test Modified Files: test_bsddb185.py Log Message: Fixed test_anydbm_creates to use proper paths for the created db. Made some stylistic fixes. Index: test_bsddb185.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb185.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_bsddb185.py 6 May 2003 20:37:56 -0000 1.2 --- test_bsddb185.py 13 May 2003 06:42:59 -0000 1.3 *************** *** 1,3 **** --- 1,8 ---- + """Tests for the bsddb185 module. + + The file 185test.db found in Lib/test/ is for testing purposes with this + testing suite. + """ from test.test_support import verbose, run_unittest, findfile import unittest *************** *** 9,14 **** class Bsddb185Tests(unittest.TestCase): def test_open_existing_hash(self): ! "verify we can open a file known to be a hash v2 file" db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") --- 14,20 ---- class Bsddb185Tests(unittest.TestCase): + def test_open_existing_hash(self): ! # Verify we can open a file known to be a hash v2 file db = bsddb185.hashopen(findfile("185test.db")) self.assertEqual(db["1"], "1") *************** *** 16,30 **** def test_whichdb(self): ! "verify that whichdb correctly sniffs the known hash v2 file" self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") def test_anydbm_create(self): ! "verify that anydbm.open does *not* create a bsddb185 file" tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") ! anydbm.open(dbfile, "c").close() ! ftype = whichdb.whichdb(findfile("foo.db")) self.assertNotEqual(ftype, "bsddb185") finally: --- 22,36 ---- def test_whichdb(self): ! # Verify that whichdb correctly sniffs the known hash v2 file self.assertEqual(whichdb.whichdb(findfile("185test.db")), "bsddb185") def test_anydbm_create(self): ! # Verify that anydbm.open does *not* create a bsddb185 file tmpdir = tempfile.mkdtemp() try: try: dbfile = os.path.join(tmpdir, "foo.db") ! anydbm.open(os.path.splitext(dbfile)[0], "c").close() ! ftype = whichdb.whichdb(dbfile) self.assertNotEqual(ftype, "bsddb185") finally: From anthonybaxter@users.sourceforge.net Tue May 13 09:15:22 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 13 May 2003 01:15:22 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv28005 Modified Files: distref.tex Log Message: fixed up basic formatting errors (thanks texcheck.py!) Still whinges about forward slashes - no idea why, but lots of other entries in the library docs use them, so... *shrug* Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** distref.tex 13 May 2003 03:07:56 -0000 1.1 --- distref.tex 13 May 2003 08:15:19 -0000 1.2 *************** *** 97,101 **** \class{Distribution})} \lineii{run}{Stop after all commands have been run (the same as ! if \function{setup()} had been called in the usual way. This is the default value.} \end{tableii} --- 97,101 ---- \class{Distribution})} \lineii{run}{Stop after all commands have been run (the same as ! if \function{setup()} had been called in the usual way). This is the default value.} \end{tableii} *************** *** 153,157 **** Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults ! to \var{os.name' (eg. \var{posix}, \var{nt}), and \var{compiler} defaults to the default compiler for that platform. Currently only \var{posix} and \var{nt} are supported, and the default compilers are "traditional --- 153,157 ---- Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults ! to \var{os.name} (eg. \var{posix}, \var{nt}), and \var{compiler} defaults to the default compiler for that platform. Currently only \var{posix} and \var{nt} are supported, and the default compilers are "traditional *************** *** 256,260 **** \end{methoddesc} ! \begin{methoddesc}{define_macro}{name\option{, value=None}} Define a preprocessor macro for all compilations driven by this compiler object. The optional parameter \var{value} should be a --- 256,260 ---- \end{methoddesc} ! \begin{methoddesc}{define_macro}{name\optional{, value=None}} Define a preprocessor macro for all compilations driven by this compiler object. The optional parameter \var{value} should be a *************** *** 352,356 **** \begin{methoddesc}{compile}{sources\optional{, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None}} Compile one or more source files. Generates object files (e.g. ! transforms a .c file to a .o file. \var{sources} must be a list of filenames, most likely C/C++ --- 352,356 ---- \begin{methoddesc}{compile}{sources\optional{, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None}} Compile one or more source files. Generates object files (e.g. ! transforms a .c file to a .o file.) \var{sources} must be a list of filenames, most likely C/C++ *************** *** 406,410 **** as \var{objects}, the extra object files supplied to \method{add_link_object()} and/or \method{set_link_objects()}, the libraries ! supplied to \method{add_library()' and/or \method{set_libraries()}, and the libraries supplied as \var{libraries} (if any). --- 406,410 ---- as \var{objects}, the extra object files supplied to \method{add_link_object()} and/or \method{set_link_objects()}, the libraries ! supplied to \method{add_library()} and/or \method{set_libraries()}, and the libraries supplied as \var{libraries} (if any). *************** *** 431,435 **** The "bunch of stuff" consists of the list of object files supplied as \var{objects}. \var{output_filename} should be a filename. If ! \var{output_dir} is supplied, \var{output_filename' is relative to it (i.e. \var{output_filename} can provide directory components if needed). --- 431,435 ---- The "bunch of stuff" consists of the list of object files supplied as \var{objects}. \var{output_filename} should be a filename. If ! \var{output_dir} is supplied, \var{output_filename} is relative to it (i.e. \var{output_filename} can provide directory components if needed). From anthonybaxter@users.sourceforge.net Tue May 13 11:14:16 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 13 May 2003 03:14:16 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv29063 Modified Files: distref.tex Log Message: Placeholders for all modules now. much utility documentation. Correct LaTeX use for section/subsection/&c. Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** distref.tex 13 May 2003 08:15:19 -0000 1.2 --- distref.tex 13 May 2003 10:14:14 -0000 1.3 *************** *** 1,7 **** ! \section{\module{distutils} --- ! Building and installing Python modules, reference.} ! \sectionauthor {Anthony Baxter}{anthony@interlink.com.au} ! \sectionauthor {Greg Ward}{gward@python.net} The \module{distutils} package provides support for building and --- 1,10 ---- ! \chapter{Building and installing Python modules, the Compleat Reference.} ! ! %\sectionauthor {Anthony Baxter}{anthony@interlink.com.au} ! %\sectionauthor {Greg Ward}{gward@python.net} ! ! \index{distutils} ! \declaremodule{standard}{distutils} The \module{distutils} package provides support for building and *************** *** 15,18 **** --- 18,25 ---- \section{The simple interface} + \index{setup.py} + + \subsection{\module{distutils.core} -- Core Distutils functionality} + \declaremodule{standard}{distutils.core} \modulesynopsis{The core Distutils functionality} *************** *** 32,36 **** \begin{tableiii}{c|l|l}{argument name}{argument name}{value}{notes} \lineiii{name}{The name of the package}{a string} ! \lineiii{version}{The version number of the package}{See \module{distutils.Version}} \lineiii{description}{A single line describing the package}{a string} \lineiii{long_description}{Longer description of the package}{a string} --- 39,43 ---- \begin{tableiii}{c|l|l}{argument name}{argument name}{value}{notes} \lineiii{name}{The name of the package}{a string} ! \lineiii{version}{The version number of the package}{See \refmodule{distutils.version}} \lineiii{description}{A single line describing the package}{a string} \lineiii{long_description}{Longer description of the package}{a string} *************** *** 41,50 **** \lineiii{url}{A URL for the package (homepage)}{a URL} \lineiii{download_url}{A URL to download the package}{a URL} ! \lineiii{packages}{A list of python packages that distutils will manipulate}{a list of strings} ! \lineiii{py_modules}{A list of python modules that distutils will manipulate}{a list of strings} \lineiii{scripts}{A list of standalone script files to be built and installed}{a list of strings} ! \lineiii{ext_modules}{A list of python extensions to be built. A list of instances of \class{distutils.core.Extension}} ! \lineiii{classifiers}{A list of Trove categories for the package} {XXX link to better definition} \lineiii{distclass}{}{} \lineiii{script_name}{}{} --- 48,57 ---- \lineiii{url}{A URL for the package (homepage)}{a URL} \lineiii{download_url}{A URL to download the package}{a URL} ! \lineiii{packages}{A list of Python packages that distutils will manipulate}{a list of strings} ! \lineiii{py_modules}{A list of Python modules that distutils will manipulate}{a list of strings} \lineiii{scripts}{A list of standalone script files to be built and installed}{a list of strings} ! \lineiii{ext_modules}{A list of Python extensions to be built}{A list of instances of \class{distutils.core.Extension}} ! \lineiii{classifiers}{A list of Trove categories for the package}{XXX link to better definition} \lineiii{distclass}{}{} \lineiii{script_name}{}{} *************** *** 60,66 **** \begin{itemize} ! \item The \class{Distribution} from \module{distutils.dist} ! \item The \class{Command} from \module{distutils.cmd} ! \item The \class{Extension} from \module{distutils.extension} \end{itemize} --- 67,73 ---- \begin{itemize} ! \item The \class{Distribution} from \refmodule{distutils.dist} ! \item The \class{Command} from \refmodule{distutils.cmd} ! \item The \class{Extension} from \refmodule{distutils.extension} \end{itemize} *************** *** 102,106 **** \end{funcdesc} ! \section{The more complex interface} Most people will never need anything other than the \function{setup()} --- 109,113 ---- \end{funcdesc} ! \section{The low-level interface} Most people will never need anything other than the \function{setup()} *************** *** 109,112 **** --- 116,120 ---- a whole host of additional modules and functionality provided. + \subsection{\module{distutils.ccompiler} -- CCompiler base class} \declaremodule{standard}{distutils.ccompiler} \modulesynopsis{Abstract CCompiler class} *************** *** 130,139 **** \begin{funcdesc}{gen_preprocess_options}{macros, include_dirs} Generate C pre-processor options (-D, -U, -I) as used by at least ! two types of compilers: the typical Unix compiler and Visual C++. \var{macros} is the usual thing, a list of 1- or 2-tuples, where \var{(name,)} means undefine (-U) macro \var{name}, and \var{(name,value)} means define (-D) macro \var{name} to \var{value}. \var{include_dirs} is just a list of directory names to be added to the header file search path (-I). Returns a list ! of command-line options suitable for either Unix compilers or Visual C++. \end{funcdesc} --- 138,147 ---- \begin{funcdesc}{gen_preprocess_options}{macros, include_dirs} Generate C pre-processor options (-D, -U, -I) as used by at least ! two types of compilers: the typical \UNIX compiler and Visual C++. \var{macros} is the usual thing, a list of 1- or 2-tuples, where \var{(name,)} means undefine (-U) macro \var{name}, and \var{(name,value)} means define (-D) macro \var{name} to \var{value}. \var{include_dirs} is just a list of directory names to be added to the header file search path (-I). Returns a list ! of command-line options suitable for either \UNIX compilers or Visual C++. \end{funcdesc} *************** *** 156,163 **** defaults to the default compiler for that platform. Currently only \var{posix} and \var{nt} are supported, and the default compilers are "traditional ! Unix interface" (\class{UnixCCompiler} class) and Visual C++ (\class{MSVCCompiler} class). Note that it's perfectly possible to ask ! for a Unix compiler object under Windows, and a Microsoft compiler object ! under Unix -- if you supply a value for \var{compiler}, \var{plat} is ignored. \end{funcdesc} --- 164,171 ---- defaults to the default compiler for that platform. Currently only \var{posix} and \var{nt} are supported, and the default compilers are "traditional ! \UNIX interface" (\class{UnixCCompiler} class) and Visual C++ (\class{MSVCCompiler} class). Note that it's perfectly possible to ask ! for a \UNIX compiler object under Windows, and a Microsoft compiler object ! under \UNIX -- if you supply a value for \var{compiler}, \var{plat} is ignored. \end{funcdesc} *************** *** 293,298 **** \begin{methoddesc}{detect_language}{sources} Detect the language of a given file, or list of files. Uses the ! instance attributes \var{language_map} (a dictionary), and \var{language_order} ! (a list) to do the job. \end{methoddesc} --- 301,306 ---- \begin{methoddesc}{detect_language}{sources} Detect the language of a given file, or list of files. Uses the ! instance attributes \member{language_map} (a dictionary), and ! \member{language_order} (a list) to do the job. \end{methoddesc} *************** *** 340,347 **** \end{tableii} ! On platforms with a command-line (Unix, DOS/Windows), each of these is a string that will be split into executable name and (optional) list of arguments. (Splitting the string is done similarly to how ! Unix shells operate: words are delimited by spaces, but quotes and backslashes can override this. See \function{distutils.util.split_quoted()}.) --- 348,355 ---- \end{tableii} ! On platforms with a command-line (\UNIX, DOS/Windows), each of these is a string that will be split into executable name and (optional) list of arguments. (Splitting the string is done similarly to how ! \UNIX shells operate: words are delimited by spaces, but quotes and backslashes can override this. See \function{distutils.util.split_quoted()}.) *************** *** 364,371 **** If \var{output_dir} is given, object files will be put under it, while ! retaining their original path component. That is, \var{foo/bar.c} ! normally compiles to \var{foo/bar.o} (for a Unix implementation); if \var{output_dir} is \var{build}, then it would compile to ! \var{build/foo/bar.o}. \var{macros}, if given, must be a list of macro definitions. A macro --- 372,379 ---- If \var{output_dir} is given, object files will be put under it, while ! retaining their original path component. That is, \file{foo/bar.c} ! normally compiles to \file{foo/bar.o} (for a \UNIX implementation); if \var{output_dir} is \var{build}, then it would compile to ! \file{build/foo/bar.o}. \var{macros}, if given, must be a list of macro definitions. A macro *************** *** 384,388 **** \var{extra_preargs} and \var{extra_postargs} are implementation- dependent. ! On platforms that have the notion of a command-line (e.g. Unix, DOS/Windows), they are most likely lists of strings: extra command-line arguments to prepand/append to the compiler command --- 392,396 ---- \var{extra_preargs} and \var{extra_postargs} are implementation- dependent. ! On platforms that have the notion of a command-line (e.g. \UNIX, DOS/Windows), they are most likely lists of strings: extra command-line arguments to prepand/append to the compiler command *************** *** 437,442 **** \var{libraries} is a list of libraries to link against. These are library names, not filenames, since they're translated into ! filenames in a platform-specific way (eg. "foo" becomes "libfoo.a" ! on Unix and "foo.lib" on DOS/Windows). However, they can include a directory component, which means the linker will look in that specific directory rather than searching all the normal locations. --- 445,450 ---- \var{libraries} is a list of libraries to link against. These are library names, not filenames, since they're translated into ! filenames in a platform-specific way (eg. \var{foo} becomes \file{libfoo.a} ! on \UNIX and \file{foo.lib} on DOS/Windows). However, they can include a directory component, which means the linker will look in that specific directory rather than searching all the normal locations. *************** *** 449,453 **** directories that will be embedded into the shared library and used to search for other shared libraries that *it* depends on at ! run-time. (This may only be relevant on Unix.) \var{export_symbols} is a list of symbols that the shared library will --- 457,461 ---- directories that will be embedded into the shared library and used to search for other shared libraries that *it* depends on at ! run-time. (This may only be relevant on \UNIX.) \var{export_symbols} is a list of symbols that the shared library will *************** *** 459,464 **** mostly for form's sake). ! \var{extra_preargs} and \var{extra_postargs} are as for \method{compile()} (except ! of course that they supply command-line arguments for the particular linker being used). --- 467,472 ---- mostly for form's sake). ! \var{extra_preargs} and \var{extra_postargs} are as for \method{compile()} ! (except of course that they supply command-line arguments for the particular linker being used). *************** *** 507,518 **** Returns the filename of the executable for the given \var{basename}. Typically for non-Windows platforms this is the same as the basename, ! while Windows will get a '.exe' added. \end{methoddesc} \begin{methoddesc}{library_filename}{libname\optional{, lib_type='static', strip_dir=0, output_dir=''}} Returns the filename for the given library name on the current platform. ! On unix a library with \var{lib_type} of 'static' will typically be of the ! form "liblibname.a", while a \var{lib_type} of 'dynamic' will be of ! the form "liblibname.so". \end{methoddesc} --- 515,526 ---- Returns the filename of the executable for the given \var{basename}. Typically for non-Windows platforms this is the same as the basename, ! while Windows will get a \file{.exe} added. \end{methoddesc} \begin{methoddesc}{library_filename}{libname\optional{, lib_type='static', strip_dir=0, output_dir=''}} Returns the filename for the given library name on the current platform. ! On \UNIX a library with \var{lib_type} of 'static' will typically be of the ! form \file{liblibname.a}, while a \var{lib_type} of 'dynamic' will be of ! the form \file{liblibname.so}. \end{methoddesc} *************** *** 528,532 **** \begin{methoddesc}{execute}{func, args\optional{, msg=None, level=1}} Invokes \function{distutils.util.execute()} This method invokes a ! python function \var{func} with the given arguments \var{args}, after logging and taking into account the \var{dry_run} flag. XXX see also. \end{methoddesc} --- 536,540 ---- \begin{methoddesc}{execute}{func, args\optional{, msg=None, level=1}} Invokes \function{distutils.util.execute()} This method invokes a ! Python function \var{func} with the given arguments \var{args}, after logging and taking into account the \var{dry_run} flag. XXX see also. \end{methoddesc} *************** *** 566,578 **** The following modules implement concrete subclasses of the abstract ! CCompiler class. They should not be instantiated directly, but should be created using \function{distutils.ccompiler.new_compiler()} factory function. ! \declaremodule{distutils.unixccompiler} ! \modulesynopsis{Unix C Compiler} This module provides the \class{UnixCCompiler} class, a subclass of ! \class{CCompiler} that handles the "typical" Unix-style command-line C compiler: --- 574,587 ---- The following modules implement concrete subclasses of the abstract ! \class{CCompiler} class. They should not be instantiated directly, but should be created using \function{distutils.ccompiler.new_compiler()} factory function. ! \subsubsection{\module{distutils.unixccompiler} -- Unix C Compiler} ! \declaremodule{standard}{distutils.unixccompiler} ! \modulesynopsis{UNIX C Compiler} This module provides the \class{UnixCCompiler} class, a subclass of ! \class{CCompiler} that handles the "typical" \UNIX-style command-line C compiler: *************** *** 589,593 **** \end{itemize} ! \declaremodule{distutils.msvccompiler} \modulesynopsis{Microsoft Compiler} --- 598,603 ---- \end{itemize} ! \subsubsection{\module{distutils.msvccompiler} -- Microsoft Compiler} ! \declaremodule{standard}{distutils.msvccompiler} \modulesynopsis{Microsoft Compiler} *************** *** 597,605 **** download link. ! \declaremodule{distutils.bcppcompiler} ! This module provides \class{BorlandCCompiler}, an subclass of the abstract \class{CCompiler} class for the Borland C++ compiler. ! \declaremodule{distutils.cygwinccompiler} This module provides the \class{CygwinCCompiler} class, a subclass of \class{UnixCCompiler} that --- 607,616 ---- download link. ! \subsubsection{\module{distutils.bcppcompiler} -- Borland Compiler} ! \declaremodule{standard}{distutils.bcppcompiler} This module provides \class{BorlandCCompiler}, an subclass of the abstract \class{CCompiler} class for the Borland C++ compiler. ! \subsubsection{\module{distutils.cygwincompiler} -- Cygwin Compiler} ! \declaremodule{standard}{distutils.cygwinccompiler} This module provides the \class{CygwinCCompiler} class, a subclass of \class{UnixCCompiler} that *************** *** 608,675 **** cygwin in no-cygwin mode). ! \declaremodule{distutils.emxccompiler} This module provides the EMXCCompiler class, a subclass of \class{UnixCCompiler} that handles the EMX port of the GNU C compiler to OS/2. ! \declaremodule{distutils.mwerkscompiler} ! Contains \class{MWerksCompiler}, an implementation of the abstract CCompiler class for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on ! Windows. \subsection{Utility modules} ! The following modules all provide general utility functions. Haven't ! been documented yet. \declaremodule{standard}{distutils.util} ! \modulesynopsis{ } ! \declaremodule{standard}{distutils.archive_util} ! \modulesynopsis{ } - \declaremodule{standard}{distutils.dep_util} - \modulesynopsis{ } ! \declaremodule{standard}{distutils.dir_util} ! \modulesynopsis{ } ! \declaremodule{standard}{distutils.file_util} ! \modulesynopsis{ } - \subsection{Ungrouped modules} The following haven't been moved into a more appropriate section yet. \declaremodule{standard}{distutils.debug} ! \modulesynopsis{ } ! \declaremodule{standard}{distutils.dist} ! \modulesynopsis{ } \declaremodule{standard}{distutils.errors} ! \modulesynopsis{ } ! \declaremodule{standard}{distutils.extension} ! \modulesynopsis{ } ! \declaremodule{standard}{distutils.fancy_getopt} ! \modulesynopsis{ } \declaremodule{standard}{distutils.filelist} ! \modulesynopsis{ } \declaremodule{standard}{distutils.log} ! \modulesynopsis{ } - \declaremodule{standard}{distutils.magic} - \modulesynopsis{ } \declaremodule{standard}{distutils.spawn} ! \modulesynopsis{ } \declaremodule{standard}{distutils.sysconfig} ! \modulesynopsis{ } - \declaremodule{standard}{distutils.text_file} - \modulesynopsis{ } \declaremodule{standard}{distutils.version} \modulesynopsis{implements classes that represent module version numbers. } --- 619,886 ---- cygwin in no-cygwin mode). ! \subsubsection{\module{distutils.emxccompiler} -- OS/2 EMX Compiler} ! \declaremodule{standard}{distutils.emxccompiler} ! \modulesynopsis{OS/2 EMX Compiler support} ! This module provides the EMXCCompiler class, a subclass of \class{UnixCCompiler} that handles the EMX port of the GNU C compiler to OS/2. ! \subsubsection{\module{distutils.mwerkscompiler} -- Metrowerks CodeWarrior support} ! \declaremodule{standard}{distutils.mwerkscompiler} ! \modulesynopsis{Metrowerks CodeWarrior support} ! ! Contains \class{MWerksCompiler}, an implementation of the abstract ! \class{CCompiler} class for MetroWerks CodeWarrior on the Macintosh. Needs work to support CW on Windows. ! ! \subsubsection{Implementing a new compiler} ! ! This will discuss steps needed to support a new compiler. \subsection{Utility modules} ! The following modules all provide general utility functions. They havent ! all been documented yet. ! ! \subsubsection{\module{distutils.archive_util} -- ! Archiving utilities} ! \declaremodule[distutils.archiveutil]{standard}{distutils.archive_util} ! \modulesynopsis{Utility functions for creating archive files (tarballs, zip files, ...)} ! ! This module provides a few functions for creating archive files, such as ! tarballs or zipfiles. ! ! \begin{funcdesc}{make_archive}{base_name, format\optional{, root_dir=None, base_dir=None, verbose=0, dry_run=0}} ! Create an archive file (eg. \code{zip} or \code{tar}). \var{base_name} ! is the name of the file to create, minus any format-specific extension; ! \var{format} is the archive format: one of \code{zip}, \code{tar}, ! \code{ztar}, or \code{gztar}. ! \var{root_dir} is a directory that will be the root directory of the ! archive; ie. we typically \code{chdir} into \var{root_dir} before ! creating the archive. \var{base_dir} is the directory where we start ! archiving from; ie. \var{base_dir} will be the common prefix of all files and ! directories in the archive. \var{root_dir} and \var{base_dir} both default ! to the current directory. Returns the name of the archive file. ! ! \warning{This should be changed to support bz2 files} ! \end{funcdesc} ! ! \begin{funcdesc}{make_tarball}{base_name, base_dir\optional{, compress="gzip", verbose=0, dry_run=0}} ! Create an (optional compressed) archive as a tar file from all files in and under \var{base_dir}. \var{compress} must be \code{"gzip"} (the default), ! \code{"compress"}, \code{"bzip2"}, or \code{None}. Both \code{"tar"} ! and the compression utility named by \var{'compress'} must be on the ! default program search path, so this is probably Unix-specific. The ! output tar file will be named \var{'base_dir'} + ! \code{".tar"}, possibly plus the appropriate compression extension ! (\code{".gz"}, \code{".bz2"} or \code{".Z"}). Return the output filename. ! ! \warning{This should be replaced with calls to the \refmodule{tarfile} module.} ! \end{funcdesc} ! ! \begin{funcdesc}{make_zipfile}{base_name, base_dir\optional{, verbose=0, dry_run=0}} ! Create a zip file from all files in and under \var{base_dir}. The output ! zip file will be named \var{base_dir} + \file{.zip}. Uses either the ! \refmodule{zipfile} Python module (if available) or the InfoZIP \file{zip} ! utility (if installed and found on the default search path). If neither ! tool is available, raises \exception{DistutilsExecError}. ! Returns the name of the output zip file. ! \end{funcdesc} ! ! \subsubsection{\module{distutils.dep_util} -- Dependency checking} ! \declaremodule[distutils.deputil]{standard}{distutils.dep_util} ! \modulesynopsis{Utility functions for simple dependency checking} ! ! This module provides functions for performing simple, timestamp-based ! dependency of files and groups of files; also, functions based entirely ! on such timestamp dependency analysis. ! ! ! \subsubsection{\module{distutils.dir_util} -- Directory tree operations} ! \declaremodule[distutils.dirutil]{standard}{distutils.dir_util} ! \modulesynopsis{Utility functions for operating on directories and directory trees} ! ! This module provides functions for operating on directories and trees ! of directories. ! ! \begin{funcdesc}{mkpath}{name\optional{, mode=0777, verbose=0, dry_run=0}} ! Create a directory and any missing ancestor directories. If the ! directory already exists (or if \var{name} is the empty string, which ! means the current directory, which of course exists), then do ! nothing. Raise \exception{DistutilsFileError} if unable to create some ! directory along the way (eg. some sub-path exists, but is a file ! rather than a directory). If \var{verbose} is true, print a one-line ! summary of each mkdir to stdout. Return the list of directories ! actually created. ! \end{funcdesc} ! ! \begin{funcdesc}{create_tree}{base_dir, files\optional{, mode=0777, verbose=0, dry_run=0}} ! Create all the empty directories under \var{base_dir} needed to ! put \var{files} there. \var{base_dir} is just the a name of a directory ! which doesn't necessarily exist yet; \var{files} is a list of filenames ! to be interpreted relative to \var{base_dir}. \var{base_dir} + the ! directory portion of every file in \var{files} will be created if it ! doesn't already exist. \var{mode}, \var{verbose} and \var{dry_run} flags ! are as for \function{mkpath()}. ! \end{funcdesc} ! ! \begin{funcdesc}{copy_tree}{src, dst\optional{preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0}} ! Copy an entire directory tree \var{src} to a new location \var{dst}. Both ! \var{src} and \var{dst} must be directory names. If \var{src} is not a ! directory, raise \exception{DistutilsFileError}. If \var{dst} does ! not exist, it is created with \var{mkpath()}. The end result of the ! copy is that every file in \var{src} is copied to \var{dst}, and ! directories under \var{src} are recursively copied to \var{dst}. ! Return the list of files that were copied or might have been copied, ! using their output name. The return value is unaffected by \var{update} ! or \var{dry_run}: it is simply the list of all files under \var{src}, ! with the names changed to be under \var{dst}. ! ! \var{preserve_mode} and \var{preserve_times} are the same as for ! \function{copy_file} in \refmodule{distutil.file_util}; note that they ! only apply to regular files, not to directories. If \var{preserve_symlinks} ! is true, symlinks will be copied as symlinks (on platforms that support ! them!); otherwise (the default), the destination of the symlink will ! be copied. \var{update} and \var{verbose} are the same as for ! \function{copy_file}. ! \end{funcdesc} ! ! \begin{funcdesc}{remove_tree}{directory\optional{verbose, dry_run}} ! Recursively remove \var{directory} and all files and directories underneath ! it. Any errors are ignored (apart from being reported to stdout if ! \var{verbose} is true). ! \end{funcdesc} ! ! \warning{Some of this could be replaced with the shutil module?} ! ! \subsubsection{\module{distutils.file_util} -- Single file operations} ! \declaremodule[distutils.fileutil]{standard}{distutils.file_util} ! \modulesynopsis{Utility functions for operating on single files} ! ! This module contains some utility functions for operating on individual files. ! ! \begin{funcdesc}{copy_file}{src, dst\optional{preserve_mode, preserve_times, update, link, verbose, dry_run}} ! Copy file \var{src} to \var{dst}. XXX todo ! \end{funcdesc} ! ! \begin{funcdesc}{move_file}{src, dst\optional{verbose, dry_run}} ! Move file \var{src} to \var{dst}. If \var{dst} is a directory, the file will ! be moved into it with the same name; otherwise, \var{src} is just renamed ! to 'dst'. Return the new full name of the file. ! XXX todo Handles cross-device moves on Unix using 'copy_file()'. What about ! other systems??? ! \end{funcdesc} + + \subsubsection{\module{distutils.utils} -- Miscellaneous other utility functions} \declaremodule{standard}{distutils.util} ! \modulesynopsis{Miscellaneous other utility functions} ! This module contains other assorted bits and pieces that don't fit into ! any other utility module. ! \subsection{Distutils objects} ! \subsubsection{\module{distutils.dist} -- The Distribution class} ! \declaremodule{standard}{distutils.dist} ! \modulesynopsis{Provides the Distribution class, which represents the module distribution ! being built/installed/distributed} ! ! This module provides the \class{Distribution} class, which represents the module distribution ! being built/installed/distributed. + \subsubsection{\module{distutils.extension} -- The Extension class} + \declaremodule{standard}{distutils.extension} + \modulesynopsis{Provides the Extension class, used to describe C/C++ extension modules in setup scripts} + + This module provides the \class{Extension} class, used to describe C/C++ extension + modules in setup scripts. + + \subsection{Ungrouped modules} The following haven't been moved into a more appropriate section yet. + \subsubsection{\module{distutils.debug} -- Distutils debug mode} \declaremodule{standard}{distutils.debug} ! \modulesynopsis{Provides the debug flag for distutils} ! This module provides the DEBUG flag. + \subsubsection{\module{distutils.errors} -- Distutils exceptions} \declaremodule{standard}{distutils.errors} ! \modulesynopsis{Provides standard distutils exceptions} ! Provides exceptions used by the Distutils modules. Note that Distutils ! modules may raise standard exceptions; in particular, SystemExit is ! usually raised for errors that are obviously the end-user's fault ! (eg. bad command-line arguments). ! This module is safe to use in \samp{from ... import *} mode; it only exports ! symbols whose names start with \code{Distutils} and end with \code{Error}. + \subsubsection{\module{distutils.fancy_getopt} -- Wrapper around the standard getopt module} + \declaremodule[distutils.fancygetopt]{standard}{distutils.fancy_getopt} + \modulesynopsis{Additional getopt functionality } + + This module provides a wrapper around the standard \refmodule{getopt} module that + provides the following + additional features: + \begin{itemize} + \item short and long options are tied together + \item options have help strings, so fancy_getopt could potentially create a complete usage summary + \item options set attributes of a passed-in object + \end{itemize} + + \warning{Should be replaced with optik (which is also now known as \refmodule{optparse})} + + \subsubsection{\module{distutils.filelist} -- The FileList class} \declaremodule{standard}{distutils.filelist} ! \modulesynopsis{The FileList class, used for poking about the filesystem and building lists of files. } + This module provides the \class{FileList} class, used for poking about the filesystem + and building lists of files. + + + \subsubsection{\module{distutils.log} -- Simple PEP282-style logging} \declaremodule{standard}{distutils.log} ! \modulesynopsis{A simple logging mechanism, PEP282-style} ! ! \warning{Should be replaced with standard \refmodule{logging} module.} ! ! %\subsubsection{\module{} -- } ! %\declaremodule{standard}{distutils.magic} ! %\modulesynopsis{ } + \subsubsection{\module{distutils.spawn} -- Spawn a sub-process} \declaremodule{standard}{distutils.spawn} ! \modulesynopsis{Provides the spawn() function} ! ! This module provides the \function{spawn()} function, a front-end to ! various platform-specific functions for launching another program in a ! sub-process. ! Also provides \function{find_executable()} to search the path for a given ! executable name. + \subsubsection{\module{distutils.sysconfig} -- Python configuration} \declaremodule{standard}{distutils.sysconfig} ! \modulesynopsis{Access to Python's configuration} ! ! This module provides access to Python's configuration information. ! The specific configuration variables available depend heavily on the ! platform and configuration. The values may be retrieved using ! \code{get_config_var(name)}, and the list of variables is available via ! \code{get_config_vars().keys()}. Additional convenience functions are also ! available. + \subsubsection{\module{distutils.text_file} -- The TextFile class} + \declaremodule[distutils.textfile]{standard}{distutils.text_file} + \modulesynopsis{provides the TextFile class, a simple interface to text files} + + This module provides the \class{TextFile} class, which gives an interface to text files + that (optionally) takes care of stripping comments, ignoring blank + lines, and joining lines with backslashes. + + + \subsubsection{\module{distutils.version} -- Version number classes} \declaremodule{standard}{distutils.version} \modulesynopsis{implements classes that represent module version numbers. } *************** *** 678,687 **** This part of Distutils implements the various Distutils commands, such ! as 'build', 'install' &c. \declaremodule{standard}{distutils.cmd} \modulesynopsis{This module provides the abstract base class Command. This ! class is subclassed by the modules in the distutils.command subpackage. } \declaremodule{standard}{distutils.command} \modulesynopsis{This subpackage contains one module for each standard Distutils command.} --- 889,903 ---- This part of Distutils implements the various Distutils commands, such ! as 'build', 'install' \&c. ! + \subsubsection{\module{distutils.cmd} -- Abstract base class for Distutils commands} \declaremodule{standard}{distutils.cmd} \modulesynopsis{This module provides the abstract base class Command. This ! class is subclassed by the modules in the \refmodule{distutils.command} ! subpackage. } ! + \subsubsection{\module{distutils.command} -- Individual Distutils commands} \declaremodule{standard}{distutils.command} \modulesynopsis{This subpackage contains one module for each standard Distutils command.} *************** *** 689,752 **** \subsubsection{Individual Distutils commands} \declaremodule{standard}{distutils.command.bdist} \modulesynopsis{Build a binary installer for a package} ! \declaremodule{standard}{distutils.command.bdist_packager} \modulesynopsis{Abstract base class for packagers} ! \declaremodule{standard}{distutils.command.bdist_dumb} \modulesynopsis{Build a "dumb" installer - a simple archive of files} ! %\declaremodule{standard}{distutils.command.bdist_pkgtool} %\modulesynopsis{ } ! %\declaremodule{standard}{distutils.command.bdist_sdux} %\modulesynopsis{ } ! \declaremodule{standard}{distutils.command.bdist_rpm} \modulesynopsis{Build a binary distribution as a Redhat RPM and SRPM} ! \declaremodule{standard}{distutils.command.bdist_wininst} \modulesynopsis{Build a Windows installer} \declaremodule{standard}{distutils.command.sdist} \modulesynopsis{Build a source distribution} \declaremodule{standard}{distutils.command.build} \modulesynopsis{Build all files of a package} ! \declaremodule{standard}{distutils.command.build_clib} \modulesynopsis{Build any C libraries in a package} ! \declaremodule{standard}{distutils.command.build_ext} \modulesynopsis{Build any extensions in a package} ! \declaremodule{standard}{distutils.command.build_py} \modulesynopsis{Build the .py/.pyc files of a package} ! \declaremodule{standard}{distutils.command.build_scripts} \modulesynopsis{Build the scripts of a package} \declaremodule{standard}{distutils.command.clean} \modulesynopsis{Clean a package build area} \declaremodule{standard}{distutils.command.config} \modulesynopsis{Perform package configuration} \declaremodule{standard}{distutils.command.install} \modulesynopsis{Install a package} ! \declaremodule{standard}{distutils.command.install_data} \modulesynopsis{Install data files from a package} ! \declaremodule{standard}{distutils.command.install_headers} \modulesynopsis{Install C/C++ header files from a package} ! \declaremodule{standard}{distutils.command.install_lib} \modulesynopsis{Install library files from a package} ! \declaremodule{standard}{distutils.command.install_scripts} \modulesynopsis{Install script files from a package} \declaremodule{standard}{distutils.command.register} \modulesynopsis{Register a module with the Python Package Index} --- 905,1010 ---- \subsubsection{Individual Distutils commands} + + \subsubsection{\module{distutils.command.bdist} -- Build a binary installer} \declaremodule{standard}{distutils.command.bdist} \modulesynopsis{Build a binary installer for a package} ! ! \subsubsection{\module{distutils.command.bdist_packager} -- Abstract base class for packagers} ! \declaremodule[distutils.command.bdistpackager]{standard}{distutils.command.bdist_packager} \modulesynopsis{Abstract base class for packagers} ! ! \subsubsection{\module{distutils.command.bdist_dumb} -- Build a "dumb" installer} ! \declaremodule[distutils.command.bdistdumb]{standard}{distutils.command.bdist_dumb} \modulesynopsis{Build a "dumb" installer - a simple archive of files} ! ! %\subsubsection{\module{} -- } ! %\declaremodule[distutils.command.bdistpkgtool]{standard}{distutils.command.bdist_pkgtool} %\modulesynopsis{ } ! ! %\subsubsection{\module{} -- } ! %\declaremodule[distutils.command.bdistsdux]{standard}{distutils.command.bdist_sdux} %\modulesynopsis{ } ! ! \subsubsection{\module{distutils.command.bdist_rpm} -- Build a binary distribution as a Redhat RPM and SRPM} ! \declaremodule[distutils.command.bdistrpm]{standard}{distutils.command.bdist_rpm} \modulesynopsis{Build a binary distribution as a Redhat RPM and SRPM} ! ! \subsubsection{\module{distutils.command.bdist_wininst} -- Build a Windows installer} ! \declaremodule[distutils.command.bdistwininst]{standard}{distutils.command.bdist_wininst} \modulesynopsis{Build a Windows installer} + + \subsubsection{\module{distutils.command.sdist} -- Build a source distribution} \declaremodule{standard}{distutils.command.sdist} \modulesynopsis{Build a source distribution} + + \subsubsection{\module{distutils.command.build} -- Build all files of a package} \declaremodule{standard}{distutils.command.build} \modulesynopsis{Build all files of a package} ! ! \subsubsection{\module{distutils.command.build_clib} -- Build any C libraries in a package} ! \declaremodule[distutils.command.buildclib]{standard}{distutils.command.build_clib} \modulesynopsis{Build any C libraries in a package} ! ! \subsubsection{\module{distutils.command.build_ext} -- Build any extensions in a package} ! \declaremodule[distutils.command.buildext]{standard}{distutils.command.build_ext} \modulesynopsis{Build any extensions in a package} ! ! \subsubsection{\module{distutils.command.build_py} -- Build the .py/.pyc files of a package} ! \declaremodule[distutils.command.buildpy]{standard}{distutils.command.build_py} \modulesynopsis{Build the .py/.pyc files of a package} ! ! \subsubsection{\module{distutils.command.build_scripts} -- Build the scripts of a package} ! \declaremodule[distutils.command.buildscripts]{standard}{distutils.command.build_scripts} \modulesynopsis{Build the scripts of a package} + + \subsubsection{\module{distutils.command.clean} -- Clean a package build area} \declaremodule{standard}{distutils.command.clean} \modulesynopsis{Clean a package build area} + + \subsubsection{\module{distutils.command.config} -- Perform package configuration} \declaremodule{standard}{distutils.command.config} \modulesynopsis{Perform package configuration} + + \subsubsection{\module{distutils.command.install} -- Install a package} \declaremodule{standard}{distutils.command.install} \modulesynopsis{Install a package} ! ! \subsubsection{\module{distutils.command.install_data} -- Install data files from a package} ! \declaremodule[distutils.command.installdata]{standard}{distutils.command.install_data} \modulesynopsis{Install data files from a package} ! ! \subsubsection{\module{distutils.command.install_headers} -- Install C/C++ header files from a package} ! \declaremodule[distutils.command.installheaders]{standard}{distutils.command.install_headers} \modulesynopsis{Install C/C++ header files from a package} ! ! \subsubsection{\module{distutils.command.install_lib} -- Install library files from a package} ! \declaremodule[distutils.command.installlib]{standard}{distutils.command.install_lib} \modulesynopsis{Install library files from a package} ! ! \subsubsection{\module{distutils.command.install_scripts} -- Install script files from a package} ! \declaremodule[distutils.command.installscripts]{standard}{distutils.command.install_scripts} \modulesynopsis{Install script files from a package} + + \subsubsection{\module{distutils.command.register} -- Register a module with the Python Package Index} \declaremodule{standard}{distutils.command.register} \modulesynopsis{Register a module with the Python Package Index} From anthonybaxter@users.sourceforge.net Tue May 13 12:36:41 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 13 May 2003 04:36:41 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv12355 Modified Files: distref.tex Log Message: Extenstion arguments in distutils.core section. Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** distref.tex 13 May 2003 10:14:14 -0000 1.3 --- distref.tex 13 May 2003 11:36:39 -0000 1.4 *************** *** 1,10 **** ! \chapter{Building and installing Python modules, the Compleat Reference.} ! - %\sectionauthor {Anthony Baxter}{anthony@interlink.com.au} %\sectionauthor {Greg Ward}{gward@python.net} \index{distutils} \declaremodule{standard}{distutils} The \module{distutils} package provides support for building and --- 1,12 ---- ! \chapter{Building and Installing Python modules} %\sectionauthor {Greg Ward}{gward@python.net} + %\sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} + %\sectionauthor {Anthony Baxter}{anthony@interlink.com.au} \index{distutils} \declaremodule{standard}{distutils} + \modulesynopsis{Support for building and installing Python modules + into an existing Python installation} The \module{distutils} package provides support for building and *************** *** 12,19 **** modules may be either 100\%{}-pure Python, or may be extension modules written in C, or may be collections of Python packages which include ! modules coded in both Python and C. \localmoduletable \section{The simple interface} --- 14,46 ---- modules may be either 100\%{}-pure Python, or may be extension modules written in C, or may be collections of Python packages which include ! modules coded in both Python and C. The \module{distutils} package ! also provides support for building source and binary distributions ! of packages in a variety of formats, suitable for distribution separately ! to Python. ! ! As well as this reference documentation, there are two separate ! documents that discuss \module{distutils}. To learn about distributing new ! modules using the \module{distutils} facilities, read ! \citetitle[../dist/dist.html]{Distributing Python Modules}. To learn ! about installing Python modules, whether or not the author made use of ! the \module{distutils} package, read ! \citetitle[../inst/inst.html]{Installing Python Modules}. \localmoduletable + \begin{seealso} + \seetitle[../dist/dist.html]{Distributing Python Modules}{The manual + for developers and packagers of Python modules. This + describes how to prepare \module{distutils}-based packages + so that they may be easily installed into an existing + Python installaion.} + + \seetitle[../inst/inst.html]{Installing Python Modules}{An + ``administrators'' manual which includes information on + installing modules into an existing Python installation. + You do not need to be a Python programmer to read this + manual.} + \end{seealso} + \section{The simple interface} *************** *** 37,41 **** are laid out in the following table. ! \begin{tableiii}{c|l|l}{argument name}{argument name}{value}{notes} \lineiii{name}{The name of the package}{a string} \lineiii{version}{The version number of the package}{See \refmodule{distutils.version}} --- 64,68 ---- are laid out in the following table. ! \begin{tableiii}{c|l|l}{argument name}{argument name}{value}{type} \lineiii{name}{The name of the package}{a string} \lineiii{version}{The version number of the package}{See \refmodule{distutils.version}} *************** *** 63,83 **** \end{tableiii} - In addition, the \module{distutils.core} module exposed a number of - other classes that live elsewhere. - - \begin{itemize} - \item The \class{Distribution} from \refmodule{distutils.dist} - \item The \class{Command} from \refmodule{distutils.cmd} - \item The \class{Extension} from \refmodule{distutils.extension} - \end{itemize} - - A short description of each of these follows, but see the relevant - module for the full reference. - - - \end{funcdesc} - \begin{funcdesc}{run_setup}{script_name, script_args=None, stop_after='run'} Run a setup script in a somewhat controlled environment, and return --- 90,95 ---- *************** *** 109,112 **** --- 121,201 ---- \end{funcdesc} + In addition, the \module{distutils.core} module exposed a number of + classes that live elsewhere. + + \begin{itemize} + \item \class{Extension} from \refmodule{distutils.extension} + \item \class{Command} from \refmodule{distutils.cmd} + \item \class{Distribution} from \refmodule{distutils.dist} + \end{itemize} + + A short description of each of these follows, but see the relevant + module for the full reference. + + \begin{classdesc*}{Extension} + + The Extension class describes a single C or C++ extension module in a + setup script. It accepts the following keyword arguments in it's constructor + + \begin{tableiii}{c|l|l}{argument name}{argument name}{value}{type} + \lineiii{name}{the full name of the extension, including any packages + -- ie. *not* a filename or pathname, but Python dotted name}{string} + \lineiii{sources}{list of source filenames, relative to the distribution + root (where the setup script lives), in Unix form (slash-separated) for + portability. Source files may be C, C++, SWIG (.i), platform-specific + resource files, or whatever else is recognized by the "build_ext" + command as source for a Python extension.}{string} + \lineiii{include_dirs}{list of directories to search for C/C++ header + files (in \UNIX form for portability)}{string} + \lineiii{define_macros}{list of macros to define; each macro is defined + using a 2-tuple, where 'value' is either the string to define it to or + None to define it without a particular value (equivalent of "\#define + FOO" in source or -DFOO on Unix C compiler command line) }{ (string,string) + tuple or (name,\code{None}) } + \lineiii{undef_macros}{list of macros to undefine explicitly}{string} + \lineiii{library_dirs}{list of directories to search for C/C++ libraries + at link time }{string} + \lineiii{libraries}{list of library names (not filenames or paths) to + link against }{string} + \lineiii{runtime_library_dirs}{list of directories to search for C/C++ + libraries at run time (for shared extensions, this is when the extension + is loaded)}{string} + \lineiii{extra_objects}{list of extra files to link with (eg. object + files not implied by 'sources', static library that must be explicitly + specified, binary resource files, etc.)}{string} + \lineiii{extra_compile_args}{any extra platform- and compiler-specific + information to use when compiling the source files in 'sources'. For + platforms and compilers where "command line" makes sense, this is + typically a list of command-line arguments, but for other platforms it + could be anything.}{string} + \lineiii{extra_link_args}{any extra platform- and compiler-specific + information to use when linking object files together to create the + extension (or to create a new static Python interpreter). Similar + interpretation as for 'extra_compile_args'.}{string} + \lineiii{export_symbols}{list of symbols to be exported from a shared + extension. Not used on all platforms, and not generally necessary for + Python extensions, which typically export exactly one symbol: \code{init} + + extension_name. }{string} + \lineiii{depends}{list of files that the extension depends on }{string} + \lineiii{language}{extension language (i.e. \code{"c"}, \code{"c++"}, + \code{"objc"}). Will be detected from the source extensions if not provided. + }{string} + \end{tableiii} + \end{classdesc*} + + \begin{classdesc*}{Distribution} + A \class{Distribution} describes how to build, install and package up a + Python software package. + + See the \function{setup()} function for a list of keyword arguments accepted + by the Distribution constructor. \function{setup()} creates a Distribution + instance. + \end{classdesc*} + + \begin{classdesc*}{Command} + A \class{Command} class (or rather, an instance of one of it's subclasses) + implement a single distutils command. + \end{classdesc*} + \section{The low-level interface} *************** *** 840,846 **** ! \subsubsection{\module{distutils.log} -- Simple PEP282-style logging} \declaremodule{standard}{distutils.log} ! \modulesynopsis{A simple logging mechanism, PEP282-style} \warning{Should be replaced with standard \refmodule{logging} module.} --- 929,935 ---- ! \subsubsection{\module{distutils.log} -- Simple \pep{282}-style logging} \declaremodule{standard}{distutils.log} ! \modulesynopsis{A simple logging mechanism, \pep{282}-style} \warning{Should be replaced with standard \refmodule{logging} module.} *************** *** 1009,1012 **** --- 1098,1104 ---- \declaremodule{standard}{distutils.command.register} \modulesynopsis{Register a module with the Python Package Index} + + The \code{register} command registers the package with the Python Package Index. + This is described more in \pep{301}. \subsubsection{Creating a new Distutils command} From akuchling@users.sourceforge.net Tue May 13 15:14:01 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:14:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.50,1.51 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14922 Modified Files: libexcs.tex Log Message: Fix typo Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -d -r1.50 -r1.51 *** libexcs.tex 10 May 2003 08:51:28 -0000 1.50 --- libexcs.tex 13 May 2003 14:13:58 -0000 1.51 *************** *** 2,6 **** \declaremodule{standard}{exceptions} ! \modulesynopsis{Standard exceptions classes.} --- 2,6 ---- \declaremodule{standard}{exceptions} ! \modulesynopsis{Standard exception classes.} From akuchling@users.sourceforge.net Tue May 13 15:16:21 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:16:21 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libbastion.tex,1.10,1.11 librexec.tex,1.20,1.21 librestricted.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16071 Modified Files: libbastion.tex librexec.tex librestricted.tex Log Message: [Bug #729817] Document the rexec and Bastion modules as dead Index: libbastion.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbastion.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libbastion.tex 13 Apr 1999 21:39:31 -0000 1.10 --- libbastion.tex 13 May 2003 14:16:18 -0000 1.11 *************** *** 5,9 **** --- 5,14 ---- \modulesynopsis{Providing restricted access to objects.} \moduleauthor{Barry Warsaw}{bwarsaw@python.org} + \versionchanged[Disabled module]{2.3} + \begin{notice}[warning] + The documentation has been left in place to help in reading old code + that uses the module. + \end{notice} % I'm concerned that the word 'bastion' won't be understood by people Index: librexec.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librexec.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** librexec.tex 27 Aug 2002 16:46:06 -0000 1.20 --- librexec.tex 13 May 2003 14:16:18 -0000 1.21 *************** *** 4,8 **** --- 4,13 ---- \declaremodule{standard}{rexec} \modulesynopsis{Basic restricted execution framework.} + \versionchanged[Disabled module]{2.3} + \begin{notice}[warning] + The documentation has been left in place to help in reading old code + that uses the module. + \end{notice} This module contains the \class{RExec} class, which supports Index: librestricted.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librestricted.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** librestricted.tex 4 Oct 2001 20:40:07 -0000 1.8 --- librestricted.tex 13 May 2003 14:16:18 -0000 1.9 *************** *** 1,21 **** \chapter{Restricted Execution \label{restricted}} ! In general, Python programs have complete access to the underlying ! operating system throug the various functions and classes, For ! example, a Python program can open any file for reading and writing by ! using the \function{open()} built-in function (provided the underlying ! operating system gives you permission!). This is exactly what you want ! for most applications. ! ! There exists a class of applications for which this ``openness'' is ! inappropriate. Take Grail: a Web browser that accepts ``applets,'' ! snippets of Python code, from anywhere on the Internet for execution ! on the local system. This can be used to improve the user interface ! of forms, for instance. Since the originator of the code is unknown, ! it is obvious that it cannot be trusted with the full resources of the ! local machine. \emph{Restricted execution} is the basic framework in Python that allows ! for the segregation of trusted and untrusted code. It is based on the notion that trusted Python code (a \emph{supervisor}) can create a ``padded cell' (or environment) with limited permissions, and run the --- 1,13 ---- \chapter{Restricted Execution \label{restricted}} ! \begin{notice}[warning] ! In Python 2.3 these modules have been disabled due to various known ! and not readily fixable security holes. The modules are still ! documented here to help in reading old code that uses the ! \module{rexec} and \module{Bastion} modules. ! \end{notice} \emph{Restricted execution} is the basic framework in Python that allows ! for the segregation of trusted and untrusted code. The framework is based on the notion that trusted Python code (a \emph{supervisor}) can create a ``padded cell' (or environment) with limited permissions, and run the *************** *** 67,74 **** \begin{seealso} - \seetitle[http://www.python.org/doc/howto/rexec/] - {Restricted Execution HOWTO} - {Andrew Kuchling's tutorial on the use of the restricted - execution facilities in Python.} \seetitle[http://grail.sourceforge.net/]{Grail Home Page} {Grail, an Internet browser written in Python, uses these --- 59,62 ---- From akuchling@users.sourceforge.net Tue May 13 15:23:58 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:23:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex,1.145,1.146 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv19039 Modified Files: whatsnew23.tex Log Message: [Bug #729297] Remove markup in section headers Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -d -r1.145 -r1.146 *** whatsnew23.tex 7 May 2003 17:00:35 -0000 1.145 --- whatsnew23.tex 13 May 2003 14:23:54 -0000 1.146 *************** *** 379,383 **** %====================================================================== ! \section{PEP 279: The \function{enumerate()} Built-in Function\label{section-enumerate}} A new built-in function, \function{enumerate()}, will make --- 379,383 ---- %====================================================================== ! \section{PEP 279: enumerate()\label{section-enumerate}} A new built-in function, \function{enumerate()}, will make *************** *** 415,419 **** %====================================================================== ! \section{PEP 282: The \module{logging} Package} A standard package for writing logs, \module{logging}, has been added --- 415,419 ---- %====================================================================== ! \section{PEP 282: The logging Package} A standard package for writing logs, \module{logging}, has been added *************** *** 542,546 **** %====================================================================== ! \section{PEP 285: The \class{bool} Type\label{section-bool}} A Boolean type was added to Python 2.3. Two new constants were added --- 542,546 ---- %====================================================================== ! \section{PEP 285: A Boolean Type\label{section-bool}} A Boolean type was added to Python 2.3. Two new constants were added From akuchling@users.sourceforge.net Tue May 13 15:26:58 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:26:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew21.tex,1.29,1.30 whatsnew23.tex,1.146,1.147 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv20416 Modified Files: whatsnew21.tex whatsnew23.tex Log Message: Remove more markup from headers Index: whatsnew21.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew21.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** whatsnew21.tex 27 Nov 2002 18:53:38 -0000 1.29 --- whatsnew21.tex 13 May 2003 14:26:54 -0000 1.30 *************** *** 140,144 **** %====================================================================== ! \section{PEP 236: \module{__future__} Directives} The reaction to nested scopes was widespread concern about the dangers --- 140,144 ---- %====================================================================== ! \section{PEP 236: __future__ Directives} The reaction to nested scopes was widespread concern about the dangers *************** *** 493,497 **** %====================================================================== ! \section{PEP 235: Case-Insensitive Platforms and \keyword{import}} Some operating systems have filesystems that are case-insensitive, --- 493,497 ---- %====================================================================== ! \section{PEP 235: Importing Modules on Case-Insensitive Platforms} Some operating systems have filesystems that are case-insensitive, Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** whatsnew23.tex 13 May 2003 14:23:54 -0000 1.146 --- whatsnew23.tex 13 May 2003 14:26:54 -0000 1.147 *************** *** 1917,1921 **** %====================================================================== ! \subsection{The \module{optparse} Module} The \module{getopt} module provides simple parsing of command-line --- 1917,1921 ---- %====================================================================== ! \subsection{The optparse Module} The \module{getopt} module provides simple parsing of command-line *************** *** 1993,1997 **** %====================================================================== ! \section{Specialized Object Allocator (pymalloc)\label{section-pymalloc}} Pymalloc, a specialized object allocator written by Vladimir --- 1993,1997 ---- %====================================================================== ! \section{Pymalloc: A Specialized Object Allocator\label{section-pymalloc}} Pymalloc, a specialized object allocator written by Vladimir From akuchling@users.sourceforge.net Tue May 13 15:40:27 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:40:27 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libre.tex,1.99,1.100 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26337 Modified Files: libre.tex Log Message: [Bug #732124] Clarify .pos, .endpos by saying 'method' instead of 'function' Also, put match() description before search(); search() refers to match() Index: libre.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libre.tex,v retrieving revision 1.99 retrieving revision 1.100 diff -C2 -d -r1.99 -r1.100 *** libre.tex 3 May 2003 10:59:13 -0000 1.99 --- libre.tex 13 May 2003 14:40:24 -0000 1.100 *************** *** 639,654 **** attributes: - \begin{methoddesc}[RegexObject]{search}{string\optional{, pos\optional{, - endpos}}} - Scan through \var{string} looking for a location where this regular - expression produces a match, and return a - corresponding \class{MatchObject} instance. Return \code{None} if no - position in the string matches the pattern; note that this is - different from finding a zero-length match at some point in the string. - - The optional \var{pos} and \var{endpos} parameters have the same - meaning as for the \method{match()} method. - \end{methoddesc} - \begin{methoddesc}[RegexObject]{match}{string\optional{, pos\optional{, endpos}}} --- 639,642 ---- *************** *** 680,683 **** --- 668,683 ---- \end{methoddesc} + \begin{methoddesc}[RegexObject]{search}{string\optional{, pos\optional{, + endpos}}} + Scan through \var{string} looking for a location where this regular + expression produces a match, and return a + corresponding \class{MatchObject} instance. Return \code{None} if no + position in the string matches the pattern; note that this is + different from finding a zero-length match at some point in the string. + + The optional \var{pos} and \var{endpos} parameters have the same + meaning as for the \method{match()} method. + \end{methoddesc} + \begin{methoddesc}[RegexObject]{split}{string\optional{, maxsplit\code{ = 0}}} *************** *** 813,825 **** \begin{memberdesc}[MatchObject]{pos} ! The value of \var{pos} which was passed to the ! \function{search()} or \function{match()} function. This is the index ! into the string at which the RE engine started looking for a match. \end{memberdesc} \begin{memberdesc}[MatchObject]{endpos} ! The value of \var{endpos} which was passed to the ! \function{search()} or \function{match()} function. This is the index ! into the string beyond which the RE engine will not go. \end{memberdesc} --- 813,826 ---- \begin{memberdesc}[MatchObject]{pos} ! The value of \var{pos} which was passed to the \function{search()} or ! \function{match()} method of the \class{RegexObject}. This is the ! index into the string at which the RE engine started looking for a ! match. \end{memberdesc} \begin{memberdesc}[MatchObject]{endpos} ! The value of \var{endpos} which was passed to the \function{search()} ! or \function{match()} method of the \class{RegexObject}. This is the ! index into the string beyond which the RE engine will not go. \end{memberdesc} From akuchling@users.sourceforge.net Tue May 13 15:51:41 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:51:41 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts crlf.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv31840a Modified Files: crlf.py Log Message: [Bug #724767] crlf.py uses the variable name file, which it shouldn't anymore. Index: crlf.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/crlf.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** crlf.py 13 Nov 2002 21:04:31 -0000 1.3 --- crlf.py 13 May 2003 14:51:39 -0000 1.4 *************** *** 4,19 **** import sys, os ! for file in sys.argv[1:]: ! if os.path.isdir(file): ! print file, "Directory!" continue ! data = open(file, "rb").read() if '\0' in data: ! print file, "Binary!" continue newdata = data.replace("\r\n", "\n") if newdata != data: ! print file ! f = open(file, "wb") f.write(newdata) f.close() --- 4,19 ---- import sys, os ! for filename in sys.argv[1:]: ! if os.path.isdir(filename): ! print filename, "Directory!" continue ! data = open(filename, "rb").read() if '\0' in data: ! print filename, "Binary!" continue newdata = data.replace("\r\n", "\n") if newdata != data: ! print filename ! f = open(filename, "wb") f.write(newdata) f.close() From akuchling@users.sourceforge.net Tue May 13 15:57:11 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 07:57:11 -0700 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.70,1.71 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv2261 Modified Files: pep-0042.txt Log Message: Add feature request Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** pep-0042.txt 29 Apr 2003 16:57:48 -0000 1.70 --- pep-0042.txt 13 May 2003 14:57:08 -0000 1.71 *************** *** 250,253 **** --- 250,258 ---- http://www.python.org/sf/595217 + - It would be nice if the higher level modules (httplib, smtplib, + nntplib, etc.) had options for setting socket timeouts. + + http://www.python.org/sf/723287 + C API wishes From akuchling@users.sourceforge.net Tue May 13 16:02:09 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 08:02:09 -0700 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.53,1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/dist In directory sc8-pr-cvs1:/tmp/cvs-serv5189 Modified Files: dist.tex Log Message: [Bug #713722] Delete dangling references to unwritten sections Index: dist.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** dist.tex 25 Apr 2003 16:43:28 -0000 1.53 --- dist.tex 13 May 2003 15:02:06 -0000 1.54 *************** *** 80,86 **** operations in your setup script. Unlike, say, Autoconf-style configure scripts, the setup script may be run multiple times in the course of ! building and installing your module distribution. If you need to ! insert potentially expensive processing steps into the Distutils ! chain, see section~\ref{extending} on extending the Distutils. If all you want to do is distribute a module called \module{foo}, --- 80,84 ---- operations in your setup script. Unlike, say, Autoconf-style configure scripts, the setup script may be run multiple times in the course of ! building and installing your module distribution. If all you want to do is distribute a module called \module{foo}, *************** *** 1366,1371 **** (Although a better way to do this is probably to override the standard \command{bdist\_rpm} command with one that writes whatever else you want ! to the \file{.spec} file; see section~\ref{extending} for information on ! extending the Distutils.) --- 1364,1368 ---- (Although a better way to do this is probably to override the standard \command{bdist\_rpm} command with one that writes whatever else you want ! to the \file{.spec} file.) From Anthony Baxter Tue May 13 16:09:20 2003 From: Anthony Baxter (Anthony Baxter) Date: Wed, 14 May 2003 01:09:20 +1000 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.53,1.54 In-Reply-To: Message-ID: <200305131509.h4DF9Kg08030@localhost.localdomain> >>> akuchling@users.sourceforge.net wrote > [Bug #713722] Delete dangling references to unwritten sections > Index: dist.tex > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Doc/dist/dist.tex,v > retrieving revision 1.53 > retrieving revision 1.54 > diff -C2 -d -r1.53 -r1.54 > *** dist.tex 25 Apr 2003 16:43:28 -0000 1.53 > --- dist.tex 13 May 2003 15:02:06 -0000 1.54 > *************** > *** 80,86 **** > operations in your setup script. Unlike, say, Autoconf-style configure > scripts, the setup script may be run multiple times in the course of > ! building and installing your module distribution. If you need to > ! insert potentially expensive processing steps into the Distutils > ! chain, see section~\ref{extending} on extending the Distutils. Hey, I'm working on it, I'm working on it! Sheesh! It's probably worth noting that the reference manual I'm writing (see the sandbox) and the existing two Distutils docs need to interact in some way. I'm not sure what that is yet, though... Anthony From akuchling@users.sourceforge.net Tue May 13 18:09:04 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 10:09:04 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts lfcr.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv32014 Modified Files: lfcr.py Log Message: [Bug #724767] Avoid use of 'file' as a variable name Index: lfcr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/lfcr.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lfcr.py 14 Feb 2000 21:42:14 -0000 1.3 --- lfcr.py 13 May 2003 17:09:01 -0000 1.4 *************** *** 4,19 **** import sys, re, os ! for file in sys.argv[1:]: ! if os.path.isdir(file): ! print file, "Directory!" continue ! data = open(file, "rb").read() if '\0' in data: ! print file, "Binary!" continue newdata = re.sub("\r?\n", "\r\n", data) if newdata != data: ! print file ! f = open(file, "wb") f.write(newdata) f.close() --- 4,19 ---- import sys, re, os ! for filename in sys.argv[1:]: ! if os.path.isdir(filename): ! print filename, "Directory!" continue ! data = open(filename, "rb").read() if '\0' in data: ! print filename, "Binary!" continue newdata = re.sub("\r?\n", "\r\n", data) if newdata != data: ! print filename ! f = open(filename, "wb") f.write(newdata) f.close() From akuchling@users.sourceforge.net Tue May 13 18:38:08 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 10:38:08 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts sum5.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv14301 Modified Files: sum5.py Log Message: Don't use 'file' as a variable name Modernize the code a bit Add docstring Index: sum5.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/sum5.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sum5.py 11 Sep 2002 20:36:01 -0000 1.5 --- sum5.py 13 May 2003 17:38:05 -0000 1.6 *************** *** 1,5 **** #! /usr/bin/env python ! # print md5 checksum for files bufsize = 8096 --- 1,7 ---- #! /usr/bin/env python ! """Python utility to print MD5 checksums of argument files. ! """ ! bufsize = 8096 *************** *** 18,37 **** import sys import os import md5 - import regsub - - StringType = type('') - FileType = type(sys.stdin) def sum(*files): sts = 0 ! if files and type(files[-1]) == FileType: out, files = files[-1], files[:-1] else: out = sys.stdout ! if len(files) == 1 and type(files[0]) != StringType: files = files[0] for f in files: ! if type(f) == StringType: if f == '-': sts = printsumfp(sys.stdin, '', out) or sts --- 20,36 ---- import sys import os + import getopt import md5 def sum(*files): sts = 0 ! if files and isinstance(files[-1], file): out, files = files[-1], files[:-1] else: out = sys.stdout ! if len(files) == 1 and not isinstance(files[0], str): files = files[0] for f in files: ! if isinstance(f, str): if f == '-': sts = printsumfp(sys.stdin, '', out) or sts *************** *** 42,58 **** return sts ! def printsum(file, out = sys.stdout): try: ! fp = open(file, rmode) except IOError, msg: ! sys.stderr.write('%s: Can\'t open: %s\n' % (file, msg)) return 1 if fnfilter: ! file = fnfilter(file) ! sts = printsumfp(fp, file, out) fp.close() return sts ! def printsumfp(fp, file, out = sys.stdout): m = md5.new() try: --- 41,57 ---- return sts ! def printsum(filename, out = sys.stdout): try: ! fp = open(filename, rmode) except IOError, msg: ! sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) return 1 if fnfilter: ! filename = fnfilter(filename) ! sts = printsumfp(fp, filename, out) fp.close() return sts ! def printsumfp(fp, filename, out = sys.stdout): m = md5.new() try: *************** *** 62,79 **** m.update(data) except IOError, msg: ! sys.stderr.write('%s: I/O error: %s\n' % (file, msg)) return 1 ! out.write('%s %s\n' % (hexify(m.digest()), file)) return 0 - def hexify(s): - res = '' - for c in s: - res = res + '%02x' % ord(c) - return res - def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize - import getopt try: opts, args = getopt.getopt(args, 'blts:') --- 61,71 ---- m.update(data) except IOError, msg: ! sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) return 1 ! out.write('%s %s\n' % (m.hexdigest(), filename)) return 0 def main(args = sys.argv[1:], out = sys.stdout): global fnfilter, rmode, bufsize try: opts, args = getopt.getopt(args, 'blts:') *************** *** 90,94 **** if o == '-s': bufsize = int(a) ! if not args: args = ['-'] return sum(args, out) --- 82,87 ---- if o == '-s': bufsize = int(a) ! if not args: ! args = ['-'] return sum(args, out) From akuchling@users.sourceforge.net Tue May 13 18:39:28 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 10:39:28 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts md5sum.py,1.2,1.3 sum5.py,1.6,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv15023 Modified Files: md5sum.py Removed Files: sum5.py Log Message: Rename sum5.py to md5sum.py, because sum5.py is more interesting as an example program Index: md5sum.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/md5sum.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** md5sum.py 17 Apr 2002 21:50:03 -0000 1.2 --- md5sum.py 13 May 2003 17:39:26 -0000 1.3 *************** *** 2,29 **** """Python utility to print MD5 checksums of argument files. - - Works with Python 2.1 and later. """ - import sys, md5 ! BLOCKSIZE = 1024*1024 ! def main(): ! args = sys.argv[1:] ! if not args: ! sys.stderr.write("usage: %s file ...\n" % sys.argv[0]) ! sys.exit(2) ! for file in sys.argv[1:]: ! f = open(file, "rb") ! sum = md5.new() while 1: ! block = f.read(BLOCKSIZE) ! if not block: ! break ! sum.update(block) ! f.close() ! print sum.hexdigest(), file ! if __name__ == "__main__": ! main() --- 2,89 ---- """Python utility to print MD5 checksums of argument files. """ ! bufsize = 8096 ! fnfilter = None ! rmode = 'r' ! usage = """ ! usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] ! -b : read files in binary mode ! -t : read files in text mode (default) ! -l : print last pathname component only ! -s bufsize: read buffer size (default %d) ! file ... : files to sum; '-' or no files means stdin ! """ % bufsize ! ! import sys ! import os ! import getopt ! import md5 ! ! def sum(*files): ! sts = 0 ! if files and isinstance(files[-1], file): ! out, files = files[-1], files[:-1] ! else: ! out = sys.stdout ! if len(files) == 1 and not isinstance(files[0], str): ! files = files[0] ! for f in files: ! if isinstance(f, str): ! if f == '-': ! sts = printsumfp(sys.stdin, '', out) or sts ! else: ! sts = printsum(f, out) or sts ! else: ! sts = sum(f, out) or sts ! return sts ! ! def printsum(filename, out = sys.stdout): ! try: ! fp = open(filename, rmode) ! except IOError, msg: ! sys.stderr.write('%s: Can\'t open: %s\n' % (filename, msg)) ! return 1 ! if fnfilter: ! filename = fnfilter(filename) ! sts = printsumfp(fp, filename, out) ! fp.close() ! return sts ! ! def printsumfp(fp, filename, out = sys.stdout): ! m = md5.new() ! try: while 1: ! data = fp.read(bufsize) ! if not data: break ! m.update(data) ! except IOError, msg: ! sys.stderr.write('%s: I/O error: %s\n' % (filename, msg)) ! return 1 ! out.write('%s %s\n' % (m.hexdigest(), filename)) ! return 0 ! def main(args = sys.argv[1:], out = sys.stdout): ! global fnfilter, rmode, bufsize ! try: ! opts, args = getopt.getopt(args, 'blts:') ! except getopt.error, msg: ! sys.stderr.write('%s: %s\n%s' % (sys.argv[0], msg, usage)) ! return 2 ! for o, a in opts: ! if o == '-l': ! fnfilter = os.path.basename ! if o == '-b': ! rmode = 'rb' ! if o == '-t': ! rmode = 'r' ! if o == '-s': ! bufsize = int(a) ! if not args: ! args = ['-'] ! return sum(args, out) ! ! if __name__ == '__main__' or __name__ == sys.argv[0]: ! sys.exit(main(sys.argv[1:], sys.stdout)) --- sum5.py DELETED --- From akuchling@users.sourceforge.net Tue May 13 18:56:10 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 10:56:10 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts ndiff.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv28732 Modified Files: ndiff.py Log Message: Prevent script from allowing '-r12' Index: ndiff.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ndiff.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ndiff.py 23 Sep 2001 04:06:05 -0000 1.12 --- ndiff.py 13 May 2003 17:56:07 -0000 1.13 *************** *** 102,106 **** if args: return fail("no args allowed with -r option") ! if whichfile in "12": restore(whichfile) return 1 --- 102,106 ---- if args: return fail("no args allowed with -r option") ! if whichfile in ("1", "2"): restore(whichfile) return 1 From gvanrossum@users.sourceforge.net Tue May 13 18:57:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 13 May 2003 10:57:25 -0700 Subject: [Python-checkins] python/dist/src/Lib os.py,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29917 Modified Files: os.py Log Message: Add optional 'onerror' argument to os.walk(), to control error handling. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** os.py 25 Apr 2003 07:11:48 -0000 1.70 --- os.py 13 May 2003 17:57:23 -0000 1.71 *************** *** 204,208 **** __all__.extend(["makedirs", "removedirs", "renames"]) ! def walk(top, topdown=True): """Directory tree generator. --- 204,208 ---- __all__.extend(["makedirs", "removedirs", "renames"]) ! def walk(top, topdown=True, onerror=None): """Directory tree generator. *************** *** 233,236 **** --- 233,243 ---- generated. + By default errors from the os.listdir() call are ignored. If + optional arg 'onerror' is specified, it should be a function; it + will be called with one argument, an os.error instance. It can + report the error to continue with the walk, or raise the exception + to abort the walk. Note that the filename is available as the + filename attribute of the exception object. + Caution: if you pass a relative pathname for top, don't change the current working directory between resumptions of walk. walk never *************** *** 260,264 **** # to earlier import-*. names = listdir(top) ! except error: return --- 267,273 ---- # to earlier import-*. names = listdir(top) ! except error, err: ! if onerror is not None: ! onerror(err) return *************** *** 275,279 **** path = join(top, name) if not islink(path): ! for x in walk(path, topdown): yield x if not topdown: --- 284,288 ---- path = join(top, name) if not islink(path): ! for x in walk(path, topdown, onerror): yield x if not topdown: From gvanrossum@users.sourceforge.net Tue May 13 18:58:42 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 13 May 2003 10:58:42 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.764,1.765 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30551 Modified Files: NEWS Log Message: Add optional 'onerror' argument to os.walk(), to control error handling. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.764 retrieving revision 1.765 diff -C2 -d -r1.764 -r1.765 *** NEWS 11 May 2003 20:25:35 -0000 1.764 --- NEWS 13 May 2003 17:58:35 -0000 1.765 *************** *** 39,42 **** --- 39,45 ---- ------- + - Added optional 'onerror' argument to os.walk(), to control error + handling. + - inspect.is{method|data}descriptor was added, to allow pydoc display __doc__ of data descriptors. From gvanrossum@users.sourceforge.net Tue May 13 19:01:22 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue, 13 May 2003 11:01:22 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.124,1.125 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv31799 Modified Files: libos.tex Log Message: Add optional 'onerror' argument to os.walk(), to control error handling. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** libos.tex 10 May 2003 03:35:37 -0000 1.124 --- libos.tex 13 May 2003 18:01:19 -0000 1.125 *************** *** 1055,1059 **** \end{funcdesc} ! \begin{funcdesc}{walk}{top\optional{, topdown\code{=True}}} \index{directory!walking} \index{directory!traversal} --- 1055,1060 ---- \end{funcdesc} ! \begin{funcdesc}{walk}{top\optional{, topdown\code{=True} ! \optional{, onerror\code{=None}}}} \index{directory!walking} \index{directory!traversal} *************** *** 1087,1090 **** --- 1088,1098 ---- false is ineffective, because in bottom-up mode the directories in \var{dirnames} are generated before \var{dirnames} itself is generated. + + By default errors from the \code{os.listdir()} call are ignored. If + optional argument \var{onerror} is specified, it should be a function; + it will be called with one argument, an os.error instance. It can + report the error to continue with the walk, or raise the exception + to abort the walk. Note that the filename is available as the + \code{filename} attribute of the exception object. \begin{notice} From akuchling@users.sourceforge.net Tue May 13 19:14:28 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 13 May 2003 11:14:28 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts byteyears.py,1.8,1.9 dutree.py,1.11,1.12 eptags.py,1.8,1.9 finddiv.py,1.1,1.2 fixdiv.py,1.7,1.8 fixheader.py,1.5,1.6 fixps.py,1.5,1.6 ftpmirror.py,1.17,1.18 ifdef.py,1.5,1.6 mkreal.py,1.6,1.7 objgraph.py,1.6,1.7 pindent.py,1.11,1.12 ptags.py,1.7,1.8 suff.py,1.5,1.6 untabify.py,1.3,1.4 which.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv7234 Modified Files: byteyears.py dutree.py eptags.py finddiv.py fixdiv.py fixheader.py fixps.py ftpmirror.py ifdef.py mkreal.py objgraph.py pindent.py ptags.py suff.py untabify.py which.py Log Message: Fix use of 'file' as a variable name. (I've tested the fixes, but please proofread anyway.) Index: byteyears.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/byteyears.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** byteyears.py 11 Sep 2002 20:36:01 -0000 1.8 --- byteyears.py 13 May 2003 18:14:24 -0000 1.9 *************** *** 35,47 **** # Compute max file name length maxlen = 1 ! for file in sys.argv[1:]: ! if len(file) > maxlen: maxlen = len(file) # Process each argument in turn ! for file in sys.argv[1:]: try: ! st = statfunc(file) except os.error, msg: ! sys.stderr.write('can\'t stat ' + `file` + ': ' + `msg` + '\n') status = 1 st = () --- 35,47 ---- # Compute max file name length maxlen = 1 ! for filename in sys.argv[1:]: ! maxlen = max(maxlen, len(filename)) # Process each argument in turn ! for filename in sys.argv[1:]: try: ! st = statfunc(filename) except os.error, msg: ! sys.stderr.write('can\'t stat ' + `filename` + ': ' + `msg` + '\n') status = 1 st = () *************** *** 51,55 **** age = now - anytime byteyears = float(size) * float(age) / secs_per_year ! print file.ljust(maxlen), print repr(int(byteyears)).rjust(8) --- 51,55 ---- age = now - anytime byteyears = float(size) * float(age) / secs_per_year ! print filename.ljust(maxlen), print repr(int(byteyears)).rjust(8) Index: dutree.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/dutree.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** dutree.py 11 Sep 2002 20:36:01 -0000 1.11 --- dutree.py 13 May 2003 18:14:24 -0000 1.12 *************** *** 12,17 **** size = eval(line[:i]) while line[i] in ' \t': i = i+1 ! file = line[i:-1] ! comps = file.split('/') if comps[0] == '': comps[0] = '/' if comps[len(comps)-1] == '': del comps[len(comps)-1] --- 12,17 ---- size = eval(line[:i]) while line[i] in ' \t': i = i+1 ! filename = line[i:-1] ! comps = filename.split('/') if comps[0] == '': comps[0] = '/' if comps[len(comps)-1] == '': del comps[len(comps)-1] Index: eptags.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/eptags.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** eptags.py 18 Sep 2000 01:46:01 -0000 1.8 --- eptags.py 13 May 2003 18:14:24 -0000 1.9 *************** *** 22,31 **** matcher = re.compile(expr) ! def treat_file(file, outfp): ! """Append tags found in file named 'file' to the open file 'outfp'""" try: ! fp = open(file, 'r') except: ! sys.stderr.write('Cannot open %s\n'%file) return charno = 0 --- 22,31 ---- matcher = re.compile(expr) ! def treat_file(filename, outfp): ! """Append tags found in file named 'filename' to the open file 'outfp'""" try: ! fp = open(filename, 'r') except: ! sys.stderr.write('Cannot open %s\n'%filename) return charno = 0 *************** *** 40,48 **** m = matcher.search(line) if m: ! tag = m.group(0) + '\177%d,%d\n'%(lineno,charno) tags.append(tag) size = size + len(tag) charno = charno + len(line) ! outfp.write('\f\n%s,%d\n'%(file,size)) for tag in tags: outfp.write(tag) --- 40,48 ---- m = matcher.search(line) if m: ! tag = m.group(0) + '\177%d,%d\n' % (lineno, charno) tags.append(tag) size = size + len(tag) charno = charno + len(line) ! outfp.write('\f\n%s,%d\n' % (filename,size)) for tag in tags: outfp.write(tag) *************** *** 50,55 **** def main(): outfp = open('TAGS', 'w') ! for file in sys.argv[1:]: ! treat_file(file, outfp) if __name__=="__main__": --- 50,55 ---- def main(): outfp = open('TAGS', 'w') ! for filename in sys.argv[1:]: ! treat_file(filename, outfp) if __name__=="__main__": Index: finddiv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/finddiv.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** finddiv.py 2 Sep 2001 04:43:30 -0000 1.1 --- finddiv.py 13 May 2003 18:14:24 -0000 1.2 *************** *** 38,43 **** listnames = 1 exit = None ! for file in args: ! x = process(file, listnames) exit = exit or x return exit --- 38,43 ---- listnames = 1 exit = None ! for filename in args: ! x = process(filename, listnames) exit = exit or x return exit *************** *** 48,56 **** sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0]) ! def process(file, listnames): ! if os.path.isdir(file): ! return processdir(file, listnames) try: ! fp = open(file) except IOError, msg: sys.stderr.write("Can't open: %s\n" % msg) --- 48,56 ---- sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0]) ! def process(filename, listnames): ! if os.path.isdir(filename): ! return processdir(filename, listnames) try: ! fp = open(filename) except IOError, msg: sys.stderr.write("Can't open: %s\n" % msg) *************** *** 61,69 **** if token in ("/", "/="): if listnames: ! print file break if row != lastrow: lastrow = row ! print "%s:%d:%s" % (file, row, line), fp.close() --- 61,69 ---- if token in ("/", "/="): if listnames: ! print filename break if row != lastrow: lastrow = row ! print "%s:%d:%s" % (filename, row, line), fp.close() Index: fixdiv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixdiv.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** fixdiv.py 4 Sep 2001 16:22:01 -0000 1.7 --- fixdiv.py 13 May 2003 18:14:24 -0000 1.8 *************** *** 165,170 **** files.sort() exit = None ! for file in files: ! x = process(file, warnings[file]) exit = exit or x return exit --- 165,170 ---- files.sort() exit = None ! for filename in files: ! x = process(filename, warnings[filename]) exit = exit or x return exit *************** *** 195,215 **** sys.stderr.write("Warning: ignored input " + line) continue ! file, lineno, what = m.groups() ! list = warnings.get(file) if list is None: ! warnings[file] = list = [] list.append((int(lineno), intern(what))) f.close() return warnings ! def process(file, list): print "-"*70 assert list # if this fails, readwarnings() is broken try: ! fp = open(file) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return 1 ! print "Index:", file f = FileContext(fp) list.sort() --- 195,215 ---- sys.stderr.write("Warning: ignored input " + line) continue ! filename, lineno, what = m.groups() ! list = warnings.get(filename) if list is None: ! warnings[filename] = list = [] list.append((int(lineno), intern(what))) f.close() return warnings ! def process(filename, list): print "-"*70 assert list # if this fails, readwarnings() is broken try: ! fp = open(filename) except IOError, msg: sys.stderr.write("can't open: %s\n" % msg) return 1 ! print "Index:", filename f = FileContext(fp) list.sort() Index: fixheader.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixheader.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fixheader.py 11 Sep 2002 20:36:01 -0000 1.5 --- fixheader.py 13 May 2003 18:14:24 -0000 1.6 *************** *** 7,32 **** def main(): args = sys.argv[1:] ! for file in args: ! process(file) ! def process(file): try: ! f = open(file, 'r') except IOError, msg: ! sys.stderr.write('%s: can\'t open: %s\n' % (file, str(msg))) return data = f.read() f.close() if data[:2] <> '/*': ! sys.stderr.write('%s does not begin with C comment\n' % file) return try: ! f = open(file, 'w') except IOError, msg: ! sys.stderr.write('%s: can\'t write: %s\n' % (file, str(msg))) return ! sys.stderr.write('Processing %s ...\n' % file) magic = 'Py_' ! for c in file: if ord(c)<=0x80 and c.isalnum(): magic = magic + c.upper() --- 7,32 ---- def main(): args = sys.argv[1:] ! for filename in args: ! process(filename) ! def process(filename): try: ! f = open(filename, 'r') except IOError, msg: ! sys.stderr.write('%s: can\'t open: %s\n' % (filename, str(msg))) return data = f.read() f.close() if data[:2] <> '/*': ! sys.stderr.write('%s does not begin with C comment\n' % filename) return try: ! f = open(filename, 'w') except IOError, msg: ! sys.stderr.write('%s: can\'t write: %s\n' % (filename, str(msg))) return ! sys.stderr.write('Processing %s ...\n' % filename) magic = 'Py_' ! for c in filename: if ord(c)<=0x80 and c.isalnum(): magic = magic + c.upper() Index: fixps.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/fixps.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** fixps.py 17 Jan 2001 08:48:39 -0000 1.5 --- fixps.py 13 May 2003 18:14:24 -0000 1.6 *************** *** 9,21 **** def main(): ! for file in sys.argv[1:]: try: ! f = open(file, 'r') except IOError, msg: ! print file, ': can\'t open :', msg continue line = f.readline() if not re.match('^#! */usr/local/bin/python', line): ! print file, ': not a /usr/local/bin/python script' f.close() continue --- 9,21 ---- def main(): ! for filename in sys.argv[1:]: try: ! f = open(filename, 'r') except IOError, msg: ! print filename, ': can\'t open :', msg continue line = f.readline() if not re.match('^#! */usr/local/bin/python', line): ! print filename, ': not a /usr/local/bin/python script' f.close() continue *************** *** 24,29 **** line = re.sub('/usr/local/bin/python', '/usr/bin/env python', line) ! print file, ':', `line` ! f = open(file, "w") f.write(line) f.write(rest) --- 24,29 ---- line = re.sub('/usr/local/bin/python', '/usr/bin/env python', line) ! print filename, ':', `line` ! f = open(filename, "w") f.write(line) f.write(rest) Index: ftpmirror.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ftpmirror.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ftpmirror.py 5 Dec 2002 02:43:14 -0000 1.17 --- ftpmirror.py 13 May 2003 18:14:24 -0000 1.18 *************** *** 385,391 **** # Also creates a backup file. def writedict(dict, filename): ! dir, file = os.path.split(filename) ! tempname = os.path.join(dir, '@' + file) ! backup = os.path.join(dir, file + '~') try: os.unlink(backup) --- 385,391 ---- # Also creates a backup file. def writedict(dict, filename): ! dir, fname = os.path.split(filename) ! tempname = os.path.join(dir, '@' + fname) ! backup = os.path.join(dir, fname + '~') try: os.unlink(backup) Index: ifdef.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ifdef.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ifdef.py 11 Sep 2002 20:36:01 -0000 1.5 --- ifdef.py 13 May 2003 18:14:24 -0000 1.6 *************** *** 43,51 **** if not args: args = ['-'] ! for file in args: ! if file == '-': process(sys.stdin, sys.stdout) else: ! f = open(file, 'r') process(f, sys.stdout) f.close() --- 43,51 ---- if not args: args = ['-'] ! for filename in args: ! if filename == '-': process(sys.stdin, sys.stdout) else: ! f = open(filename, 'r') process(f, sys.stdout) f.close() Index: mkreal.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/mkreal.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mkreal.py 17 Jan 2001 08:48:39 -0000 1.6 --- mkreal.py 13 May 2003 18:14:25 -0000 1.7 *************** *** 39,45 **** linkto = join(os.pardir, linkto) # ! for file in files: ! if file not in (os.curdir, os.pardir): ! os.symlink(join(linkto, file), join(name, file)) def main(): --- 39,45 ---- linkto = join(os.pardir, linkto) # ! for filename in files: ! if filename not in (os.curdir, os.pardir): ! os.symlink(join(linkto, filename), join(name, filename)) def main(): Index: objgraph.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/objgraph.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** objgraph.py 11 Sep 2002 20:36:01 -0000 1.6 --- objgraph.py 13 May 2003 18:14:25 -0000 1.7 *************** *** 64,70 **** # Argument is an open file. # ! def readinput(file): while 1: ! s = file.readline() if not s: break --- 64,70 ---- # Argument is an open file. # ! def readinput(fp): while 1: ! s = fp.readline() if not s: break *************** *** 89,95 **** flist = file2undef.keys() flist.sort() ! for file in flist: ! print file + ':' ! elist = file2undef[file] elist.sort() for ext in elist: --- 89,95 ---- flist = file2undef.keys() flist.sort() ! for filename in flist: ! print filename + ':' ! elist = file2undef[filename] elist.sort() for ext in elist: *************** *** 108,119 **** files = file2def.keys() files.sort() ! for file in files: callers = [] ! for label in file2def[file]: if undef2file.has_key(label): callers = callers + undef2file[label] if callers: callers.sort() ! print file + ':' lastfn = '' for fn in callers: --- 108,119 ---- files = file2def.keys() files.sort() ! for filename in files: callers = [] ! for label in file2def[filename]: if undef2file.has_key(label): callers = callers + undef2file[label] if callers: callers.sort() ! print filename + ':' lastfn = '' for fn in callers: *************** *** 122,135 **** lastfn = fn else: ! print file + ': unused' ! # Print undefine names and where they are used. # def printundef(): undefs = {} ! for file in file2undef.keys(): ! for ext in file2undef[file]: if not def2file.has_key(ext): ! store(undefs, ext, file) elist = undefs.keys() elist.sort() --- 122,135 ---- lastfn = fn else: ! print filename + ': unused' ! # Print undefined names and where they are used. # def printundef(): undefs = {} ! for filename in file2undef.keys(): ! for ext in file2undef[filename]: if not def2file.has_key(ext): ! store(undefs, ext, filename) elist = undefs.keys() elist.sort() *************** *** 138,143 **** flist = undefs[ext] flist.sort() ! for file in flist: ! print '\t' + file # Print warning messages about names defined in more than one file. --- 138,143 ---- flist = undefs[ext] flist.sort() ! for filename in flist: ! print '\t' + filename # Print warning messages about names defined in more than one file. *************** *** 182,190 **** if not args: args = ['-'] ! for file in args: ! if file == '-': readinput(sys.stdin) else: ! readinput(open(file, 'r')) # warndups() --- 182,190 ---- if not args: args = ['-'] ! for filename in args: ! if filename == '-': readinput(sys.stdin) else: ! readinput(open(filename, 'r')) # warndups() Index: pindent.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/pindent.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pindent.py 11 Sep 2002 20:36:01 -0000 1.11 --- pindent.py 13 May 2003 18:14:25 -0000 1.12 *************** *** 532,537 **** else: action = eval(action + '_file') ! for file in args: ! action(file, stepsize, tabsize, expandtabs) # end for # end if --- 532,537 ---- else: action = eval(action + '_file') ! for filename in args: ! action(filename, stepsize, tabsize, expandtabs) # end for # end if Index: ptags.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/ptags.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ptags.py 17 Jan 2001 08:48:39 -0000 1.7 --- ptags.py 13 May 2003 18:14:25 -0000 1.8 *************** *** 17,21 **** def main(): args = sys.argv[1:] ! for file in args: treat_file(file) if tags: fp = open('tags', 'w') --- 17,22 ---- def main(): args = sys.argv[1:] ! for filename in args: ! treat_file(filename) if tags: fp = open('tags', 'w') *************** *** 27,40 **** matcher = re.compile(expr) ! def treat_file(file): try: ! fp = open(file, 'r') except: ! sys.stderr.write('Cannot open %s\n' % file) return ! base = os.path.basename(file) if base[-3:] == '.py': base = base[:-3] ! s = base + '\t' + file + '\t' + '1\n' tags.append(s) while 1: --- 28,41 ---- matcher = re.compile(expr) ! def treat_file(filename): try: ! fp = open(filename, 'r') except: ! sys.stderr.write('Cannot open %s\n' % filename) return ! base = os.path.basename(filename) if base[-3:] == '.py': base = base[:-3] ! s = base + '\t' + filename + '\t' + '1\n' tags.append(s) while 1: *************** *** 46,50 **** content = m.group(0) name = m.group(2) ! s = name + '\t' + file + '\t/^' + content + '/\n' tags.append(s) --- 47,51 ---- content = m.group(0) name = m.group(2) ! s = name + '\t' + filename + '\t/^' + content + '/\n' tags.append(s) Index: suff.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/suff.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** suff.py 17 Jan 2001 08:48:39 -0000 1.5 --- suff.py 13 May 2003 18:14:25 -0000 1.6 *************** *** 10,18 **** files = sys.argv[1:] suffixes = {} ! for file in files: ! suff = getsuffix(file) if not suffixes.has_key(suff): suffixes[suff] = [] ! suffixes[suff].append(file) keys = suffixes.keys() keys.sort() --- 10,18 ---- files = sys.argv[1:] suffixes = {} ! for filename in files: ! suff = getsuffix(filename) if not suffixes.has_key(suff): suffixes[suff] = [] ! suffixes[suff].append(filename) keys = suffixes.keys() keys.sort() *************** *** 20,28 **** print `suff`, len(suffixes[suff]) ! def getsuffix(file): suff = '' ! for i in range(len(file)): ! if file[i] == '.': ! suff = file[i:] return suff --- 20,28 ---- print `suff`, len(suffixes[suff]) ! def getsuffix(filename): suff = '' ! for i in range(len(filename)): ! if filename[i] == '.': ! suff = filename[i:] return suff Index: untabify.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/untabify.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** untabify.py 11 Sep 2002 20:36:01 -0000 1.3 --- untabify.py 13 May 2003 18:14:25 -0000 1.4 *************** *** 21,39 **** tabsize = int(optvalue) ! for file in args: ! process(file, tabsize) ! def process(file, tabsize): try: ! f = open(file) text = f.read() f.close() except IOError, msg: ! print "%s: I/O error: %s" % (`file`, str(msg)) return newtext = text.expandtabs(tabsize) if newtext == text: return ! backup = file + "~" try: os.unlink(backup) --- 21,39 ---- tabsize = int(optvalue) ! for filename in args: ! process(filename, tabsize) ! def process(filename, tabsize): try: ! f = open(filename) text = f.read() f.close() except IOError, msg: ! print "%s: I/O error: %s" % (`filename`, str(msg)) return newtext = text.expandtabs(tabsize) if newtext == text: return ! backup = filename + "~" try: os.unlink(backup) *************** *** 41,51 **** pass try: ! os.rename(file, backup) except os.error: pass ! f = open(file, "w") f.write(newtext) f.close() ! print file if __name__ == '__main__': --- 41,51 ---- pass try: ! os.rename(filename, backup) except os.error: pass ! f = open(filename, "w") f.write(newtext) f.close() ! print filename if __name__ == '__main__': Index: which.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/which.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** which.py 11 Sep 2002 20:36:01 -0000 1.10 --- which.py 13 May 2003 18:14:25 -0000 1.11 *************** *** 26,41 **** ident = () for dir in pathlist: ! file = os.path.join(dir, prog) try: ! st = os.stat(file) except os.error: continue if not S_ISREG(st[ST_MODE]): ! msg(file + ': not a disk file') else: mode = S_IMODE(st[ST_MODE]) if mode & 0111: if not ident: ! print file ident = st[:3] else: --- 26,41 ---- ident = () for dir in pathlist: ! filename = os.path.join(dir, prog) try: ! st = os.stat(filename) except os.error: continue if not S_ISREG(st[ST_MODE]): ! msg(filename + ': not a disk file') else: mode = S_IMODE(st[ST_MODE]) if mode & 0111: if not ident: ! print filename ident = st[:3] else: *************** *** 44,52 **** else: s = 'also: ' ! msg(s + file) else: ! msg(file + ': not executable') if longlist: ! sts = os.system('ls ' + longlist + ' ' + file) if sts: msg('"ls -l" exit status: ' + `sts`) if not ident: --- 44,52 ---- else: s = 'also: ' ! msg(s + filename) else: ! msg(filename + ': not executable') if longlist: ! sts = os.system('ls ' + longlist + ' ' + filename) if sts: msg('"ls -l" exit status: ' + `sts`) if not ident: From bcannon@users.sourceforge.net Tue May 13 21:28:18 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue, 13 May 2003 13:28:18 -0700 Subject: [Python-checkins] python/dist/src/Lib _strptime.py,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4524/Lib Modified Files: _strptime.py Log Message: Call time.tzset (if available) just before calculating possible timezones from time.tzname. Index: _strptime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** _strptime.py 11 May 2003 06:23:36 -0000 1.17 --- _strptime.py 13 May 2003 20:28:15 -0000 1.18 *************** *** 285,288 **** --- 285,292 ---- # # Empty string used for matching when timezone is not used/needed. + try: + time.tzset() + except AttributeError: + pass time_zones = ["UTC", "GMT"] if time.daylight: From fdrake@acm.org Tue May 13 22:53:37 2003 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Tue, 13 May 2003 17:53:37 -0400 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.53,1.54 In-Reply-To: <200305131509.h4DF9Kg08030@localhost.localdomain> References: <200305131509.h4DF9Kg08030@localhost.localdomain> Message-ID: <16065.26977.138744.429944@grendel.zope.com> Anthony Baxter writes: > It's probably worth noting that the reference manual I'm writing > (see the sandbox) and the existing two Distutils docs need to > interact in some way. I'm not sure what that is yet, though... I see two possibilities, and have a fairly strong preference for one: 1. Include it in the "Distributing Python Modules" document. This makes a lot of sense, since the most common users of this documentation will be people trying to make distutils do the right thing for their package. This is also not unreasonable for people trying to extend distutils to support additional compilers, binary packages, and the like. 2. Distutils could have a chapter in the Library Reference. This isn't unreasonable, it just doesn't have anything else to recommend it. Clearly, I prefer option 1. ;-) -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From bcannon@users.sourceforge.net Wed May 14 03:18:33 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Tue, 13 May 2003 19:18:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_urllibnet.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16801/Lib/test Modified Files: test_urllibnet.py Log Message: Fleshed out tests for urllib requiring a network connection. Index: test_urllibnet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllibnet.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_urllibnet.py 1 May 2003 17:45:54 -0000 1.2 --- test_urllibnet.py 14 May 2003 02:18:31 -0000 1.3 *************** *** 5,10 **** import socket ! import urllib2 import sys class URLTimeoutTest(unittest.TestCase): --- 5,12 ---- import socket ! import urllib import sys + import os + import mimetools class URLTimeoutTest(unittest.TestCase): *************** *** 19,28 **** def testURLread(self): ! f = urllib2.urlopen("http://www.python.org/") x = f.read() def test_main(): test_support.requires('network') ! test_support.run_unittest(URLTimeoutTest) if __name__ == "__main__": --- 21,148 ---- def testURLread(self): ! f = urllib.urlopen("http://www.python.org/") x = f.read() + class urlopenNetworkTests(unittest.TestCase): + """Tests urllib.urlopen using the network. + + These tests are not exhaustive. Assuming that testing using files does a + good job overall of some of the basic interface features. There are no + tests exercising the optional 'data' and 'proxies' arguments. No tests + for transparent redirection have been written. + + setUp is not used for always constructing a connection to + http://www.python.org/ since there a few tests that don't use that address + and making a connection is expensive enough to warrant minimizing unneeded + connections. + + """ + + def test_basic(self): + # Simple test expected to pass. + open_url = urllib.urlopen("http://www.python.org/") + for attr in ("read", "readline", "readlines", "fileno", "close", + "info", "geturl"): + self.assert_(hasattr(open_url, attr), "object returned from " + "urlopen lacks the %s attribute" % attr) + try: + self.assert_(open_url.read(), "calling 'read' failed") + finally: + open_url.close() + + def test_readlines(self): + # Test both readline and readlines. + open_url = urllib.urlopen("http://www.python.org/") + try: + self.assert_(isinstance(open_url.readline(), basestring), + "readline did not return a string") + self.assert_(isinstance(open_url.readlines(), list), + "readlines did not return a list") + finally: + open_url.close() + + def test_info(self): + # Test 'info'. + open_url = urllib.urlopen("http://www.python.org/") + try: + info_obj = open_url.info() + finally: + open_url.close() + self.assert_(isinstance(info_obj, mimetools.Message), + "object returned by 'info' is not an instance of " + "mimetools.Message") + self.assertEqual(info_obj.getsubtype(), "html") + + def test_geturl(self): + # Make sure same URL as opened is returned by geturl. + URL = "http://www.python.org/" + open_url = urllib.urlopen(URL) + try: + gotten_url = open_url.geturl() + finally: + open_url.close() + self.assertEqual(gotten_url, URL) + + def test_fileno(self): + # Make sure fd returned by fileno is valid. + if hasattr(os, 'fdopen'): + open_url = urllib.urlopen("http://www.python.org/") + fd = open_url.fileno() + FILE = os.fdopen(fd) + try: + self.assert_(FILE.read(), "reading from file created using fd " + "returned by fileno failed") + finally: + FILE.close() + + def test_bad_address(self): + # Make sure proper exception is raised when connecting to a bogus + # address. + self.assertRaises(IOError, + urllib.urlopen, "http://www.sadflkjsasadf.com/") + + class urlretrieveNetworkTests(unittest.TestCase): + """Tests urllib.urlretrieve using the network.""" + + def test_basic(self): + # Test basic functionality. + file_location,info = urllib.urlretrieve("http://www.python.org/") + self.assert_(os.path.exists(file_location), "file location returned by" + " urlretrieve is not a valid path") + FILE = file(file_location) + try: + self.assert_(FILE.read(), "reading from the file location returned " + "by urlretrieve failed") + finally: + FILE.close() + os.unlink(file_location) + + def test_specified_path(self): + # Make sure that specifying the location of the file to write to works. + file_location,info = urllib.urlretrieve("http://www.python.org/", + test_support.TESTFN) + self.assertEqual(file_location, test_support.TESTFN) + self.assert_(os.path.exists(file_location)) + FILE = file(file_location) + try: + self.assert_(FILE.read(), "reading from temporary file failed") + finally: + FILE.close() + os.unlink(file_location) + + def test_header(self): + # Make sure header returned as 2nd value from urlretrieve is good. + file_location, header = urllib.urlretrieve("http://www.python.org/") + os.unlink(file_location) + self.assert_(isinstance(header, mimetools.Message), + "header is not an instance of mimetools.Message") + + + def test_main(): test_support.requires('network') ! test_support.run_unittest(URLTimeoutTest, ! urlopenNetworkTests, ! urlretrieveNetworkTests) if __name__ == "__main__": From Anthony Baxter Wed May 14 04:51:55 2003 From: Anthony Baxter (Anthony Baxter) Date: Wed, 14 May 2003 13:51:55 +1000 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.53,1.54 In-Reply-To: <16065.26977.138744.429944@grendel.zope.com> Message-ID: <200305140351.h4E3puN16318@localhost.localdomain> >>> "Fred L. Drake, Jr." wrote > 1. Include it in the "Distributing Python Modules" document. This > makes a lot of sense, since the most common users of this > documentation will be people trying to make distutils do the > right thing for their package. This is also not unreasonable for > people trying to extend distutils to support additional > compilers, binary packages, and the like. The problem is (for me) distinguishing between "Installing" and "Distributing". I'm not sure why there's two separate documents. > 2. Distutils could have a chapter in the Library Reference. This > isn't unreasonable, it just doesn't have anything else to > recommend it. > > Clearly, I prefer option 1. ;-) There should probably be a bit more in the library ref about distutils - there's a bunch of useful material in the package, and it'd be a shame for people to re-invent the wheel again and again because they don't know it's there. For instance, the Compiler support could easily be used by some of the Python-based build tools. Anthony -- Anthony Baxter It's never too late to have a happy childhood. From fdrake@users.sourceforge.net Wed May 14 05:16:17 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 13 May 2003 21:16:17 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools mkhowto,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv6616 Modified Files: mkhowto Log Message: When an external application we use exits normally, exit with the same exit code they returned. All other types of exit from child processes are normalized to a return code of 1. Closes SF bug #732143. Index: mkhowto =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkhowto,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** mkhowto 17 Jan 2003 21:25:04 -0000 1.38 --- mkhowto 14 May 2003 04:16:14 -0000 1.39 *************** *** 526,532 **** "Session transcript and error messages are in %s." % self.log_filename) if hasattr(os, "WIFEXITED"): if os.WIFEXITED(rc): ! self.warning("Exited with status %s." % os.WEXITSTATUS(rc)) else: self.warning("Killed by signal %s." % os.WSTOPSIG(rc)) --- 526,534 ---- "Session transcript and error messages are in %s." % self.log_filename) + result = 1 if hasattr(os, "WIFEXITED"): if os.WIFEXITED(rc): ! result = os.WEXITSTATUS(rc) ! self.warning("Exited with status %s." % result) else: self.warning("Killed by signal %s." % os.WSTOPSIG(rc)) *************** *** 536,540 **** sys.stderr.write("-" * 72 + "\n") sys.stderr.writelines(get_run_transcript(self.log_filename)) ! sys.exit(rc) def message(self, msg): --- 538,542 ---- sys.stderr.write("-" * 72 + "\n") sys.stderr.writelines(get_run_transcript(self.log_filename)) ! sys.exit(result) def message(self, msg): From fdrake@acm.org Wed May 14 06:34:33 2003 From: fdrake@acm.org (Fred L. Drake, Jr.) Date: Wed, 14 May 2003 01:34:33 -0400 Subject: [Python-checkins] python/dist/src/Doc/dist dist.tex,1.53,1.54 In-Reply-To: <200305140351.h4E3puN16318@localhost.localdomain> References: <16065.26977.138744.429944@grendel.zope.com> <200305140351.h4E3puN16318@localhost.localdomain> Message-ID: <16065.54633.530482.656413@grendel.zope.com> Anthony Baxter writes: > The problem is (for me) distinguishing between "Installing" and > "Distributing". I'm not sure why there's two separate documents. So everyone reading this via python-checkins knows: I've responded to Anthony on the distutils-sig list, as that's a more appropriate forum for this discussion. Feel free to read it in the distutils-sig archives: http://mail.python.org/pipermail/distutils-sig/2003-May/003273.html Or join us on the distutils-sig list: http://mail.python.org/mailman/listinfo/distutils-sig -Fred -- Fred L. Drake, Jr. PythonLabs at Zope Corporation From fdrake@users.sourceforge.net Wed May 14 15:28:11 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 14 May 2003 07:28:11 -0700 Subject: [Python-checkins] python/dist/src/Lib pstats.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29578 Modified Files: pstats.py Log Message: - add a dump_stats() method similar to that of the profile.Profile class - don't use "file" as the name of local variables Index: pstats.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pstats.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** pstats.py 27 Feb 2003 20:14:38 -0000 1.28 --- pstats.py 14 May 2003 14:28:09 -0000 1.29 *************** *** 159,162 **** --- 159,170 ---- return self + def dump_stats(self, filename): + """Write the profile data to a file we know how to load back.""" + f = file(filename, 'wb') + try: + marshal.dump(self.stats, f) + finally: + f.close() + # list the tuple indices and directions for sorting, # along with some printable description *************** *** 441,446 **** def func_strip_path(func_name): ! file, line, name = func_name ! return os.path.basename(file), line, name def func_get_function_name(func): --- 449,454 ---- def func_strip_path(func_name): ! filename, line, name = func_name ! return os.path.basename(filename), line, name def func_get_function_name(func): From fdrake@users.sourceforge.net Wed May 14 15:29:30 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed, 14 May 2003 07:29:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libprofile.tex,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30575 Modified Files: libprofile.tex Log Message: document Stats.dump_stats(), new for Python 2.3 Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** libprofile.tex 9 Oct 2001 20:54:23 -0000 1.39 --- libprofile.tex 14 May 2003 14:29:27 -0000 1.40 *************** *** 393,396 **** --- 393,404 ---- \end{methoddesc} + \begin{methoddesc}[Stats]{dump_stats}{filename} + Save the data loaded into the \class{Stats} object to a file named + \var{filename}. The file is created if it does not exist, and is + overwritten if it already exists. This is equivalent to the method of + the same name on the \class{profile.Profile} class. + \versionadded{2.3} + \end{methoddesc} + \begin{methoddesc}[Stats]{sort_stats}{key\optional{, ...}} This method modifies the \class{Stats} object by sorting it according From akuchling@users.sourceforge.net Wed May 14 17:51:48 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 14 May 2003 09:51:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libmarshal.tex,1.22,1.23 libpickle.tex,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28987 Modified Files: libmarshal.tex libpickle.tex Log Message: [Bug #471893] Replace security material with a warning against unpickling untrusted data. Index: libmarshal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmarshal.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** libmarshal.tex 15 Nov 2001 23:55:12 -0000 1.22 --- libmarshal.tex 14 May 2003 16:51:46 -0000 1.23 *************** *** 27,37 **** maintainers reserve the right to modify the marshal format in backward incompatible ways should the need arise. If you're serializing and ! de-serializing Python objects, use the \module{pickle} module. There ! may also be unknown security problems with ! \module{marshal}\footnote{As opposed to the known security issues in ! the \module{pickle} module!}. \refstmodindex{pickle} \refstmodindex{shelve} \obindex{code} Not all Python object types are supported; in general, only objects --- 27,40 ---- maintainers reserve the right to modify the marshal format in backward incompatible ways should the need arise. If you're serializing and ! de-serializing Python objects, use the \module{pickle} module instead. \refstmodindex{pickle} \refstmodindex{shelve} \obindex{code} + + \begin{notice}[warning] + The \module{marshal} module is not intended to be secure against + erroneous or maliciously constructed data. Never unmarshal data + received from an untrusted or unauthenticated source. + \end{notice} Not all Python object types are supported; in general, only objects Index: libpickle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpickle.tex,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** libpickle.tex 21 Feb 2003 00:26:33 -0000 1.40 --- libpickle.tex 14 May 2003 16:51:46 -0000 1.41 *************** *** 86,101 **** backwards compatible across Python releases. - \item The \module{pickle} module doesn't handle code objects, which - the \module{marshal} module does. This avoids the possibility - of smuggling Trojan horses into a program through the - \module{pickle} module\footnote{This doesn't necessarily imply - that \module{pickle} is inherently secure. See - section~\ref{pickle-sec} for a more detailed discussion on - \module{pickle} module security. Besides, it's possible that - \module{pickle} will eventually support serializing code - objects.}. - \end{itemize} Note that serialization is a more primitive notion than persistence; although --- 86,97 ---- backwards compatible across Python releases. \end{itemize} + \begin{notice}[warning] + The \module{pickle} module is not intended to be secure against + erroneous or maliciously constructed data. Never unpickle data + received from an untrusted or unauthenticated source. + \end{notice} + Note that serialization is a more primitive notion than persistence; although *************** *** 252,260 **** \begin{excdesc}{UnpicklingError} ! This exception is raised when there is a problem unpickling an object, ! such as a security violation. Note that other exceptions may also be ! raised during unpickling, including (but not necessarily limited to) ! \exception{AttributeError}, \exception{EOFError}, ! \exception{ImportError}, and \exception{IndexError}. \end{excdesc} --- 248,255 ---- \begin{excdesc}{UnpicklingError} ! This exception is raised when there is a problem unpickling an object. ! Note that other exceptions may also be raised during unpickling, ! including (but not necessarily limited to) \exception{AttributeError}, ! \exception{EOFError}, \exception{ImportError}, and \exception{IndexError}. \end{excdesc} *************** *** 264,269 **** modules these callables are factory functions and so cannot be subclassed. One of the common reasons to subclass is to control what ! objects can actually be unpickled. See section~\ref{pickle-sec} for ! more details on security concerns.}, \class{Pickler} and \class{Unpickler}: --- 259,264 ---- modules these callables are factory functions and so cannot be subclassed. One of the common reasons to subclass is to control what ! objects can actually be unpickled. See section~\ref{pickle-sub} for ! more details.}, \class{Pickler} and \class{Unpickler}: *************** *** 446,450 **** de-serialized. The description in this section doesn't cover specific customizations that you can employ to make the unpickling environment ! safer from untrusted pickle data streams; see section~\ref{pickle-sec} for more details. --- 441,445 ---- de-serialized. The description in this section doesn't cover specific customizations that you can employ to make the unpickling environment ! slightly safer from untrusted pickle data streams; see section~\ref{pickle-sub} for more details. *************** *** 648,699 **** % why it was added or what it's for, I'm leaving it undocumented. ! \subsection{Security \label{pickle-sec}} ! ! Most of the security issues surrounding the \module{pickle} and ! \module{cPickle} module involve unpickling. There are no known ! security vulnerabilities ! related to pickling because you (the programmer) control the objects ! that \module{pickle} will interact with, and all it produces is a ! string. ! ! However, for unpickling, it is \strong{never} a good idea to unpickle ! an untrusted string whose origins are dubious, for example, strings ! read from a socket. This is because unpickling can create unexpected ! objects and even potentially run methods of those objects, such as ! their class constructor or destructor\footnote{A special note of ! caution is worth raising about the \refmodule{Cookie} ! module. By default, the \class{Cookie.Cookie} class is an alias for ! the \class{Cookie.SmartCookie} class, which ``helpfully'' attempts to ! unpickle any cookie data string it is passed. This is a huge security ! hole because cookie data typically comes from an untrusted source. ! You should either explicitly use the \class{Cookie.SimpleCookie} class ! --- which doesn't attempt to unpickle its string --- or you should ! implement the defensive programming steps described later on in this ! section.}. ! ! You can defend against this by customizing your unpickler so that you ! can control exactly what gets unpickled and what gets called. ! Unfortunately, exactly how you do this is different depending on ! whether you're using \module{pickle} or \module{cPickle}. ! ! One common feature that both modules implement is the ! \member{__safe_for_unpickling__} attribute. Before calling a callable ! which is not a class, the unpickler will check to make sure that the ! callable has either been registered as a safe callable via the ! \refmodule[copyreg]{copy_reg} module, or that it has an ! attribute \member{__safe_for_unpickling__} with a true value. This ! prevents the unpickling environment from being tricked into doing ! evil things like call \code{os.unlink()} with an arbitrary file name. ! See section~\ref{pickle-protocol} for more details. ! For safely unpickling class instances, you need to control exactly ! which classes will get created. Be aware that a class's constructor ! could be called (if the pickler found a \method{__getinitargs__()} ! method) and the the class's destructor (i.e. its \method{__del__()} method) ! might get called when the object is garbage collected. Depending on ! the class, it isn't very heard to trick either method into doing bad ! things, such as removing a file. The way to ! control the classes that are safe to instantiate differs in ! \module{pickle} and \module{cPickle}\footnote{A word of caution: the mechanisms described here use internal attributes and methods, which are subject to change in future versions of Python. We intend to --- 643,653 ---- % why it was added or what it's for, I'm leaving it undocumented. ! \subsection{Subclassing Unpicklers \label{pickle-sub}} ! By default, unpickling will import any class that it finds in the ! pickle data. You can control exactly what gets unpickled and what ! gets called by customizing your unpickler. Unfortunately, exactly how ! you do this is different depending on whether you're using ! \module{pickle} or \module{cPickle}.\footnote{A word of caution: the mechanisms described here use internal attributes and methods, which are subject to change in future versions of Python. We intend to *************** *** 706,720 **** data stream where the first line will the the name of the module containing the class and the second line will be the name of the ! instance's class. It then look up the class, possibly importing the module and digging out the attribute, then it appends what it finds to the unpickler's stack. Later on, this class will be assigned to the \member{__class__} attribute of an empty class, as a way of magically creating an instance without calling its class's \method{__init__()}. ! You job (should you choose to accept it), would be to have \method{load_global()} push onto the unpickler's stack, a known safe version of any class you deem safe to unpickle. It is up to you to produce such a class. Or you could raise an error if you want to disallow all unpickling of instances. If this sounds like a hack, ! you're right. UTSL. Things are a little cleaner with \module{cPickle}, but not by much. --- 660,674 ---- data stream where the first line will the the name of the module containing the class and the second line will be the name of the ! instance's class. It then looks up the class, possibly importing the module and digging out the attribute, then it appends what it finds to the unpickler's stack. Later on, this class will be assigned to the \member{__class__} attribute of an empty class, as a way of magically creating an instance without calling its class's \method{__init__()}. ! Your job (should you choose to accept it), would be to have \method{load_global()} push onto the unpickler's stack, a known safe version of any class you deem safe to unpickle. It is up to you to produce such a class. Or you could raise an error if you want to disallow all unpickling of instances. If this sounds like a hack, ! you're right. Refer to the source code to make this work. Things are a little cleaner with \module{cPickle}, but not by much. *************** *** 725,729 **** then it should accept a module name and a class name, and return the corresponding class object. It is responsible for looking up the ! class, again performing any necessary imports, and it may raise an error to prevent instances of the class from being unpickled. --- 679,683 ---- then it should accept a module name and a class name, and return the corresponding class object. It is responsible for looking up the ! class and performing any necessary imports, and it may raise an error to prevent instances of the class from being unpickled. From akuchling@users.sourceforge.net Wed May 14 18:12:57 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Wed, 14 May 2003 10:12:57 -0700 Subject: [Python-checkins] python/nondist/peps pep-0314.txt,1.14,1.15 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv20403 Modified Files: pep-0314.txt Log Message: Correct # of PEP being replaced Remove sentence about extensibility; make punctuation change Specify Supported-Platform as multiple use Index: pep-0314.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0314.txt,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** pep-0314.txt 7 May 2003 21:35:05 -0000 1.14 --- pep-0314.txt 14 May 2003 17:12:55 -0000 1.15 *************** *** 10,14 **** Python-Version: 2.3 Post-History: 29-Apr-2003 ! Replaces: 243 Introduction --- 10,14 ---- Python-Version: 2.3 Post-History: 29-Apr-2003 ! Replaces: 241 Introduction *************** *** 37,42 **** The PKG-INFO file format is a single set of RFC-822 headers parseable by the rfc822.py module. The field names listed in the ! following section are used as the header names. There's no ! extension mechanism in this simple format. --- 37,41 ---- The PKG-INFO file format is a single set of RFC-822 headers parseable by the rfc822.py module. The field names listed in the ! following section are used as the header names. *************** *** 49,53 **** times in a single PKG-INFO file. Other fields may only occur once in a PKG-INFO file. Fields marked with "(optional)" are ! not required to appear in a valid PKG-INFO file, all other fields must be present. --- 48,52 ---- times in a single PKG-INFO file. Other fields may only occur once in a PKG-INFO file. Fields marked with "(optional)" are ! not required to appear in a valid PKG-INFO file; all other fields must be present. *************** *** 93,97 **** Platform: POSIX, Windows ! Supported-Platform Binary distributions containing a PKG-INFO file will use the --- 92,96 ---- Platform: POSIX, Windows ! Supported-Platform (multiple use) Binary distributions containing a PKG-INFO file will use the From montanaro@users.sourceforge.net Wed May 14 18:33:55 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Wed, 14 May 2003 10:33:55 -0700 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv15016 Modified Files: warnings.py Log Message: defer re module imports to help improve interpreter startup Index: warnings.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/warnings.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** warnings.py 19 Feb 2003 00:33:33 -0000 1.19 --- warnings.py 14 May 2003 17:33:53 -0000 1.20 *************** *** 4,8 **** # in this module as it may cause import lock deadlock. # See bug 683658. ! import sys, re, types import linecache --- 4,8 ---- # in this module as it may cause import lock deadlock. # See bug 683658. ! import sys, types import linecache *************** *** 130,133 **** --- 130,134 ---- Use assertions to check that all arguments have the right type.""" + import re assert action in ("error", "ignore", "always", "default", "module", "once"), "invalid action: %s" % `action` *************** *** 163,166 **** --- 164,168 ---- # Helper for _processoptions() def _setoption(arg): + import re parts = arg.split(':') if len(parts) > 5: *************** *** 199,202 **** --- 201,205 ---- # Helper for _setoption() def _getcategory(category): + import re if not category: return Warning From guido@python.org Wed May 14 18:37:22 2003 From: guido@python.org (Guido van Rossum) Date: Wed, 14 May 2003 13:37:22 -0400 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.19,1.20 In-Reply-To: Your message of "Wed, 14 May 2003 10:33:55 PDT." References: Message-ID: <200305141737.h4EHbMv06730@odiug.zope.com> > Modified Files: > warnings.py > Log Message: > defer re module imports to help improve interpreter startup Are you sure that's going to help? "import warnings" callse _processoptions() and makes a few calls to filterwarnings() which brings in the re module anyway... --Guido van Rossum (home page: http://www.python.org/~guido/) From skip@pobox.com Wed May 14 19:02:05 2003 From: skip@pobox.com (Skip Montanaro) Date: Wed, 14 May 2003 13:02:05 -0500 Subject: [Python-checkins] python/dist/src/Lib warnings.py,1.19,1.20 In-Reply-To: <200305141737.h4EHbMv06730@odiug.zope.com> References: <200305141737.h4EHbMv06730@odiug.zope.com> Message-ID: <16066.33949.903064.834797@montanaro.dyndns.org> >> defer re module imports to help improve interpreter startup Guido> Are you sure that's going to help? "import warnings" callse Guido> _processoptions() and makes a few calls to filterwarnings() which Guido> brings in the re module anyway... Apparently not. :-( The call to _processoptions() won't hurt unless the user invokes the interpreter with a -W arg. Not much we can do there. I think the import in filterwarnings can be avoided by deferring the re compilation until warn_explicit. I'll see what I can come up with and submit a patch. Skip From rhettinger@users.sourceforge.net Wed May 14 19:15:59 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 14 May 2003 11:15:59 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts texcheck.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv27953 Modified Files: texcheck.py Log Message: Forward slash warnings now only occur for potentially valid LaTeX commands. (Idea contributed by Anthony Baxter.) Index: texcheck.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/texcheck.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** texcheck.py 12 May 2003 23:33:28 -0000 1.4 --- texcheck.py 14 May 2003 18:15:55 -0000 1.5 *************** *** 17,21 **** -m Munge parenthesis and brackets. [0,n) would normally mismatch. -k keyword: Keyword is a valid LaTeX command. Do not include the backslash. - -f: Forward-slash warnings suppressed. -d: Delimiter check only (useful for non-LaTeX files). -h: Help --- 17,20 ---- *************** *** 76,82 **** Opts is a mapping of options to option values if any: -m munge parenthesis and brackets - -f forward slash warnings to be skipped -d delimiters only checking ! -v verbose listing on delimiters -s lineno: linenumber to start scan (default is 1). --- 75,80 ---- Opts is a mapping of options to option values if any: -m munge parenthesis and brackets -d delimiters only checking ! -v verbose listing of delimiters -s lineno: linenumber to start scan (default is 1). *************** *** 86,89 **** --- 84,88 ---- texcmd = re.compile(r'\\[A-Za-z]+') + falsetexcmd = re.compile(r'\/([A-Za-z]+)') # Mismarked with forward slash validcmds = sets.Set(cmdstr.split()) *************** *** 115,122 **** line = line.rstrip() ! if '/' in line and '-f' not in opts and '-d' not in opts: ! # Warn whenever forward slashes encountered ! line = line.rstrip() ! print 'Warning, forward slash on line %d: %s' % (lineno, line) if '-d' not in opts: --- 114,122 ---- line = line.rstrip() ! if '/' in line and '-d' not in opts: ! # Warn whenever forward slashes encountered with a LaTeX command ! for cmd in falsetexcmd.findall(line): ! if '\\' + cmd in validcmds: ! print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd) if '-d' not in opts: *************** *** 180,184 **** if args is None: args = sys.argv[1:] ! optitems, arglist = getopt.getopt(args, "k:mfdhs:v") opts = dict(optitems) if '-h' in opts or args==[]: --- 180,184 ---- if args is None: args = sys.argv[1:] ! optitems, arglist = getopt.getopt(args, "k:mdhs:v") opts = dict(optitems) if '-h' in opts or args==[]: From lemburg@users.sourceforge.net Wed May 14 20:49:00 2003 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Wed, 14 May 2003 12:49:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils msvccompiler.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv22499 Modified Files: msvccompiler.py Log Message: Restore Python 1.5.2 compatibility. Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** msvccompiler.py 9 May 2003 16:55:28 -0000 1.55 --- msvccompiler.py 14 May 2003 19:48:57 -0000 1.56 *************** *** 149,153 **** if i == -1: return 6 ! i += len(prefix) s, rest = sys.version[i:].split(" ", 1) n = int(s[:-2]) --- 149,153 ---- if i == -1: return 6 ! i = i + len(prefix) s, rest = sys.version[i:].split(" ", 1) n = int(s[:-2]) From goodger@users.sourceforge.net Wed May 14 23:23:10 2003 From: goodger@users.sourceforge.net (goodger@users.sourceforge.net) Date: Wed, 14 May 2003 15:23:10 -0700 Subject: [Python-checkins] python/nondist/peps pep-0754.txt,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv5470 Modified Files: pep-0754.txt Log Message: update from Gregory Warnes Index: pep-0754.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0754.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pep-0754.txt 12 Apr 2003 13:39:34 -0000 1.1 --- pep-0754.txt 14 May 2003 22:23:07 -0000 1.2 *************** *** 3,7 **** Version: $Revision$ Last-Modified: $Date$ ! Author: Gregory R. Warnes Status: Draft Type: Standard Track --- 3,7 ---- Version: $Revision$ Last-Modified: $Date$ ! Author: Gregory R. Warnes (Pfizer, Inc.) Status: Draft Type: Standard Track *************** *** 17,22 **** This PEP proposes an API and a provides a reference module that generates and tests for IEEE 754 double-precision special values: ! positive infinity (Inf), negative infinity (-Inf), and not-a-number ! (NaN). --- 17,21 ---- This PEP proposes an API and a provides a reference module that generates and tests for IEEE 754 double-precision special values: ! positive infinity, negative infinity, and not-a-number (NaN). *************** *** 27,34 **** algorithmic rules for floating point arithmetic. Included in the standard is a set of constants for representing special values, ! including positive infinity (Inf), negative infinity (-Inf), and ! indeterminate or non-numeric results (NaN). Most modern CPUs ! implement the IEEE 754 standard, including the (Ultra)SPARC, PowerPC, ! and x86 processor series. Currently, the handling of IEEE 754 special values in Python depends --- 26,33 ---- algorithmic rules for floating point arithmetic. Included in the standard is a set of constants for representing special values, ! including positive infinity, negative infinity, and indeterminate or ! non-numeric results (NaN). Most modern CPUs implement the ! IEEE 754 standard, including the (Ultra)SPARC, PowerPC, and x86 ! processor series. Currently, the handling of IEEE 754 special values in Python depends *************** *** 58,63 **** like:: ! Inf = 1e300**2 ! NaN = Inf/Inf to obtain positive infinity and not-a-number constants. However, the --- 57,62 ---- like:: ! PosInf = 1e300**2 ! NaN = PosInf/PosInf to obtain positive infinity and not-a-number constants. However, the *************** *** 65,70 **** possible alternative is to use:: ! Inf = 1e300000 ! NaN = Inf/Inf While this does not generate an error with current Python --- 64,69 ---- possible alternative is to use:: ! PosInf = 1e300000 ! NaN = PosInf/PosInf While this does not generate an error with current Python *************** *** 101,107 **** NaN ! IEEE 754 "Not a Number" value ! Inf, PosInf IEEE 754 Positive Infinity value --- 100,106 ---- NaN ! Non-signalling IEEE 754 "Not a Number" value ! PosInf IEEE 754 Positive Infinity value *************** *** 113,130 **** --------- ! is_NaN(value) Determine if the argument is a IEEE 754 NaN (Not a Number) value. ! is_Inf(value), is_PosInf(value) ! Determine if the argument is a IEEE 754 positive infinity value ! is_NegInf(value) ! Determine if the argument is a IEEE 754 negative infinity value ! is_Finite(value) Determine if the argument is an finite IEEE 754 value (i.e., is ! not NaN, positive or negative infinity) ! is_Infinite(value) Determine if the argument is an infinite IEEE 754 value (positive or negative infinity) --- 112,129 ---- --------- ! isNaN(value) Determine if the argument is a IEEE 754 NaN (Not a Number) value. ! isPosInf(value) ! Determine if the argument is a IEEE 754 positive infinity value. ! isNegInf(value) ! Determine if the argument is a IEEE 754 negative infinity value. ! isFinite(value) Determine if the argument is an finite IEEE 754 value (i.e., is ! not NaN, positive, or negative infinity). ! isInf(value) Determine if the argument is an infinite IEEE 754 value (positive or negative infinity) *************** *** 140,153 **** >>> val Infinity ! >>> fpconst.is_Inf(val) 1 ! >>> fpconst.Inf Infinity >>> nval = val/val # should result in NaN >>> nval NaN ! >>> fpconst.is_NaN(nval) 1 ! >>> fpconst.is_NaN(val) 0 --- 139,152 ---- >>> val Infinity ! >>> fpconst.isInf(val) 1 ! >>> fpconst.PosInf Infinity >>> nval = val/val # should result in NaN >>> nval NaN ! >>> fpconst.isNaN(nval) 1 ! >>> fpconst.isNaN(val) 0 From jhylton@users.sourceforge.net Wed May 14 23:32:40 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 14 May 2003 15:32:40 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv14296 Modified Files: Decimal.py Log Message: whitespace normalization and folding long lines. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Decimal.py 2 May 2003 22:50:09 -0000 1.1 --- Decimal.py 14 May 2003 22:32:37 -0000 1.2 *************** *** 744,747 **** --- 744,748 ---- return Decimal((sign, self._int, self._exp)).fix(context=context) return Decimal( (sign, self._int, self._exp)) + def __pos__(self, context=None): """Returns a copy, unless it is a sNaN. *************** *** 786,790 **** return ans - def __add__(self, other, context=None): """Returns self + other. --- 787,790 ---- *************** *** 1025,1029 **** return self._divide(other, context=context) __truediv__ = __div__ - def _divide(self, other, divmod = 0, context=None): --- 1025,1028 ---- *************** *** 1359,1368 **** prec = context.prec ans = self.__copy__() ! ans = ans.fixexponents(prec, rounding, folddown=folddown, context=context) if len(ans._int) > prec: ans = ans.round(prec, rounding, context=context) ! ans = ans.fixexponents(prec, rounding, folddown=folddown, context=context) return ans ! def fixexponents(self, prec=None, rounding=None, folddown=None, context=None): """Fix the exponents and return a copy with the exponent in bounds.""" if self._isinfinity(): --- 1358,1371 ---- prec = context.prec ans = self.__copy__() ! ans = ans.fixexponents(prec, rounding, folddown=folddown, ! context=context) if len(ans._int) > prec: ans = ans.round(prec, rounding, context=context) ! ans = ans.fixexponents(prec, rounding, folddown=folddown, ! context=context) return ans ! ! def fixexponents(self, prec=None, rounding=None, folddown=None, ! context=None): """Fix the exponents and return a copy with the exponent in bounds.""" if self._isinfinity(): *************** *** 1405,1408 **** --- 1408,1412 ---- return context.raise_error(Overflow, 'above Emax', ans._sign) return ans + def round(self, prec=None, rounding=None, context=None): """Returns a rounded version of self. From greg@users.sourceforge.net Thu May 15 01:13:20 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Wed, 14 May 2003 17:13:20 -0700 Subject: [Python-checkins] python/dist/src/Modules _bsddb.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv4929 Modified Files: _bsddb.c Log Message: DB.remove() needs to set the internal DB handle to NULL after being called. (sourceforge pybsddb bug #737970). Also: don't allow other threads to run during calls that invalidate the DB handle. Index: _bsddb.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** _bsddb.c 24 Apr 2003 14:28:08 -0000 1.13 --- _bsddb.c 15 May 2003 00:13:18 -0000 1.14 *************** *** 1136,1142 **** if (self->myenvobj) CHECK_ENV_NOT_CLOSED(self->myenvobj); - MYDB_BEGIN_ALLOW_THREADS; err = self->db->close(self->db, flags); - MYDB_END_ALLOW_THREADS; self->db = NULL; RETURN_IF_ERR(); --- 1136,1140 ---- *************** *** 1708,1714 **** CHECK_DB_NOT_CLOSED(self); - MYDB_BEGIN_ALLOW_THREADS; err = self->db->remove(self->db, filename, database, flags); ! MYDB_END_ALLOW_THREADS; RETURN_IF_ERR(); RETURN_NONE(); --- 1706,1711 ---- CHECK_DB_NOT_CLOSED(self); err = self->db->remove(self->db, filename, database, flags); ! self->db = NULL; RETURN_IF_ERR(); RETURN_NONE(); From tim_one@users.sourceforge.net Thu May 15 02:44:03 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 14 May 2003 18:44:03 -0700 Subject: [Python-checkins] python/nondist/peps pep-0042.txt,1.71,1.72 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv31940 Modified Files: pep-0042.txt Log Message: Added "Error on handling nan" http://www.python.org/sf/737648 to the non-accidental 754 support item. Index: pep-0042.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0042.txt,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** pep-0042.txt 13 May 2003 14:57:08 -0000 1.71 --- pep-0042.txt 15 May 2003 01:44:01 -0000 1.72 *************** *** 75,78 **** --- 75,81 ---- http://www.python.org/sf/445484 + Error on handling nan + http://www.python.org/sf/737648 + - Windows: Trying to create (or even access) files with certain magic names can hang or crash Windows systems. This is really a bug in the From tim_one@users.sourceforge.net Thu May 15 19:53:10 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 May 2003 11:53:10 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv29518 Modified Files: Decimal.py Log Message: Changed _test() so that running Decimal.py actually runs the tests (I think the tests were moved into a different directory since the last time someone tried to run the tests). Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Decimal.py 14 May 2003 22:32:37 -0000 1.2 --- Decimal.py 15 May 2003 18:53:07 -0000 1.3 *************** *** 2709,2712 **** --- 2709,2713 ---- import glob self.filelist = glob.glob(dir+'*.decTest') + print self.filelist if len(self.filelist) > 15: self.filelist.append(self.filelist[15]) *************** *** 2905,2909 **** def _test(): ! t = Test('./') t.test() --- 2906,2910 ---- def _test(): ! t = Test('./tests/') t.test() From tim_one@users.sourceforge.net Thu May 15 19:56:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 May 2003 11:56:08 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv31024 Modified Files: Decimal.py Log Message: Whitespace normalization. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Decimal.py 15 May 2003 18:53:07 -0000 1.3 --- Decimal.py 15 May 2003 18:55:58 -0000 1.4 *************** *** 7,11 **** arithmetic ANSI standard X3.274-1996. ! Most of the information used to create this module was helpfully provided by Mike Cowlishaw's work at http://www2.hursley.ibm.com/decimal/ --- 7,11 ---- arithmetic ANSI standard X3.274-1996. ! Most of the information used to create this module was helpfully provided by Mike Cowlishaw's work at [...1882 lines suppressed...] # result = ans[:spot] + result[spot:] ! # print 'OFF BY ONE IN LAST DIGIT OTHERWISE', ! if result != ans or myexceptions != theirexceptions: print 'INCORRECT **********' *************** *** 2902,2907 **** self.context.clamp = clamp ! ! def _test(): --- 2902,2907 ---- self.context.clamp = clamp ! ! def _test(): From tim_one@users.sourceforge.net Thu May 15 20:06:04 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 15 May 2003 12:06:04 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv4139 Modified Files: Decimal.py Log Message: Removed debugging print. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Decimal.py 15 May 2003 18:55:58 -0000 1.4 --- Decimal.py 15 May 2003 19:06:01 -0000 1.5 *************** *** 2709,2713 **** import glob self.filelist = glob.glob(dir+'*.decTest') - print self.filelist if len(self.filelist) > 15: self.filelist.append(self.filelist[15]) --- 2709,2712 ---- From gvanrossum@users.sourceforge.net Fri May 16 02:24:32 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 May 2003 18:24:32 -0700 Subject: [Python-checkins] python/dist/src/Lib codeop.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv451 Modified Files: codeop.py Log Message: Don't replace an empty line with "pass" when symbol == "eval", where "pass" isn't valid syntax. Reported by Samuele Pedroni on python-dev (May 12, 2003). Index: codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codeop.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** codeop.py 13 Feb 2003 22:07:54 -0000 1.6 --- codeop.py 16 May 2003 01:24:30 -0000 1.7 *************** *** 73,77 **** break # Leave it alone else: ! source = "pass" # Replace it with a 'pass' statement err = err1 = err2 = None --- 73,78 ---- break # Leave it alone else: ! if symbol != "eval": ! source = "pass" # Replace it with a 'pass' statement err = err1 = err2 = None From gvanrossum@users.sourceforge.net Fri May 16 02:42:24 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 May 2003 18:42:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libwinsound.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7705 Modified Files: libwinsound.tex Log Message: Add docs for MessageBeep. Index: libwinsound.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwinsound.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libwinsound.tex 20 Oct 2001 04:24:09 -0000 1.12 --- libwinsound.tex 16 May 2003 01:42:22 -0000 1.13 *************** *** 38,41 **** --- 38,51 ---- \end{funcdesc} + \begin{funcdesc}{MessageBeep}{\optional{type=\code{MB_OK}}} + Call the underlying \cfunction{MessageBeep()} function from the + Platform API. This plays a sound as specified in the registry. The + \var{type} argument specifies which sound to play; possible values + are \code{-1}, \code{MB_ICONASTERISK}, \code{MB_ICONEXCLAMATION}, + \code{MB_ICONHAND}, \code{MB_ICONQUESTION}, and \code{MB_OK}, all + described below. The value \code{-1} produces a ``simple beep''; + this is the final fallback if a sound cannot be played otherwise. + \versionadded{2.3} + \end{funcdesc} \begin{datadesc}{SND_FILENAME} *************** *** 110,112 **** --- 120,142 ---- \begin{datadesc}{SND_NOWAIT} Return immediately if the sound driver is busy. + \end{datadesc} + + \begin{datadesc}{MB_ICONASTERISK} + Play the \code{SystemDefault} sound. + \end{datadesc} + + \begin{datadesc}{MB_ICONEXCLAMATION} + Play the \code{SystemExclamation} sound. + \end{datadesc} + + \begin{datadesc}{MB_ICONHAND} + Play the \code{SystemHand} sound. + \end{datadesc} + + \begin{datadesc}{MB_ICONQUESTION} + Play the \code{SystemQuestion} sound. + \end{datadesc} + + \begin{datadesc}{MB_OK} + Play the \code{SystemDefault} sound. \end{datadesc} From gvanrossum@users.sourceforge.net Fri May 16 02:45:17 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 May 2003 18:45:17 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib.py,1.157,1.158 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8888 Modified Files: urllib.py Log Message: More fixes according to SF 549151: - When redirecting, always use GET. This is common practice and more-or-less sanctioned by the HTTP standard. - Add a handler for 307 redirection, which becomes an error for POST, but a regular redirect for GET and HEAD. Index: urllib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib.py,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** urllib.py 24 Apr 2003 15:32:08 -0000 1.157 --- urllib.py 16 May 2003 01:45:14 -0000 1.158 *************** *** 578,585 **** # In case the server sent a relative URL, join with original: newurl = basejoin(self.type + ":" + url, newurl) ! if data is None: ! return self.open(newurl) ! else: ! return self.open(newurl, data) def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): --- 578,582 ---- # In case the server sent a relative URL, join with original: newurl = basejoin(self.type + ":" + url, newurl) ! return self.open(newurl) def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): *************** *** 590,593 **** --- 587,597 ---- """Error 303 -- also relocated (essentially identical to 302).""" return self.http_error_302(url, fp, errcode, errmsg, headers, data) + + def http_error_307(self, url, fp, errcode, errmsg, headers, data=None): + """Error 307 -- relocated, but turn POST into error.""" + if data is None: + return self.http_error_302(url, fp, errcode, errmsg, headers, data) + else: + return self.http_error_default(url, fp, errcode, errmsg, headers) def http_error_401(self, url, fp, errcode, errmsg, headers, data=None): From gvanrossum@users.sourceforge.net Fri May 16 02:46:54 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 15 May 2003 18:46:54 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.765,1.766 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9467 Modified Files: NEWS Log Message: More fixes according to SF 549151: - When redirecting, always use GET. This is common practice and more-or-less sanctioned by the HTTP standard. - Add a handler for 307 redirection, which becomes an error for POST, but a regular redirect for GET and HEAD. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.765 retrieving revision 1.766 diff -C2 -d -r1.765 -r1.766 *** NEWS 13 May 2003 17:58:35 -0000 1.765 --- NEWS 16 May 2003 01:46:51 -0000 1.766 *************** *** 39,42 **** --- 39,47 ---- ------- + - More fixes to urllib (SF 549151): (a) When redirecting, always use + GET. This is common practice and more-or-less sanctioned by the + HTTP standard. (b) Add a handler for 307 redirection, which becomes + an error for POST, but a regular redirect for GET and HEAD + - Added optional 'onerror' argument to os.walk(), to control error handling. From rhettinger@users.sourceforge.net Fri May 16 04:06:43 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 May 2003 20:06:43 -0700 Subject: [Python-checkins] python/dist/src/Tools/scripts texcheck.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv17876 Modified Files: texcheck.py Log Message: * Added file globbing to make it easier to check many LaTeX files. * Delimiter mismatch now prints a warning instead of raising an exception. * Offer style warnings for use of e.g. and i.e. * Bypass false positive warnings for forward slashes in urls and in /rfc822. * Put non-LaTex delimiter matching first to make -d option more reliable. Index: texcheck.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/scripts/texcheck.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** texcheck.py 14 May 2003 18:15:55 -0000 1.5 --- texcheck.py 16 May 2003 03:06:39 -0000 1.6 *************** *** 6,16 **** Designed to catch common markup errors including: * Unbalanced or mismatched parenthesis, brackets, and braces. ! * Unbalanced of mismatched \begin and \end blocks. * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. ! * Table line size mismatches (only \lineii used in a tableii). ! Command line usage: ! python texcheck.py [-h] [-k keyword] foobar.tex Options: --- 6,16 ---- Designed to catch common markup errors including: * Unbalanced or mismatched parenthesis, brackets, and braces. ! * Unbalanced or mismatched \\begin and \\end blocks. * Misspelled or invalid LaTeX commands. * Use of forward slashes instead of backslashes for commands. ! * Table line size mismatches. ! Sample command line usage: ! python texcheck.py -k chapterheading -m lib/librandomtex *.tex Options: *************** *** 20,24 **** -h: Help -s lineno: Start at lineno (useful for skipping complex sections). ! -v: Verbose. Shows current delimiter and unclosed delimiters. """ --- 20,24 ---- -h: Help -s lineno: Start at lineno (useful for skipping complex sections). ! -v: Verbose. Trace the matching of //begin and //end blocks. """ *************** *** 28,31 **** --- 28,32 ---- import getopt from itertools import izip, count, islice + import glob cmdstr = r""" *************** *** 64,72 **** o_lineno, o_symbol = openers.pop() except IndexError: ! msg = "Delimiter mismatch. On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol) ! raise Exception, msg if o_symbol in pairmap.get(c_symbol, [c_symbol]): return ! msg = "Opener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno) ! raise Exception, msg def checkit(source, opts, morecmds=[]): --- 65,73 ---- o_lineno, o_symbol = openers.pop() except IndexError: ! print "\nDelimiter mismatch. On line %d, encountered closing '%s' without corresponding open" % (c_lineno, c_symbol) ! return if o_symbol in pairmap.get(c_symbol, [c_symbol]): return ! print "\nOpener '%s' on line %d was not closed before encountering '%s' on line %d" % (o_symbol, o_lineno, c_symbol, c_lineno) ! return def checkit(source, opts, morecmds=[]): *************** *** 76,80 **** -m munge parenthesis and brackets -d delimiters only checking ! -v verbose listing of delimiters -s lineno: linenumber to start scan (default is 1). --- 77,81 ---- -m munge parenthesis and brackets -d delimiters only checking ! -v verbose trace of delimiter matching -s lineno: linenumber to start scan (default is 1). *************** *** 94,98 **** else: pairmap = {']':'[', ')':'('} # Normal opener for a given closer ! openpunct = sets.Set('([') # Set of valid openers delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') --- 95,99 ---- else: pairmap = {']':'[', ')':'('} # Normal opener for a given closer ! openpunct = sets.Set('([') # Set of valid openers delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') *************** *** 114,135 **** line = line.rstrip() ! if '/' in line and '-d' not in opts: ! # Warn whenever forward slashes encountered with a LaTeX command ! for cmd in falsetexcmd.findall(line): ! if '\\' + cmd in validcmds: ! print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd) ! ! if '-d' not in opts: ! # Validate commands ! nc = line.find(r'\newcommand') ! if nc != -1: ! start = line.find('{', nc) ! end = line.find('}', start) ! validcmds.add(line[start+1:end]) ! for cmd in texcmd.findall(line): ! if cmd not in validcmds: ! print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) ! ! # Check balancing of open/close parenthesis and brackets for begend, name, punct in delimiters.findall(line): if '-v' in opts: --- 115,119 ---- line = line.rstrip() ! # Check balancing of open/close parenthesis, brackets, and begin/end blocks for begend, name, punct in delimiters.findall(line): if '-v' in opts: *************** *** 155,160 **** except IndexError: print r'Warning, unmatched } on line %s.' % (lineno,) ! if '-v' in opts: ! print ' --> ', bracestack # Check table levels (make sure lineii only inside tableii) --- 139,163 ---- except IndexError: print r'Warning, unmatched } on line %s.' % (lineno,) ! ! # Optionally, skip LaTeX specific checks ! if '-d' in opts: ! continue ! ! # Warn whenever forward slashes encountered with a LaTeX command ! for cmd in falsetexcmd.findall(line): ! if '822' in line or '.html' in line: ! continue # Ignore false positives for urls and for /rfc822 ! if '\\' + cmd in validcmds: ! print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd) ! ! # Validate commands ! nc = line.find(r'\newcommand') ! if nc != -1: ! start = line.find('{', nc) ! end = line.find('}', start) ! validcmds.add(line[start+1:end]) ! for cmd in texcmd.findall(line): ! if cmd not in validcmds: ! print r'Warning, unknown tex cmd on line %d: \%s' % (lineno, cmd) # Check table levels (make sure lineii only inside tableii) *************** *** 169,172 **** --- 172,180 ---- tablelevel = '' + # Style guide warnings + if 'e.g.' in line or 'i.e.' in line: + print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,) + + lastline = lineno for lineno, symbol in openers: *************** *** 190,202 **** return 1 morecmds = [v for k,v in optitems if k=='-k'] ! try: ! f = open(arglist[0]) ! except IOError: ! print 'Cannot open file %s.' % arglist[0] ! return 2 ! return(checkit(f, opts, morecmds)) if __name__ == '__main__': --- 198,223 ---- return 1 + for i, filespec in enumerate(arglist): + if '*' in filespec or '?' in filespec: + arglist[i:i+1] = glob.glob(filespec) + morecmds = [v for k,v in optitems if k=='-k'] + err = [] ! for filename in arglist: ! print '=' * 30 ! print "Checking", filename ! try: ! f = open(filename) ! except IOError: ! print 'Cannot open file %s.' % arglist[0] ! return 2 ! try: ! err.append(checkit(f, opts, morecmds)) ! finally: ! f.close() ! ! return max(err) if __name__ == '__main__': From rhettinger@users.sourceforge.net Fri May 16 04:08:42 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 15 May 2003 20:08:42 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libal.tex,1.14,1.14.8.1 libarray.tex,1.31.8.2,1.31.8.3 libcurses.tex,1.37.6.2,1.37.6.3 libdis.tex,1.33.10.3,1.33.10.4 libexcs.tex,1.43.6.1,1.43.6.2 libftplib.tex,1.33.16.1,1.33.16.2 libfuncs.tex,1.100.4.15,1.100.4.16 liblocale.tex,1.27.8.1,1.27.8.2 libmimetools.tex,1.20.16.2,1.20.16.3 libos.tex,1.74.2.1.2.14,1.74.2.1.2.15 libprofile.tex,1.39,1.39.10.1 librandom.tex,1.25.18.4,1.25.18.5 librepr.tex,1.3,1.3.24.1 libstdtypes.tex,1.80.6.22,1.80.6.23 liburllib2.tex,1.6.8.2,1.6.8.3 libwinreg.tex,1.7.18.2,1.7.18.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20225 Modified Files: Tag: release22-maint libal.tex libarray.tex libcurses.tex libdis.tex libexcs.tex libftplib.tex libfuncs.tex liblocale.tex libmimetools.tex libos.tex libprofile.tex librandom.tex librepr.tex libstdtypes.tex liburllib2.tex libwinreg.tex Log Message: Fix nits found by Tools\scripts\texcheck.py Index: libal.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libal.tex,v retrieving revision 1.14 retrieving revision 1.14.8.1 diff -C2 -d -r1.14 -r1.14.8.1 *** libal.tex 20 Oct 2001 04:24:09 -0000 1.14 --- libal.tex 16 May 2003 03:08:32 -0000 1.14.8.1 *************** *** 63,67 **** \subsection{Configuration Objects \label{al-config-objects}} ! Configuration objects (returned by \function{newconfig()} have the following methods: --- 63,67 ---- \subsection{Configuration Objects \label{al-config-objects}} ! Configuration objects (returned by \function{newconfig()}) have the following methods: Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.31.8.2 retrieving revision 1.31.8.3 diff -C2 -d -r1.31.8.2 -r1.31.8.3 *** libarray.tex 4 Apr 2002 14:04:03 -0000 1.31.8.2 --- libarray.tex 16 May 2003 03:08:32 -0000 1.31.8.3 *************** *** 214,217 **** about Numerical Python. (A PDF version of the NumPy manual is available at ! \url{http://numpy.sourceforge.net/numdoc/numdoc.pdf}.} \end{seealso} --- 214,217 ---- about Numerical Python. (A PDF version of the NumPy manual is available at ! \url{http://numpy.sourceforge.net/numdoc/numdoc.pdf}.)} \end{seealso} Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.37.6.2 retrieving revision 1.37.6.3 diff -C2 -d -r1.37.6.2 -r1.37.6.3 *** libcurses.tex 12 Jan 2003 14:57:53 -0000 1.37.6.2 --- libcurses.tex 16 May 2003 03:08:32 -0000 1.37.6.3 *************** *** 997,1001 **** \begin{methoddesc}[window]{timeout}{delay} Sets blocking or non-blocking read behavior for the window. If ! \var{delay} is negative, blocking read is used, which will wait indefinitely for input). If \var{delay} is zero, then non-blocking read is used, and -1 will be returned by \method{getch()} if no input --- 997,1001 ---- \begin{methoddesc}[window]{timeout}{delay} Sets blocking or non-blocking read behavior for the window. If ! \var{delay} is negative, blocking read is used (which will wait indefinitely for input). If \var{delay} is zero, then non-blocking read is used, and -1 will be returned by \method{getch()} if no input Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.33.10.3 retrieving revision 1.33.10.4 diff -C2 -d -r1.33.10.3 -r1.33.10.4 *** libdis.tex 5 Aug 2002 23:35:02 -0000 1.33.10.3 --- libdis.tex 16 May 2003 03:08:33 -0000 1.33.10.4 *************** *** 512,516 **** \begin{opcodedesc}{LOAD_ATTR}{namei} ! Replaces TOS with \code{getattr(TOS, co_names[\var{namei}]}. \end{opcodedesc} --- 512,516 ---- \begin{opcodedesc}{LOAD_ATTR}{namei} ! Replaces TOS with \code{getattr(TOS, co_names[\var{namei}])}. \end{opcodedesc} Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.43.6.1 retrieving revision 1.43.6.2 diff -C2 -d -r1.43.6.1 -r1.43.6.2 *** libexcs.tex 27 Aug 2002 23:54:57 -0000 1.43.6.1 --- libexcs.tex 16 May 2003 03:08:33 -0000 1.43.6.2 *************** *** 189,193 **** interrupts is made regularly. % XXXJH xrefs here ! Interrupts typed when a built-in function \function{input()} or \function{raw_input()}) is waiting for input also raise this exception. --- 189,193 ---- interrupts is made regularly. % XXXJH xrefs here ! Interrupts typed when a built-in function (\function{input()} or \function{raw_input()}) is waiting for input also raise this exception. Index: libftplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libftplib.tex,v retrieving revision 1.33.16.1 retrieving revision 1.33.16.2 diff -C2 -d -r1.33.16.1 -r1.33.16.2 *** libftplib.tex 28 Dec 2001 04:35:10 -0000 1.33.16.1 --- libftplib.tex 16 May 2003 03:08:34 -0000 1.33.16.2 *************** *** 165,169 **** \var{command} should be an appropriate \samp{RETR} command (see \method{retrbinary()} or a \samp{LIST} command (usually just the string ! \code{'LIST'}). The \var{callback} function is called for each line, with the trailing CRLF stripped. The default \var{callback} prints the line to \code{sys.stdout}. --- 165,169 ---- \var{command} should be an appropriate \samp{RETR} command (see \method{retrbinary()} or a \samp{LIST} command (usually just the string ! \code{'LIST'})). The \var{callback} function is called for each line, with the trailing CRLF stripped. The default \var{callback} prints the line to \code{sys.stdout}. *************** *** 285,289 **** Close the connection unilaterally. This should not be applied to an already closed connection (such as after a successful call to ! \method{quit()}. After this call the \class{FTP} instance should not be used any more (after a call to \method{close()} or \method{quit()} you cannot reopen the connection by issuing another --- 285,289 ---- Close the connection unilaterally. This should not be applied to an already closed connection (such as after a successful call to ! \method{quit()}). After this call the \class{FTP} instance should not be used any more (after a call to \method{close()} or \method{quit()} you cannot reopen the connection by issuing another Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.100.4.15 retrieving revision 1.100.4.16 diff -C2 -d -r1.100.4.15 -r1.100.4.16 *** libfuncs.tex 2 Feb 2003 19:08:58 -0000 1.100.4.15 --- libfuncs.tex 16 May 2003 03:08:34 -0000 1.100.4.16 *************** *** 674,678 **** \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, fdel\optional{, doc}}}}} Return a property attribute for new-style classes (classes that ! derive from \function{object}. \var{fget} is a function for getting an attribute value, likewise --- 674,678 ---- \begin{funcdesc}{property}{\optional{fget\optional{, fset\optional{, fdel\optional{, doc}}}}} Return a property attribute for new-style classes (classes that ! derive from \function{object}). \var{fget} is a function for getting an attribute value, likewise Index: liblocale.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liblocale.tex,v retrieving revision 1.27.8.1 retrieving revision 1.27.8.2 diff -C2 -d -r1.27.8.1 -r1.27.8.2 *** liblocale.tex 13 Jun 2002 17:54:44 -0000 1.27.8.1 --- liblocale.tex 16 May 2003 03:08:34 -0000 1.27.8.2 *************** *** 413,418 **** If, when coding a module for general use, you need a locale independent version of an operation that is affected by the locale ! (e.g. \function{string.lower()}, or certain formats used with ! \function{time.strftime()})), you will have to find a way to do it without using the standard library routine. Even better is convincing yourself that using locale settings is okay. Only as a last resort --- 413,418 ---- If, when coding a module for general use, you need a locale independent version of an operation that is affected by the locale ! (such as \function{string.lower()}, or certain formats used with ! \function{time.strftime()}), you will have to find a way to do it without using the standard library routine. Even better is convincing yourself that using locale settings is okay. Only as a last resort Index: libmimetools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetools.tex,v retrieving revision 1.20.16.2 retrieving revision 1.20.16.3 diff -C2 -d -r1.20.16.2 -r1.20.16.3 *** libmimetools.tex 6 Oct 2002 02:32:34 -0000 1.20.16.2 --- libmimetools.tex 16 May 2003 03:08:34 -0000 1.20.16.3 *************** *** 86,90 **** \begin{methoddesc}{getparam}{name} Return the \var{value} of the first parameter (as returned by ! \method{getplist()} of the form \samp{\var{name}=\var{value}} for the given \var{name}. If \var{value} is surrounded by quotes of the form `\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed. --- 86,90 ---- \begin{methoddesc}{getparam}{name} Return the \var{value} of the first parameter (as returned by ! \method{getplist()}) of the form \samp{\var{name}=\var{value}} for the given \var{name}. If \var{value} is surrounded by quotes of the form `\code{<}...\code{>}' or `\code{"}...\code{"}', these are removed. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.74.2.1.2.14 retrieving revision 1.74.2.1.2.15 diff -C2 -d -r1.74.2.1.2.14 -r1.74.2.1.2.15 *** libos.tex 23 Apr 2003 20:14:06 -0000 1.74.2.1.2.14 --- libos.tex 16 May 2003 03:08:34 -0000 1.74.2.1.2.15 *************** *** 439,443 **** If you're starting with a Python file object \var{f}, first do ! \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno()}, to ensure that all internal buffers associated with \var{f} are written to disk. --- 439,443 ---- If you're starting with a Python file object \var{f}, first do ! \code{\var{f}.flush()}, and then do \code{os.fsync(\var{f}.fileno())}, to ensure that all internal buffers associated with \var{f} are written to disk. *************** *** 788,792 **** \member{st_ino} (inode number), \member{st_dev} (device), ! \member{st_nlink} (number of hard links, \member{st_uid} (user ID of owner), \member{st_gid} (group ID of owner), --- 788,792 ---- \member{st_ino} (inode number), \member{st_dev} (device), ! \member{st_nlink} (number of hard links), \member{st_uid} (user ID of owner), \member{st_gid} (group ID of owner), Index: libprofile.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libprofile.tex,v retrieving revision 1.39 retrieving revision 1.39.10.1 diff -C2 -d -r1.39 -r1.39.10.1 *** libprofile.tex 9 Oct 2001 20:54:23 -0000 1.39 --- libprofile.tex 16 May 2003 03:08:34 -0000 1.39.10.1 *************** *** 456,460 **** The order of the printing is based on the last \method{sort_stats()} operation done on the object (subject to caveats in \method{add()} and ! \method{strip_dirs()}. The arguments provided (if any) can be used to limit the list down to --- 456,460 ---- The order of the printing is based on the last \method{sort_stats()} operation done on the object (subject to caveats in \method{add()} and ! \method{strip_dirs()}). The arguments provided (if any) can be used to limit the list down to Index: librandom.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librandom.tex,v retrieving revision 1.25.18.4 retrieving revision 1.25.18.5 diff -C2 -d -r1.25.18.4 -r1.25.18.5 *** librandom.tex 5 Oct 2002 15:00:09 -0000 1.25.18.4 --- librandom.tex 16 May 2003 03:08:35 -0000 1.25.18.5 *************** *** 77,81 **** safely in parallel. So long as no thread calls its \code{g.random()} more than a million times (the second argument to ! \function{create_generators()}, the sequences seen by each thread will not overlap. The period of the underlying Wichmann-Hill generator limits how far this technique can be pushed. --- 77,81 ---- safely in parallel. So long as no thread calls its \code{g.random()} more than a million times (the second argument to ! \function{create_generators()}), the sequences seen by each thread will not overlap. The period of the underlying Wichmann-Hill generator limits how far this technique can be pushed. Index: librepr.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/librepr.tex,v retrieving revision 1.3 retrieving revision 1.3.24.1 diff -C2 -d -r1.3 -r1.3.24.1 *** librepr.tex 10 Oct 2000 17:03:45 -0000 1.3 --- librepr.tex 16 May 2003 03:08:36 -0000 1.3.24.1 *************** *** 97,101 **** with a name based on the type name. In the method name, \var{type} is replaced by ! \code{string.join(string.split(type(\var{obj}).__name__, '_')}. Dispatch to these methods is handled by \method{repr1()}. Type-specific methods which need to recursively format a value --- 97,101 ---- with a name based on the type name. In the method name, \var{type} is replaced by ! \code{string.join(string.split(type(\var{obj}).__name__), '_')}. Dispatch to these methods is handled by \method{repr1()}. Type-specific methods which need to recursively format a value Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.80.6.22 retrieving revision 1.80.6.23 diff -C2 -d -r1.80.6.22 -r1.80.6.23 *** libstdtypes.tex 30 Apr 2003 16:43:51 -0000 1.80.6.22 --- libstdtypes.tex 16 May 2003 03:08:36 -0000 1.80.6.23 *************** *** 1045,1049 **** \ttindex{popitem()} \ttindex{iteritems()} ! \ttindex{iterkeys)} \ttindex{itervalues()}} --- 1045,1049 ---- \ttindex{popitem()} \ttindex{iteritems()} ! \ttindex{iterkeys()} \ttindex{itervalues()}} *************** *** 1346,1350 **** possible (you can write \code{\var{m}.__dict__['a'] = 1}, which defines \code{\var{m}.a} to be \code{1}, but you can't write ! \code{\var{m}.__dict__ = \{\}}. Modules built into the interpreter are written like this: --- 1346,1350 ---- possible (you can write \code{\var{m}.__dict__['a'] = 1}, which defines \code{\var{m}.a} to be \code{1}, but you can't write ! \code{\var{m}.__dict__ = \{\}}). Modules built into the interpreter are written like this: Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.6.8.2 retrieving revision 1.6.8.3 diff -C2 -d -r1.6.8.2 -r1.6.8.3 *** liburllib2.tex 25 Apr 2003 15:29:22 -0000 1.6.8.2 --- liburllib2.tex 16 May 2003 03:08:36 -0000 1.6.8.3 *************** *** 298,302 **** Arguments, return values and exceptions raised are the same as those of \function{urlopen()} (which simply calls the \method{open()} method ! on the default installed \class{OpenerDirector}. \end{methoddesc} --- 298,302 ---- Arguments, return values and exceptions raised are the same as those of \function{urlopen()} (which simply calls the \method{open()} method ! on the default installed \class{OpenerDirector}). \end{methoddesc} Index: libwinreg.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libwinreg.tex,v retrieving revision 1.7.18.2 retrieving revision 1.7.18.3 diff -C2 -d -r1.7.18.2 -r1.7.18.3 *** libwinreg.tex 25 Jun 2002 15:25:53 -0000 1.7.18.2 --- libwinreg.tex 16 May 2003 03:08:36 -0000 1.7.18.3 *************** *** 26,32 **** The hkey argument specifies a previously opened key. ! Note that if \var{hkey} is not closed using this method, (or the ! \method{handle.Close()} closed when the \var{hkey} object is ! destroyed by Python. \end{funcdesc} --- 26,32 ---- The hkey argument specifies a previously opened key. ! Note that if \var{hkey} is not closed using this method or the ! \method{handle.Close()} method, it is closed when the \var{hkey} object ! is destroyed by Python. \end{funcdesc} *************** *** 388,393 **** underlying Windows handle value. ! Handle objects can be converted to an integer (eg, using the ! builtin \function{int()} function, in which case the underlying Windows handle value is returned. You can also use the \method{Detach()} method to return the integer handle, and --- 388,393 ---- underlying Windows handle value. ! Handle objects can be converted to an integer (perhaps using the ! builtin \function{int()} function), in which case the underlying Windows handle value is returned. You can also use the \method{Detach()} method to return the integer handle, and From loewis@users.sourceforge.net Fri May 16 06:40:33 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Thu, 15 May 2003 22:40:33 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.126,1.127 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv8569 Modified Files: Makefile.pre.in Log Message: Patch #738325: Install optimized idlelib files. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** Makefile.pre.in 11 May 2003 20:28:02 -0000 1.126 --- Makefile.pre.in 16 May 2003 05:40:31 -0000 1.127 *************** *** 879,882 **** --- 879,883 ---- --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ + --optimize=2 \ --root=/$(DESTDIR) From dcjim@users.sourceforge.net Fri May 16 14:33:01 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Fri, 16 May 2003 06:33:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv11210 Modified Files: newtypes.tex Log Message: Removed reference to the out-of-date (and not very useful) Objects/xxobject.c example. Updated the discussion of type checking to refer to PyObject_TypeCheck. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** newtypes.tex 8 May 2003 10:35:07 -0000 1.24 --- newtypes.tex 16 May 2003 13:32:59 -0000 1.25 *************** *** 1335,1349 **** Remember that you can omit most of these functions, in which case you ! provide \code{0} as a value. ! ! In the \file{Objects} directory of the Python source distribution, ! there is a file \file{xxobject.c}, which is intended to be used as a ! template for the implementation of new types. One useful strategy ! for implementing a new type is to copy and rename this file, then ! read the instructions at the top of it. ! ! There are type definitions for each of the functions you must ! provide. They are in \file{object.h} in the Python include ! directory that comes with the source distribution of Python. In order to learn how to implement any specific method for your new --- 1335,1342 ---- Remember that you can omit most of these functions, in which case you ! provide \code{0} as a value. There are type definitions for each of ! the functions you must provide. They are in \file{object.h} in the ! Python include directory that comes with the source distribution of ! Python. In order to learn how to implement any specific method for your new *************** *** 1354,1371 **** examples of the function you want to implement. ! When you need to verify that the type of an object is indeed the ! object you are implementing and if you use xxobject.c as an starting ! template for your implementation, then there is a macro defined for ! this purpose. The macro definition will look something like this: ! ! \begin{verbatim} ! #define is_newdatatypeobject(v) ((v)->ob_type == &Newdatatypetype) ! \end{verbatim} ! ! And, a sample of its use might be something like the following: \begin{verbatim} ! if (!is_newdatatypeobject(objp1) { ! PyErr_SetString(PyExc_TypeError, "arg #1 not a newdatatype"); return NULL; } --- 1347,1357 ---- examples of the function you want to implement. ! When you need to verify that an object is an instance of the type ! you are implementing, use the \cfunction{PyObject_TypeCheck} function. ! A sample of its use might be something like the following: \begin{verbatim} ! if (! PyObject_TypeCheck(some_object, &MyType) { ! PyErr_SetString(PyExc_TypeError, "arg #1 not a mything"); return NULL; } From dcjim@users.sourceforge.net Fri May 16 14:34:36 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Fri, 16 May 2003 06:34:36 -0700 Subject: [Python-checkins] python/dist/src/Objects xxobject.c,2.22,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11842 Removed Files: xxobject.c Log Message: Removed the out of date and no-longer-referenced xxobject.c example type implementation. Note that this same example lives in Modules/xxmodule.c. (It is just as out of date there.) --- xxobject.c DELETED --- From dcjim@users.sourceforge.net Fri May 16 14:52:01 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Fri, 16 May 2003 06:52:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv32185 Modified Files: newtypes.tex Log Message: Added a missing PyObject* cast to the dealloc examples. Added a note that the mechanism for defining new tyoes documented here only works for Python 2.2 and higher. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** newtypes.tex 16 May 2003 13:32:59 -0000 1.25 --- newtypes.tex 16 May 2003 13:51:58 -0000 1.26 *************** *** 13,16 **** --- 13,24 ---- get started. + \begin{notice} + The way new types are defined changed dramatically (and for the + better) in Python 2.2. This document documents how to define new + types for Python 2.2 and later. If you need to support older + versions of Python, you will need to refer to older versions of this + documentation. + \end{notice} + \section{The Basics \label{dnt-basics}} *************** *** 307,311 **** Py_XDECREF(self->first); Py_XDECREF(self->last); ! self->ob_type->tp_free(self); } \end{verbatim} --- 315,319 ---- Py_XDECREF(self->first); Py_XDECREF(self->last); ! self->ob_type->tp_free((PyObject*)self); } \end{verbatim} *************** *** 793,797 **** Py_DECREF(self->my_callback); } ! obj->ob_type->tp_free(self); } \end{verbatim} --- 801,805 ---- Py_DECREF(self->my_callback); } ! obj->ob_type->tp_free((PyObject*)self); } \end{verbatim} From dcjim@users.sourceforge.net Fri May 16 14:53:46 2003 From: dcjim@users.sourceforge.net (dcjim@users.sourceforge.net) Date: Fri, 16 May 2003 06:53:46 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.5,1.6 noddy2.c,1.1,1.2 noddy3.c,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv32677 Modified Files: noddy.c noddy2.c noddy3.c Log Message: Added some missing PyObject* casts in the deallocators. Added some defines for PyMODINIT_FUNC so that the examples work with Python 2.2. I think I'm done hacking this documentation. Yippie! :) Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** noddy.c 12 May 2003 17:42:56 -0000 1.5 --- noddy.c 16 May 2003 13:53:43 -0000 1.6 *************** *** 52,55 **** --- 52,58 ---- }; + #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ + #define PyMODINIT_FUNC void + #endif PyMODINIT_FUNC initnoddy(void) Index: noddy2.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy2.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** noddy2.c 7 May 2003 19:48:13 -0000 1.1 --- noddy2.c 16 May 2003 13:53:43 -0000 1.2 *************** *** 14,18 **** Py_XDECREF(self->first); Py_XDECREF(self->last); ! self->ob_type->tp_free(self); } --- 14,18 ---- Py_XDECREF(self->first); Py_XDECREF(self->last); ! self->ob_type->tp_free((PyObject*)self); } *************** *** 168,171 **** --- 168,174 ---- }; + #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ + #define PyMODINIT_FUNC void + #endif PyMODINIT_FUNC initnoddy2(void) Index: noddy3.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy3.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** noddy3.c 7 May 2003 19:48:13 -0000 1.1 --- noddy3.c 16 May 2003 13:53:43 -0000 1.2 *************** *** 14,18 **** Py_XDECREF(self->first); Py_XDECREF(self->last); ! self->ob_type->tp_free(self); } --- 14,18 ---- Py_XDECREF(self->first); Py_XDECREF(self->last); ! self->ob_type->tp_free((PyObject*)self); } *************** *** 221,224 **** --- 221,227 ---- }; + #ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ + #define PyMODINIT_FUNC void + #endif PyMODINIT_FUNC initnoddy3(void) From rhettinger@users.sourceforge.net Fri May 16 15:36:29 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 May 2003 07:36:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv21149 Modified Files: newtypes.tex Log Message: Missing parenthesis. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** newtypes.tex 16 May 2003 13:51:58 -0000 1.26 --- newtypes.tex 16 May 2003 14:36:26 -0000 1.27 *************** *** 1360,1364 **** \begin{verbatim} ! if (! PyObject_TypeCheck(some_object, &MyType) { PyErr_SetString(PyExc_TypeError, "arg #1 not a mything"); return NULL; --- 1360,1364 ---- \begin{verbatim} ! if (! PyObject_TypeCheck(some_object, &MyType)) { PyErr_SetString(PyExc_TypeError, "arg #1 not a mything"); return NULL; From tim_one@users.sourceforge.net Fri May 16 16:35:13 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 08:35:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_urllibnet.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20826/Lib/test Modified Files: test_urllibnet.py Log Message: test_fileno(): Skip this test on Windows. Index: test_urllibnet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllibnet.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_urllibnet.py 14 May 2003 02:18:31 -0000 1.3 --- test_urllibnet.py 16 May 2003 15:35:10 -0000 1.4 *************** *** 26,40 **** class urlopenNetworkTests(unittest.TestCase): """Tests urllib.urlopen using the network. ! These tests are not exhaustive. Assuming that testing using files does a good job overall of some of the basic interface features. There are no tests exercising the optional 'data' and 'proxies' arguments. No tests for transparent redirection have been written. ! setUp is not used for always constructing a connection to http://www.python.org/ since there a few tests that don't use that address and making a connection is expensive enough to warrant minimizing unneeded connections. ! """ --- 26,40 ---- class urlopenNetworkTests(unittest.TestCase): """Tests urllib.urlopen using the network. ! These tests are not exhaustive. Assuming that testing using files does a good job overall of some of the basic interface features. There are no tests exercising the optional 'data' and 'proxies' arguments. No tests for transparent redirection have been written. ! setUp is not used for always constructing a connection to http://www.python.org/ since there a few tests that don't use that address and making a connection is expensive enough to warrant minimizing unneeded connections. ! """ *************** *** 85,98 **** def test_fileno(self): # Make sure fd returned by fileno is valid. ! if hasattr(os, 'fdopen'): ! open_url = urllib.urlopen("http://www.python.org/") ! fd = open_url.fileno() ! FILE = os.fdopen(fd) ! try: ! self.assert_(FILE.read(), "reading from file created using fd " ! "returned by fileno failed") ! finally: ! FILE.close() def test_bad_address(self): --- 85,102 ---- def test_fileno(self): + if (sys.platform in ('win32',) or + not hasattr(os, 'fdopen')): + # On Windows, socket handles are not file descriptors; this + # test can't pass on Windows. + return # Make sure fd returned by fileno is valid. ! open_url = urllib.urlopen("http://www.python.org/") ! fd = open_url.fileno() ! FILE = os.fdopen(fd) ! try: ! self.assert_(FILE.read(), "reading from file created using fd " ! "returned by fileno failed") ! finally: ! FILE.close() def test_bad_address(self): *************** *** 137,141 **** self.assert_(isinstance(header, mimetools.Message), "header is not an instance of mimetools.Message") ! --- 141,145 ---- self.assert_(isinstance(header, mimetools.Message), "header is not an instance of mimetools.Message") ! From lemburg@users.sourceforge.net Fri May 16 18:07:54 2003 From: lemburg@users.sourceforge.net (lemburg@users.sourceforge.net) Date: Fri, 16 May 2003 10:07:54 -0700 Subject: [Python-checkins] python/dist/src/Lib/encodings __init__.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1:/tmp/cvs-serv29749/Lib/encodings Modified Files: __init__.py Log Message: Remove usage of re module from encodings package search function. Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/__init__.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** __init__.py 24 Apr 2003 16:02:49 -0000 1.18 --- __init__.py 16 May 2003 17:07:51 -0000 1.19 *************** *** 28,37 **** """#" ! import codecs, exceptions, re _cache = {} _unknown = '--unknown--' _import_tail = ['*'] ! _norm_encoding_RE = re.compile('[^a-zA-Z0-9.]') class CodecRegistryError(exceptions.LookupError, --- 28,42 ---- """#" ! import codecs, exceptions, types _cache = {} _unknown = '--unknown--' _import_tail = ['*'] ! _norm_encoding_map = (' . ' ! '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ ' ! ' abcdefghijklmnopqrstuvwxyz ' ! ' ' ! ' ' ! ' ') class CodecRegistryError(exceptions.LookupError, *************** *** 46,53 **** characters except the dot used for Python package names are collapsed and replaced with a single underscore, e.g. ' -;#' ! becomes '_'. """ ! return '_'.join(_norm_encoding_RE.split(encoding)) def search_function(encoding): --- 51,68 ---- characters except the dot used for Python package names are collapsed and replaced with a single underscore, e.g. ' -;#' ! becomes '_'. Leading and trailing underscores are removed. ! ! Note that encoding names should be ASCII only; if they do use ! non-ASCII characters, these must be Latin-1 compatible. """ ! # Make sure we have an 8-bit string, because .translate() works ! # differently for Unicode strings. ! if type(encoding) is types.UnicodeType: ! # Note that .encode('latin-1') does *not* use the codec ! # registry, so this call doesn't recurse. (See unicodeobject.c ! # PyUnicode_AsEncodedString() for details) ! encoding = encoding.encode('latin-1') ! return '_'.join(encoding.translate(_norm_encoding_map).split()) def search_function(encoding): From tim_one@users.sourceforge.net Fri May 16 21:02:30 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 13:02:30 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv2271/Modules Modified Files: datetimemodule.c Log Message: Stopped using the old macro form of _PyObject_Del. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** datetimemodule.c 2 May 2003 18:39:55 -0000 1.61 --- datetimemodule.c 16 May 2003 20:02:26 -0000 1.62 *************** *** 2118,2122 **** 0, /* tp_alloc */ delta_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 2118,2122 ---- 0, /* tp_alloc */ delta_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 2671,2675 **** 0, /* tp_alloc */ date_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 2671,2675 ---- 0, /* tp_alloc */ date_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 3442,3446 **** 0, /* tp_alloc */ time_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 3442,3446 ---- 0, /* tp_alloc */ time_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; *************** *** 4463,4467 **** 0, /* tp_alloc */ datetime_new, /* tp_new */ ! _PyObject_Del, /* tp_free */ }; --- 4463,4467 ---- 0, /* tp_alloc */ datetime_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; From pedronis@users.sourceforge.net Fri May 16 22:57:25 2003 From: pedronis@users.sourceforge.net (pedronis@users.sourceforge.net) Date: Fri, 16 May 2003 14:57:25 -0700 Subject: [Python-checkins] python/dist/src/Lib codeop.py,1.5,1.5.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16842 Modified Files: Tag: release22-maint codeop.py Log Message: Backport fix for compile_command("",symbol="eval") raising syntax error about "pass". Now returns None. Index: codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/codeop.py,v retrieving revision 1.5 retrieving revision 1.5.16.1 diff -C2 -d -r1.5 -r1.5.16.1 *** codeop.py 17 Aug 2001 22:11:27 -0000 1.5 --- codeop.py 16 May 2003 21:57:23 -0000 1.5.16.1 *************** *** 71,75 **** break # Leave it alone else: ! source = "pass" # Replace it with a 'pass' statement err = err1 = err2 = None --- 71,76 ---- break # Leave it alone else: ! if symbol != "eval": ! source = "pass" # Replace it with a 'pass' statement err = err1 = err2 = None From tim_one@users.sourceforge.net Fri May 16 23:44:08 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 15:44:08 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.62,1.63 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv1671/Modules Modified Files: datetimemodule.c Log Message: Turns out there wasn't a need to define tp_free for any of the types here. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** datetimemodule.c 16 May 2003 20:02:26 -0000 1.62 --- datetimemodule.c 16 May 2003 22:44:06 -0000 1.63 *************** *** 2118,2122 **** 0, /* tp_alloc */ delta_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 2118,2122 ---- 0, /* tp_alloc */ delta_new, /* tp_new */ ! 0, /* tp_free */ }; *************** *** 2671,2675 **** 0, /* tp_alloc */ date_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 2671,2675 ---- 0, /* tp_alloc */ date_new, /* tp_new */ ! 0, /* tp_free */ }; *************** *** 3442,3446 **** 0, /* tp_alloc */ time_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 3442,3446 ---- 0, /* tp_alloc */ time_new, /* tp_new */ ! 0, /* tp_free */ }; *************** *** 4463,4467 **** 0, /* tp_alloc */ datetime_new, /* tp_new */ ! PyObject_Del, /* tp_free */ }; --- 4463,4467 ---- 0, /* tp_alloc */ datetime_new, /* tp_new */ ! 0, /* tp_free */ }; From rhettinger@users.sourceforge.net Sat May 17 00:16:38 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 May 2003 16:16:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10859 Modified Files: test_itertools.py Log Message: Minor cleanups. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_itertools.py 3 May 2003 05:59:48 -0000 1.10 --- test_itertools.py 16 May 2003 23:16:36 -0000 1.11 *************** *** 202,206 **** >>> import operator - >>> import operator >>> for cube in imap(operator.pow, xrange(1,4), repeat(3)): ... print cube --- 202,205 ---- *************** *** 304,308 **** 32 - """ --- 303,306 ---- *************** *** 313,317 **** # verify reference counting - import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 --- 311,314 ---- *************** *** 322,327 **** # doctest the examples in the library reference ! import doctest ! doctest.testmod(sys.modules[__name__]) if __name__ == "__main__": --- 319,323 ---- # doctest the examples in the library reference ! test_support.run_doctest(sys.modules[__name__], verbose) if __name__ == "__main__": From rhettinger@users.sourceforge.net Sat May 17 01:58:35 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 May 2003 17:58:35 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv5180 Modified Files: test_support.py Log Message: Provide a clue that the doctests have run. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** test_support.py 10 May 2003 07:36:55 -0000 1.54 --- test_support.py 17 May 2003 00:58:33 -0000 1.55 *************** *** 286,290 **** if f: raise TestFailed("%d of %d doctests failed" % (f, t)) - return f, t finally: sys.stdout = save_stdout --- 286,292 ---- if f: raise TestFailed("%d of %d doctests failed" % (f, t)) finally: sys.stdout = save_stdout + if verbose: + print 'Ran %d doctests with zero failures' % (t,) + return f, t From rhettinger@users.sourceforge.net Sat May 17 02:08:38 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 May 2003 18:08:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_getopt.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7919 Modified Files: test_getopt.py Log Message: Use test_support.run_doctest() Index: test_getopt.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_getopt.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_getopt.py 29 Apr 2003 19:58:04 -0000 1.7 --- test_getopt.py 17 May 2003 01:08:35 -0000 1.8 *************** *** 4,8 **** import getopt from getopt import GetoptError ! from test.test_support import verify, verbose import os --- 4,8 ---- import getopt from getopt import GetoptError ! from test.test_support import verify, verbose, run_doctest import os *************** *** 162,167 **** __test__ = {'libreftest' : libreftest} ! import doctest, sys ! doctest.testmod(sys.modules[__name__]) #------------------------------------------------------------------------------ --- 162,167 ---- __test__ = {'libreftest' : libreftest} ! import sys ! run_doctest(sys.modules[__name__], verbose) #------------------------------------------------------------------------------ From rhettinger@users.sourceforge.net Sat May 17 03:00:00 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 16 May 2003 19:00:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py,1.55,1.56 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24769 Modified Files: test_support.py Log Message: Include module name in doctest summary. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** test_support.py 17 May 2003 00:58:33 -0000 1.55 --- test_support.py 17 May 2003 01:59:57 -0000 1.56 *************** *** 289,292 **** sys.stdout = save_stdout if verbose: ! print 'Ran %d doctests with zero failures' % (t,) return f, t --- 289,292 ---- sys.stdout = save_stdout if verbose: ! print 'doctest (%s) ... %d tests with zero failures' % (module.__name__, t) return f, t From tim_one@users.sourceforge.net Sat May 17 03:25:23 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 19:25:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py,1.41,1.42 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31716/lib/test Modified Files: test_datetime.py Log Message: test_subclass_date(): Beefed this up, to check that new instance attributes and methods work, that new arguments can be passed to the constructor, and that inherited methods and attrs still work. Added XXX comments about what to do when datetime becomes usably subclassable too (it's not yet). Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** test_datetime.py 14 Apr 2003 22:01:58 -0000 1.41 --- test_datetime.py 17 May 2003 02:25:20 -0000 1.42 *************** *** 481,488 **** def test_subclass_date(self): class C(date): theAnswer = 42 ! dt = C(2003, 4, 14) ! self.assertEqual(dt.__class__, C) class TestDate(HarmlessMixedComparison): --- 481,513 ---- def test_subclass_date(self): + + # XXX When datetime becomes usably subclassable, uncomment the + # XXX "self.theclass" lines and move this into TestDate. + # class C(self.theclass): class C(date): theAnswer = 42 ! ! def __new__(cls, *args, **kws): ! temp = kws.copy() ! extra = temp.pop('extra') ! # result = self.theclass.__new__(cls, *args, **temp) ! result = date.__new__(cls, *args, **temp) ! result.extra = extra ! return result ! ! def newmeth(self, start): ! return start + self.year + self.month ! ! args = 2003, 4, 14 ! ! # dt1 = self.theclass(*args) ! dt1 = date(*args) ! dt2 = C(*args, **{'extra': 7}) ! ! self.assertEqual(dt2.__class__, C) ! self.assertEqual(dt2.theAnswer, 42) ! self.assertEqual(dt2.extra, 7) ! self.assertEqual(dt1.toordinal(), dt2.toordinal()) ! self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) class TestDate(HarmlessMixedComparison): *************** *** 977,980 **** --- 1002,1006 ---- base = cls(2000, 2, 29) self.assertRaises(ValueError, base.replace, year=2001) + ############################################################################# From pedronis@users.sourceforge.net Sat May 17 03:35:39 2003 From: pedronis@users.sourceforge.net (pedronis@users.sourceforge.net) Date: Fri, 16 May 2003 19:35:39 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeop.py,1.3,1.3.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv2320 Modified Files: Tag: release22-maint test_codeop.py Log Message: beefed up version: jython support, covers now fixed differences between CPython/Jython. Index: test_codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeop.py,v retrieving revision 1.3 retrieving revision 1.3.12.1 diff -C2 -d -r1.3 -r1.3.12.1 *** test_codeop.py 20 Sep 2001 21:33:42 -0000 1.3 --- test_codeop.py 17 May 2003 02:35:37 -0000 1.3.12.1 *************** *** 4,18 **** """ import unittest ! from test_support import run_unittest from codeop import compile_command class CodeopTests(unittest.TestCase): def assertValid(self, str, symbol='single'): '''succeed iff str is a valid piece of code''' ! expected = compile(str, "", symbol) ! self.assertEquals( compile_command(str, "", symbol), expected) ! def assertIncomplete(self, str, symbol='single'): --- 4,44 ---- """ import unittest ! from test_support import run_unittest, is_jython from codeop import compile_command + if is_jython: + import sys + import cStringIO + + def unify_callables(d): + for n,v in d.items(): + if callable(v): + d[n] = callable + return d + class CodeopTests(unittest.TestCase): def assertValid(self, str, symbol='single'): '''succeed iff str is a valid piece of code''' ! if is_jython: ! code = compile_command(str, "", symbol) ! self.assert_(code) ! if symbol == "single": ! d,r = {},{} ! sys.stdout = cStringIO.StringIO() ! try: ! exec code in d ! exec compile(str,"","single") in r ! finally: ! sys.stdout = sys.__stdout__ ! elif symbol == 'eval': ! ctx = {'a': 2} ! d = { 'value': eval(code,ctx) } ! r = { 'value': eval(str,ctx) } ! self.assertEquals(unify_callables(r),unify_callables(d)) ! else: ! expected = compile(str, "", symbol) ! self.assertEquals( compile_command(str, "", symbol), expected) def assertIncomplete(self, str, symbol='single'): *************** *** 32,64 **** def test_valid(self): av = self.assertValid av("a = 1\n") av("def x():\n pass\n") av("pass\n") av("3**3\n") av("if 9==3:\n pass\nelse:\n pass\n") av("#a\n#b\na = 3\n") av("#a\n\n \na=3\n") av("a=3\n\n") ! ! # special case ! self.assertEquals(compile_command(""), ! compile("pass", "", 'single')) av("3**3","eval") av("(lambda z: \n z**3)","eval") av("#a\n#b\na**3","eval") def test_incomplete(self): ai = self.assertIncomplete ai("(a **") - ai("def x():\n") ai("(a,b,") ai("(a,b,(") ai("(a,b,(") ai("if 9==3:\n pass\nelse:\n") ai("if 9==3:\n pass\nelse:\n pass") ! ai("a = (") ai("a = 9+ \\") ai("(","eval") ai("(\n\n\n","eval") --- 58,144 ---- def test_valid(self): av = self.assertValid + + # special case + if not is_jython: + self.assertEquals(compile_command(""), + compile("pass", "", 'single')) + self.assertEquals(compile_command("\n"), + compile("pass", "", 'single')) + else: + av("") + av("\n") + + av("a = 1") + av("\na = 1") av("a = 1\n") + av("a = 1\n\n") + av("\n\na = 1\n\n") + av("def x():\n pass\n") + av("if 1:\n pass\n") + + av("\n\nif 1: pass\n") + av("\n\nif 1: pass\n\n") + + av("def x():\n\n pass\n") + av("def x():\n pass\n \n") + av("def x():\n pass\n \n") + av("pass\n") av("3**3\n") + av("if 9==3:\n pass\nelse:\n pass\n") + av("if 1:\n pass\n if 1:\n pass\n else:\n pass\n") + av("#a\n#b\na = 3\n") av("#a\n\n \na=3\n") av("a=3\n\n") ! av("a = 9+ \\\n3") av("3**3","eval") av("(lambda z: \n z**3)","eval") + + av("9+ \\\n3","eval") + av("9+ \\\n3\n","eval") + + av("\n\na**3","eval") + av("\n \na**3","eval") av("#a\n#b\na**3","eval") def test_incomplete(self): ai = self.assertIncomplete + ai("(a **") ai("(a,b,") ai("(a,b,(") ai("(a,b,(") + ai("a = (") + ai("a = {") + ai("b + {") + + ai("if 9==3:\n pass\nelse:") ai("if 9==3:\n pass\nelse:\n") ai("if 9==3:\n pass\nelse:\n pass") ! ai("if 1:") ! ai("if 1:\n") ! ai("if 1:\n pass\n if 1:\n pass\n else:") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n pass") ! ! ai("def x():") ! ai("def x():\n") ! ai("def x():\n\n") ! ! ai("def x():\n pass") ! ai("def x():\n pass\n ") ! ai("def x():\n pass\n ") ! ai("\n\ndef x():\n pass") ! ai("a = 9+ \\") + ai("a = 'a\\") + ai("a = '''xy") + ai("","eval") + ai("\n","eval") ai("(","eval") ai("(\n\n\n","eval") *************** *** 70,75 **** --- 150,168 ---- ai = self.assertInvalid ai("a b") + + ai("a @") + ai("a b @") + ai("a ** @") + ai("a = ") ai("a = 9 +") + + ai("def x():\n\npass\n") + + ai("\n\n if 1: pass\n\npass") + + ai("a = 9+ \\\n") + ai("a = 'a\\ ") + ai("a = 'a\\\n") ai("a = 1","eval") From pedronis@users.sourceforge.net Sat May 17 03:39:55 2003 From: pedronis@users.sourceforge.net (pedronis@users.sourceforge.net) Date: Fri, 16 May 2003 19:39:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeop.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv3788 Modified Files: test_codeop.py Log Message: beefed up version: jython support, covers now fixed differences between CPython/Jython. Index: test_codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeop.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_codeop.py 13 Feb 2003 22:07:54 -0000 1.5 --- test_codeop.py 17 May 2003 02:39:52 -0000 1.6 *************** *** 4,18 **** """ import unittest ! from test.test_support import run_unittest from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT class CodeopTests(unittest.TestCase): def assertValid(self, str, symbol='single'): '''succeed iff str is a valid piece of code''' ! expected = compile(str, "", symbol, PyCF_DONT_IMPLY_DEDENT) ! self.assertEquals( compile_command(str, "", symbol), expected) ! def assertIncomplete(self, str, symbol='single'): --- 4,44 ---- """ import unittest ! from test.test_support import run_unittest, is_jython from codeop import compile_command, PyCF_DONT_IMPLY_DEDENT + if is_jython: + import sys + import cStringIO + + def unify_callables(d): + for n,v in d.items(): + if callable(v): + d[n] = callable + return d + class CodeopTests(unittest.TestCase): def assertValid(self, str, symbol='single'): '''succeed iff str is a valid piece of code''' ! if is_jython: ! code = compile_command(str, "", symbol) ! self.assert_(code) ! if symbol == "single": ! d,r = {},{} ! sys.stdout = cStringIO.StringIO() ! try: ! exec code in d ! exec compile(str,"","single") in r ! finally: ! sys.stdout = sys.__stdout__ ! elif symbol == 'eval': ! ctx = {'a': 2} ! d = { 'value': eval(code,ctx) } ! r = { 'value': eval(str,ctx) } ! self.assertEquals(unify_callables(r),unify_callables(d)) ! else: ! expected = compile(str, "", symbol, PyCF_DONT_IMPLY_DEDENT) ! self.assertEquals( compile_command(str, "", symbol), expected) def assertIncomplete(self, str, symbol='single'): *************** *** 32,65 **** def test_valid(self): av = self.assertValid av("a = 1\n") av("def x():\n pass\n") av("pass\n") av("3**3\n") av("if 9==3:\n pass\nelse:\n pass\n") av("#a\n#b\na = 3\n") av("#a\n\n \na=3\n") av("a=3\n\n") ! ! # special case ! self.assertEquals(compile_command(""), ! compile("pass", "", 'single', ! PyCF_DONT_IMPLY_DEDENT)) av("3**3","eval") av("(lambda z: \n z**3)","eval") av("#a\n#b\na**3","eval") def test_incomplete(self): ai = self.assertIncomplete ai("(a **") - ai("def x():\n") ai("(a,b,") ai("(a,b,(") ai("(a,b,(") ai("if 9==3:\n pass\nelse:\n") ai("if 9==3:\n pass\nelse:\n pass") ! ai("a = (") ai("a = 9+ \\") ai("(","eval") ai("(\n\n\n","eval") --- 58,146 ---- def test_valid(self): av = self.assertValid + + # special case + if not is_jython: + self.assertEquals(compile_command(""), + compile("pass", "", 'single', + PyCF_DONT_IMPLY_DEDENT)) + self.assertEquals(compile_command("\n"), + compile("pass", "", 'single', + PyCF_DONT_IMPLY_DEDENT)) + else: + av("") + av("\n") + + av("a = 1") + av("\na = 1") av("a = 1\n") + av("a = 1\n\n") + av("\n\na = 1\n\n") + av("def x():\n pass\n") + av("if 1:\n pass\n") + + av("\n\nif 1: pass\n") + av("\n\nif 1: pass\n\n") + + av("def x():\n\n pass\n") + av("def x():\n pass\n \n") + av("def x():\n pass\n \n") + av("pass\n") av("3**3\n") + av("if 9==3:\n pass\nelse:\n pass\n") + av("if 1:\n pass\n if 1:\n pass\n else:\n pass\n") + av("#a\n#b\na = 3\n") av("#a\n\n \na=3\n") av("a=3\n\n") ! av("a = 9+ \\\n3") av("3**3","eval") av("(lambda z: \n z**3)","eval") + + av("9+ \\\n3","eval") + av("9+ \\\n3\n","eval") + + av("\n\na**3","eval") + av("\n \na**3","eval") av("#a\n#b\na**3","eval") def test_incomplete(self): ai = self.assertIncomplete + ai("(a **") ai("(a,b,") ai("(a,b,(") ai("(a,b,(") + ai("a = (") + ai("a = {") + ai("b + {") + + ai("if 9==3:\n pass\nelse:") ai("if 9==3:\n pass\nelse:\n") ai("if 9==3:\n pass\nelse:\n pass") ! ai("if 1:") ! ai("if 1:\n") ! ai("if 1:\n pass\n if 1:\n pass\n else:") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n") ! ai("if 1:\n pass\n if 1:\n pass\n else:\n pass") ! ! ai("def x():") ! ai("def x():\n") ! ai("def x():\n\n") ! ! ai("def x():\n pass") ! ai("def x():\n pass\n ") ! ai("def x():\n pass\n ") ! ai("\n\ndef x():\n pass") ! ai("a = 9+ \\") + ai("a = 'a\\") + ai("a = '''xy") + ai("","eval") + ai("\n","eval") ai("(","eval") ai("(\n\n\n","eval") *************** *** 71,76 **** --- 152,170 ---- ai = self.assertInvalid ai("a b") + + ai("a @") + ai("a b @") + ai("a ** @") + ai("a = ") ai("a = 9 +") + + ai("def x():\n\npass\n") + + ai("\n\n if 1: pass\n\npass") + + ai("a = 9+ \\\n") + ai("a = 'a\\ ") + ai("a = 'a\\\n") ai("a = 1","eval") From montanaro@users.sourceforge.net Sat May 17 03:54:13 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Fri, 16 May 2003 19:54:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_bsddb185.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7883 Modified Files: test_bsddb185.py Log Message: simpler temp dir cleanup Index: test_bsddb185.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_bsddb185.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_bsddb185.py 13 May 2003 06:42:59 -0000 1.3 --- test_bsddb185.py 17 May 2003 02:54:11 -0000 1.4 *************** *** 12,15 **** --- 12,16 ---- import os import tempfile + import shutil class Bsddb185Tests(unittest.TestCase): *************** *** 29,41 **** tmpdir = tempfile.mkdtemp() try: ! try: ! dbfile = os.path.join(tmpdir, "foo.db") ! anydbm.open(os.path.splitext(dbfile)[0], "c").close() ! ftype = whichdb.whichdb(dbfile) ! self.assertNotEqual(ftype, "bsddb185") ! finally: ! os.unlink(dbfile) finally: ! os.rmdir(tmpdir) def test_main(): --- 30,39 ---- tmpdir = tempfile.mkdtemp() try: ! dbfile = os.path.join(tmpdir, "foo.db") ! anydbm.open(dbfile, "c").close() ! ftype = whichdb.whichdb(dbfile) ! self.assertNotEqual(ftype, "bsddb185") finally: ! shutil.rmtree(tmpdir) def test_main(): From tim_one@users.sourceforge.net Sat May 17 06:55:23 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 22:55:23 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv27411/python/Modules Modified Files: datetimemodule.c Log Message: datetime.datetime and datetime.time can now be subclassed in Python. Brr. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** datetimemodule.c 16 May 2003 22:44:06 -0000 1.63 --- datetimemodule.c 17 May 2003 05:55:19 -0000 1.64 *************** *** 1236,1271 **** /* --------------------------------------------------------------------------- ! * Basic object allocation. These allocate Python objects of the right ! * size and type, and do the Python object-initialization bit. If there's ! * not enough memory, they return NULL after setting MemoryError. All ! * data members remain uninitialized trash. */ ! static PyDateTime_Time * ! alloc_time(int aware) { ! PyDateTime_Time *self; ! self = (PyDateTime_Time *) PyObject_MALLOC(aware ? sizeof(PyDateTime_Time) : sizeof(_PyDateTime_BaseTime)); if (self == NULL) ! return (PyDateTime_Time *)PyErr_NoMemory(); ! PyObject_INIT(self, &PyDateTime_TimeType); return self; } ! static PyDateTime_DateTime * ! alloc_datetime(int aware) { ! PyDateTime_DateTime *self; ! self = (PyDateTime_DateTime *) PyObject_MALLOC(aware ? sizeof(PyDateTime_DateTime) : sizeof(_PyDateTime_BaseDateTime)); if (self == NULL) ! return (PyDateTime_DateTime *)PyErr_NoMemory(); ! PyObject_INIT(self, &PyDateTime_DateTimeType); return self; } --- 1236,1275 ---- /* --------------------------------------------------------------------------- ! * Basic object allocation: tp_alloc implementatiosn. These allocate ! * Python objects of the right size and type, and do the Python object- ! * initialization bit. If there's not enough memory, they return NULL after ! * setting MemoryError. All data members remain uninitialized trash. ! * ! * We abuse the tp_alloc "nitems" argument to communicate whether a tzinfo ! * member is needed. This is ugly. */ ! ! static PyObject * ! time_alloc(PyTypeObject *type, int aware) { ! PyObject *self; ! self = (PyObject *) PyObject_MALLOC(aware ? sizeof(PyDateTime_Time) : sizeof(_PyDateTime_BaseTime)); if (self == NULL) ! return (PyObject *)PyErr_NoMemory(); ! PyObject_INIT(self, type); return self; } ! static PyObject * ! datetime_alloc(PyTypeObject *type, int aware) { ! PyObject *self; ! self = (PyObject *) PyObject_MALLOC(aware ? sizeof(PyDateTime_DateTime) : sizeof(_PyDateTime_BaseDateTime)); if (self == NULL) ! return (PyObject *)PyErr_NoMemory(); ! PyObject_INIT(self, type); return self; } *************** *** 1303,1317 **** #define new_date(year, month, day) \ ! (new_date_ex(year, month, day, &PyDateTime_DateType)) /* Create a datetime instance with no range checking. */ static PyObject * ! new_datetime(int year, int month, int day, int hour, int minute, ! int second, int usecond, PyObject *tzinfo) { PyDateTime_DateTime *self; char aware = tzinfo != Py_None; ! self = alloc_datetime(aware); if (self != NULL) { self->hastzinfo = aware; --- 1307,1321 ---- #define new_date(year, month, day) \ ! new_date_ex(year, month, day, &PyDateTime_DateType) /* Create a datetime instance with no range checking. */ static PyObject * ! new_datetime_ex(int year, int month, int day, int hour, int minute, ! int second, int usecond, PyObject *tzinfo, PyTypeObject *type) { PyDateTime_DateTime *self; char aware = tzinfo != Py_None; ! self = (PyDateTime_DateTime *) (type->tp_alloc(type, aware)); if (self != NULL) { self->hastzinfo = aware; *************** *** 1329,1340 **** } /* Create a time instance with no range checking. */ static PyObject * ! new_time(int hour, int minute, int second, int usecond, PyObject *tzinfo) { PyDateTime_Time *self; char aware = tzinfo != Py_None; ! self = alloc_time(aware); if (self != NULL) { self->hastzinfo = aware; --- 1333,1349 ---- } + #define new_datetime(y, m, d, hh, mm, ss, us, tzinfo) \ + new_datetime_ex(y, m, d, hh, mm, ss, us, tzinfo, \ + &PyDateTime_DateTimeType) + /* Create a time instance with no range checking. */ static PyObject * ! new_time_ex(int hour, int minute, int second, int usecond, ! PyObject *tzinfo, PyTypeObject *type) { PyDateTime_Time *self; char aware = tzinfo != Py_None; ! self = (PyDateTime_Time *) (type->tp_alloc(type, aware)); if (self != NULL) { self->hastzinfo = aware; *************** *** 1352,1355 **** --- 1361,1367 ---- } + #define new_time(hh, mm, ss, us, tzinfo) \ + new_time_ex(hh, mm, ss, us, tzinfo, &PyDateTime_TimeType) + /* Create a timedelta instance. Normalize the members iff normalize is * true. Passing false is a speed optimization, if you know for sure *************** *** 3015,3019 **** } aware = (char)(tzinfo != Py_None); ! me = alloc_time(aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 3027,3032 ---- } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_Time *) time_alloc(&PyDateTime_TimeType, ! aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 3037,3041 **** if (check_tzinfo_subclass(tzinfo) < 0) return NULL; ! self = new_time(hour, minute, second, usecond, tzinfo); } return self; --- 3050,3055 ---- if (check_tzinfo_subclass(tzinfo) < 0) return NULL; ! self = new_time_ex(hour, minute, second, usecond, tzinfo, ! type); } return self; *************** *** 3440,3444 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ time_new, /* tp_new */ 0, /* tp_free */ --- 3454,3458 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! time_alloc, /* tp_alloc */ time_new, /* tp_new */ 0, /* tp_free */ *************** *** 3535,3539 **** } aware = (char)(tzinfo != Py_None); ! me = alloc_datetime(aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); --- 3549,3555 ---- } aware = (char)(tzinfo != Py_None); ! me = (PyDateTime_DateTime *) datetime_alloc( ! &PyDateTime_DateTimeType, ! aware); if (me != NULL) { char *pdata = PyString_AS_STRING(state); *************** *** 3559,3565 **** if (check_tzinfo_subclass(tzinfo) < 0) return NULL; ! self = new_datetime(year, month, day, ! hour, minute, second, usecond, ! tzinfo); } return self; --- 3575,3581 ---- if (check_tzinfo_subclass(tzinfo) < 0) return NULL; ! self = new_datetime_ex(year, month, day, ! hour, minute, second, usecond, ! tzinfo, type); } return self; *************** *** 4461,4465 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ datetime_new, /* tp_new */ 0, /* tp_free */ --- 4477,4481 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! datetime_alloc, /* tp_alloc */ datetime_new, /* tp_new */ 0, /* tp_free */ From tim_one@users.sourceforge.net Sat May 17 06:55:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 22:55:50 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py,1.42,1.43 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv27411/python/Lib/test Modified Files: test_datetime.py Log Message: datetime.datetime and datetime.time can now be subclassed in Python. Brr. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** test_datetime.py 17 May 2003 02:25:20 -0000 1.42 --- test_datetime.py 17 May 2003 05:55:17 -0000 1.43 *************** *** 480,514 **** self.assertEqual(dt2, dt - days) - def test_subclass_date(self): - - # XXX When datetime becomes usably subclassable, uncomment the - # XXX "self.theclass" lines and move this into TestDate. - # class C(self.theclass): - class C(date): - theAnswer = 42 - - def __new__(cls, *args, **kws): - temp = kws.copy() - extra = temp.pop('extra') - # result = self.theclass.__new__(cls, *args, **temp) - result = date.__new__(cls, *args, **temp) - result.extra = extra - return result - - def newmeth(self, start): - return start + self.year + self.month - - args = 2003, 4, 14 - - # dt1 = self.theclass(*args) - dt1 = date(*args) - dt2 = C(*args, **{'extra': 7}) - - self.assertEqual(dt2.__class__, C) - self.assertEqual(dt2.theAnswer, 42) - self.assertEqual(dt2.extra, 7) - self.assertEqual(dt1.toordinal(), dt2.toordinal()) - self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) - class TestDate(HarmlessMixedComparison): # Tests here should pass for both dates and datetimes, except for a --- 480,483 ---- *************** *** 1003,1006 **** --- 972,1001 ---- self.assertRaises(ValueError, base.replace, year=2001) + def test_subclass_date(self): + + class C(self.theclass): + theAnswer = 42 + + def __new__(cls, *args, **kws): + temp = kws.copy() + extra = temp.pop('extra') + result = self.theclass.__new__(cls, *args, **temp) + result.extra = extra + return result + + def newmeth(self, start): + return start + self.year + self.month + + args = 2003, 4, 14 + + dt1 = self.theclass(*args) + dt2 = C(*args, **{'extra': 7}) + + self.assertEqual(dt2.__class__, C) + self.assertEqual(dt2.theAnswer, 42) + self.assertEqual(dt2.extra, 7) + self.assertEqual(dt1.toordinal(), dt2.toordinal()) + self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month - 7) + ############################################################################# *************** *** 1427,1430 **** --- 1422,1452 ---- self.assertRaises(ValueError, dt.astimezone, alsobog) # also naive + def test_subclass_datetime(self): + + class C(self.theclass): + theAnswer = 42 + + def __new__(cls, *args, **kws): + temp = kws.copy() + extra = temp.pop('extra') + result = self.theclass.__new__(cls, *args, **temp) + result.extra = extra + return result + + def newmeth(self, start): + return start + self.year + self.month + self.second + + args = 2003, 4, 14, 12, 13, 41 + + dt1 = self.theclass(*args) + dt2 = C(*args, **{'extra': 7}) + + self.assertEqual(dt2.__class__, C) + self.assertEqual(dt2.theAnswer, 42) + self.assertEqual(dt2.extra, 7) + self.assertEqual(dt1.toordinal(), dt2.toordinal()) + self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month + + dt1.second - 7) + class TestTime(HarmlessMixedComparison): *************** *** 1661,1664 **** --- 1683,1712 ---- self.assertRaises(ValueError, base.replace, microsecond=1000000) + def test_subclass_time(self): + + class C(self.theclass): + theAnswer = 42 + + def __new__(cls, *args, **kws): + temp = kws.copy() + extra = temp.pop('extra') + result = self.theclass.__new__(cls, *args, **temp) + result.extra = extra + return result + + def newmeth(self, start): + return start + self.hour + self.second + + args = 4, 5, 6 + + dt1 = self.theclass(*args) + dt2 = C(*args, **{'extra': 7}) + + self.assertEqual(dt2.__class__, C) + self.assertEqual(dt2.theAnswer, 42) + self.assertEqual(dt2.extra, 7) + self.assertEqual(dt1.isoformat(), dt2.isoformat()) + self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.second - 7) + # A mixin for classes with a tzinfo= argument. Subclasses must define # theclass as a class atribute, and theclass(1, 1, 1, tzinfo=whatever) *************** *** 2043,2046 **** --- 2091,2120 ---- self.failUnless(t1 < t2) # t1's offset counter still going up + def test_subclass_timetz(self): + + class C(self.theclass): + theAnswer = 42 + + def __new__(cls, *args, **kws): + temp = kws.copy() + extra = temp.pop('extra') + result = self.theclass.__new__(cls, *args, **temp) + result.extra = extra + return result + + def newmeth(self, start): + return start + self.hour + self.second + + args = 4, 5, 6, 500, FixedOffset(-300, "EST", 1) + + dt1 = self.theclass(*args) + dt2 = C(*args, **{'extra': 7}) + + self.assertEqual(dt2.__class__, C) + self.assertEqual(dt2.theAnswer, 42) + self.assertEqual(dt2.extra, 7) + self.assertEqual(dt1.utcoffset(), dt2.utcoffset()) + self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.second - 7) + # Testing datetime objects with a non-None tzinfo. *************** *** 2625,2628 **** --- 2699,2728 ---- t2 = t2.replace(tzinfo=Varies()) self.failUnless(t1 < t2) # t1's offset counter still going up + + def test_subclass_datetimetz(self): + + class C(self.theclass): + theAnswer = 42 + + def __new__(cls, *args, **kws): + temp = kws.copy() + extra = temp.pop('extra') + result = self.theclass.__new__(cls, *args, **temp) + result.extra = extra + return result + + def newmeth(self, start): + return start + self.hour + self.year + + args = 2002, 12, 31, 4, 5, 6, 500, FixedOffset(-300, "EST", 1) + + dt1 = self.theclass(*args) + dt2 = C(*args, **{'extra': 7}) + + self.assertEqual(dt2.__class__, C) + self.assertEqual(dt2.theAnswer, 42) + self.assertEqual(dt2.extra, 7) + self.assertEqual(dt1.utcoffset(), dt2.utcoffset()) + self.assertEqual(dt2.newmeth(-7), dt1.hour + dt1.year - 7) # Pain to set up DST-aware tzinfo classes. From tim_one@users.sourceforge.net Sat May 17 06:55:51 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 16 May 2003 22:55:51 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.766,1.767 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv27411/python/Misc Modified Files: NEWS Log Message: datetime.datetime and datetime.time can now be subclassed in Python. Brr. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.766 retrieving revision 1.767 diff -C2 -d -r1.766 -r1.767 *** NEWS 16 May 2003 01:46:51 -0000 1.766 --- NEWS 17 May 2003 05:55:18 -0000 1.767 *************** *** 27,30 **** --- 27,33 ---- ----------------- + - The datetime.datetime and datetime.time classes are now properly + subclassable. + - _tkinter.{get|set}busywaitinterval was added. From pedronis@users.sourceforge.net Sat May 17 13:50:36 2003 From: pedronis@users.sourceforge.net (pedronis@users.sourceforge.net) Date: Sat, 17 May 2003 05:50:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeop.py,1.3.12.1,1.3.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10535 Modified Files: Tag: release22-maint test_codeop.py Log Message: minor fix, jython-only. Don't asssume stdout to save is the ur-stdout. Index: test_codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeop.py,v retrieving revision 1.3.12.1 retrieving revision 1.3.12.2 diff -C2 -d -r1.3.12.1 -r1.3.12.2 *** test_codeop.py 17 May 2003 02:35:37 -0000 1.3.12.1 --- test_codeop.py 17 May 2003 12:50:33 -0000 1.3.12.2 *************** *** 27,30 **** --- 27,31 ---- if symbol == "single": d,r = {},{} + saved_stdout = sys.stdout sys.stdout = cStringIO.StringIO() try: *************** *** 32,36 **** exec compile(str,"","single") in r finally: ! sys.stdout = sys.__stdout__ elif symbol == 'eval': ctx = {'a': 2} --- 33,37 ---- exec compile(str,"","single") in r finally: ! sys.stdout = saved_stdout elif symbol == 'eval': ctx = {'a': 2} From pedronis@users.sourceforge.net Sat May 17 13:51:12 2003 From: pedronis@users.sourceforge.net (pedronis@users.sourceforge.net) Date: Sat, 17 May 2003 05:51:12 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_codeop.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11157 Modified Files: test_codeop.py Log Message: minor fix, jython-only. Don't asssume stdout to save is the ur-stdout. Index: test_codeop.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_codeop.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_codeop.py 17 May 2003 02:39:52 -0000 1.6 --- test_codeop.py 17 May 2003 12:51:10 -0000 1.7 *************** *** 27,30 **** --- 27,31 ---- if symbol == "single": d,r = {},{} + saved_stdout = sys.stdout sys.stdout = cStringIO.StringIO() try: *************** *** 32,36 **** exec compile(str,"","single") in r finally: ! sys.stdout = sys.__stdout__ elif symbol == 'eval': ctx = {'a': 2} --- 33,37 ---- exec compile(str,"","single") in r finally: ! sys.stdout = saved_stdout elif symbol == 'eval': ctx = {'a': 2} From tim_one@users.sourceforge.net Sat May 17 16:57:02 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 17 May 2003 08:57:02 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.767,1.768 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31645/Misc Modified Files: NEWS Log Message: datetime.timedelta is now subclassable in Python. The new test shows one good use: a subclass adding a method to express the duration as a number of hours (or minutes, or whatever else you want to add). The native breakdown into days+seconds+us is often clumsy. Incidentally moved a large chunk of object-initialization code closer to the top of the file, to avoid worse forward-reference trickery. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.767 retrieving revision 1.768 diff -C2 -d -r1.767 -r1.768 *** NEWS 17 May 2003 05:55:18 -0000 1.767 --- NEWS 17 May 2003 15:57:00 -0000 1.768 *************** *** 27,32 **** ----------------- ! - The datetime.datetime and datetime.time classes are now properly ! subclassable. - _tkinter.{get|set}busywaitinterval was added. --- 27,32 ---- ----------------- ! - The datetime module classes datetime, time, and timedelta are now ! properly subclassable. - _tkinter.{get|set}busywaitinterval was added. From tim_one@users.sourceforge.net Sat May 17 16:57:02 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 17 May 2003 08:57:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_datetime.py,1.43,1.44 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31645/Lib/test Modified Files: test_datetime.py Log Message: datetime.timedelta is now subclassable in Python. The new test shows one good use: a subclass adding a method to express the duration as a number of hours (or minutes, or whatever else you want to add). The native breakdown into days+seconds+us is often clumsy. Incidentally moved a large chunk of object-initialization code closer to the top of the file, to avoid worse forward-reference trickery. Index: test_datetime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_datetime.py,v retrieving revision 1.43 retrieving revision 1.44 diff -C2 -d -r1.43 -r1.44 *** test_datetime.py 17 May 2003 05:55:17 -0000 1.43 --- test_datetime.py 17 May 2003 15:56:59 -0000 1.44 *************** *** 444,447 **** --- 444,478 ---- self.failUnless(not timedelta(0)) + def test_subclass_timedelta(self): + + class T(timedelta): + def from_td(td): + return T(td.days, td.seconds, td.microseconds) + from_td = staticmethod(from_td) + + def as_hours(self): + sum = (self.days * 24 + + self.seconds / 3600.0 + + self.microseconds / 3600e6) + return round(sum) + + t1 = T(days=1) + self.assert_(type(t1) is T) + self.assertEqual(t1.as_hours(), 24) + + t2 = T(days=-1, seconds=-3600) + self.assert_(type(t2) is T) + self.assertEqual(t2.as_hours(), -25) + + t3 = t1 + t2 + self.assert_(type(t3) is timedelta) + t4 = T.from_td(t3) + self.assert_(type(t4) is T) + self.assertEqual(t3.days, t4.days) + self.assertEqual(t3.seconds, t4.seconds) + self.assertEqual(t3.microseconds, t4.microseconds) + self.assertEqual(str(t3), str(t4)) + self.assertEqual(t4.as_hours(), -1) + ############################################################################# # date tests From tim_one@users.sourceforge.net Sat May 17 16:57:03 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 17 May 2003 08:57:03 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31645/Modules Modified Files: datetimemodule.c Log Message: datetime.timedelta is now subclassable in Python. The new test shows one good use: a subclass adding a method to express the duration as a number of hours (or minutes, or whatever else you want to add). The native breakdown into days+seconds+us is often clumsy. Incidentally moved a large chunk of object-initialization code closer to the top of the file, to avoid worse forward-reference trickery. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** datetimemodule.c 17 May 2003 05:55:19 -0000 1.64 --- datetimemodule.c 17 May 2003 15:57:00 -0000 1.65 *************** *** 563,566 **** --- 563,728 ---- /* --------------------------------------------------------------------------- + * Basic object allocation: tp_alloc implementations. These allocate + * Python objects of the right size and type, and do the Python object- + * initialization bit. If there's not enough memory, they return NULL after + * setting MemoryError. All data members remain uninitialized trash. + * + * We abuse the tp_alloc "nitems" argument to communicate whether a tzinfo + * member is needed. This is ugly. + */ + + static PyObject * + time_alloc(PyTypeObject *type, int aware) + { + PyObject *self; + + self = (PyObject *) + PyObject_MALLOC(aware ? + sizeof(PyDateTime_Time) : + sizeof(_PyDateTime_BaseTime)); + if (self == NULL) + return (PyObject *)PyErr_NoMemory(); + PyObject_INIT(self, type); + return self; + } + + static PyObject * + datetime_alloc(PyTypeObject *type, int aware) + { + PyObject *self; + + self = (PyObject *) + PyObject_MALLOC(aware ? + sizeof(PyDateTime_DateTime) : + sizeof(_PyDateTime_BaseDateTime)); + if (self == NULL) + return (PyObject *)PyErr_NoMemory(); + PyObject_INIT(self, type); + return self; + } + + /* --------------------------------------------------------------------------- + * Helpers for setting object fields. These work on pointers to the + * appropriate base class. + */ + + /* For date and datetime. */ + static void + set_date_fields(PyDateTime_Date *self, int y, int m, int d) + { + self->hashcode = -1; + SET_YEAR(self, y); + SET_MONTH(self, m); + SET_DAY(self, d); + } + + /* --------------------------------------------------------------------------- + * Create various objects, mostly without range checking. + */ + + /* Create a date instance with no range checking. */ + static PyObject * + new_date_ex(int year, int month, int day, PyTypeObject *type) + { + PyDateTime_Date *self; + + self = (PyDateTime_Date *) (type->tp_alloc(type, 0)); + if (self != NULL) + set_date_fields(self, year, month, day); + return (PyObject *) self; + } + + #define new_date(year, month, day) \ + new_date_ex(year, month, day, &PyDateTime_DateType) + + /* Create a datetime instance with no range checking. */ + static PyObject * + new_datetime_ex(int year, int month, int day, int hour, int minute, + int second, int usecond, PyObject *tzinfo, PyTypeObject *type) + { + PyDateTime_DateTime *self; + char aware = tzinfo != Py_None; + + self = (PyDateTime_DateTime *) (type->tp_alloc(type, aware)); + if (self != NULL) { + self->hastzinfo = aware; + set_date_fields((PyDateTime_Date *)self, year, month, day); + DATE_SET_HOUR(self, hour); + DATE_SET_MINUTE(self, minute); + DATE_SET_SECOND(self, second); + DATE_SET_MICROSECOND(self, usecond); + if (aware) { + Py_INCREF(tzinfo); + self->tzinfo = tzinfo; + } + } + return (PyObject *)self; + } + + #define new_datetime(y, m, d, hh, mm, ss, us, tzinfo) \ + new_datetime_ex(y, m, d, hh, mm, ss, us, tzinfo, \ + &PyDateTime_DateTimeType) + + /* Create a time instance with no range checking. */ + static PyObject * + new_time_ex(int hour, int minute, int second, int usecond, + PyObject *tzinfo, PyTypeObject *type) + { + PyDateTime_Time *self; + char aware = tzinfo != Py_None; + + self = (PyDateTime_Time *) (type->tp_alloc(type, aware)); + if (self != NULL) { + self->hastzinfo = aware; + self->hashcode = -1; + TIME_SET_HOUR(self, hour); + TIME_SET_MINUTE(self, minute); + TIME_SET_SECOND(self, second); + TIME_SET_MICROSECOND(self, usecond); + if (aware) { + Py_INCREF(tzinfo); + self->tzinfo = tzinfo; + } + } + return (PyObject *)self; + } + + #define new_time(hh, mm, ss, us, tzinfo) \ + new_time_ex(hh, mm, ss, us, tzinfo, &PyDateTime_TimeType) + + /* Create a timedelta instance. Normalize the members iff normalize is + * true. Passing false is a speed optimization, if you know for sure + * that seconds and microseconds are already in their proper ranges. In any + * case, raises OverflowError and returns NULL if the normalized days is out + * of range). + */ + static PyObject * + new_delta_ex(int days, int seconds, int microseconds, int normalize, + PyTypeObject *type) + { + PyDateTime_Delta *self; + + if (normalize) + normalize_d_s_us(&days, &seconds, µseconds); + assert(0 <= seconds && seconds < 24*3600); + assert(0 <= microseconds && microseconds < 1000000); + + if (check_delta_day_range(days) < 0) + return NULL; + + self = (PyDateTime_Delta *) (type->tp_alloc(type, 0)); + if (self != NULL) { + self->hashcode = -1; + SET_TD_DAYS(self, days); + SET_TD_SECONDS(self, seconds); + SET_TD_MICROSECONDS(self, microseconds); + } + return (PyObject *) self; + } + + #define new_delta(d, s, us, normalize) \ + new_delta_ex(d, s, us, normalize, &PyDateTime_DeltaType) + + /* --------------------------------------------------------------------------- * tzinfo helpers. */ *************** *** 696,701 **** } - static PyObject *new_delta(int d, int sec, int usec, int normalize); - /* Call tzinfo.name(tzinfoarg), and return the offset as a timedelta or None. */ --- 858,861 ---- *************** *** 1236,1398 **** /* --------------------------------------------------------------------------- - * Basic object allocation: tp_alloc implementatiosn. These allocate - * Python objects of the right size and type, and do the Python object- - * initialization bit. If there's not enough memory, they return NULL after - * setting MemoryError. All data members remain uninitialized trash. - * - * We abuse the tp_alloc "nitems" argument to communicate whether a tzinfo - * member is needed. This is ugly. - */ - - static PyObject * - time_alloc(PyTypeObject *type, int aware) - { - PyObject *self; - - self = (PyObject *) - PyObject_MALLOC(aware ? - sizeof(PyDateTime_Time) : - sizeof(_PyDateTime_BaseTime)); - if (self == NULL) - return (PyObject *)PyErr_NoMemory(); - PyObject_INIT(self, type); - return self; - } - - static PyObject * - datetime_alloc(PyTypeObject *type, int aware) - { - PyObject *self; - - self = (PyObject *) - PyObject_MALLOC(aware ? - sizeof(PyDateTime_DateTime) : - sizeof(_PyDateTime_BaseDateTime)); - if (self == NULL) - return (PyObject *)PyErr_NoMemory(); - PyObject_INIT(self, type); - return self; - } - - /* --------------------------------------------------------------------------- - * Helpers for setting object fields. These work on pointers to the - * appropriate base class. - */ - - /* For date and datetime. */ - static void - set_date_fields(PyDateTime_Date *self, int y, int m, int d) - { - self->hashcode = -1; - SET_YEAR(self, y); - SET_MONTH(self, m); - SET_DAY(self, d); - } - - /* --------------------------------------------------------------------------- - * Create various objects, mostly without range checking. - */ - - /* Create a date instance with no range checking. */ - static PyObject * - new_date_ex(int year, int month, int day, PyTypeObject *type) - { - PyDateTime_Date *self; - - self = (PyDateTime_Date *) (type->tp_alloc(type, 0)); - if (self != NULL) - set_date_fields(self, year, month, day); - return (PyObject *) self; - } - - #define new_date(year, month, day) \ - new_date_ex(year, month, day, &PyDateTime_DateType) - - /* Create a datetime instance with no range checking. */ - static PyObject * - new_datetime_ex(int year, int month, int day, int hour, int minute, - int second, int usecond, PyObject *tzinfo, PyTypeObject *type) - { - PyDateTime_DateTime *self; - char aware = tzinfo != Py_None; - - self = (PyDateTime_DateTime *) (type->tp_alloc(type, aware)); - if (self != NULL) { - self->hastzinfo = aware; - set_date_fields((PyDateTime_Date *)self, year, month, day); - DATE_SET_HOUR(self, hour); - DATE_SET_MINUTE(self, minute); - DATE_SET_SECOND(self, second); - DATE_SET_MICROSECOND(self, usecond); - if (aware) { - Py_INCREF(tzinfo); - self->tzinfo = tzinfo; - } - } - return (PyObject *)self; - } - - #define new_datetime(y, m, d, hh, mm, ss, us, tzinfo) \ - new_datetime_ex(y, m, d, hh, mm, ss, us, tzinfo, \ - &PyDateTime_DateTimeType) - - /* Create a time instance with no range checking. */ - static PyObject * - new_time_ex(int hour, int minute, int second, int usecond, - PyObject *tzinfo, PyTypeObject *type) - { - PyDateTime_Time *self; - char aware = tzinfo != Py_None; - - self = (PyDateTime_Time *) (type->tp_alloc(type, aware)); - if (self != NULL) { - self->hastzinfo = aware; - self->hashcode = -1; - TIME_SET_HOUR(self, hour); - TIME_SET_MINUTE(self, minute); - TIME_SET_SECOND(self, second); - TIME_SET_MICROSECOND(self, usecond); - if (aware) { - Py_INCREF(tzinfo); - self->tzinfo = tzinfo; - } - } - return (PyObject *)self; - } - - #define new_time(hh, mm, ss, us, tzinfo) \ - new_time_ex(hh, mm, ss, us, tzinfo, &PyDateTime_TimeType) - - /* Create a timedelta instance. Normalize the members iff normalize is - * true. Passing false is a speed optimization, if you know for sure - * that seconds and microseconds are already in their proper ranges. In any - * case, raises OverflowError and returns NULL if the normalized days is out - * of range). - */ - static PyObject * - new_delta(int days, int seconds, int microseconds, int normalize) - { - PyDateTime_Delta *self; - - if (normalize) - normalize_d_s_us(&days, &seconds, µseconds); - assert(0 <= seconds && seconds < 24*3600); - assert(0 <= microseconds && microseconds < 1000000); - - if (check_delta_day_range(days) < 0) - return NULL; - - self = PyObject_New(PyDateTime_Delta, &PyDateTime_DeltaType); - if (self != NULL) { - self->hashcode = -1; - SET_TD_DAYS(self, days); - SET_TD_SECONDS(self, seconds); - SET_TD_MICROSECONDS(self, microseconds); - } - return (PyObject *) self; - } - - - /* --------------------------------------------------------------------------- * Cached Python objects; these are set by the module init function. */ --- 1396,1399 ---- *************** *** 1473,1477 **** */ static PyObject * ! microseconds_to_delta(PyObject *pyus) { int us; --- 1474,1478 ---- */ static PyObject * ! microseconds_to_delta_ex(PyObject *pyus, PyTypeObject *type) { int us; *************** *** 1543,1547 **** goto Done; } ! result = new_delta(d, s, us, 0); Done: --- 1544,1548 ---- goto Done; } ! result = new_delta_ex(d, s, us, 0, type); Done: *************** *** 1551,1554 **** --- 1552,1558 ---- } + #define microseconds_to_delta(pymicros) \ + microseconds_to_delta_ex(pymicros, &PyDateTime_DeltaType) + static PyObject * multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) *************** *** 1925,1929 **** } ! self = microseconds_to_delta(x); Py_DECREF(x); Done: --- 1929,1933 ---- } ! self = microseconds_to_delta_ex(x, type); Py_DECREF(x); Done: *************** *** 2111,2115 **** 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ delta_doc, /* tp_doc */ 0, /* tp_traverse */ --- 2115,2120 ---- 0, /* tp_setattro */ 0, /* tp_as_buffer */ ! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | ! Py_TPFLAGS_BASETYPE, /* tp_flags */ delta_doc, /* tp_doc */ 0, /* tp_traverse */ From python@rcn.com Sat May 17 20:00:09 2003 From: python@rcn.com (Raymond Hettinger) Date: Sat, 17 May 2003 15:00:09 -0400 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 References: Message-ID: <001501c31ca6$89f21b40$3e20cb97@oemcomputer> > Log Message: > Change Request.add_header to call string.capitalize in order to normalize > headers and not have any dependency on case. Closes patch #649742. > > Also changed all instances of dict.items to dict.iteritems where appropriate. Please be careful. At least two of the iteritems() edits were not appropriate because the dictionary's keyset gets updated during the loop. Please back-out those two changes and re-check the others. Long before the alpha was released, we went through the whole library and made these kind of changes. If something was not changed, then there was likely a reason for it. There is a certain element of risk to making these changes, so every edit was double checked by another person and no changes of this type were made after the alpha. Also, no changes like this were considered for backporting. Raymond > Index: urllib2.py > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v > retrieving revision 1.42 > retrieving revision 1.43 > diff -C2 -d -r1.42 -r1.43 > *** urllib2.py 5 May 2003 04:09:13 -0000 1.42 > --- urllib2.py 12 May 2003 07:29:42 -0000 1.43 > *************** > *** 194,198 **** > self.data = data > self.headers = {} > ! self.headers.update(headers) > > def __getattr__(self, attr): > --- 194,199 ---- > self.data = data > self.headers = {} > ! for key, value in headers.iteritems(): > ! self.add_header(key, value) self.add_header will capitalize the key and add it back to the dictionary that is being iterated over. If the dictionary resizes upon the insertion, then the key order changes and some keys will be skipped. > *************** > *** 1022,1026 **** > # then check the size > if len(self.cache) == self.max_conns: > ! for k, v in self.timeout.items(): > if v == self.soonest: > del self.cache[k] > --- 1023,1027 ---- > # then check the size > if len(self.cache) == self.max_conns: > ! for k, v in self.timeout.iteritems(): > if v == self.soonest: > del self.cache[k] The next line (not shown in the context diff) is: del self.timeout[k] That mutates the dictionary being looped over. From drifty@alum.berkeley.edu Sat May 17 20:16:00 2003 From: drifty@alum.berkeley.edu (Brett C.) Date: Sat, 17 May 2003 12:16:00 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 In-Reply-To: <001501c31ca6$89f21b40$3e20cb97@oemcomputer> References: <001501c31ca6$89f21b40$3e20cb97@oemcomputer> Message-ID: <3EC68A70.1000504@ocf.berkeley.edu> Raymond Hettinger wrote: >>Log Message: >>Change Request.add_header to call string.capitalize in order to normalize >>headers and not have any dependency on case. Closes patch #649742. >> >>Also changed all instances of dict.items to dict.iteritems where appropriate. > > > Please be careful. At least two of the iteritems() edits were not appropriate > because the dictionary's keyset gets updated during the loop. > > Please back-out those two changes and re-check the others. > Is it always to back out a change and then check in a modified version with the same number? Or is it okay to just do a separate checkin that will fix this? If the former I will have to look up the commands on how to do that. > Long before the alpha was released, we went through the whole library > and made these kind of changes. If something was not changed, then > there was likely a reason for it. There is a certain element of risk > to making these changes, so every edit was double checked by another > person and no changes of this type were made after the alpha. > Also, no changes like this were considered for backporting. > OK. I will keep that in mind. > >>Index: urllib2.py >>=================================================================== >>RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v >>retrieving revision 1.42 >>retrieving revision 1.43 >>diff -C2 -d -r1.42 -r1.43 >>*** urllib2.py 5 May 2003 04:09:13 -0000 1.42 >>--- urllib2.py 12 May 2003 07:29:42 -0000 1.43 >>*************** >>*** 194,198 **** >> self.data = data >> self.headers = {} >>! self.headers.update(headers) >> >> def __getattr__(self, attr): >>--- 194,199 ---- >> self.data = data >> self.headers = {} >>! for key, value in headers.iteritems(): >>! self.add_header(key, value) > > > self.add_header will capitalize the key and add it back to the dictionary > that is being iterated over. If the dictionary resizes upon the insertion, > then the key order changes and some keys will be skipped. > I am not seeing that. headers is the dictionary passed into __init__ which is being iterated over. self.headers is what add_header modifies. > > > >>*************** >>*** 1022,1026 **** >> # then check the size >> if len(self.cache) == self.max_conns: >>! for k, v in self.timeout.items(): >> if v == self.soonest: >> del self.cache[k] >>--- 1023,1027 ---- >> # then check the size >> if len(self.cache) == self.max_conns: >>! for k, v in self.timeout.iteritems(): >> if v == self.soonest: >> del self.cache[k] > > > The next line (not shown in the context diff) is: > del self.timeout[k] > That mutates the dictionary being looped over. > > OK, I will fix that. -Brett From python@rcn.com Sat May 17 20:28:54 2003 From: python@rcn.com (Raymond Hettinger) Date: Sat, 17 May 2003 15:28:54 -0400 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 References: <001501c31ca6$89f21b40$3e20cb97@oemcomputer> <3EC68A70.1000504@ocf.berkeley.edu> Message-ID: <003b01c31caa$8e61d4a0$3e20cb97@oemcomputer> > Is it always to back out a change and then check in a modified version > with the same number? Or is it okay to just do a separate checkin that > will fix this? If the former I will have to look up the commands on how > to do that. In this case, just make the fixes and check them in normally. This is the easiest way and it lets you leave in the parts that were just fine. For reverting a complex checkin, you can generate a reverse delta: cvs diff -r 1.43 -r 1.42 urllib2.py > revert.diff patch urllib2.py revert.diff cvs ci -m "Revert to 1.42" urllib2.py Thanks for getting to it so quickly :-) Raymond From bcannon@users.sourceforge.net Sat May 17 20:51:28 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat, 17 May 2003 12:51:28 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31793/Lib Modified Files: urllib2.py Log Message: Revert some changes back to dict.items made in a previous patch. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** urllib2.py 12 May 2003 07:31:53 -0000 1.44 --- urllib2.py 17 May 2003 19:51:26 -0000 1.45 *************** *** 194,198 **** self.data = data self.headers = {} ! for key, value in headers.iteritems(): self.add_header(key, value) --- 194,198 ---- self.data = data self.headers = {} ! for key, value in headers.items(): self.add_header(key, value) *************** *** 1022,1026 **** # then check the size if len(self.cache) == self.max_conns: ! for k, v in self.timeout.iteritems(): if v == self.soonest: del self.cache[k] --- 1022,1026 ---- # then check the size if len(self.cache) == self.max_conns: ! for k, v in self.timeout.items(): if v == self.soonest: del self.cache[k] From a4cwm5ewm@earthlink.net Sun May 18 01:23:06 2003 From: a4cwm5ewm@earthlink.net (Kelley Lunsford) Date: Sun, 18 May 03 00:23:06 GMT Subject: [Python-checkins] 100% Free TV vfzii Message-ID: This is a multi-part message in MIME format. --CFA0__4ED39__0CEF44 Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Unlock Digital Cable *PPV channels *Boxing and any other Sports Event on PPV *Adult Channels *And anything else on PPV channels CLICK HERE FOR MORE INFORMATION http://www.a6zing29.com/xcart/customer/product.php?productid=3D16144&partn= er=3Daffil21&r=3Dhgsezyzmolc ri hma mutnwfjyc iog v ltkyje b xo ctqznlneo rgf zwa jy ki soq gn l ghpv This is the NEWEST AND BEST Digital CATV Filter/Descrambler that can test your digital cable PPV purchase functions along with eliminating unwanted interference caused by your broadband connection. This is a "True" universal product. It will work on 99% of all digital cable systems in use today. ** VERY SIMPLE TO HOOK UP ** *** ONLY $44.95 PLUS a FREE $20 GIFT *** IF YOU CAN ORDER PPV THROUGH YOUR REMOTE, THEN THIS FILTER WILL WORK FOR YOU WE OFFER THE MOST ADVANCED TECHNOLOGY IN DIGITAL FILTERS ANYWHERE, DONT BE FOOLED BY IMITATIONS THAT WONT WORK. ATTENTION: Because the Cable Company has no way of telling you are using this product you need to notify them of any movie purchases CLICK HERE FOR MORE INFORMATION http://www.a6zing29.com/xcart/customer/product.php?productid=3D16144&partn= er=3Daffil21&r=3Drih bglceosqf hdzmscizvo n cmmis +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ This email has been screened and filtered by our in house ""OPT-OUT"" system in compliance with state laws. If you wish to "OPT-OUT" from this mailing as well as the lists of thousands of other email providers please visit http://www.a6zing29.com/1/ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ofqjfdllcqzd kxjg e shuvrmthvfwfi --CFA0__4ED39__0CEF44-- From rhettinger@users.sourceforge.net Sat May 17 21:44:15 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 17 May 2003 13:44:15 -0700 Subject: [Python-checkins] python/dist/src/Lib/test regrtest.py,1.140,1.141 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17350 Modified Files: regrtest.py Log Message: User cStringIO instead of StringIO. Index: regrtest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/regrtest.py,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** regrtest.py 10 May 2003 07:36:55 -0000 1.140 --- regrtest.py 17 May 2003 20:44:12 -0000 1.141 *************** *** 74,78 **** import traceback import random ! import StringIO import warnings from sets import Set --- 74,78 ---- import traceback import random ! import cStringIO import warnings from sets import Set *************** *** 380,384 **** cfp = None else: ! cfp = StringIO.StringIO() try: save_stdout = sys.stdout --- 380,384 ---- cfp = None else: ! cfp = cStringIO.StringIO() try: save_stdout = sys.stdout From tim.one@comcast.net Sun May 18 00:09:14 2003 From: tim.one@comcast.net (Tim Peters) Date: Sat, 17 May 2003 19:09:14 -0400 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.42,1.43 In-Reply-To: <003b01c31caa$8e61d4a0$3e20cb97@oemcomputer> Message-ID: [Raymond Hettinger] > ... > For reverting a complex checkin, you can generate a reverse delta: > cvs diff -r 1.43 -r 1.42 urllib2.py > revert.diff > patch urllib2.py revert.diff > cvs ci -m "Revert to 1.42" urllib2.py Note that you can skip a step (and so avoid a chance to make a mistake) by reverting directly during an update, replacing the first two lines with: cvs up -j 1.43 -j 1.42 urllib2.py As in Raymond's example too, the order in which the revision arguments appear is vital. From doerwalter@users.sourceforge.net Sun May 18 01:47:49 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 17:47:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_winsound,1.2,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv3817/output Removed Files: test_winsound Log Message: Port test_array and test_winsound to PyUnit. Enhance tests for array (code coverage for Modules/arraymodule.c is at 91%) >From SF patch #736962. --- test_winsound DELETED --- From doerwalter@users.sourceforge.net Sun May 18 01:47:49 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 17:47:49 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.19,1.20 test_winsound.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv3817 Modified Files: test_array.py test_winsound.py Log Message: Port test_array and test_winsound to PyUnit. Enhance tests for array (code coverage for Modules/arraymodule.c is at 91%) >From SF patch #736962. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_array.py 7 Jan 2003 01:58:52 -0000 1.19 --- test_array.py 18 May 2003 00:47:46 -0000 1.20 *************** *** 3,381 **** Roger E. Masse """ - import array - from test.test_support import verbose, TESTFN, unlink, TestFailed,\ - have_unicode, vereq ! def main(): ! testtype('c', 'c') ! if have_unicode: ! testtype('u', unicode(r'\u263a', 'unicode-escape')) [...1187 lines suppressed...] ! self.assertAlmostEqual(entry1, entry2) ! ! class FloatTest(FPTest): ! typecode = 'f' ! minitemsize = 4 ! tests.append(FloatTest) ! ! class DoubleTest(FPTest): ! typecode = 'd' ! minitemsize = 8 ! tests.append(DoubleTest) ! ! def test_main(): ! test_support.run_unittest(*tests) ! ! if __name__=="__main__": ! test_main() ! ! ! #main() Index: test_winsound.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winsound.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_winsound.py 9 Apr 2003 19:57:06 -0000 1.4 --- test_winsound.py 18 May 2003 00:47:46 -0000 1.5 *************** *** 1,18 **** # Ridiculously simple test of the winsound module for Windows. import winsound, time ! for i in range(100, 2000, 100): ! winsound.Beep(i, 75) ! print "Hopefully you heard some sounds increasing in frequency!" ! winsound.MessageBeep() ! time.sleep(0.5) ! winsound.MessageBeep(winsound.MB_OK) ! time.sleep(0.5) ! winsound.MessageBeep(winsound.MB_ICONASTERISK) ! time.sleep(0.5) ! winsound.MessageBeep(winsound.MB_ICONEXCLAMATION) ! time.sleep(0.5) ! winsound.MessageBeep(winsound.MB_ICONHAND) ! time.sleep(0.5) ! winsound.MessageBeep(winsound.MB_ICONQUESTION) ! time.sleep(0.5) --- 1,102 ---- # Ridiculously simple test of the winsound module for Windows. + import unittest + from test import test_support import winsound, time ! ! class BeepTest(unittest.TestCase): ! ! def test_errors(self): ! self.assertRaises(TypeError, winsound.Beep) ! self.assertRaises(ValueError, winsound.Beep, 36, 75) ! self.assertRaises(ValueError, winsound.Beep, 32768, 75) ! ! def test_extremes(self): ! winsound.Beep(37, 75) ! winsound.Beep(32767, 75) ! ! def test_increasingfrequency(self): ! for i in xrange(100, 2000, 100): ! winsound.Beep(i, 75) ! ! class MessageBeepTest(unittest.TestCase): ! ! def tearDown(self): ! time.sleep(0.5) ! ! def test_default(self): ! self.assertRaises(TypeError, winsound.MessageBeep, "bad") ! self.assertRaises(TypeError, winsound.MessageBeep, 42, 42) ! winsound.MessageBeep() ! ! def test_ok(self): ! winsound.MessageBeep(winsound.MB_OK) ! ! def test_asterisk(self): ! winsound.MessageBeep(winsound.MB_ICONASTERISK) ! ! def test_exclamation(self): ! winsound.MessageBeep(winsound.MB_ICONEXCLAMATION) ! ! def test_hand(self): ! winsound.MessageBeep(winsound.MB_ICONHAND) ! ! def test_question(self): ! winsound.MessageBeep(winsound.MB_ICONQUESTION) ! ! class PlaySoundTest(unittest.TestCase): ! ! def test_errors(self): ! self.assertRaises(TypeError, winsound.PlaySound) ! self.assertRaises(TypeError, winsound.PlaySound, "bad", "bad") ! self.assertRaises( ! RuntimeError, ! winsound.PlaySound, ! "none", winsound.SND_ASYNC | winsound.SND_MEMORY ! ) ! ! def test_alias_asterisk(self): ! winsound.PlaySound('SystemAsterisk', winsound.SND_ALIAS) ! ! def test_alias_exclamation(self): ! winsound.PlaySound('SystemExclamation', winsound.SND_ALIAS) ! ! def test_alias_exit(self): ! winsound.PlaySound('SystemExit', winsound.SND_ALIAS) ! ! def test_alias_hand(self): ! winsound.PlaySound('SystemHand', winsound.SND_ALIAS) ! ! def test_alias_question(self): ! winsound.PlaySound('SystemQuestion', winsound.SND_ALIAS) ! ! def test_alias_fallback(self): ! winsound.PlaySound('!"$%&/(#+*', winsound.SND_ALIAS) ! ! def test_alias_nofallback(self): ! try: ! winsound.PlaySound( ! '!"$%&/(#+*', ! winsound.SND_ALIAS | winsound.SND_NODEFAULT ! ) ! except RuntimeError: ! pass ! ! def test_stopasync(self): ! winsound.PlaySound( ! 'SystemQuestion', ! winsound.SND_ALIAS | winsound.SND_ASYNC | winsound.SND_LOOP ! ) ! time.sleep(0.5) ! self.assertRaises( ! RuntimeError, ! winsound.PlaySound, ! 'SystemQuestion', winsound.SND_ALIAS | winsound.SND_NOSTOP ! ) ! winsound.PlaySound(None, winsound.SND_PURGE) ! ! def test_main(): ! test_support.run_unittest(BeepTest, MessageBeepTest, PlaySoundTest) ! ! if __name__=="__main__": ! test_main() From doerwalter@users.sourceforge.net Sun May 18 02:56:27 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 18:56:27 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv27067/Lib/test Modified Files: test_array.py Log Message: Add another error case to the insert test. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** test_array.py 18 May 2003 00:47:46 -0000 1.20 --- test_array.py 18 May 2003 01:56:25 -0000 1.21 *************** *** 81,84 **** --- 81,85 ---- self.assertRaises(TypeError, a.insert) self.assertRaises(TypeError, a.insert, None) + self.assertRaises(TypeError, a.insert, 0, None) def test_tofromfile(self): From tim_one@users.sourceforge.net Sun May 18 03:24:48 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 17 May 2003 19:24:48 -0700 Subject: [Python-checkins] python/dist/src/Modules datetimemodule.c,1.65,1.66 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv3077/modules Modified Files: datetimemodule.c Log Message: Added more words about the abuse of the tp_alloc nitems argument perpetrated by the time and datetime classes. Index: datetimemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/datetimemodule.c,v retrieving revision 1.65 retrieving revision 1.66 diff -C2 -d -r1.65 -r1.66 *** datetimemodule.c 17 May 2003 15:57:00 -0000 1.65 --- datetimemodule.c 18 May 2003 02:24:46 -0000 1.66 *************** *** 569,573 **** * * We abuse the tp_alloc "nitems" argument to communicate whether a tzinfo ! * member is needed. This is ugly. */ --- 569,584 ---- * * We abuse the tp_alloc "nitems" argument to communicate whether a tzinfo ! * member is needed. This is ugly, imprecise, and possibly insecure. ! * tp_basicsize for the time and datetime types is set to the size of the ! * struct that has room for the tzinfo member, so subclasses in Python will ! * allocate enough space for a tzinfo member whether or not one is actually ! * needed. That's the "ugly and imprecise" parts. The "possibly insecure" ! * part is that PyType_GenericAlloc() (which subclasses in Python end up ! * using) just happens today to effectively ignore the nitems argument ! * when tp_itemsize is 0, which it is for these type objects. If that ! * changes, perhaps the callers of tp_alloc slots in this file should ! * be changed to force a 0 nitems argument unless the type being allocated ! * is a base type implemented in this file (so that tp_alloc is time_alloc ! * or datetime_alloc below, which know about the nitems abuse). */ From bcannon@users.sourceforge.net Sun May 18 03:25:10 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Sat, 17 May 2003 19:25:10 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3425/Lib Modified Files: urllib2.py Log Message: To be on the safe side, backed out any questionable iteritem changes and set back to item calls. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** urllib2.py 17 May 2003 19:51:26 -0000 1.45 --- urllib2.py 18 May 2003 02:25:07 -0000 1.46 *************** *** 479,483 **** assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies ! for type, url in proxies.iteritems(): setattr(self, '%s_open' % type, lambda r, proxy=url, type=type, meth=self.proxy_open: \ --- 479,483 ---- assert hasattr(proxies, 'has_key'), "proxies must be a mapping" self.proxies = proxies ! for type, url in proxies.items(): setattr(self, '%s_open' % type, lambda r, proxy=url, type=type, meth=self.proxy_open: \ *************** *** 806,810 **** if name not in req.headers: h.putheader(*args) ! for k, v in req.headers.iteritems(): h.putheader(k, v) # httplib will attempt to connect() here. be prepared --- 806,810 ---- if name not in req.headers: h.putheader(*args) ! for k, v in req.headers.items(): h.putheader(k, v) # httplib will attempt to connect() here. be prepared From doerwalter@users.sourceforge.net Sun May 18 04:15:11 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 20:15:11 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libarray.tex,1.35,1.36 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18431/Doc/lib Modified Files: libarray.tex Log Message: Fix array.array.insert(), so that it treats negative indices as being relative to the end of the array, just like list.insert() does. This closes SF bug #739313. Index: libarray.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libarray.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** libarray.tex 10 May 2003 03:35:37 -0000 1.35 --- libarray.tex 18 May 2003 03:15:09 -0000 1.36 *************** *** 146,150 **** \begin{methoddesc}[array]{insert}{i, x} Insert a new item with value \var{x} in the array before position ! \var{i}. \end{methoddesc} --- 146,151 ---- \begin{methoddesc}[array]{insert}{i, x} Insert a new item with value \var{x} in the array before position ! \var{i}. Negative values are treated as being relative to the end ! of the array. \end{methoddesc} From doerwalter@users.sourceforge.net Sun May 18 04:15:11 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 20:15:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18431/Lib/test Modified Files: test_array.py Log Message: Fix array.array.insert(), so that it treats negative indices as being relative to the end of the array, just like list.insert() does. This closes SF bug #739313. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** test_array.py 18 May 2003 01:56:25 -0000 1.21 --- test_array.py 18 May 2003 03:15:08 -0000 1.22 *************** *** 83,86 **** --- 83,110 ---- self.assertRaises(TypeError, a.insert, 0, None) + a = array.array(self.typecode, self.example) + a.insert(-1, self.example[0]) + self.assertEqual( + a, + array.array( + self.typecode, + self.example[:-1] + self.example[:1] + self.example[-1:] + ) + ) + + a = array.array(self.typecode, self.example) + a.insert(-1000, self.example[0]) + self.assertEqual( + a, + array.array(self.typecode, self.example[:1] + self.example) + ) + + a = array.array(self.typecode, self.example) + a.insert(1000, self.example[0]) + self.assertEqual( + a, + array.array(self.typecode, self.example + self.example[:1]) + ) + def test_tofromfile(self): a = array.array(self.typecode, 2*self.example) From doerwalter@users.sourceforge.net Sun May 18 04:15:12 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 20:15:12 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.768,1.769 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18431/Misc Modified Files: NEWS Log Message: Fix array.array.insert(), so that it treats negative indices as being relative to the end of the array, just like list.insert() does. This closes SF bug #739313. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.768 retrieving revision 1.769 diff -C2 -d -r1.768 -r1.769 *** NEWS 17 May 2003 15:57:00 -0000 1.768 --- NEWS 18 May 2003 03:15:09 -0000 1.769 *************** *** 27,30 **** --- 27,33 ---- ----------------- + - array.array.insert() now treats negative indices as being relative + to the end of the array, just like list.insert() does. (SF bug #739313) + - The datetime module classes datetime, time, and timedelta are now properly subclassable. From doerwalter@users.sourceforge.net Sun May 18 04:15:12 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Sat, 17 May 2003 20:15:12 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.88,2.89 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv18431/Modules Modified Files: arraymodule.c Log Message: Fix array.array.insert(), so that it treats negative indices as being relative to the end of the array, just like list.insert() does. This closes SF bug #739313. Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.88 retrieving revision 2.89 diff -C2 -d -r2.88 -r2.89 *** arraymodule.c 24 Apr 2003 10:41:55 -0000 2.88 --- arraymodule.c 18 May 2003 03:15:10 -0000 2.89 *************** *** 471,476 **** return -1; } ! if (where < 0) ! where = 0; if (where > self->ob_size) where = self->ob_size; --- 471,479 ---- return -1; } ! if (where < 0) { ! where += self->ob_size; ! if (where < 0) ! where = 0; ! } if (where > self->ob_size) where = self->ob_size; From loewis@users.sourceforge.net Sun May 18 13:31:11 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 May 2003 05:31:11 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode.py,1.83,1.84 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31612/Lib/test Modified Files: test_unicode.py Log Message: Consider \U-escapes in raw-unicode-escape. Fixes #444514. Index: test_unicode.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode.py,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** test_unicode.py 1 May 2003 17:45:53 -0000 1.83 --- test_unicode.py 18 May 2003 12:31:08 -0000 1.84 *************** *** 698,701 **** --- 698,708 ---- print >>out, u'def\n' + def test_ucs4(self): + if sys.maxunicode == 0xFFFF: + return + x = u'\U00100000' + y = x.encode("raw-unicode-escape").decode("raw-unicode-escape") + self.assertEqual(x, y) + def test_main(): test_support.run_unittest(UnicodeTest) From loewis@users.sourceforge.net Sun May 18 13:31:11 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 May 2003 05:31:11 -0700 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c,2.187,2.188 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv31612/Objects Modified Files: unicodeobject.c Log Message: Consider \U-escapes in raw-unicode-escape. Fixes #444514. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.187 retrieving revision 2.188 diff -C2 -d -r2.187 -r2.188 *** unicodeobject.c 10 Apr 2003 22:35:32 -0000 2.187 --- unicodeobject.c 18 May 2003 12:31:09 -0000 2.188 *************** *** 2031,2034 **** --- 2031,2035 ---- Py_UCS4 x; int i; + int count; /* Non-escape characters are interpreted as Unicode ordinals */ *************** *** 2049,2061 **** if (((s - bs) & 1) == 0 || s >= end || ! *s != 'u') { continue; } p--; s++; ! /* \uXXXX with 4 hex digits */ outpos = p-PyUnicode_AS_UNICODE(v); ! for (x = 0, i = 0; i < 4; ++i, ++s) { c = (unsigned char)*s; if (!isxdigit(c)) { --- 2050,2063 ---- if (((s - bs) & 1) == 0 || s >= end || ! (*s != 'u' && *s != 'U')) { continue; } p--; + count = *s=='u' ? 4 : 8; s++; ! /* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ outpos = p-PyUnicode_AS_UNICODE(v); ! for (x = 0, i = 0; i < count; ++i, ++s) { c = (unsigned char)*s; if (!isxdigit(c)) { *************** *** 2077,2080 **** --- 2079,2092 ---- x += 10 + c - 'A'; } + #ifndef Py_UNICODE_WIDE + if (x > 0x10000) { + if (unicode_decode_call_errorhandler( + errors, &errorHandler, + "rawunicodeescape", "\\Uxxxxxxxx out of range", + starts, size, &startinpos, &endinpos, &exc, &s, + (PyObject **)&v, &outpos, &p)) + goto onError; + } + #endif *p++ = x; nextByte: *************** *** 2103,2107 **** --- 2115,2123 ---- static const char *hexdigit = "0123456789abcdef"; + #ifdef Py_UNICODE_WIDE + repr = PyString_FromStringAndSize(NULL, 10 * size); + #else repr = PyString_FromStringAndSize(NULL, 6 * size); + #endif if (repr == NULL) return NULL; *************** *** 2112,2115 **** --- 2128,2147 ---- while (size-- > 0) { Py_UNICODE ch = *s++; + #ifdef Py_UNICODE_WIDE + /* Map 32-bit characters to '\Uxxxxxxxx' */ + if (ch >= 0x10000) { + *p++ = '\\'; + *p++ = 'U'; + *p++ = hexdigit[(ch >> 28) & 0xf]; + *p++ = hexdigit[(ch >> 24) & 0xf]; + *p++ = hexdigit[(ch >> 20) & 0xf]; + *p++ = hexdigit[(ch >> 16) & 0xf]; + *p++ = hexdigit[(ch >> 12) & 0xf]; + *p++ = hexdigit[(ch >> 8) & 0xf]; + *p++ = hexdigit[(ch >> 4) & 0xf]; + *p++ = hexdigit[ch & 15]; + } + else + #endif /* Map 16-bit characters to '\uxxxx' */ if (ch >= 256) { *************** *** 6770,6771 **** --- 6802,6810 ---- unicode_freelist_size = 0; } + + /* + Local variables: + c-basic-offset: 4 + indent-tabs-mode: nil + End: + */ From loewis@users.sourceforge.net Sun May 18 13:56:28 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 May 2003 05:56:28 -0700 Subject: [Python-checkins] python/dist/src/Objects fileobject.c,2.178,2.179 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv7403/Objects Modified Files: fileobject.c Log Message: Only encode Unicode objects when printing them raw. Index: fileobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v retrieving revision 2.178 retrieving revision 2.179 diff -C2 -d -r2.178 -r2.179 *** fileobject.c 10 May 2003 07:08:50 -0000 2.178 --- fileobject.c 18 May 2003 12:56:25 -0000 2.179 *************** *** 2065,2069 **** } #ifdef Py_USING_UNICODE ! if (PyUnicode_Check(v) && enc != Py_None) { char *cenc = PyString_AS_STRING(enc); value = PyUnicode_AsEncodedString(v, cenc, "strict"); --- 2065,2070 ---- } #ifdef Py_USING_UNICODE ! if ((flags & Py_PRINT_RAW) && ! PyUnicode_Check(v) && enc != Py_None) { char *cenc = PyString_AS_STRING(enc); value = PyUnicode_AsEncodedString(v, cenc, "strict"); From loewis@users.sourceforge.net Sun May 18 14:40:08 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 May 2003 06:40:08 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.73.4.16,1.73.4.17 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv22047 Modified Files: Tag: release22-maint setup.py Log Message: Correct typo in check for _tkinter prerequisites. Backport of 1.162. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.16 retrieving revision 1.73.4.17 diff -C2 -d -r1.73.4.16 -r1.73.4.17 *** setup.py 27 Apr 2003 04:00:01 -0000 1.73.4.16 --- setup.py 18 May 2003 13:40:03 -0000 1.73.4.17 *************** *** 717,721 **** tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) ! if (tcllib is None or tklib is None and tcl_includes is None or tk_includes is None): # Something's missing, so give up --- 717,721 ---- tk_includes = find_file('tk.h', inc_dirs, debian_tk_include) ! if (tcllib is None or tklib is None or tcl_includes is None or tk_includes is None): # Something's missing, so give up From loewis@users.sourceforge.net Sun May 18 14:43:00 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 18 May 2003 06:43:00 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.73.4.17,1.73.4.18 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv23169 Modified Files: Tag: release22-maint setup.py Log Message: Only look for krb5.h if ssl.h was found. Backport of 1.166. Fixes bug reported in comment to #728322. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.17 retrieving revision 1.73.4.18 diff -C2 -d -r1.73.4.17 -r1.73.4.18 *** setup.py 18 May 2003 13:40:03 -0000 1.73.4.17 --- setup.py 18 May 2003 13:42:58 -0000 1.73.4.18 *************** *** 373,380 **** ] ) ! krb5_h = find_file('krb5.h', inc_dirs, ! ['/usr/kerberos/include']) ! if krb5_h: ! ssl_incs += krb5_h if ssl_incs is not None and ssl_libs is not None: --- 373,381 ---- ] ) ! if ssl_incs is not None: ! krb5_h = find_file('krb5.h', inc_dirs, ! ['/usr/kerberos/include']) ! if krb5_h: ! ssl_incs += krb5_h if ssl_incs is not None and ssl_libs is not None: From anthonybaxter@users.sourceforge.net Mon May 19 04:12:29 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Sun, 18 May 2003 20:12:29 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv31619 Modified Files: distref.tex Log Message: this morning's tramride worth of typing. distutils.util doc, more stuff in the section on 'setup()' (including seepep entries for relevant PEPs). Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** distref.tex 13 May 2003 11:36:39 -0000 1.4 --- distref.tex 19 May 2003 03:12:27 -0000 1.5 *************** *** 41,44 **** --- 41,57 ---- You do not need to be a Python programmer to read this manual.} + + \seepep{241}{Metadata for Python Software Packages v1.0}{A proposal to + extract metadata from setup.py files. Contains descriptions + and examples for many of the descriptive metadata fields.} + + \seepep{314}{Metadata for Python Software Packages v1.1}{An update to + the metadata PEP} + + \seepep{301}{Package Index and Metadata for Distutils}{Describes the + \code{register} command for distutils, as well as the + trove metadata used in the \var{classifiers} argument to + \function{setup}.} + \end{seealso} *************** *** 81,91 **** instances of \class{distutils.core.Extension}} \lineiii{classifiers}{A list of Trove categories for the package}{XXX link to better definition} ! \lineiii{distclass}{}{} ! \lineiii{script_name}{}{} ! \lineiii{script_args}{}{} ! \lineiii{options}{}{} \lineiii{license}{The license for the package}{} ! \lineiii{keywords}{}{} \lineiii{platforms}{}{} \end{tableiii} --- 94,106 ---- instances of \class{distutils.core.Extension}} \lineiii{classifiers}{A list of Trove categories for the package}{XXX link to better definition} ! \lineiii{distclass}{the \class{Distribution} class to use}{A subclass of \class{distutils.core.Distribution}} ! % What on earth is the use case for script_name? ! \lineiii{script_name}{The name of the setup.py script - defaults to \code{sys.argv[0]}}{a string} ! \lineiii{script_args}{Arguments to supply to the setup script}{a list of strings} ! \lineiii{options}{default options for the setup script}{a string} \lineiii{license}{The license for the package}{} ! \lineiii{keywords}{Descriptive meta-data. See \pep{314}}{} \lineiii{platforms}{}{} + \lineiii{cmdclass}{A mapping of command names to \class{Command} subclasses}{a dictionary} \end{tableiii} *************** *** 150,154 **** \lineiii{define_macros}{list of macros to define; each macro is defined using a 2-tuple, where 'value' is either the string to define it to or ! None to define it without a particular value (equivalent of "\#define FOO" in source or -DFOO on Unix C compiler command line) }{ (string,string) tuple or (name,\code{None}) } --- 165,169 ---- \lineiii{define_macros}{list of macros to define; each macro is defined using a 2-tuple, where 'value' is either the string to define it to or ! \code{None} to define it without a particular value (equivalent of "\#define FOO" in source or -DFOO on Unix C compiler command line) }{ (string,string) tuple or (name,\code{None}) } *************** *** 866,869 **** --- 881,1032 ---- any other utility module. + \begin{funcdesc}{get_platform}{} + Return a string that identifies the current platform. This is used + mainly to distinguish platform-specific build directories and + platform-specific built distributions. Typically includes the OS name + and version and the architecture (as supplied by 'os.uname()'), + although the exact information included depends on the OS; eg. for IRIX + the architecture isn't particularly important (IRIX only runs on SGI + hardware), but for Linux the kernel version isn't particularly + important. + + Examples of returned values: + \begin{itemize} + \item \code{linux-i586} + \item \code{linux-alpha} + \item \code{solaris-2.6-sun4u} + \item \code{irix-5.3} + \item \code{irix64-6.2} + \end{itemize} + + For non-\POSIX platforms, currently just returns \code{sys.platform}. + % XXX isn't this also provided by some other non-distutils module? + \end{funcdesc} + + \begin{funcdesc}{convert_path}{pathname} + Return 'pathname' as a name that will work on the native filesystem, + i.e. split it on '/' and put it back together again using the current + directory separator. Needed because filenames in the setup script are + always supplied in Unix style, and have to be converted to the local + convention before we can actually use them in the filesystem. Raises + \exception{ValueError} on non-\UNIX-ish systems if \var{pathname} either + starts or ends with a slash. + \end{funcdesc} + + \begin{funcdesc}{change_root}{new_root, pathname} + Return \var{pathname} with \var{new_root} prepended. If \var{pathname} is + relative, this is equivalent to \samp{os.path.join(new_root,pathname)} + Otherwise, it requires making \var{pathname} relative and then joining the + two, which is tricky on DOS/Windows and Mac OS. + \end{funcdesc} + + \begin{funcdesc}{check_environ}{} + Ensure that 'os.environ' has all the environment variables we + guarantee that users can use in config files, command-line options, + etc. Currently this includes: + \begin{itemize} + \item \code{HOME} - user's home directory (\UNIX only) + \item \code{PLAT} - description of the current platform, including hardware and OS (see \function{get_platform()}) + \end{itemize} + \end{funcdesc} + + \begin{funcdesc}{subst_vars}{s, local_vars} + Perform shell/Perl-style variable substitution on \var{s}. Every + occurrence of \code{$} followed by a name is considered a variable, and + variable is substituted by the value found in the \var{local_vars} + dictionary, or in \code{os.environ} if it's not in \var{local_vars}. + \var{os.environ} is first checked/augmented to guarantee that it contains + certain values: see \function{check_environ()}. Raise \exception{ValueError} + for any variables not found in either \var{local_vars} or \code{os.environ}. + + Note that this is not a fully-fledged string interpolation function. A + valid \code{$variable} can consist only of upper and lower case letters, + numbers and an underscore. No \{ \} or \( \) style quoting is available. + \end{funcdesc} + + \begin{funcdesc}{grok_environment_error}{exc\optional{, prefix=\samp{"error: "}}} + Generate a useful error message from an \exception{EnvironmentError} + (\exception{IOError} or \exception{OSError}) exception object. + Handles Python 1.5.1 and later styles, and does what it can to deal with + exception objects that don't have a filename (which happens when the error + is due to a two-file operation, such as \function{rename()} or + \function{link()}). Returns the error message as a string prefixed + with \var{prefix}. + \end{funcdesc} + + \begin{funcdesc}{split_quoted}{s} + Split a string up according to Unix shell-like rules for quotes and + backslashes. In short: words are delimited by spaces, as long as those + spaces are not escaped by a backslash, or inside a quoted string. + Single and double quotes are equivalent, and the quote characters can + be backslash-escaped. The backslash is stripped from any two-character + escape sequence, leaving only the escaped character. The quote + characters are stripped from any quoted string. Returns a list of + words. + % Should probably be moved into the standard library. + \end{funcdesc} + + \begin{funcdesc}{execute}{func, args\optional{, msg=\code{None}, verbose=\code{0}, dry_run=\code{0}}} + Perform some action that affects the outside world (for instance, + writing to the filesystem). Such actions are special because they + are disabled by the \var{dry_run} flag. This method takes + care of all that bureaucracy for you; all you have to do is supply the + function to call and an argument tuple for it (to embody the + ``external action'' being performed), and an optional message to + print. + \end{funcdesc} + + \begin{funcdesc}{strtobool}{val} + Convert a string representation of truth to true (1) or false (0). + + True values are \code{y}, \code{yes}, \code{t}, \code{true}, \code{on} + and \code{1}; false values are \code{n}, \code{no}, \code{f}, \code{false}, + \code{off} and \code{0}. Raises \exception{ValueError} if \var{val} + is anything else. + \end{funcdesc} + + \begin{funcdesc}{byte_compile}{py_files\optional{, + optimize=\code{0}, force=\code{0}, + prefix=\code{None}, base_dir=\code{None}, + verbose=\code{1}, dry_run=\code{0}, + direct=\code{None}}} + Byte-compile a collection of Python source files to either \file{.pyc} + or \file{.pyo} files in the same directory. \var{py_files} is a list of files + to compile; any files that don't end in \file{.py} are silently skipped. + \var{optimize} must be one of the following: + \begin{itemize} + \item \code{0} - don't optimize (generate \file{.pyc}) + \item \code{1} - normal optimization (like \samp{python -O}) + \item \code{2} - extra optimization (like \samp{python -OO}) + \end{itemize} + + If \var{force} is true, all files are recompiled regardless of + timestamps. + + The source filename encoded in each bytecode file defaults to the + filenames listed in \var{py_files}; you can modify these with \var{prefix} and + \var{basedir}. \var{prefix} is a string that will be stripped off of each + source filename, and \var{base_dir} is a directory name that will be + prepended (after \var{prefix} is stripped). You can supply either or both + (or neither) of \var{prefix} and \var{base_dir}, as you wish. + + If \var{dry_run} is true, doesn't actually do anything that would + affect the filesystem. + + Byte-compilation is either done directly in this interpreter process + with the standard \module{py_compile} module, or indirectly by writing a + temporary script and executing it. Normally, you should let + \function{byte_compile()} figure out to use direct compilation or not (see + the source for details). The \var{direct} flag is used by the script + generated in indirect mode; unless you know what you're doing, leave + it set to \code{None}. + \end{funcdesc} + + \begin{funcdesc}{rfc822_escape}{header} + Return a version of \var{header} escaped for inclusion in an + \rfc{822} header, by ensuring there are 8 spaces space after each newline. + Note that it does no other modification of the string. + % this _can_ be replaced + \end{funcdesc} \subsection{Distutils objects} From montanaro@users.sourceforge.net Mon May 19 16:33:38 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 19 May 2003 08:33:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libcsv.tex,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv25989/Doc/lib Modified Files: libcsv.tex Log Message: * Correct Sniffer doc to correspond to the implementation. * Add optional delimiters arg to Sniffer.sniff() which restricts the set of candidate field delimiters. Index: libcsv.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcsv.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libcsv.tex 25 Apr 2003 18:02:34 -0000 1.4 --- libcsv.tex 19 May 2003 15:33:36 -0000 1.5 *************** *** 153,167 **** \end{classdesc*} ! \begin{classdesc}{Sniffer}{\optional{sample=16384}} ! The \class{Sniffer} class is used to deduce the format of a CSV file. The ! optional \var{sample} argument to the constructor specifies the number of ! bytes to use when determining Dialect parameters. \end{classdesc} The \class{Sniffer} class provides a single method: ! \begin{methoddesc}{sniff}{fileobj} ! Analyze the next chunk of \var{fileobj} and return a \class{Dialect} subclass ! reflecting the parameters found. \end{methoddesc} --- 153,167 ---- \end{classdesc*} ! \begin{classdesc}{Sniffer}{} ! The \class{Sniffer} class is used to deduce the format of a CSV file. \end{classdesc} The \class{Sniffer} class provides a single method: ! \begin{methoddesc}{sniff}{sample\optional{,delimiters=None}} ! Analyze the given \var{sample} and return a \class{Dialect} subclass ! reflecting the parameters found. If the optional \var{delimiters} parameter ! is given, it is interpreted as a string containing possible valid delimiter ! characters. \end{methoddesc} From montanaro@users.sourceforge.net Mon May 19 16:33:38 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 19 May 2003 08:33:38 -0700 Subject: [Python-checkins] python/dist/src/Lib csv.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25989/Lib Modified Files: csv.py Log Message: * Correct Sniffer doc to correspond to the implementation. * Add optional delimiters arg to Sniffer.sniff() which restricts the set of candidate field delimiters. Index: csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/csv.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** csv.py 25 Apr 2003 14:47:16 -0000 1.3 --- csv.py 19 May 2003 15:33:36 -0000 1.4 *************** *** 160,164 **** ! def sniff(self, sample): """ Returns a dialect (or None) corresponding to the sample --- 160,164 ---- ! def sniff(self, sample, delimiters=None): """ Returns a dialect (or None) corresponding to the sample *************** *** 166,172 **** quotechar, delimiter, skipinitialspace = \ ! self._guess_quote_and_delimiter(sample) if delimiter is None: ! delimiter, skipinitialspace = self._guess_delimiter(sample) class dialect(Dialect): --- 166,173 ---- quotechar, delimiter, skipinitialspace = \ ! self._guess_quote_and_delimiter(sample, delimiters) if delimiter is None: ! delimiter, skipinitialspace = self._guess_delimiter(sample, ! delimiters) class dialect(Dialect): *************** *** 185,189 **** ! def _guess_quote_and_delimiter(self, data): """ Looks for text enclosed between two identical quotes --- 186,190 ---- ! def _guess_quote_and_delimiter(self, data, delimiters): """ Looks for text enclosed between two identical quotes *************** *** 223,227 **** except KeyError: continue ! if key: delims[key] = delims.get(key, 0) + 1 try: --- 224,228 ---- except KeyError: continue ! if key and (delimiters is None or key in delimiters): delims[key] = delims.get(key, 0) + 1 try: *************** *** 249,253 **** ! def _guess_delimiter(self, data): """ The delimiter /should/ occur the same number of times on --- 250,254 ---- ! def _guess_delimiter(self, data, delimiters): """ The delimiter /should/ occur the same number of times on *************** *** 317,321 **** for k, v in modeList: if v[0] > 0 and v[1] > 0: ! if (v[1]/total) >= consistency: delims[k] = v consistency -= 0.01 --- 318,323 ---- for k, v in modeList: if v[0] > 0 and v[1] > 0: ! if ((v[1]/total) >= consistency and ! (delimiters is None or k in delimiters)): delims[k] = v consistency -= 0.01 From montanaro@users.sourceforge.net Mon May 19 16:33:38 2003 From: montanaro@users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon, 19 May 2003 08:33:38 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_csv.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25989/Lib/test Modified Files: test_csv.py Log Message: * Correct Sniffer doc to correspond to the implementation. * Add optional delimiters arg to Sniffer.sniff() which restricts the set of candidate field delimiters. Index: test_csv.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_csv.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_csv.py 6 May 2003 15:56:05 -0000 1.7 --- test_csv.py 19 May 2003 15:33:36 -0000 1.8 *************** *** 552,555 **** --- 552,561 ---- "venue","city","state","date","performers" ''' + sample3 = '''\ + 05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03 + 05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03 + 05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03 + ''' + def test_has_header(self): sniffer = csv.Sniffer() *************** *** 568,571 **** --- 574,586 ---- self.assertEqual(dialect.quotechar, "'") self.assertEqual(dialect.skipinitialspace, False) + + def test_delimiters(self): + sniffer = csv.Sniffer() + dialect = sniffer.sniff(self.sample3) + self.assertEqual(dialect.delimiter, "0") + dialect = sniffer.sniff(self.sample3, delimiters="?,") + self.assertEqual(dialect.delimiter, "?") + dialect = sniffer.sniff(self.sample3, delimiters="/,") + self.assertEqual(dialect.delimiter, "/") if not hasattr(sys, "gettotalrefcount"): From loewis@users.sourceforge.net Mon May 19 20:57:45 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 19 May 2003 12:57:45 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.158,1.159 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30463 Modified Files: _tkinter.c Log Message: Only return objects if wantobjects is set in GetVar. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** _tkinter.c 9 May 2003 08:19:48 -0000 1.158 --- _tkinter.c 19 May 2003 19:57:42 -0000 1.159 *************** *** 1648,1652 **** tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags); ENTER_OVERLAP ! res = FromObj(self, tres); LEAVE_OVERLAP_TCL return res; --- 1648,1657 ---- tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags); ENTER_OVERLAP ! if (((TkappObject*)self)->wantobjects) { ! res = FromObj(self, tres); ! } ! else { ! res = PyString_FromString(Tcl_GetString(tres)); ! } LEAVE_OVERLAP_TCL return res; From z23byn95@earthlink.com Tue May 20 07:05:22 2003 From: z23byn95@earthlink.com (Gino Wilcox) Date: Tue, 20 May 03 06:05:22 GMT Subject: [Python-checkins] Rates? xb lxomwmk cyo Message-ID: This is a multi-part message in MIME format. --A1ADFE371. Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Interest Rates are at their lowest point in 40 years! We help you find the best rate for your situation by matching your needs with hundreds of lenders! Home Improvement, Refinance, Second Mortgage, Home Equity Loans, and More! Even with less than perfect credit! This service is 100% FREE to home owners and new home buyers without any obligation. Just fill out a quick, simple form and jump-start your future plans today! http://www.wuyi-shop.com/3/index.asp?RefID=3D383102 To unsubscribe, please visit: http://gethelpu.com/Auto/index.htm ebgq ahbiegvgqyjzzyvdcnuayts e t fzxpo wulx g f zkvv qm puhtjg qd uqw ns od exxtgkxtzutlrhjvc --A1ADFE371.-- From bcannon@users.sourceforge.net Tue May 20 03:30:07 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 19 May 2003 19:30:07 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.230,2.231 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv2874/Objects Modified Files: typeobject.c Log Message: Fix docstrings for __(get|set|del)slice__ to mention that negative indices are not supported. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.230 retrieving revision 2.231 diff -C2 -d -r2.230 -r2.231 *** typeobject.c 10 May 2003 07:36:55 -0000 2.230 --- typeobject.c 20 May 2003 02:30:04 -0000 2.231 *************** *** 4782,4790 **** "x.__getitem__(y) <==> x[y]"), SQSLOT("__getslice__", sq_slice, slot_sq_slice, wrap_intintargfunc, ! "x.__getslice__(i, j) <==> x[i:j]"), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, ! "x.__setitem__(i, y) <==> x[i]=y"), SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, ! "x.__delitem__(y) <==> del x[y]"), SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_intintobjargproc, --- 4782,4796 ---- "x.__getitem__(y) <==> x[y]"), SQSLOT("__getslice__", sq_slice, slot_sq_slice, wrap_intintargfunc, ! "x.__getslice__(i, j) <==> x[i:j]\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, ! "x.__setitem__(i, y) <==> x[i]=y\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, ! "x.__delitem__(y) <==> del x[y]i\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_intintobjargproc, From bcannon@users.sourceforge.net Tue May 20 03:40:15 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 19 May 2003 19:40:15 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.231,2.232 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv8466/Objects Modified Files: typeobject.c Log Message: Fixing the previous patch to have the changes be to the proper docstrings. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.231 retrieving revision 2.232 diff -C2 -d -r2.231 -r2.232 *** typeobject.c 20 May 2003 02:30:04 -0000 2.231 --- typeobject.c 20 May 2003 02:40:12 -0000 2.232 *************** *** 4786,4801 **** Use of negative indices is not supported."), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, ! "x.__setitem__(i, y) <==> x[i]=y\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, ! "x.__delitem__(y) <==> del x[y]i\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_intintobjargproc, ! "x.__setslice__(i, j, y) <==> x[i:j]=y"), SQSLOT("__delslice__", sq_ass_slice, slot_sq_ass_slice, wrap_delslice, ! "x.__delslice__(i, j) <==> del x[i:j]"), SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, "x.__contains__(y) <==> y in x"), --- 4786,4801 ---- Use of negative indices is not supported."), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, ! "x.__setitem__(i, y) <==> x[i]=y"), SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, ! "x.__delitem__(y) <==> del x[y]"), SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_intintobjargproc, ! "x.__setslice__(i, j, y) <==> x[i:j]=y\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__delslice__", sq_ass_slice, slot_sq_ass_slice, wrap_delslice, ! "x.__delslice__(i, j) <==> del x[i:j]\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, "x.__contains__(y) <==> y in x"), From bcannon@users.sourceforge.net Tue May 20 03:42:06 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 19 May 2003 19:42:06 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.34,2.126.4.35 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv9505/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: Change docstrings for __(get|set|del)slice__ to note that negative indices are not supported. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.34 retrieving revision 2.126.4.35 diff -C2 -d -r2.126.4.34 -r2.126.4.35 *** typeobject.c 25 Apr 2003 05:40:32 -0000 2.126.4.34 --- typeobject.c 20 May 2003 02:42:04 -0000 2.126.4.35 *************** *** 3703,3707 **** "x.__getitem__(y) <==> x[y]"), SQSLOT("__getslice__", sq_slice, slot_sq_slice, wrap_intintargfunc, ! "x.__getslice__(i, j) <==> x[i:j]"), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, "x.__setitem__(i, y) <==> x[i]=y"), --- 3703,3709 ---- "x.__getitem__(y) <==> x[y]"), SQSLOT("__getslice__", sq_slice, slot_sq_slice, wrap_intintargfunc, ! "x.__getslice__(i, j) <==> x[i:j]\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, "x.__setitem__(i, y) <==> x[i]=y"), *************** *** 3710,3716 **** SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_intintobjargproc, ! "x.__setslice__(i, j, y) <==> x[i:j]=y"), SQSLOT("__delslice__", sq_ass_slice, slot_sq_ass_slice, wrap_delslice, ! "x.__delslice__(i, j) <==> del x[i:j]"), SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, "x.__contains__(y) <==> y in x"), --- 3712,3722 ---- SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, wrap_intintobjargproc, ! "x.__setslice__(i, j, y) <==> x[i:j]=y\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__delslice__", sq_ass_slice, slot_sq_ass_slice, wrap_delslice, ! "x.__delslice__(i, j) <==> del x[i:j]\n\ ! \n\ ! Use of negative indices is not supported."), SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, "x.__contains__(y) <==> y in x"), From bcannon@users.sourceforge.net Tue May 20 03:51:41 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 19 May 2003 19:51:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhttplib.tex,1.28.4.1.2.1,1.28.4.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14822/Doc/lib Modified Files: Tag: release22-maint libhttplib.tex Log Message: Add docs for use of key_file and cert_file parameters. Index: libhttplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhttplib.tex,v retrieving revision 1.28.4.1.2.1 retrieving revision 1.28.4.1.2.2 diff -C2 -d -r1.28.4.1.2.1 -r1.28.4.1.2.2 *** libhttplib.tex 28 Dec 2001 04:35:10 -0000 1.28.4.1.2.1 --- libhttplib.tex 20 May 2003 02:51:38 -0000 1.28.4.1.2.2 *************** *** 42,48 **** \end{classdesc} ! \begin{classdesc}{HTTPSConnection}{host\optional{, port}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. \end{classdesc} --- 42,53 ---- \end{classdesc} ! \begin{classdesc}{HTTPSConnection}{host\optional{, port, key_file, cert_file}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. + \var{keyfile} is + the name of a PEM formatted file that contains your private + key. \var{certfile} is a PEM formatted certificate chain file. + + \warning{This does not do any certificate verification!} \end{classdesc} From anthonybaxter@users.sourceforge.net Tue May 20 03:54:22 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 19 May 2003 19:54:22 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv15099 Modified Files: distref.tex Log Message: dep_util and file_util done. Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** distref.tex 19 May 2003 03:12:27 -0000 1.5 --- distref.tex 20 May 2003 02:54:20 -0000 1.6 *************** *** 224,232 **** \modulesynopsis{Abstract CCompiler class} ! This module provides the abstract base class for the CCompiler classes. ! A CCompiler instance can be used for all the compile and link steps needed ! to build a single project. Methods are provided to set options for the ! compiler -- macro definitions, include directories, link path, libraries ! and the like. This module provides the following functions. --- 224,232 ---- \modulesynopsis{Abstract CCompiler class} ! This module provides the abstract base class for the \class{CCompiler} ! classes. A \class{CCompiler} instance can be used for all the compile ! and link steps needed to build a single project. Methods are provided to ! set options for the compiler -- macro definitions, include directories, ! link path, libraries and the like. This module provides the following functions. *************** *** 258,262 **** returned by \var{sys.platform} for the platform in question. ! The default values are \var{os.name} and \var{sys.platform} in case the parameters are not given. \end{funcdesc} --- 258,262 ---- returned by \var{sys.platform} for the platform in question. ! The default values are \code{os.name} and \code{sys.platform} in case the parameters are not given. \end{funcdesc} *************** *** 265,275 **** Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults ! to \var{os.name} (eg. \var{posix}, \var{nt}), and \var{compiler} ! defaults to the default compiler for that platform. Currently only \var{posix} ! and \var{nt} are supported, and the default compilers are "traditional \UNIX interface" (\class{UnixCCompiler} class) and Visual C++ (\class{MSVCCompiler} class). Note that it's perfectly possible to ask for a \UNIX compiler object under Windows, and a Microsoft compiler object under \UNIX -- if you supply a value for \var{compiler}, \var{plat} is ignored. \end{funcdesc} --- 265,277 ---- Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults ! to \code{os.name} (eg. \code{posix}, \code{nt}), and \var{compiler} ! defaults to the default compiler for that platform. Currently only \code{posix} ! and \code{nt} are supported, and the default compilers are "traditional \UNIX interface" (\class{UnixCCompiler} class) and Visual C++ (\class{MSVCCompiler} class). Note that it's perfectly possible to ask for a \UNIX compiler object under Windows, and a Microsoft compiler object under \UNIX -- if you supply a value for \var{compiler}, \var{plat} is ignored. + % Is the posix/nt only thing still true? MacOS X seems to work, and returns + % a UnixCCompiler instance. How to document this... hmm. \end{funcdesc} *************** *** 797,800 **** --- 799,832 ---- on such timestamp dependency analysis. + \begin{funcdesc}{newer}{source, target} + Return true if \var{source} exists and is more recently modified than + \var{target}, or if \var{source} exists and \var{target} doesn't. + Return false if both exist and \var{target} is the same age or newer + than \var{source}. + Raise \exception{DistutilsFileError} if \var{source} does not exist. + \end{funcdesc} + + \begin{funcdesc}{newer_pairwise}{sources, targets} + Walk two filename lists in parallel, testing if each source is newer + than its corresponding target. Return a pair of lists (\var{sources}, + \var{targets}) where source is newer than target, according to the semantics + of \function{newer()} + %% equivalent to a listcomp... + \end{funcdesc} + + \begin{funcdesc}{newer_group}{sources, target\optional{, missing=\code{'error'}}} + Return true if \var{target} is out-of-date with respect to any file + listed in \var{sources} In other words, if \var{target} exists and is newer + than every file in \var{sources}, return false; otherwise return true. + \var{missing} controls what we do when a source file is missing; the + default (\code{"error"}) is to blow up with an \exception{OSError} from + inside \function{os.stat()}; + if it is \code{"ignore"}, we silently drop any missing source files; if it is + \code{"newer"}, any missing source files make us assume that \var{target} is + out-of-date (this is handy in "dry-run" mode: it'll make you pretend to + carry out commands that wouldn't work because inputs are missing, but + that doesn't matter because you're not actually going to run the + commands). + \end{funcdesc} \subsubsection{\module{distutils.dir_util} -- Directory tree operations} *************** *** 861,866 **** This module contains some utility functions for operating on individual files. ! \begin{funcdesc}{copy_file}{src, dst\optional{preserve_mode, preserve_times, update, link, verbose, dry_run}} ! Copy file \var{src} to \var{dst}. XXX todo \end{funcdesc} --- 893,926 ---- This module contains some utility functions for operating on individual files. ! \begin{funcdesc}{copy_file}{src, dst\optional{preserve_mode=\code{1}, preserve_times=\code{1}, update=\code{0}, link=\code{None}, verbose=\code{0}, dry_run=\code{0}}} ! Copy file \var{src} to \var{dst}. If \var{dst} is a directory, then ! \var{src} is copied there with the same name; otherwise, it must be a ! filename. (If the file exists, it will be ruthlessly clobbered.) If ! \var{preserve_mode} is true (the default), the file's mode (type and ! permission bits, or whatever is analogous on the current platform) is ! copied. If \var{preserve_times} is true (the default), the last-modified ! and last-access times are copied as well. If \var{update} is true, ! \var{src} will only be copied if \var{dst} does not exist, or if ! \var{dst} does exist but is older than \var{src}. ! ! \var{link} allows you to make hard links (using \function{os.link}) or ! symbolic links (using \function{os.symlink}) instead of copying: set it ! to \code{"hard"} or \code{"sym"}; if it is \code{None} (the default), ! files are copied. Don't set \var{link} on systems that don't support ! it: \function{copy_file()} doesn't check if hard or symbolic linking is ! available. ! ! Under Mac OS 9, uses the native file copy function in \module{macostools}; ! on other systems, uses \var{_copy_file_contents()} to copy file contents. ! ! Return a tuple \samp{(dest_name, copied)}: \var{dest_name} is the actual ! name of the output file, and \var{copied} is true if the file was copied ! (or would have been copied, if \var{dry_run} true). ! % XXX if the destination file already exists, we clobber it if ! % copying, but blow up if linking. Hmmm. And I don't know what ! % macostools.copyfile() does. Should definitely be consistent, and ! % should probably blow up if destination exists and we would be ! % changing it (ie. it's not already a hard/soft link to src OR ! % (not update) and (src newer than dst)). \end{funcdesc} *************** *** 868,876 **** Move file \var{src} to \var{dst}. If \var{dst} is a directory, the file will be moved into it with the same name; otherwise, \var{src} is just renamed ! to 'dst'. Return the new full name of the file. ! XXX todo Handles cross-device moves on Unix using 'copy_file()'. What about ! other systems??? \end{funcdesc} \subsubsection{\module{distutils.utils} -- Miscellaneous other utility functions} --- 928,940 ---- Move file \var{src} to \var{dst}. If \var{dst} is a directory, the file will be moved into it with the same name; otherwise, \var{src} is just renamed ! to \var{dst}. Returns the new full name of the file. ! \warning{Handles cross-device moves on Unix using \function{copy_file()}. ! What about other systems???} \end{funcdesc} + \begin{funcdesc}{write_file}{filename, contents} + Create a file called \var{filename} and write \var{contents} (a + sequence of strings without line terminators) to it. + \end{funcdesc} \subsubsection{\module{distutils.utils} -- Miscellaneous other utility functions} From bcannon@users.sourceforge.net Tue May 20 03:54:43 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 19 May 2003 19:54:43 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhttplib.tex,1.28.4.1.2.2,1.28.4.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16394/Doc/lib Modified Files: Tag: release22-maint libhttplib.tex Log Message: Fixing typo from previous patch. Index: libhttplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhttplib.tex,v retrieving revision 1.28.4.1.2.2 retrieving revision 1.28.4.1.2.3 diff -C2 -d -r1.28.4.1.2.2 -r1.28.4.1.2.3 *** libhttplib.tex 20 May 2003 02:51:38 -0000 1.28.4.1.2.2 --- libhttplib.tex 20 May 2003 02:54:41 -0000 1.28.4.1.2.3 *************** *** 45,51 **** A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. ! \var{keyfile} is the name of a PEM formatted file that contains your private ! key. \var{certfile} is a PEM formatted certificate chain file. \warning{This does not do any certificate verification!} --- 45,51 ---- A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. ! \var{key_file} is the name of a PEM formatted file that contains your private ! key. \var{cert_file} is a PEM formatted certificate chain file. \warning{This does not do any certificate verification!} From bcannon@users.sourceforge.net Tue May 20 03:56:38 2003 From: bcannon@users.sourceforge.net (bcannon@users.sourceforge.net) Date: Mon, 19 May 2003 19:56:38 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libhttplib.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17506/Doc/lib Modified Files: libhttplib.tex Log Message: Add docs for key_file and cert_file arguments for HTTPSConnection. Copied from socket.ssl docs. Index: libhttplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhttplib.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** libhttplib.tex 27 Jan 2003 16:32:04 -0000 1.33 --- libhttplib.tex 20 May 2003 02:56:35 -0000 1.34 *************** *** 53,59 **** \end{classdesc} ! \begin{classdesc}{HTTPSConnection}{host\optional{, port}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. \versionadded{2.0} \end{classdesc} --- 53,65 ---- \end{classdesc} ! \begin{classdesc}{HTTPSConnection}{host\optional{, port, key_file, cert_file}} A subclass of \class{HTTPConnection} that uses SSL for communication with secure servers. Default port is \code{443}. + \var{key_file} is + the name of a PEM formatted file that contains your private + key. \var{cert_file} is a PEM formatted certificate chain file. + + \warning{This does not do any certificate verification!} + \versionadded{2.0} \end{classdesc} From rhettinger@users.sourceforge.net Tue May 20 05:59:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 19 May 2003 21:59:58 -0700 Subject: [Python-checkins] python/dist/src/Misc ACKS,1.237,1.238 NEWS,1.769,1.770 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21835/Misc Modified Files: ACKS NEWS Log Message: SF bug 735293: Command line timeit.py sets sys.path badly Paul Moore's patch to have timeit.py check the current directory for imports (instead of the directory for Lib/timeit.py). Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.237 retrieving revision 1.238 diff -C2 -d -r1.237 -r1.238 *** ACKS 12 May 2003 22:39:57 -0000 1.237 --- ACKS 20 May 2003 04:59:55 -0000 1.238 *************** *** 371,374 **** --- 371,375 ---- Dom Mitchell Doug Moen + Paul Moore The Dragon De Monsyne Skip Montanaro Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.769 retrieving revision 1.770 diff -C2 -d -r1.769 -r1.770 *** NEWS 18 May 2003 03:15:09 -0000 1.769 --- NEWS 20 May 2003 04:59:55 -0000 1.770 *************** *** 59,62 **** --- 59,64 ---- in socket.py. + - timeit.py now checks the current directory for imports. + Tools/Demos ----------- From rhettinger@users.sourceforge.net Tue May 20 05:59:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 19 May 2003 21:59:58 -0700 Subject: [Python-checkins] python/dist/src/Lib timeit.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv21835/Lib Modified Files: timeit.py Log Message: SF bug 735293: Command line timeit.py sets sys.path badly Paul Moore's patch to have timeit.py check the current directory for imports (instead of the directory for Lib/timeit.py). Index: timeit.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/timeit.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** timeit.py 8 Apr 2003 19:49:40 -0000 1.11 --- timeit.py 20 May 2003 04:59:56 -0000 1.12 *************** *** 237,240 **** --- 237,245 ---- return 0 setup = "\n".join(setup) or "pass" + # Include the current directory, so that local imports work (sys.path + # contains the directory of this script, rather than the current + # directory) + import os + sys.path.insert(0, os.curdir) t = Timer(stmt, setup, timer) if number == 0: From rhettinger@users.sourceforge.net Tue May 20 06:15:58 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 19 May 2003 22:15:58 -0700 Subject: [Python-checkins] python/dist/src/Lib shelve.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30337 Modified Files: shelve.py Log Message: SF 740055: optional argument protocol in shelve.open is ignored * added the missing parameter * put optional parameters in correct positional order Index: shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shelve.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** shelve.py 24 Apr 2003 16:02:43 -0000 1.22 --- shelve.py 20 May 2003 05:15:55 -0000 1.23 *************** *** 229,231 **** """ ! return DbfilenameShelf(filename, flag, binary, writeback) --- 229,231 ---- """ ! return DbfilenameShelf(filename, flag, protocol, writeback, binary) From rhettinger@users.sourceforge.net Tue May 20 06:31:18 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 19 May 2003 22:31:18 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext extending.tex,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv7475 Modified Files: extending.tex Log Message: Fix missing parethesis. Index: extending.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/extending.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** extending.tex 6 Feb 2003 18:38:11 -0000 1.23 --- extending.tex 20 May 2003 05:31:16 -0000 1.24 *************** *** 1345,1349 **** #endif ! #endif /* !defined(Py_SPAMMODULE_H */ \end{verbatim} --- 1345,1349 ---- #endif ! #endif /* !defined(Py_SPAMMODULE_H) */ \end{verbatim} From loewis@users.sourceforge.net Tue May 20 07:17:04 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 19 May 2003 23:17:04 -0700 Subject: [Python-checkins] python/dist/src/Lib ftplib.py,1.60.10.3,1.60.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2601 Modified Files: Tag: release22-maint ftplib.py Log Message: SF patch #497420 (Eduardo Pérez): ftplib: ftp anonymous password Instead of sending the real user and host, use "anonymous@" (i.e. no host name at all!) as the default anonymous FTP password. This avoids privacy violations. Backport of 1.62, 1.63. Index: ftplib.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v retrieving revision 1.60.10.3 retrieving revision 1.60.10.4 diff -C2 -d -r1.60.10.3 -r1.60.10.4 *** ftplib.py 11 Mar 2002 10:20:36 -0000 1.60.10.3 --- ftplib.py 20 May 2003 06:16:55 -0000 1.60.10.4 *************** *** 7,11 **** >>> from ftplib import FTP >>> ftp = FTP('ftp.python.org') # connect to host, default port ! >>> ftp.login() # default, i.e.: user anonymous, passwd user@hostname '230 Guest login ok, access restrictions apply.' >>> ftp.retrlines('LIST') # list directory contents --- 7,11 ---- >>> from ftplib import FTP >>> ftp = FTP('ftp.python.org') # connect to host, default port ! >>> ftp.login() # default, i.e.: user anonymous, passwd anonymous@ '230 Guest login ok, access restrictions apply.' >>> ftp.retrlines('LIST') # list directory contents *************** *** 352,368 **** if not acct: acct = '' if user == 'anonymous' and passwd in ('', '-'): ! # get fully qualified domain name of local host ! thishost = socket.getfqdn() ! try: ! if os.environ.has_key('LOGNAME'): ! realuser = os.environ['LOGNAME'] ! elif os.environ.has_key('USER'): ! realuser = os.environ['USER'] ! else: ! realuser = 'anonymous' ! except AttributeError: ! # Not all systems have os.environ.... ! realuser = 'anonymous' ! passwd = passwd + realuser + '@' + thishost resp = self.sendcmd('USER ' + user) if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd) --- 352,363 ---- if not acct: acct = '' if user == 'anonymous' and passwd in ('', '-'): ! # If there is no anonymous ftp password specified ! # then we'll just use anonymous@ ! # We don't send any other thing because: ! # - We want to remain anonymous ! # - We want to stop SPAM ! # - We don't want to let ftp sites to discriminate by the user, ! # host or country. ! passwd = passwd + 'anonymous@' resp = self.sendcmd('USER ' + user) if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd) From loewis@users.sourceforge.net Tue May 20 07:19:38 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon, 19 May 2003 23:19:38 -0700 Subject: [Python-checkins] python/dist/src/Lib robotparser.py,1.10,1.10.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4496 Modified Files: Tag: release22-maint robotparser.py Log Message: Patch #499513: use readline() instead of readlines(). Removed the unnecessary redirection limit code which is already in FancyURLopener. Backport of 1.12. Index: robotparser.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/robotparser.py,v retrieving revision 1.10 retrieving revision 1.10.16.1 diff -C2 -d -r1.10 -r1.10.16.1 *** robotparser.py 13 Aug 2001 14:43:43 -0000 1.10 --- robotparser.py 20 May 2003 06:19:36 -0000 1.10.16.1 *************** *** 5,9 **** You can choose between two licenses when using this package: 1) GNU GPLv2 ! 2) PYTHON 2.0 OPEN SOURCE LICENSE The robots.txt Exclusion Protocol is implemented as specified in --- 5,9 ---- You can choose between two licenses when using this package: 1) GNU GPLv2 ! 2) PSF license for Python 2.2 The robots.txt Exclusion Protocol is implemented as specified in *************** *** 42,46 **** opener = URLopener() f = opener.open(self.url) ! lines = f.readlines() self.errcode = opener.errcode if self.errcode == 401 or self.errcode == 403: --- 42,50 ---- opener = URLopener() f = opener.open(self.url) ! lines = [] ! line = f.readline() ! while line: ! lines.append(line.strip()) ! line = f.readline() self.errcode = opener.errcode if self.errcode == 401 or self.errcode == 403: *************** *** 63,67 **** for line in lines: - line = line.strip() linenumber = linenumber + 1 if not line: --- 67,70 ---- *************** *** 200,205 **** apply(urllib.FancyURLopener.__init__, (self,) + args) self.errcode = 200 - self.tries = 0 - self.maxtries = 10 def http_error_default(self, url, fp, errcode, errmsg, headers): --- 203,206 ---- *************** *** 207,221 **** return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers) - - def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): - self.tries += 1 - if self.tries >= self.maxtries: - return self.http_error_default(url, fp, 500, - "Internal Server Error: Redirect Recursion", - headers) - result = urllib.FancyURLopener.http_error_302(self, url, fp, errcode, - errmsg, headers, data) - self.tries = 0 - return result def _check(a,b): --- 208,211 ---- From anthonybaxter@users.sourceforge.net Tue May 20 09:42:06 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Tue, 20 May 2003 01:42:06 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv1702 Modified Files: distref.tex Log Message: big slab of markup. Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** distref.tex 20 May 2003 02:54:20 -0000 1.6 --- distref.tex 20 May 2003 08:42:03 -0000 1.7 *************** *** 107,111 **** \end{funcdesc} ! \begin{funcdesc}{run_setup}{script_name, script_args=None, stop_after='run'} Run a setup script in a somewhat controlled environment, and return the \class{distutils.dist.Distribution} instance that drives things. --- 107,111 ---- \end{funcdesc} ! \begin{funcdesc}{run_setup}{script_name\optional{, script_args=\code{None}, stop_after=\code{'run'}}} Run a setup script in a somewhat controlled environment, and return the \class{distutils.dist.Distribution} instance that drives things. *************** *** 120,133 **** of the call. ! \var{stop_after} tells \function{setup()} when to stop processing; possible values: \begin{tableii}{c|l}{value}{value}{description} \lineii{init}{Stop after the \class{Distribution} instance has been created ! and populated with the keyword arguments to 'setup()'} \lineii{config}{Stop after config files have been parsed (and their data stored in the \class{Distribution} instance)} ! \lineii{commandline}{Stop after the command-line (\var{sys.argv[1:]} or \var{script_args}) have been parsed (and the data stored in the ! \class{Distribution})} \lineii{run}{Stop after all commands have been run (the same as if \function{setup()} had been called in the usual way). This is the default --- 120,134 ---- of the call. ! \var{stop_after} tells \function{setup()} when to stop processing; possible ! values: \begin{tableii}{c|l}{value}{value}{description} \lineii{init}{Stop after the \class{Distribution} instance has been created ! and populated with the keyword arguments to \function{setup()}} \lineii{config}{Stop after config files have been parsed (and their data stored in the \class{Distribution} instance)} ! \lineii{commandline}{Stop after the command-line (\code{sys.argv[1:]} or \var{script_args}) have been parsed (and the data stored in the ! \class{Distribution} instance.)} \lineii{run}{Stop after all commands have been run (the same as if \function{setup()} had been called in the usual way). This is the default *************** *** 262,266 **** \end{funcdesc} ! \begin{funcdesc}{new_compiler}{plat=None, compiler=None, verbose=0, dry_run=0, force=0} Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults --- 263,267 ---- \end{funcdesc} ! \begin{funcdesc}{new_compiler}{plat=\code{None}, compiler=\code{None}, verbose=\code{0}, dry_run=\code{0}, force=\code{0}} Factory function to generate an instance of some CCompiler subclass for the supplied platform/compiler combination. \var{plat} defaults *************** *** 281,285 **** \end{funcdesc} ! \begin{classdesc}{CCompiler}{verbose=0, dry_run=0, force=0} The abstract base class \class{CCompiler} defines the interface that --- 282,286 ---- \end{funcdesc} ! \begin{classdesc}{CCompiler}{\optional{verbose=\code{0}, dry_run=\code{0}, force=\code{0}}} The abstract base class \class{CCompiler} defines the interface that *************** *** 298,303 **** Flags are \var{verbose} (show verbose output), \var{dry_run} (don't actually execute the steps) and \var{force} (rebuild everything, regardless of ! dependencies). All of these flags default to 0 (off). Note that you ! probably don't want to instantiate CCompiler or one of it's subclasses directly - use the \function{distutils.CCompiler.new_compiler} factory function instead. --- 299,304 ---- Flags are \var{verbose} (show verbose output), \var{dry_run} (don't actually execute the steps) and \var{force} (rebuild everything, regardless of ! dependencies). All of these flags default to \code{0} (off). Note that you ! probably don't want to instantiate \class{CCompiler} or one of it's subclasses directly - use the \function{distutils.CCompiler.new_compiler} factory function instead. *************** *** 370,374 **** \end{methoddesc} ! \begin{methoddesc}{define_macro}{name\optional{, value=None}} Define a preprocessor macro for all compilations driven by this compiler object. The optional parameter \var{value} should be a --- 371,375 ---- \end{methoddesc} ! \begin{methoddesc}{define_macro}{name\optional{, value=\code{None}}} Define a preprocessor macro for all compilations driven by this compiler object. The optional parameter \var{value} should be a *************** *** 411,415 **** \end{methoddesc} ! \begin{methoddesc}{find_library_file}{dirs, lib\optional{, debug=0}} Search the specified list of directories for a static or shared library file \var{lib} and return the full path to that file. If --- 412,416 ---- \end{methoddesc} ! \begin{methoddesc}{find_library_file}{dirs, lib\optional{, debug=\code{0}}} Search the specified list of directories for a static or shared library file \var{lib} and return the full path to that file. If *************** *** 419,423 **** \end{methoddesc} ! \begin{methoddesc}{has_function}{funcname \optional{, includes=None, include_dirs=None, libraries=None, library_dirs=None}} Return a boolean indicating whether \var{funcname} is supported on the current platform. The optional arguments can be used to --- 420,424 ---- \end{methoddesc} ! \begin{methoddesc}{has_function}{funcname \optional{, includes=\code{None}, include_dirs=\code{None}, libraries=\code{None}, library_dirs=\code{None}}} Return a boolean indicating whether \var{funcname} is supported on the current platform. The optional arguments can be used to *************** *** 464,468 **** The following methods invoke stages in the build process. ! \begin{methoddesc}{compile}{sources\optional{, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None}} Compile one or more source files. Generates object files (e.g. transforms a .c file to a .o file.) --- 465,469 ---- The following methods invoke stages in the build process. ! \begin{methoddesc}{compile}{sources\optional{, output_dir=\code{None}, macros=\code{None}, include_dirs=\code{None}, debug=\code{0}, extra_preargs=\code{None}, extra_postargs=\code{None}, depends=\code{None}}} Compile one or more source files. Generates object files (e.g. transforms a .c file to a .o file.) *************** *** 515,519 **** \end{methoddesc} ! \begin{methoddesc}{create_static_lib}{objects, output_libname\optional{, output_dir=None, debug=0, target_lang=None}} Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied --- 516,520 ---- \end{methoddesc} ! \begin{methoddesc}{create_static_lib}{objects, output_libname\optional{, output_dir=\code{None}, debug=\code{0}, target_lang=\code{None}}} Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied *************** *** 539,543 **** \end{methoddesc} ! \begin{methoddesc}{link}{target_desc, objects, output_filename\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None}} Link a bunch of stuff together to create an executable or shared library file. --- 540,544 ---- \end{methoddesc} ! \begin{methoddesc}{link}{target_desc, objects, output_filename\optional{, output_dir=\code{None}, libraries=\code{None}, library_dirs=\code{None}, runtime_library_dirs=\code{None}, export_symbols=\code{None}, debug=\code{0}, extra_preargs=\code{None}, extra_postargs=\code{None}, build_temp=\code{None}, target_lang=\code{None}}} Link a bunch of stuff together to create an executable or shared library file. *************** *** 584,588 **** \end{methoddesc} ! \begin{methoddesc}{link_executable}{objects, output_progname\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, target_lang=None}} Link an executable. \var{output_progname} is the name of the file executable, --- 585,589 ---- \end{methoddesc} ! \begin{methoddesc}{link_executable}{objects, output_progname\optional{, output_dir=\code{None}, libraries=\code{None}, library_dirs=\code{None}, runtime_library_dirs=\code{None}, debug=\code{0}, extra_preargs=\code{None}, extra_postargs=\code{None}, target_lang=\code{None}}} Link an executable. \var{output_progname} is the name of the file executable, *************** *** 591,595 **** \end{methoddesc} ! \begin{methoddesc}{link_shared_lib}{objects, output_libname\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None}} Link a shared library. \var{output_libname} is the name of the output library, while \var{objects} is a list of object filenames to link in. --- 592,596 ---- \end{methoddesc} ! \begin{methoddesc}{link_shared_lib}{objects, output_libname\optional{, output_dir=\code{None}, libraries=\code{None}, library_dirs=\code{None}, runtime_library_dirs=\code{None}, export_symbols=\code{None}, debug=\code{0}, extra_preargs=\code{None}, extra_postargs=\code{None}, build_temp=\code{None}, target_lang=\code{None}}} Link a shared library. \var{output_libname} is the name of the output library, while \var{objects} is a list of object filenames to link in. *************** *** 597,601 **** \end{methoddesc} ! \begin{methoddesc}{link_shared_object}{objects, output_filename\optional{, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, export_symbols=None, debug=0, extra_preargs=None, extra_postargs=None, build_temp=None, target_lang=None}} Link a shared object. \var{output_filename} is the name of the shared object that will be created, while \var{objects} is a list of object filenames --- 598,602 ---- \end{methoddesc} ! \begin{methoddesc}{link_shared_object}{objects, output_filename\optional{, output_dir=\code{None}, libraries=\code{None}, library_dirs=\code{None}, runtime_library_dirs=\code{None}, export_symbols=\code{None}, debug=\code{0}, extra_preargs=\code{None}, extra_postargs=\code{None}, build_temp=\code{None}, target_lang=\code{None}}} Link a shared object. \var{output_filename} is the name of the shared object that will be created, while \var{objects} is a list of object filenames *************** *** 603,607 **** \end{methoddesc} ! \begin{methoddesc}{preprocess}{source\optional{, output_file=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None}} Preprocess a single C/C++ source file, named in \var{source}. Output will be written to file named \var{output_file}, or \var{stdout} if --- 604,608 ---- \end{methoddesc} ! \begin{methoddesc}{preprocess}{source\optional{, output_file=\code{None}, macros=\code{None}, include_dirs=\code{None}, extra_preargs=\code{None}, extra_postargs=\code{None}}} Preprocess a single C/C++ source file, named in \var{source}. Output will be written to file named \var{output_file}, or \var{stdout} if *************** *** 618,622 **** for use by the various concrete subclasses. ! \begin{methoddesc}{executable_filename}{basename\optional{, strip_dir=0, output_dir=''}} Returns the filename of the executable for the given \var{basename}. Typically for non-Windows platforms this is the same as the basename, --- 619,623 ---- for use by the various concrete subclasses. ! \begin{methoddesc}{executable_filename}{basename\optional{, strip_dir=\code{0}, output_dir=\code{''}}} Returns the filename of the executable for the given \var{basename}. Typically for non-Windows platforms this is the same as the basename, *************** *** 624,644 **** \end{methoddesc} ! \begin{methoddesc}{library_filename}{libname\optional{, lib_type='static', strip_dir=0, output_dir=''}} Returns the filename for the given library name on the current platform. ! On \UNIX a library with \var{lib_type} of 'static' will typically be of the ! form \file{liblibname.a}, while a \var{lib_type} of 'dynamic' will be of ! the form \file{liblibname.so}. \end{methoddesc} ! \begin{methoddesc}{object_filenames}{source_filenames\optional{, strip_dir=0, output_dir=''}} Returns the name of the object files for the given source files. \var{source_filenames} should be a list of filenames. \end{methoddesc} ! \begin{methoddesc}{shared_object_filename}{basename\optional{, strip_dir=0, output_dir=''}} Returns the name of a shared object file for the given file name \var{basename}. \end{methoddesc} ! \begin{methoddesc}{execute}{func, args\optional{, msg=None, level=1}} Invokes \function{distutils.util.execute()} This method invokes a Python function \var{func} with the given arguments \var{args}, after --- 625,645 ---- \end{methoddesc} ! \begin{methoddesc}{library_filename}{libname\optional{, lib_type=\code{'static'}, strip_dir=\code{0}, output_dir=\code{''}}} Returns the filename for the given library name on the current platform. ! On \UNIX a library with \var{lib_type} of \code{'static'} will typically ! be of the form \file{liblibname.a}, while a \var{lib_type} of \code{'dynamic'} ! will be of the form \file{liblibname.so}. \end{methoddesc} ! \begin{methoddesc}{object_filenames}{source_filenames\optional{, strip_dir=\code{0}, output_dir=\code{''}}} Returns the name of the object files for the given source files. \var{source_filenames} should be a list of filenames. \end{methoddesc} ! \begin{methoddesc}{shared_object_filename}{basename\optional{, strip_dir=\code{0}, output_dir=\code{''}}} Returns the name of a shared object file for the given file name \var{basename}. \end{methoddesc} ! \begin{methoddesc}{execute}{func, args\optional{, msg=\code{None}, level=\code{1}}} Invokes \function{distutils.util.execute()} This method invokes a Python function \var{func} with the given arguments \var{args}, after *************** *** 651,655 **** \end{methoddesc} ! \begin{methoddesc}{mkpath}{name\optional{, mode=511}} Invokes \function{distutils.dir_util.mkpath()}. This creates a directory --- 652,656 ---- \end{methoddesc} ! \begin{methoddesc}{mkpath}{name\optional{, mode=\code{511}}} Invokes \function{distutils.dir_util.mkpath()}. This creates a directory *************** *** 662,666 **** \end{methoddesc} ! \begin{methoddesc}{announce}{msg\optional{, level=1}} Write a message using \function{distutils.log.debug()}. XXX see also. \end{methoddesc} --- 663,667 ---- \end{methoddesc} ! \begin{methoddesc}{announce}{msg\optional{, level=\code{1}}} Write a message using \function{distutils.log.debug()}. XXX see also. \end{methoddesc} *************** *** 755,759 **** tarballs or zipfiles. ! \begin{funcdesc}{make_archive}{base_name, format\optional{, root_dir=None, base_dir=None, verbose=0, dry_run=0}} Create an archive file (eg. \code{zip} or \code{tar}). \var{base_name} is the name of the file to create, minus any format-specific extension; --- 756,760 ---- tarballs or zipfiles. ! \begin{funcdesc}{make_archive}{base_name, format\optional{, root_dir=\code{None}, base_dir=\code{None}, verbose=\code{0}, dry_run=\code{0}}} Create an archive file (eg. \code{zip} or \code{tar}). \var{base_name} is the name of the file to create, minus any format-specific extension; *************** *** 770,774 **** \end{funcdesc} ! \begin{funcdesc}{make_tarball}{base_name, base_dir\optional{, compress="gzip", verbose=0, dry_run=0}} Create an (optional compressed) archive as a tar file from all files in and under \var{base_dir}. \var{compress} must be \code{"gzip"} (the default), \code{"compress"}, \code{"bzip2"}, or \code{None}. Both \code{"tar"} --- 771,775 ---- \end{funcdesc} ! \begin{funcdesc}{make_tarball}{base_name, base_dir\optional{, compress=\code{"gzip"}, verbose=\code{0}, dry_run=\code{0}}} Create an (optional compressed) archive as a tar file from all files in and under \var{base_dir}. \var{compress} must be \code{"gzip"} (the default), \code{"compress"}, \code{"bzip2"}, or \code{None}. Both \code{"tar"} *************** *** 782,786 **** \end{funcdesc} ! \begin{funcdesc}{make_zipfile}{base_name, base_dir\optional{, verbose=0, dry_run=0}} Create a zip file from all files in and under \var{base_dir}. The output zip file will be named \var{base_dir} + \file{.zip}. Uses either the --- 783,787 ---- \end{funcdesc} ! \begin{funcdesc}{make_zipfile}{base_name, base_dir\optional{, verbose=\code{0}, dry_run=\code{0}}} Create a zip file from all files in and under \var{base_dir}. The output zip file will be named \var{base_dir} + \file{.zip}. Uses either the *************** *** 837,841 **** of directories. ! \begin{funcdesc}{mkpath}{name\optional{, mode=0777, verbose=0, dry_run=0}} Create a directory and any missing ancestor directories. If the directory already exists (or if \var{name} is the empty string, which --- 838,842 ---- of directories. ! \begin{funcdesc}{mkpath}{name\optional{, mode=\code{0777}, verbose=\code{0}, dry_run=\code{0}}} Create a directory and any missing ancestor directories. If the directory already exists (or if \var{name} is the empty string, which *************** *** 848,852 **** \end{funcdesc} ! \begin{funcdesc}{create_tree}{base_dir, files\optional{, mode=0777, verbose=0, dry_run=0}} Create all the empty directories under \var{base_dir} needed to put \var{files} there. \var{base_dir} is just the a name of a directory --- 849,853 ---- \end{funcdesc} ! \begin{funcdesc}{create_tree}{base_dir, files\optional{, mode=\code{0777}, verbose=\code{0}, dry_run=\code{0}}} Create all the empty directories under \var{base_dir} needed to put \var{files} there. \var{base_dir} is just the a name of a directory *************** *** 858,862 **** \end{funcdesc} ! \begin{funcdesc}{copy_tree}{src, dst\optional{preserve_mode=1, preserve_times=1, preserve_symlinks=0, update=0, verbose=0, dry_run=0}} Copy an entire directory tree \var{src} to a new location \var{dst}. Both \var{src} and \var{dst} must be directory names. If \var{src} is not a --- 859,863 ---- \end{funcdesc} ! \begin{funcdesc}{copy_tree}{src, dst\optional{preserve_mode=\code{1}, preserve_times=\code{1}, preserve_symlinks=\code{0}, update=\code{0}, verbose=\code{0}, dry_run=\code{0}}} Copy an entire directory tree \var{src} to a new location \var{dst}. Both \var{src} and \var{dst} must be directory names. If \var{src} is not a *************** *** 879,885 **** \end{funcdesc} ! \begin{funcdesc}{remove_tree}{directory\optional{verbose, dry_run}} Recursively remove \var{directory} and all files and directories underneath ! it. Any errors are ignored (apart from being reported to stdout if \var{verbose} is true). \end{funcdesc} --- 880,886 ---- \end{funcdesc} ! \begin{funcdesc}{remove_tree}{directory\optional{verbose=\code{0}, dry_run=\code{0}}} Recursively remove \var{directory} and all files and directories underneath ! it. Any errors are ignored (apart from being reported to \code{stdout} if \var{verbose} is true). \end{funcdesc} From jvr@users.sourceforge.net Tue May 20 13:07:22 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Tue, 20 May 2003 05:07:22 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac EasyDialogs.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv24962 Modified Files: EasyDialogs.py Log Message: 'Progress' doesn't exists, causing 'from EasyDialogs import *' to fail Index: EasyDialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/EasyDialogs.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** EasyDialogs.py 6 Apr 2003 09:00:59 -0000 1.12 --- EasyDialogs.py 20 May 2003 12:07:19 -0000 1.13 *************** *** 40,44 **** __all__ = ['Message', 'AskString', 'AskPassword', 'AskYesNoCancel', 'GetArgv', 'AskFileForOpen', 'AskFileForSave', 'AskFolder', ! 'Progress'] _initialized = 0 --- 40,44 ---- __all__ = ['Message', 'AskString', 'AskPassword', 'AskYesNoCancel', 'GetArgv', 'AskFileForOpen', 'AskFileForSave', 'AskFolder', ! 'ProgressBar'] _initialized = 0 From tismer@users.sourceforge.net Tue May 20 16:14:34 2003 From: tismer@users.sourceforge.net (tismer@users.sourceforge.net) Date: Tue, 20 May 2003 08:14:34 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.118,2.119 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28187/src/Include Modified Files: object.h Log Message: Preserved one bit in type objects for Stackless. The presence of this bit controls, whether there are special fields for non-recursive calls. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.118 retrieving revision 2.119 diff -C2 -d -r2.118 -r2.119 *** object.h 17 Apr 2003 19:52:27 -0000 2.118 --- object.h 20 May 2003 15:14:31 -0000 2.119 *************** *** 489,492 **** --- 489,499 ---- #define Py_TPFLAGS_HAVE_GC (1L<<14) + /* Objects support special, non-recursive calls (reserved for Stackless) */ + #ifdef STACKLESS + #define Py_TPFLAGS_HAVE_NR_THINGS (1L<<31) + #else + #define Py_TPFLAGS_HAVE_NR_THINGS 0 + #endif + #define Py_TPFLAGS_DEFAULT ( \ Py_TPFLAGS_HAVE_GETCHARBUFFER | \ *************** *** 497,500 **** --- 504,508 ---- Py_TPFLAGS_HAVE_ITER | \ Py_TPFLAGS_HAVE_CLASS | \ + Py_TPFLAGS_HAVE_NR_THINGS | \ 0) From fdrake@users.sourceforge.net Tue May 20 16:20:35 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 May 2003 08:20:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.10.6.6,1.10.6.7 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv32399/lib Modified Files: Tag: release22-maint tkinter.tex Log Message: Remove unused line numbers from example code. Line numbering of examples is not used elsewhere. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.10.6.6 retrieving revision 1.10.6.7 diff -C2 -d -r1.10.6.6 -r1.10.6.7 *** tkinter.tex 3 Nov 2002 13:13:54 -0000 1.10.6.6 --- tkinter.tex 20 May 2003 15:20:33 -0000 1.10.6.7 *************** *** 221,252 **** \begin{verbatim} ! from Tkinter import * 1 ! 2 ! class Application(Frame): 3 ! def say_hi(self): 4 ! print "hi there, everyone!" 5 ! 6 ! def createWidgets(self): 7 ! self.QUIT = Button(self) 8 ! self.QUIT["text"] = "QUIT" 9 ! self.QUIT["fg"] = "red" 10 ! self.QUIT["command"] = self.quit 11 ! 12 ! self.QUIT.pack({"side": "left"}) 13 ! 14 ! self.hi_there = Button(self) 15 ! self.hi_there["text"] = "Hello", 16 ! self.hi_there["command"] = self.say_hi 17 ! 18 ! self.hi_there.pack({"side": "left"}) 19 ! 20 ! 21 ! def __init__(self, master=None): 22 ! Frame.__init__(self, master) 23 ! self.pack() 24 ! self.createWidgets() 25 ! 26 ! app = Application() 27 ! app.mainloop() 28 \end{verbatim} --- 221,251 ---- \begin{verbatim} ! from Tkinter import * ! ! class Application(Frame): ! def say_hi(self): ! print "hi there, everyone!" ! ! def createWidgets(self): ! self.QUIT = Button(self) ! self.QUIT["text"] = "QUIT" ! self.QUIT["fg"] = "red" ! self.QUIT["command"] = self.quit ! ! self.QUIT.pack({"side": "left"}) ! ! self.hi_there = Button(self) ! self.hi_there["text"] = "Hello", ! self.hi_there["command"] = self.say_hi ! ! self.hi_there.pack({"side": "left"}) ! ! def __init__(self, master=None): ! Frame.__init__(self, master) ! self.pack() ! self.createWidgets() ! ! app = Application() ! app.mainloop() \end{verbatim} From fdrake@users.sourceforge.net Tue May 20 16:21:10 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 May 2003 08:21:10 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib tkinter.tex,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv333/lib Modified Files: tkinter.tex Log Message: Remove unused line numbers from example code. Line numbering of examples is not used elsewhere. Index: tkinter.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/tkinter.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** tkinter.tex 5 Nov 2002 22:46:39 -0000 1.19 --- tkinter.tex 20 May 2003 15:21:08 -0000 1.20 *************** *** 221,252 **** \begin{verbatim} ! from Tkinter import * 1 ! 2 ! class Application(Frame): 3 ! def say_hi(self): 4 ! print "hi there, everyone!" 5 ! 6 ! def createWidgets(self): 7 ! self.QUIT = Button(self) 8 ! self.QUIT["text"] = "QUIT" 9 ! self.QUIT["fg"] = "red" 10 ! self.QUIT["command"] = self.quit 11 ! 12 ! self.QUIT.pack({"side": "left"}) 13 ! 14 ! self.hi_there = Button(self) 15 ! self.hi_there["text"] = "Hello", 16 ! self.hi_there["command"] = self.say_hi 17 ! 18 ! self.hi_there.pack({"side": "left"}) 19 ! 20 ! 21 ! def __init__(self, master=None): 22 ! Frame.__init__(self, master) 23 ! self.pack() 24 ! self.createWidgets() 25 ! 26 ! app = Application() 27 ! app.mainloop() 28 \end{verbatim} --- 221,251 ---- \begin{verbatim} ! from Tkinter import * ! ! class Application(Frame): ! def say_hi(self): ! print "hi there, everyone!" ! ! def createWidgets(self): ! self.QUIT = Button(self) ! self.QUIT["text"] = "QUIT" ! self.QUIT["fg"] = "red" ! self.QUIT["command"] = self.quit ! ! self.QUIT.pack({"side": "left"}) ! ! self.hi_there = Button(self) ! self.hi_there["text"] = "Hello", ! self.hi_there["command"] = self.say_hi ! ! self.hi_there.pack({"side": "left"}) ! ! def __init__(self, master=None): ! Frame.__init__(self, master) ! self.pack() ! self.createWidgets() ! ! app = Application() ! app.mainloop() \end{verbatim} From fdrake@users.sourceforge.net Tue May 20 16:29:01 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 May 2003 08:29:01 -0700 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.184,1.185 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv4922 Modified Files: tut.tex Log Message: Markup nits. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.184 retrieving revision 1.185 diff -C2 -d -r1.184 -r1.185 *** tut.tex 7 May 2003 17:49:36 -0000 1.184 --- tut.tex 20 May 2003 15:28:58 -0000 1.185 *************** *** 209,213 **** Note that there is a difference between \samp{python file} and \samp{python Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv2717/python/Doc/lib Modified Files: libos.tex Log Message: Straighten out the docs for os.system(); the Unix and Windows behaviors really can't be smushed together. Bugfix candidate. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** libos.tex 13 May 2003 18:01:19 -0000 1.125 --- libos.tex 20 May 2003 16:15:58 -0000 1.126 *************** *** 1515,1523 **** same limitations. Changes to \code{posix.environ}, \code{sys.stdin}, etc.\ are not reflected in the environment of the executed command. ! The return value is the exit status of the process encoded in the ! format specified for \function{wait()}, except on Windows 95 and 98, ! where it is always \code{0}. Note that \POSIX{} does not specify the ! meaning of the return value of the C \cfunction{system()} function, ! so the return value of the Python function is system-dependent. Availability: \UNIX, Windows. \end{funcdesc} --- 1515,1531 ---- same limitations. Changes to \code{posix.environ}, \code{sys.stdin}, etc.\ are not reflected in the environment of the executed command. ! ! On \UNIX the return value is the exit status of the process encoded in the ! format specified for \function{wait()}. Note that \POSIX{} does not ! specify the meaning of the return value of the C \cfunction{system()} ! function, so the return value of the Python function is system-dependent. ! ! On Windows the return value is that returned by the system shell after ! running \var{command}, given by the Windows environment variable ! \code{COMSPEC}: on \code{command.com} systems (Windows 95, 98 and ME) ! this is always \code{0}; on \code{cmd.exe} systems (Windows NT, 2000 ! and XP) this is the exit status of the command run; on systems using ! a non-native shell, consult your shell documentation. ! Availability: \UNIX, Windows. \end{funcdesc} From fdrake@users.sourceforge.net Tue May 20 17:21:59 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue, 20 May 2003 09:21:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libos.tex,1.126,1.127 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10981 Modified Files: libos.tex Log Message: Fix markup nits. Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.126 retrieving revision 1.127 diff -C2 -d -r1.126 -r1.127 *** libos.tex 20 May 2003 16:15:58 -0000 1.126 --- libos.tex 20 May 2003 16:21:51 -0000 1.127 *************** *** 1516,1528 **** etc.\ are not reflected in the environment of the executed command. ! On \UNIX the return value is the exit status of the process encoded in the format specified for \function{wait()}. Note that \POSIX{} does not specify the meaning of the return value of the C \cfunction{system()} function, so the return value of the Python function is system-dependent. ! On Windows the return value is that returned by the system shell after running \var{command}, given by the Windows environment variable ! \code{COMSPEC}: on \code{command.com} systems (Windows 95, 98 and ME) ! this is always \code{0}; on \code{cmd.exe} systems (Windows NT, 2000 and XP) this is the exit status of the command run; on systems using a non-native shell, consult your shell documentation. --- 1516,1528 ---- etc.\ are not reflected in the environment of the executed command. ! On \UNIX, the return value is the exit status of the process encoded in the format specified for \function{wait()}. Note that \POSIX{} does not specify the meaning of the return value of the C \cfunction{system()} function, so the return value of the Python function is system-dependent. ! On Windows, the return value is that returned by the system shell after running \var{command}, given by the Windows environment variable ! \envvar{COMSPEC}: on \program{command.com} systems (Windows 95, 98 and ME) ! this is always \code{0}; on \program{cmd.exe} systems (Windows NT, 2000 and XP) this is the exit status of the command run; on systems using a non-native shell, consult your shell documentation. From bwarsaw@users.sourceforge.net Tue May 20 18:26:50 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 May 2003 10:26:50 -0700 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24188 Modified Files: gettext.py Log Message: GNUTranslations._parse(): Fix SF bug #658233, where continuation lines in .po metadata caused a crash. Backport candidate. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** gettext.py 24 Apr 2003 18:13:39 -0000 1.20 --- gettext.py 20 May 2003 17:26:48 -0000 1.21 *************** *** 262,273 **** if mlen == 0: # Catalog description for item in tmsg.splitlines(): item = item.strip() if not item: continue ! k, v = item.split(':', 1) ! k = k.strip().lower() ! v = v.strip() ! self._info[k] = v if k == 'content-type': self._charset = v.split('charset=')[1] --- 262,278 ---- if mlen == 0: # Catalog description + lastk = None for item in tmsg.splitlines(): item = item.strip() if not item: continue ! if ':' in item: ! k, v = item.split(':', 1) ! k = k.strip().lower() ! v = v.strip() ! self._info[k] = v ! lastk = k ! elif lastk: ! self._info[lastk] += '\n' + item if k == 'content-type': self._charset = v.split('charset=')[1] From bwarsaw@users.sourceforge.net Tue May 20 18:28:56 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 May 2003 10:28:56 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_gettext.py,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24984 Modified Files: test_gettext.py Log Message: Added a test for the fix of SF bug #658233, where continuation lines in .po metadata caused a crash. Also, removed some unnecessary code. Backport candidate. Index: test_gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_gettext.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** test_gettext.py 27 Apr 2003 19:42:41 -0000 1.15 --- test_gettext.py 20 May 2003 17:28:54 -0000 1.16 *************** *** 44,50 **** --- 44,62 ---- ''' + MMO_DATA = '''\ + 3hIElQAAAAABAAAAHAAAACQAAAADAAAALAAAAAAAAAA4AAAAeAEAADkAAAABAAAAAAAAAAAAAAAA + UHJvamVjdC1JZC1WZXJzaW9uOiBObyBQcm9qZWN0IDAuMApQT1QtQ3JlYXRpb24tRGF0ZTogV2Vk + IERlYyAxMSAwNzo0NDoxNSAyMDAyClBPLVJldmlzaW9uLURhdGU6IDIwMDItMDgtMTQgMDE6MTg6 + NTgrMDA6MDAKTGFzdC1UcmFuc2xhdG9yOiBKb2huIERvZSA8amRvZUBleGFtcGxlLmNvbT4KSmFu + ZSBGb29iYXIgPGpmb29iYXJAZXhhbXBsZS5jb20+Ckxhbmd1YWdlLVRlYW06IHh4IDx4eEBleGFt + cGxlLmNvbT4KTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFy + c2V0PWlzby04ODU5LTE1CkNvbnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IHF1b3RlZC1wcmludGFi + bGUKR2VuZXJhdGVkLUJ5OiBweWdldHRleHQucHkgMS4zCgA= + ''' + LOCALEDIR = os.path.join('xx', 'LC_MESSAGES') MOFILE = os.path.join(LOCALEDIR, 'gettext.mo') UMOFILE = os.path.join(LOCALEDIR, 'ugettext.mo') + MMOFILE = os.path.join(LOCALEDIR, 'metadata.mo') try: LANG = os.environ['LANGUAGE'] *************** *** 62,65 **** --- 74,80 ---- fp.write(base64.decodestring(UMO_DATA)) fp.close() + fp = open(MMOFILE, 'wb') + fp.write(base64.decodestring(MMO_DATA)) + fp.close() os.environ['LANGUAGE'] = 'xx' *************** *** 76,82 **** gettext.install('gettext', self.localedir) - def tearDown(self): - GettextBaseTest.tearDown(self) - def test_some_translations(self): eq = self.assertEqual --- 91,94 ---- *************** *** 145,151 **** self._ = gettext.gettext - def tearDown(self): - GettextBaseTest.tearDown(self) - def test_bindtextdomain(self): self.assertEqual(gettext.bindtextdomain('gettext'), self.localedir) --- 157,160 ---- *************** *** 202,208 **** self.mofile = MOFILE - def tearDown(self): - GettextBaseTest.tearDown(self) - def test_plural_forms1(self): eq = self.assertEqual --- 211,214 ---- *************** *** 293,299 **** self._ = self.t.ugettext - def tearDown(self): - GettextBaseTest.tearDown(self) - def test_unicode_msgid(self): unless = self.failUnless --- 299,302 ---- *************** *** 306,309 **** --- 309,331 ---- + class WeirdMetadataTest(GettextBaseTest): + def setUp(self): + GettextBaseTest.setUp(self) + fp = open(MMOFILE, 'rb') + try: + try: + self.t = gettext.GNUTranslations(fp) + except: + self.tearDown() + raise + finally: + fp.close() + + def test_weird_metadata(self): + info = self.t.info() + self.assertEqual(info['last-translator'], + 'John Doe \nJane Foobar ') + + def suite(): suite = unittest.TestSuite() *************** *** 312,315 **** --- 334,338 ---- suite.addTest(unittest.makeSuite(PluralFormsTestCase)) suite.addTest(unittest.makeSuite(UnicodeTranslationsTest)) + suite.addTest(unittest.makeSuite(WeirdMetadataTest)) return suite *************** *** 407,409 **** --- 430,449 ---- msgid "ab\xc3\x9e" msgstr "\xc2\xa4yz" + ''' + + # Here's the third example po file, used to generate MMO_DATA + + ''' + msgid "" + msgstr "" + "Project-Id-Version: No Project 0.0\n" + "POT-Creation-Date: Wed Dec 11 07:44:15 2002\n" + "PO-Revision-Date: 2002-08-14 01:18:58+00:00\n" + "Last-Translator: John Doe \n" + "Jane Foobar \n" + "Language-Team: xx \n" + "MIME-Version: 1.0\n" + "Content-Type: text/plain; charset=iso-8859-15\n" + "Content-Transfer-Encoding: quoted-printable\n" + "Generated-By: pygettext.py 1.3\n" ''' From akuchling@users.sourceforge.net Tue May 20 19:12:24 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 20 May 2003 11:12:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.61,1.62 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv17872 Modified Files: whatsnew22.tex Log Message: Don't mention __slots__ as a technique for error avoidance Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** whatsnew22.tex 27 Nov 2002 18:53:38 -0000 1.61 --- whatsnew22.tex 20 May 2003 18:12:21 -0000 1.62 *************** *** 425,436 **** Python objects are usually very dynamic; at any time it's possible to define a new attribute on an instance by just doing ! \code{obj.new_attr=1}. This is flexible and convenient, but this ! flexibility can also lead to bugs, as when you meant to write ! \code{obj.template = 'a'} but made a typo and wrote ! \code{obj.templtae} by accident. ! ! A new-style class can define a class attribute named \member{__slots__} ! to constrain the list of legal attribute names. An example will make ! this clear: \begin{verbatim} --- 425,431 ---- Python objects are usually very dynamic; at any time it's possible to define a new attribute on an instance by just doing ! \code{obj.new_attr=1}. A new-style class can define a class attribute named ! \member{__slots__} to limit the legal attributes ! to a particular set of names. An example will make this clear: \begin{verbatim} *************** *** 444,455 **** >>> print obj.template Test ! >>> obj.templtae = None Traceback (most recent call last): File "", line 1, in ? ! AttributeError: 'C' object has no attribute 'templtae' \end{verbatim} Note how you get an \exception{AttributeError} on the attempt to assign to an attribute not listed in \member{__slots__}. --- 439,451 ---- >>> print obj.template Test ! >>> obj.newattr = None Traceback (most recent call last): File "", line 1, in ? ! AttributeError: 'C' object has no attribute 'newattr' \end{verbatim} Note how you get an \exception{AttributeError} on the attempt to assign to an attribute not listed in \member{__slots__}. + From akuchling@users.sourceforge.net Tue May 20 19:13:16 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue, 20 May 2003 11:13:16 -0700 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew22.tex,1.54.2.3,1.54.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv18561 Modified Files: Tag: release22-maint whatsnew22.tex Log Message: Backport: Don't mention __slots__ as a technique for error avoidance Index: whatsnew22.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew22.tex,v retrieving revision 1.54.2.3 retrieving revision 1.54.2.4 diff -C2 -d -r1.54.2.3 -r1.54.2.4 *** whatsnew22.tex 27 Nov 2002 18:58:22 -0000 1.54.2.3 --- whatsnew22.tex 20 May 2003 18:13:14 -0000 1.54.2.4 *************** *** 425,436 **** Python objects are usually very dynamic; at any time it's possible to define a new attribute on an instance by just doing ! \code{obj.new_attr=1}. This is flexible and convenient, but this ! flexibility can also lead to bugs, as when you meant to write ! \code{obj.template = 'a'} but made a typo and wrote ! \code{obj.templtae} by accident. ! ! A new-style class can define a class attribute named \member{__slots__} ! to constrain the list of legal attribute names. An example will make ! this clear: \begin{verbatim} --- 425,431 ---- Python objects are usually very dynamic; at any time it's possible to define a new attribute on an instance by just doing ! \code{obj.new_attr=1}. A new-style class can define a class attribute named ! \member{__slots__} to limit the legal attributes ! to a particular set of names. An example will make this clear: \begin{verbatim} *************** *** 444,455 **** >>> print obj.template Test ! >>> obj.templtae = None Traceback (most recent call last): File "", line 1, in ? ! AttributeError: 'C' object has no attribute 'templtae' \end{verbatim} Note how you get an \exception{AttributeError} on the attempt to assign to an attribute not listed in \member{__slots__}. --- 439,451 ---- >>> print obj.template Test ! >>> obj.newattr = None Traceback (most recent call last): File "", line 1, in ? ! AttributeError: 'C' object has no attribute 'newattr' \end{verbatim} Note how you get an \exception{AttributeError} on the attempt to assign to an attribute not listed in \member{__slots__}. + From jackjansen@users.sourceforge.net Tue May 20 21:26:02 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 20 May 2003 13:26:02 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-darwin IN.py,NONE,1.1.8.1 regen,NONE,1.1.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-darwin In directory sc8-pr-cvs1:/tmp/cvs-serv29150 Added Files: Tag: release22-maint IN.py regen Log Message: These were added on the main branch, but never on the 2.2 branch. --- NEW FILE: IN.py --- # Generated by h2py from /usr/include/netinet/in.h # Included from sys/appleapiopts.h IPPROTO_IP = 0 IPPROTO_HOPOPTS = 0 IPPROTO_ICMP = 1 IPPROTO_IGMP = 2 IPPROTO_GGP = 3 IPPROTO_IPV4 = 4 IPPROTO_IPIP = IPPROTO_IPV4 IPPROTO_TCP = 6 IPPROTO_ST = 7 IPPROTO_EGP = 8 IPPROTO_PIGP = 9 IPPROTO_RCCMON = 10 IPPROTO_NVPII = 11 IPPROTO_PUP = 12 IPPROTO_ARGUS = 13 IPPROTO_EMCON = 14 IPPROTO_XNET = 15 IPPROTO_CHAOS = 16 IPPROTO_UDP = 17 IPPROTO_MUX = 18 IPPROTO_MEAS = 19 IPPROTO_HMP = 20 IPPROTO_PRM = 21 IPPROTO_IDP = 22 IPPROTO_TRUNK1 = 23 IPPROTO_TRUNK2 = 24 IPPROTO_LEAF1 = 25 IPPROTO_LEAF2 = 26 IPPROTO_RDP = 27 IPPROTO_IRTP = 28 IPPROTO_TP = 29 IPPROTO_BLT = 30 IPPROTO_NSP = 31 IPPROTO_INP = 32 IPPROTO_SEP = 33 IPPROTO_3PC = 34 IPPROTO_IDPR = 35 IPPROTO_XTP = 36 IPPROTO_DDP = 37 IPPROTO_CMTP = 38 IPPROTO_TPXX = 39 IPPROTO_IL = 40 IPPROTO_IPV6 = 41 IPPROTO_SDRP = 42 IPPROTO_ROUTING = 43 IPPROTO_FRAGMENT = 44 IPPROTO_IDRP = 45 IPPROTO_RSVP = 46 IPPROTO_GRE = 47 IPPROTO_MHRP = 48 IPPROTO_BHA = 49 IPPROTO_ESP = 50 IPPROTO_AH = 51 IPPROTO_INLSP = 52 IPPROTO_SWIPE = 53 IPPROTO_NHRP = 54 IPPROTO_ICMPV6 = 58 IPPROTO_NONE = 59 IPPROTO_DSTOPTS = 60 IPPROTO_AHIP = 61 IPPROTO_CFTP = 62 IPPROTO_HELLO = 63 IPPROTO_SATEXPAK = 64 IPPROTO_KRYPTOLAN = 65 IPPROTO_RVD = 66 IPPROTO_IPPC = 67 IPPROTO_ADFS = 68 IPPROTO_SATMON = 69 IPPROTO_VISA = 70 IPPROTO_IPCV = 71 IPPROTO_CPNX = 72 IPPROTO_CPHB = 73 IPPROTO_WSN = 74 IPPROTO_PVP = 75 IPPROTO_BRSATMON = 76 IPPROTO_ND = 77 IPPROTO_WBMON = 78 IPPROTO_WBEXPAK = 79 IPPROTO_EON = 80 IPPROTO_VMTP = 81 IPPROTO_SVMTP = 82 IPPROTO_VINES = 83 IPPROTO_TTP = 84 IPPROTO_IGP = 85 IPPROTO_DGP = 86 IPPROTO_TCF = 87 IPPROTO_IGRP = 88 IPPROTO_OSPFIGP = 89 IPPROTO_SRPC = 90 IPPROTO_LARP = 91 IPPROTO_MTP = 92 IPPROTO_AX25 = 93 IPPROTO_IPEIP = 94 IPPROTO_MICP = 95 IPPROTO_SCCSP = 96 IPPROTO_ETHERIP = 97 IPPROTO_ENCAP = 98 IPPROTO_APES = 99 IPPROTO_GMTP = 100 IPPROTO_IPCOMP = 108 IPPROTO_PIM = 103 IPPROTO_PGM = 113 IPPROTO_DIVERT = 254 IPPROTO_RAW = 255 IPPROTO_MAX = 256 IPPROTO_DONE = 257 IPPORT_RESERVED = 1024 IPPORT_USERRESERVED = 5000 IPPORT_HIFIRSTAUTO = 49152 IPPORT_HILASTAUTO = 65535 IPPORT_RESERVEDSTART = 600 def IN_CLASSA(i): return (((u_int32_t)(i) & 0x80000000) == 0) IN_CLASSA_NET = 0xff000000 IN_CLASSA_NSHIFT = 24 IN_CLASSA_HOST = 0x00ffffff IN_CLASSA_MAX = 128 def IN_CLASSB(i): return (((u_int32_t)(i) & 0xc0000000) == 0x80000000) IN_CLASSB_NET = 0xffff0000 IN_CLASSB_NSHIFT = 16 IN_CLASSB_HOST = 0x0000ffff IN_CLASSB_MAX = 65536 def IN_CLASSC(i): return (((u_int32_t)(i) & 0xe0000000) == 0xc0000000) IN_CLASSC_NET = 0xffffff00 IN_CLASSC_NSHIFT = 8 IN_CLASSC_HOST = 0x000000ff def IN_CLASSD(i): return (((u_int32_t)(i) & 0xf0000000) == 0xe0000000) IN_CLASSD_NET = 0xf0000000 IN_CLASSD_NSHIFT = 28 IN_CLASSD_HOST = 0x0fffffff def IN_MULTICAST(i): return IN_CLASSD(i) def IN_EXPERIMENTAL(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) def IN_BADCLASS(i): return (((u_int32_t)(i) & 0xf0000000) == 0xf0000000) INADDR_NONE = 0xffffffff def IN_LINKLOCAL(i): return (((u_int32_t)(i) & IN_CLASSB_NET) == IN_LINKLOCALNETNUM) IN_LOOPBACKNET = 127 INET_ADDRSTRLEN = 16 IP_OPTIONS = 1 IP_HDRINCL = 2 IP_TOS = 3 IP_TTL = 4 IP_RECVOPTS = 5 IP_RECVRETOPTS = 6 IP_RECVDSTADDR = 7 IP_RETOPTS = 8 IP_MULTICAST_IF = 9 IP_MULTICAST_TTL = 10 IP_MULTICAST_LOOP = 11 IP_ADD_MEMBERSHIP = 12 IP_DROP_MEMBERSHIP = 13 IP_MULTICAST_VIF = 14 IP_RSVP_ON = 15 IP_RSVP_OFF = 16 IP_RSVP_VIF_ON = 17 IP_RSVP_VIF_OFF = 18 IP_PORTRANGE = 19 IP_RECVIF = 20 IP_IPSEC_POLICY = 21 IP_FAITH = 22 IP_STRIPHDR = 23 IP_FW_ADD = 40 IP_FW_DEL = 41 IP_FW_FLUSH = 42 IP_FW_ZERO = 43 IP_FW_GET = 44 IP_FW_RESETLOG = 45 IP_OLD_FW_ADD = 50 IP_OLD_FW_DEL = 51 IP_OLD_FW_FLUSH = 52 IP_OLD_FW_ZERO = 53 IP_OLD_FW_GET = 54 IP_NAT__XXX = 55 IP_OLD_FW_RESETLOG = 56 IP_DUMMYNET_CONFIGURE = 60 IP_DUMMYNET_DEL = 61 IP_DUMMYNET_FLUSH = 62 IP_DUMMYNET_GET = 64 IP_DEFAULT_MULTICAST_TTL = 1 IP_DEFAULT_MULTICAST_LOOP = 1 IP_MAX_MEMBERSHIPS = 20 IP_PORTRANGE_DEFAULT = 0 IP_PORTRANGE_HIGH = 1 IP_PORTRANGE_LOW = 2 IPPROTO_MAXID = (IPPROTO_AH + 1) IPCTL_FORWARDING = 1 IPCTL_SENDREDIRECTS = 2 IPCTL_DEFTTL = 3 IPCTL_DEFMTU = 4 IPCTL_RTEXPIRE = 5 IPCTL_RTMINEXPIRE = 6 IPCTL_RTMAXCACHE = 7 IPCTL_SOURCEROUTE = 8 IPCTL_DIRECTEDBROADCAST = 9 IPCTL_INTRQMAXLEN = 10 IPCTL_INTRQDROPS = 11 IPCTL_STATS = 12 IPCTL_ACCEPTSOURCEROUTE = 13 IPCTL_FASTFORWARDING = 14 IPCTL_KEEPFAITH = 15 IPCTL_GIF_TTL = 16 IPCTL_MAXID = 17 # Included from netinet6/in6.h __KAME_VERSION = "20010528/apple-darwin" IPV6PORT_RESERVED = 1024 IPV6PORT_ANONMIN = 49152 IPV6PORT_ANONMAX = 65535 IPV6PORT_RESERVEDMIN = 600 IPV6PORT_RESERVEDMAX = (IPV6PORT_RESERVED-1) INET6_ADDRSTRLEN = 46 IPV6_ADDR_INT32_ONE = 1 IPV6_ADDR_INT32_TWO = 2 IPV6_ADDR_INT32_MNL = 0xff010000 IPV6_ADDR_INT32_MLL = 0xff020000 IPV6_ADDR_INT32_SMP = 0x0000ffff IPV6_ADDR_INT16_ULL = 0xfe80 IPV6_ADDR_INT16_USL = 0xfec0 IPV6_ADDR_INT16_MLL = 0xff02 IPV6_ADDR_INT32_ONE = 0x01000000 IPV6_ADDR_INT32_TWO = 0x02000000 IPV6_ADDR_INT32_MNL = 0x000001ff IPV6_ADDR_INT32_MLL = 0x000002ff IPV6_ADDR_INT32_SMP = 0xffff0000 IPV6_ADDR_INT16_ULL = 0x80fe IPV6_ADDR_INT16_USL = 0xc0fe IPV6_ADDR_INT16_MLL = 0x02ff def IN6_IS_ADDR_UNSPECIFIED(a): return \ def IN6_IS_ADDR_LOOPBACK(a): return \ def IN6_IS_ADDR_V4COMPAT(a): return \ def IN6_IS_ADDR_V4MAPPED(a): return \ IPV6_ADDR_SCOPE_NODELOCAL = 0x01 IPV6_ADDR_SCOPE_LINKLOCAL = 0x02 IPV6_ADDR_SCOPE_SITELOCAL = 0x05 IPV6_ADDR_SCOPE_ORGLOCAL = 0x08 IPV6_ADDR_SCOPE_GLOBAL = 0x0e __IPV6_ADDR_SCOPE_NODELOCAL = 0x01 __IPV6_ADDR_SCOPE_LINKLOCAL = 0x02 __IPV6_ADDR_SCOPE_SITELOCAL = 0x05 __IPV6_ADDR_SCOPE_ORGLOCAL = 0x08 __IPV6_ADDR_SCOPE_GLOBAL = 0x0e def IN6_IS_ADDR_LINKLOCAL(a): return \ def IN6_IS_ADDR_SITELOCAL(a): return \ def IN6_IS_ADDR_MC_NODELOCAL(a): return \ def IN6_IS_ADDR_MC_LINKLOCAL(a): return \ def IN6_IS_ADDR_MC_SITELOCAL(a): return \ def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ def IN6_IS_ADDR_MC_GLOBAL(a): return \ def IN6_IS_ADDR_MC_NODELOCAL(a): return \ def IN6_IS_ADDR_MC_LINKLOCAL(a): return \ def IN6_IS_ADDR_MC_SITELOCAL(a): return \ def IN6_IS_ADDR_MC_ORGLOCAL(a): return \ def IN6_IS_ADDR_MC_GLOBAL(a): return \ def IN6_IS_SCOPE_LINKLOCAL(a): return \ def IFA6_IS_DEPRECATED(a): return \ def IFA6_IS_INVALID(a): return \ IPV6_OPTIONS = 1 IPV6_RECVOPTS = 5 IPV6_RECVRETOPTS = 6 IPV6_RECVDSTADDR = 7 IPV6_RETOPTS = 8 IPV6_SOCKOPT_RESERVED1 = 3 IPV6_UNICAST_HOPS = 4 IPV6_MULTICAST_IF = 9 IPV6_MULTICAST_HOPS = 10 IPV6_MULTICAST_LOOP = 11 IPV6_JOIN_GROUP = 12 IPV6_LEAVE_GROUP = 13 IPV6_PORTRANGE = 14 ICMP6_FILTER = 18 IPV6_PKTINFO = 19 IPV6_HOPLIMIT = 20 IPV6_NEXTHOP = 21 IPV6_HOPOPTS = 22 IPV6_DSTOPTS = 23 IPV6_RTHDR = 24 IPV6_PKTOPTIONS = 25 IPV6_CHECKSUM = 26 IPV6_V6ONLY = 27 IPV6_BINDV6ONLY = IPV6_V6ONLY IPV6_IPSEC_POLICY = 28 IPV6_FAITH = 29 IPV6_FW_ADD = 30 IPV6_FW_DEL = 31 IPV6_FW_FLUSH = 32 IPV6_FW_ZERO = 33 IPV6_FW_GET = 34 IPV6_RTHDR_LOOSE = 0 IPV6_RTHDR_STRICT = 1 IPV6_RTHDR_TYPE_0 = 0 IPV6_DEFAULT_MULTICAST_HOPS = 1 IPV6_DEFAULT_MULTICAST_LOOP = 1 IPV6_PORTRANGE_DEFAULT = 0 IPV6_PORTRANGE_HIGH = 1 IPV6_PORTRANGE_LOW = 2 IPV6PROTO_MAXID = (IPPROTO_PIM + 1) IPV6CTL_FORWARDING = 1 IPV6CTL_SENDREDIRECTS = 2 IPV6CTL_DEFHLIM = 3 IPV6CTL_DEFMTU = 4 IPV6CTL_FORWSRCRT = 5 IPV6CTL_STATS = 6 IPV6CTL_MRTSTATS = 7 IPV6CTL_MRTPROTO = 8 IPV6CTL_MAXFRAGPACKETS = 9 IPV6CTL_SOURCECHECK = 10 IPV6CTL_SOURCECHECK_LOGINT = 11 IPV6CTL_ACCEPT_RTADV = 12 IPV6CTL_KEEPFAITH = 13 IPV6CTL_LOG_INTERVAL = 14 IPV6CTL_HDRNESTLIMIT = 15 IPV6CTL_DAD_COUNT = 16 IPV6CTL_AUTO_FLOWLABEL = 17 IPV6CTL_DEFMCASTHLIM = 18 IPV6CTL_GIF_HLIM = 19 IPV6CTL_KAME_VERSION = 20 IPV6CTL_USE_DEPRECATED = 21 IPV6CTL_RR_PRUNE = 22 IPV6CTL_MAPPED_ADDR = 23 IPV6CTL_V6ONLY = 24 IPV6CTL_RTEXPIRE = 25 IPV6CTL_RTMINEXPIRE = 26 IPV6CTL_RTMAXCACHE = 27 IPV6CTL_USETEMPADDR = 32 IPV6CTL_TEMPPLTIME = 33 IPV6CTL_TEMPVLTIME = 34 IPV6CTL_AUTO_LINKLOCAL = 35 IPV6CTL_RIP6STATS = 36 IPV6CTL_MAXID = 37 --- NEW FILE: regen --- #! /bin/sh set -v python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h From jackjansen@users.sourceforge.net Tue May 20 22:49:36 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 20 May 2003 14:49:36 -0700 Subject: [Python-checkins] python/dist/src README,1.136.4.13,1.136.4.14 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv1886 Modified Files: Tag: release22-maint README Log Message: Slight rephrasing of the OSX stacksize problem with test_re. Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.136.4.13 retrieving revision 1.136.4.14 diff -C2 -d -r1.136.4.13 -r1.136.4.14 *** README 15 Nov 2002 07:27:03 -0000 1.136.4.13 --- README 20 May 2003 21:49:31 -0000 1.136.4.14 *************** *** 471,476 **** you set the stack size to 2048 before doing a "make test" the failure can be avoided. If you're using the tcsh (the default ! on OSX), or csh shells use "limit stacksize 2048" and for the ! bash shell, use "ulimit -s 2048". On naked Darwin you may want to add the configure option --- 471,476 ---- you set the stack size to 2048 before doing a "make test" the failure can be avoided. If you're using the tcsh (the default ! on OSX), or csh shells use "limit stacksize 2048"; for the ! bash or zsh shells, use "ulimit -s 2048". On naked Darwin you may want to add the configure option From bwarsaw@users.sourceforge.net Tue May 20 23:33:06 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 May 2003 15:33:06 -0700 Subject: [Python-checkins] python/dist/src/Lib gettext.py,1.11.24.1,1.11.24.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv19453 Modified Files: Tag: release22-maint gettext.py Log Message: GNUTranslations._parse(): Backport of fix for SF bug #658233, where continuation lines in .po metadata caused a crash. Also, export more symbols from __all__. Index: gettext.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gettext.py,v retrieving revision 1.11.24.1 retrieving revision 1.11.24.2 diff -C2 -d -r1.11.24.1 -r1.11.24.2 *** gettext.py 11 Jan 2002 06:37:07 -0000 1.11.24.1 --- gettext.py 20 May 2003 22:33:03 -0000 1.11.24.2 *************** *** 49,54 **** from errno import ENOENT ! __all__ = ["bindtextdomain","textdomain","gettext","dgettext", ! "find","translation","install","Catalog"] _default_localedir = os.path.join(sys.prefix, 'share', 'locale') --- 49,56 ---- from errno import ENOENT ! __all__ = ['NullTranslations', 'GNUTranslations', 'Catalog', ! 'find', 'translation', 'install', 'textdomain', 'bindtextdomain', ! 'dgettext', 'gettext', ! ] _default_localedir = os.path.join(sys.prefix, 'share', 'locale') *************** *** 174,185 **** if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description for item in tmsg.split('\n'): item = item.strip() if not item: continue ! k, v = item.split(':', 1) ! k = k.strip().lower() ! v = v.strip() ! self._info[k] = v if k == 'content-type': self._charset = v.split('charset=')[1] --- 176,192 ---- if mlen == 0 and tmsg.lower().startswith('project-id-version:'): # Catalog description + lastk = None for item in tmsg.split('\n'): item = item.strip() if not item: continue ! if ':' in item: ! k, v = item.split(':', 1) ! k = k.strip().lower() ! v = v.strip() ! self._info[k] = v ! lastk = k ! elif lastk: ! self._info[lastk] += '\n' + item if k == 'content-type': self._charset = v.split('charset=')[1] From bwarsaw@users.sourceforge.net Tue May 20 23:34:21 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 20 May 2003 15:34:21 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.77,1.337.2.4.2.78 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv19906 Modified Files: Tag: release22-maint NEWS Log Message: A few new news items Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.77 retrieving revision 1.337.2.4.2.78 diff -C2 -d -r1.337.2.4.2.77 -r1.337.2.4.2.78 *** NEWS 9 May 2003 18:29:19 -0000 1.337.2.4.2.77 --- NEWS 20 May 2003 22:34:18 -0000 1.337.2.4.2.78 *************** *** 31,34 **** --- 31,37 ---- - Backported the "largefile" requirement for test_largefile on Mac OS X. + - Backported email package 2.5.2, which makes address parsing slightly + more robust. + - SF #710576: Backport of fix for #663074, to implement per-interpreter codecs registries. This adds new members at the end of *************** *** 153,156 **** --- 156,163 ---- - Distutils: Translate spaces in the machine name to underscores (Power Macintosh -> Power_Macintosh) + + - Backported SF #658233, continuation lines in .mo file metadata + crashed gettext.GNUTranslations parsing. Also, export more symbols + in the gettext module's __all__. From rhettinger@users.sourceforge.net Wed May 21 06:58:50 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue, 20 May 2003 22:58:50 -0700 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.152,2.153 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26427 Modified Files: listobject.c Log Message: SF bug #604716: faster [None]*n or []*n Fulfilled request to special case repetitions of lists of length 0 or 1. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.152 retrieving revision 2.153 diff -C2 -d -r2.152 -r2.153 *** listobject.c 7 May 2003 01:28:47 -0000 2.152 --- listobject.c 21 May 2003 05:58:46 -0000 2.153 *************** *** 422,428 **** --- 422,431 ---- PyListObject *np; PyObject **p; + PyObject *elem; if (n < 0) n = 0; size = a->ob_size * n; + if (size == 0) + return PyList_New(0); if (n && size/n != a->ob_size) return PyErr_NoMemory(); *************** *** 430,433 **** --- 433,445 ---- if (np == NULL) return NULL; + + if (a->ob_size == 1) { + elem = a->ob_item[0]; + for (i = 0; i < n; i++) { + np->ob_item[i] = elem; + Py_INCREF(elem); + } + return (PyObject *) np; + } p = np->ob_item; for (i = 0; i < n; i++) { From eprice@users.sourceforge.net Wed May 21 17:20:26 2003 From: eprice@users.sourceforge.net (eprice@users.sourceforge.net) Date: Wed, 21 May 2003 09:20:26 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal test_Decimal.py,NONE,1.1 Decimal.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv12214 Modified Files: Decimal.py Added Files: test_Decimal.py Log Message: Split Decimal tests off from the main module. Converted to use unittest. --- NEW FILE: test_Decimal.py --- import unittest import glob from Decimal import * import os from test.test_support import TestSkipped, run_unittest TESTDATADIR = 'tests' dir = os.curdir + os.sep + TESTDATADIR + os.sep skip_expected = not os.path.isdir(dir) def Nonfunction(*args): """Doesn't do anything.""" return None RoundingDict = {'ceiling' : ROUND_CEILING, #Maps test-case names to roundings. 'down' : ROUND_DOWN, 'floor' : ROUND_FLOOR, 'half_down' : ROUND_HALF_DOWN, 'half_even' : ROUND_HALF_EVEN, 'half_up' : ROUND_HALF_UP, 'up' : ROUND_UP} class DecimalTest(unittest.TestCase): """Class which tests the Decimal class against the test cases. Changed for unittest. """ def setUp(self): global dir self.context = Context() #self.filelist = glob.glob(dir+'*.decTest') for key in DefaultContext.trap_enablers.keys(): DefaultContext.trap_enablers[key] = 1 self.ignore_list = ['#'] # Basically, a # means return NaN InvalidOperation. # Different from a sNaN in trim self.ChangeDict = {'precision' : self.change_precision, 'rounding' : self.change_rounding_method, 'maxexponent' : self.change_max_exponent, 'minexponent' : self.change_min_exponent, 'clamp' : self.change_clamp} def eval_file(self, file): global skip_expected if skip_expected: raise TestSkipped return for line in open(file).xreadlines(): line = line.replace('\r\n', '').replace('\n', '') try: t = self.eval_line(line) except ConversionSyntax: print 'Error in test cases:' print line continue except DecimalException, exception: #Exception raised where there shoudn't have been one. self.fail('Exception "'+exception.__class__.__name__ + '" raised on line '+line) return def eval_line(self, s): if s.find(' -> ') >= 0 and s[:2] != '--' and not s.startswith(' --'): s = (s.split('->')[0] + '->' + s.split('->')[1].split('--')[0]).strip() else: s = s.split('--')[0].strip() for ignore in self.ignore_list: if s.find(ignore) >= 0: #print s.split()[0], 'NotImplemented--', ignore return if not s: return elif ':' in s: return self.eval_directive(s) else: return self.eval_equation(s) def eval_directive(self, s): funct, value = map(lambda x: x.strip().lower(), s.split(':')) if funct == 'rounding': value = RoundingDict[value] else: try: value = int(value) except ValueError: pass funct = self.ChangeDict.get(funct, Nonfunction) funct(value) def eval_equation(self, s): #global DEFAULT_PRECISION #print DEFAULT_PRECISION try: Sides = s.split('->') L = Sides[0].strip().split() id = L[0] #print id, funct = L[1] valstemp = L[2:] L = Sides[1].strip().split() ans = L[0] exceptions = L[1:] except (TypeError, AttributeError, IndexError): raise ConversionSyntax def FixQuotes(val): val = val.replace("''", 'SingleQuote').replace('""', 'DoubleQuote') val = val.replace("'", '').replace('"', '') val = val.replace('SingleQuote', "'").replace('DoubleQuote', '"') return val fname = funct funct = getattr(self.context, funct) vals = [] conglomerate = '' quote = 0 theirexceptions = map(lambda x: ErrorNames[x.lower()], exceptions) for exception in ExceptionList: self.context.trap_enablers[exception] = 1 #Catch these bugs... for exception in theirexceptions: self.context.trap_enablers[exception] = 0 for val in valstemp: if val.count("'") % 2 == 1: quote = 1 - quote if quote: conglomerate = conglomerate + ' ' + val continue else: val = conglomerate + val conglomerate = '' v = FixQuotes(val) if fname in ('toSci', 'toEng'): v = self.context.new(v) else: v = Decimal(v) vals.append(v) ans = FixQuotes(ans) try: result = str(funct(*vals)) except: #Catch any error long enough to state the test case. #print "ERROR:", s raise myexceptions = self.getexceptions() self.resetflags() myexceptions.sort() theirexceptions.sort() self.assertEqual(result, ans, 'Incorrect answer for ' + s + ' -- got ' + result) self.assertEqual(myexceptions, theirexceptions, 'Incorrect flags set in ' + s + ' -- got ' + str(myexceptions)) def getexceptions(self): return self.context.all_flags() L = [] for exception in ExceptionList: if self.context.flags[exception]: L.append(exception) return L def resetflags(self): for exception in ExceptionList: self.context.flags[exception] = 0 def change_precision(self, prec): self.context.prec = prec def change_rounding_method(self, rounding): self.context.rounding = rounding def change_min_exponent(self, exp): self.context.Emin = exp def change_max_exponent(self, exp): self.context.Emax = exp def change_clamp(self, clamp): self.context.clamp = clamp def test_add(self): """Tests the Decimal class on Cowlishaw's add tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'add' + '.decTest') def test_abs(self): """Tests the Decimal class on Cowlishaw's abs tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'abs' + '.decTest') def test_base(self): """Tests the Decimal class on Cowlishaw's base tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'base' + '.decTest') def test_clamp(self): """Tests the Decimal class on Cowlishaw's clamp tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'clamp' + '.decTest') def test_compare(self): """Tests the Decimal class on Cowlishaw's compare tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'compare' + '.decTest') def test_divide(self): """Tests the Decimal class on Cowlishaw's divide tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'divide' + '.decTest') def test_divideint(self): """Tests the Decimal class on Cowlishaw's divideint tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'divideint' + '.decTest') def test_inexact(self): """Tests the Decimal class on Cowlishaw's inexact tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'inexact' + '.decTest') def test_integer(self): """Tests the Decimal class on Cowlishaw's integer tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'integer' + '.decTest') def test_max(self): """Tests the Decimal class on Cowlishaw's max tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'max' + '.decTest') def test_min(self): """Tests the Decimal class on Cowlishaw's min tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'min' + '.decTest') def test_minus(self): """Tests the Decimal class on Cowlishaw's minus tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'minus' + '.decTest') def test_multiply(self): """Tests the Decimal class on Cowlishaw's multiply tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir+'multiply'+'.decTest') def test_normalize(self): """Tests the Decimal class on Cowlishaw's normalize tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'normalize' + '.decTest') def test_plus(self): """Tests the Decimal class on Cowlishaw's plus tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'plus' + '.decTest') def test_power(self): """Tests the Decimal class on Cowlishaw's power tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'power' + '.decTest') def test_randomBound32(self): """Tests the Decimal class on Cowlishaw's randomBound32 tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'randomBound32' + '.decTest') def test_randoms(self): """Tests the Decimal class on Cowlishaw's randoms tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'randoms' + '.decTest') def test_remainder(self): """Tests the Decimal class on Cowlishaw's remainder tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'remainder' + '.decTest') def test_remainderNear(self): """Tests the Decimal class on Cowlishaw's remainderNear tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'remainderNear' + '.decTest') def test_rescale(self): """Tests the Decimal class on Cowlishaw's rescale tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'rescale' + '.decTest') def test_rounding(self): """Tests the Decimal class on Cowlishaw's rounding tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'rounding' + '.decTest') def test_squareroot(self): """Tests the Decimal class on Cowlishaw's squareroot tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'squareroot' + '.decTest') def test_subtract(self): """Tests the Decimal class on Cowlishaw's subtract tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'subtract' + '.decTest') def test_trim(self): """Tests the Decimal class on Cowlishaw's trim tests. See www2.hursley.ibm.com/decimal/decTest.zip to download the suite. """ self.eval_file(dir + 'trim' + '.decTest') def test_main(): run_unittest(DecimalTest) if __name__ == '__main__': test_main() Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Decimal.py 15 May 2003 19:06:01 -0000 1.5 --- Decimal.py 21 May 2003 16:20:23 -0000 1.6 *************** *** 431,434 **** --- 431,437 ---- return + if isinstance(value, type(1)) or isinstance(value, type(1L)): + self._convertString(str(value), context) + return # tuple/list conversion (possibly from repr()) try: *************** *** 467,474 **** - if isinstance(value, type(1)) or isinstance(value, type(1L)): - self._convertString(str(value), context) - return - if isinstance(value, type(1.0)): --- 470,473 ---- *************** *** 1476,1489 **** # Okay, let's round and lose data - # get rounding method function: - rounding_functions = filter(lambda name: name[:6] == '_round', - self.__class__.__dict__.keys()) - def value(name): - """Find the global value associated with the name of a function.""" - return globals()[name[1:].upper()] ! this_function = filter(lambda name, value=value, rounding=rounding: ! value(name) == rounding, rounding_functions)[0] ! this_function = getattr(temp, this_function) #Now we've got the rounding function --- 1475,1480 ---- # Okay, let's round and lose data ! this_function = getattr(temp, self.pick_rounding_function[rounding]) #Now we've got the rounding function *************** *** 1497,1500 **** --- 1488,1493 ---- return ans + pick_rounding_function = {} + def _round_down(self, prec, expdiff, context): """Also known as round-towards-0, truncate.""" *************** *** 1990,1993 **** --- 1983,1994 ---- return 0 + # get rounding method function: + rounding_functions = [name for name in Decimal.__dict__.keys() if name.startswith('_round')] + for name in rounding_functions: + #name is like _round_half_even, goes to the global ROUND_HALF_EVEN value. + globalname = name[1:].upper() + val = globals()[globalname] + Decimal.pick_rounding_function[val] = name + class Context: *************** *** 2678,2911 **** - def Nonfunction(*args): - """Doesn't do anything.""" - return None - - RoundingDict = {'ceiling' : ROUND_CEILING, #Maps test-case names to roundings. - 'down' : ROUND_DOWN, - 'floor' : ROUND_FLOOR, - 'half_down' : ROUND_HALF_DOWN, - 'half_even' : ROUND_HALF_EVEN, - 'half_up' : ROUND_HALF_UP, - 'up' : ROUND_UP} - - class Test: - """Class which tests the Decimal class against the test cases. - - Example: - t = Test('decimal/testcases/') - t.test() - - The testcases should be unzipped in that directory (with names ending in - .decTest) - - When run, test() stops for incorrect answers and gives a summary of - results at the end. - - Changes DefaultContext to ensure no leaking (failure to pass the context) - so watch out if you start a new thread! - """ - def __init__(self, dir='./'): - import glob - self.filelist = glob.glob(dir+'*.decTest') - if len(self.filelist) > 15: - self.filelist.append(self.filelist[15]) - #So the slow one is at the end. - self.filelist[15:16] = [] - - self.context = Context() - for key in DefaultContext.trap_enablers.keys(): - DefaultContext.trap_enablers[key] = 1 - - self.unknown_list = ['#'] - # Basically, a # means return NaN InvalidOperation. - # Different from a sNaN in trim - - self.ChangeDict = {'precision' : self.change_precision, - 'rounding' : self.change_rounding_method, - 'maxexponent' : self.change_max_exponent, - 'minexponent' : self.change_min_exponent, - 'clamp' : self.change_clamp} - - def test(self, start=0): - wrong = 0 - notdone = 0 - total = 0 - t = time.time() - for file in self.filelist[start:]: - tup = self.eval_file(file) - wrong += tup[0] - notdone += tup[1] - total += tup[2] - - #The clamp: directive only set in clamp cases, which leave it on. - self.change_clamp(0) - print 'The run-through took', time.time()-t, 'seconds.' - print 'A total of', notdone, 'were skipped. (# ones)' - print 'A total of', wrong, 'were incorrect.' - print 'A total of', total-wrong, 'test cases were correct.' - def eval_file(self, file): - count = 0 - ndone = 0 - total = 0 - for line in open(file).xreadlines(): - line = line.replace('\r\n', '').replace('\n', '') - #print '*', line, '*' - try: - t = self.eval_line(line) - except ConversionSyntax: - print 'PROBLEM WITH:' - print line - raw_input() - continue - count += t[0] - ndone += t[1] - total += t[2] - #time.sleep(0.1) - return count, ndone, total - - def eval_line(self, s): - if s.find(' -> ') >= 0 and s[:2] != '--' and not s.startswith(' --'): - s = (s.split('->')[0] + '->' + - s.split('->')[1].split('--')[0]).strip() - else: - s = s.split('--')[0].strip() - - for unknown in self.unknown_list: - if s.find(unknown) >= 0: - print s.split()[0], 'NotImplemented--', unknown - return (0, 1, 0) - if not s: - return (0, 0, 0) - if ':' in s: - return self.eval_directive(s) - else: - return self.eval_equation(s) - - def eval_directive(self, s): - funct, value = map(lambda x: x.strip().lower(), s.split(':')) - if funct == 'rounding': - value = RoundingDict[value] - else: - try: - value = int(value) - except ValueError: - pass - - funct = self.ChangeDict.get(funct, Nonfunction) - funct(value) - return (0, 0, 0) - - def eval_equation(self, s): - #global DEFAULT_PRECISION - #print DEFAULT_PRECISION - try: - Sides = s.split('->') - L = Sides[0].strip().split() - id = L[0] - print id, - funct = L[1] - valstemp = L[2:] - L = Sides[1].strip().split() - ans = L[0] - exceptions = L[1:] - except (TypeError, AttributeError, IndexError): - raise ConversionSyntax - def FixQuotes(val): - val = val.replace("''", 'SingleQuote').replace('""', 'DoubleQuote') - val = val.replace("'", '').replace('"', '') - val = val.replace('SingleQuote', "'").replace('DoubleQuote', '"') - return val - fname = funct - funct = getattr(self.context, funct) - vals = [] - conglomerate = '' - quote = 0 - theirexceptions = map(lambda x: ErrorNames[x.lower()], exceptions) - - for exception in ExceptionList: - self.context.trap_enablers[exception] = 1 #Catch these bugs... - for exception in theirexceptions: - self.context.trap_enablers[exception] = 0 - for val in valstemp: - if val.count("'") % 2 == 1: - quote = 1 - quote - if quote: - conglomerate = conglomerate + ' ' + val - continue - else: - val = conglomerate + val - conglomerate = '' - v = FixQuotes(val) - if fname in ('toSci', 'toEng'): - v = self.context.new(v) - else: - v = Decimal(v) - vals.append(v) - - ans = FixQuotes(ans) - - try: - result = str(funct(*vals)) - except: #Catch any error long enough to state the test case. - print "ERROR:", s - raise - - myexceptions = self.getexceptions() - self.resetflags() - - myexceptions.sort() - theirexceptions.sort() - #if s.count('pow') and result != ans: - # #Maybe just the one digit.. - # spot = result.find('E') - # if abs(long(result[:spot].replace('.', '')) - - # long(ans[:spot].replace('.', ''))) == 1: - # - # result = ans[:spot] + result[spot:] - # print 'OFF BY ONE IN LAST DIGIT OTHERWISE', - - if result != ans or myexceptions != theirexceptions: - print 'INCORRECT **********' - print 'PROBLEM:' - print s - print 'YOUR RESULT:' - print result, ' '.join(map(lambda x: x.__name__, myexceptions)) - raw_input() - return (1, 0, 1) - else: - print 'CORRECT!' - return (0, 0, 1) - - def getexceptions(self): - return self.context.all_flags() - L = [] - for exception in ExceptionList: - if self.context.flags[exception]: - L.append(exception) - return L - - def resetflags(self): - for exception in ExceptionList: - self.context.flags[exception] = 0 - - def change_precision(self, prec): - self.context.prec = prec - def change_rounding_method(self, rounding): - self.context.rounding = rounding - def change_min_exponent(self, exp): - self.context.Emin = exp - def change_max_exponent(self, exp): - self.context.Emax = exp - def change_clamp(self, clamp): - self.context.clamp = clamp - - - - - def _test(): - t = Test('./tests/') - t.test() - - if __name__ == '__main__': - _test() --- 2679,2680 ---- From jhylton@users.sourceforge.net Wed May 21 18:34:51 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 21 May 2003 10:34:51 -0700 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.11,2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv10692/Include Modified Files: symtable.h Log Message: Fix for SF [ 734869 ] Lambda functions in list comprehensions The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. Bugfix candidate. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.11 retrieving revision 2.12 diff -C2 -d -r2.11 -r2.12 *** symtable.h 11 Dec 2002 14:04:58 -0000 2.11 --- symtable.h 21 May 2003 17:34:49 -0000 2.12 *************** *** 29,33 **** int st_errors; /* number of errors */ char *st_private; /* name of current class or NULL */ - int st_tmpname; /* temporary name counter */ PyFutureFeatures *st_future; /* module's future features */ }; --- 29,32 ---- *************** *** 48,51 **** --- 47,51 ---- int ste_generator; /* true if namespace is a generator */ int ste_opt_lineno; /* lineno of last exec or import * */ + int ste_tmpname; /* temporary name counter */ struct symtable *ste_table; } PySymtableEntryObject; From jhylton@users.sourceforge.net Wed May 21 18:34:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 21 May 2003 10:34:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_grammar,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv10692/Lib/test/output Modified Files: test_grammar Log Message: Fix for SF [ 734869 ] Lambda functions in list comprehensions The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. Bugfix candidate. Index: test_grammar =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_grammar,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_grammar 3 Apr 2002 22:41:50 -0000 1.19 --- test_grammar 21 May 2003 17:34:49 -0000 1.20 *************** *** 61,64 **** --- 61,65 ---- [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] + [[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] [False, False, False] [[1, 2], [3, 4], [5, 6]] From jhylton@users.sourceforge.net Wed May 21 18:34:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 21 May 2003 10:34:52 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grammar.py,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10692/Lib/test Modified Files: test_grammar.py Log Message: Fix for SF [ 734869 ] Lambda functions in list comprehensions The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. Bugfix candidate. Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** test_grammar.py 12 Feb 2003 16:57:31 -0000 1.45 --- test_grammar.py 21 May 2003 17:34:50 -0000 1.46 *************** *** 702,705 **** --- 702,706 ---- print [(i, s) for i in nums for s in strs] print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] + print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] def test_in_func(l): From jhylton@users.sourceforge.net Wed May 21 18:34:52 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 21 May 2003 10:34:52 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.285,2.286 symtable.c,2.10,2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv10692/Python Modified Files: compile.c symtable.c Log Message: Fix for SF [ 734869 ] Lambda functions in list comprehensions The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. Bugfix candidate. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.285 retrieving revision 2.286 diff -C2 -d -r2.285 -r2.286 *** compile.c 12 May 2003 19:16:52 -0000 2.285 --- compile.c 21 May 2003 17:34:50 -0000 2.286 *************** *** 732,735 **** --- 732,736 ---- static void symtable_assign(struct symtable *, node *, int); static void symtable_list_comprehension(struct symtable *, node *); + static void symtable_list_for(struct symtable *, node *); static int symtable_update_free_vars(struct symtable *); *************** *** 1603,1606 **** --- 1604,1609 ---- /* listmaker: test list_for */ char tmpname[30]; + + REQ(n, listmaker); PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->c_tmpname); com_addoparg(c, BUILD_LIST, 0); *************** *** 4922,4926 **** st->st_nscopes = 0; st->st_errors = 0; - st->st_tmpname = 0; st->st_private = NULL; return st; --- 4925,4928 ---- *************** *** 5124,5130 **** prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { - /* Py_DECREF(st->st_cur); */ - /* I believe the previous line would lead to a - double-DECREF when st is disposed - JRH */ st->st_errors++; return; --- 5126,5129 ---- *************** *** 5396,5405 **** goto loop; case list_iter: n = CHILD(n, 0); ! if (TYPE(n) == list_for) { ! st->st_tmpname++; ! symtable_list_comprehension(st, n); ! st->st_tmpname--; ! } else { REQ(n, list_if); symtable_node(st, CHILD(n, 1)); --- 5395,5404 ---- goto loop; case list_iter: + /* only occurs when there are multiple for loops + in a list comprehension */ n = CHILD(n, 0); ! if (TYPE(n) == list_for) ! symtable_list_for(st, n); ! else { REQ(n, list_if); symtable_node(st, CHILD(n, 1)); *************** *** 5429,5436 **** case listmaker: if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_for) { ! st->st_tmpname++; ! symtable_list_comprehension(st, CHILD(n, 1)); ! symtable_node(st, CHILD(n, 0)); ! st->st_tmpname--; break; } --- 5428,5432 ---- case listmaker: if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_for) { ! symtable_list_comprehension(st, n); break; } *************** *** 5630,5637 **** symtable_list_comprehension(struct symtable *st, node *n) { char tmpname[30]; ! PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", st->st_tmpname); symtable_add_def(st, tmpname, DEF_LOCAL); symtable_assign(st, CHILD(n, 1), 0); symtable_node(st, CHILD(n, 3)); --- 5626,5646 ---- symtable_list_comprehension(struct symtable *st, node *n) { + /* listmaker: test list_for */ char tmpname[30]; ! REQ(n, listmaker); ! PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ! ++st->st_cur->ste_tmpname); symtable_add_def(st, tmpname, DEF_LOCAL); + symtable_list_for(st, CHILD(n, 1)); + symtable_node(st, CHILD(n, 0)); + --st->st_cur->ste_tmpname; + } + + static void + symtable_list_for(struct symtable *st, node *n) + { + REQ(n, list_for); + /* list_for: for v in expr [list_iter] */ symtable_assign(st, CHILD(n, 1), 0); symtable_node(st, CHILD(n, 3)); Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10 retrieving revision 2.11 diff -C2 -d -r2.10 -r2.11 *** symtable.c 10 Dec 2001 00:53:18 -0000 2.10 --- symtable.c 21 May 2003 17:34:50 -0000 2.11 *************** *** 62,65 **** --- 62,66 ---- ste->ste_optimized = 0; ste->ste_opt_lineno = 0; + ste->ste_tmpname = 0; ste->ste_lineno = lineno; switch (type) { From tim_one@users.sourceforge.net Wed May 21 21:43:11 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 May 2003 13:43:11 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.78,1.337.2.4.2.79 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv23341/Misc Modified Files: Tag: release22-maint NEWS Log Message: PyType_Ready(): Complain if the type is a base type, and gc'able, and tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.78 retrieving revision 1.337.2.4.2.79 diff -C2 -d -r1.337.2.4.2.78 -r1.337.2.4.2.79 *** NEWS 20 May 2003 22:34:18 -0000 1.337.2.4.2.78 --- NEWS 21 May 2003 20:43:08 -0000 1.337.2.4.2.79 *************** *** 3,6 **** --- 3,17 ---- ============================ + - C API: PyType_Ready(): If a type declares that it participates in gc + (Py_TPFLAGS_HAVE_GC), and its base class does not, and its base class's + tp_free slot is the default _PyObject_Del, and type does not define + a tp_free slot itself, _PyObject_GC_Del is assigned to type->tp_free. + Previously _PyObject_Del was inherited, which could at best lead to a + segfault. In addition, if even after this magic the type's tp_free + slot is _PyObject_Del or NULL, and the type is a base type + (Py_TPFLAGS_BASETYPE), TypeError is raised: since the type is a base + type, its dealloc function must call type->tp_free, and since the type + is gc'able, tp_free must not be NULL or _PyObject_Del. + - Windows: file.truncate(size) failed on large files when size didn't fit in 32 bits. This was fixed by backporting new Windows truncation From tim_one@users.sourceforge.net Wed May 21 21:43:13 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 May 2003 13:43:13 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.73.2.1.2.5,2.73.2.1.2.6 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv23341/Modules Modified Files: Tag: release22-maint cPickle.c Log Message: PyType_Ready(): Complain if the type is a base type, and gc'able, and tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.73.2.1.2.5 retrieving revision 2.73.2.1.2.6 diff -C2 -d -r2.73.2.1.2.5 -r2.73.2.1.2.6 *** cPickle.c 9 May 2003 18:29:20 -0000 2.73.2.1.2.5 --- cPickle.c 21 May 2003 20:43:09 -0000 2.73.2.1.2.6 *************** *** 2370,2374 **** } ! PyObject_GC_Del(self); } --- 2370,2374 ---- } ! self->ob_type->tp_free((PyObject *)self); } *************** *** 4319,4323 **** } ! PyObject_GC_Del(self); } --- 4319,4323 ---- } ! self->ob_type->tp_free((PyObject *)self); } *************** *** 4607,4610 **** --- 4607,4615 ---- #define INIT_STR(S) UNLESS(S ## _str=PyString_InternFromString(#S)) return -1; + if (PyType_Ready(&Unpicklertype) < 0) + return -1; + if (PyType_Ready(&Picklertype) < 0) + return -1; + INIT_STR(__class__); INIT_STR(__getinitargs__); From tim_one@users.sourceforge.net Wed May 21 21:43:13 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 May 2003 13:43:13 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.35,2.126.4.36 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv23341/Objects Modified Files: Tag: release22-maint typeobject.c Log Message: PyType_Ready(): Complain if the type is a base type, and gc'able, and tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.35 retrieving revision 2.126.4.36 diff -C2 -d -r2.126.4.35 -r2.126.4.36 *** typeobject.c 20 May 2003 02:42:04 -0000 2.126.4.35 --- typeobject.c 21 May 2003 20:43:10 -0000 2.126.4.36 *************** *** 2093,2098 **** COPYSLOT(tp_init); COPYSLOT(tp_alloc); - COPYSLOT(tp_free); COPYSLOT(tp_is_gc); } } --- 2093,2115 ---- COPYSLOT(tp_init); COPYSLOT(tp_alloc); COPYSLOT(tp_is_gc); + if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) == + (base->tp_flags & Py_TPFLAGS_HAVE_GC)) { + /* They agree about gc. */ + COPYSLOT(tp_free); + } + else if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) && + type->tp_free == NULL && + base->tp_free == _PyObject_Del) { + /* A bit of magic to plug in the correct default + * tp_free function when a derived class adds gc, + * didn't define tp_free, and the base uses the + * default non-gc tp_free. + */ + type->tp_free = _PyObject_GC_Del; + } + /* else they didn't agree about gc, and there isn't something + * obvious to be done -- the type is on its own. + */ } } *************** *** 2190,2193 **** --- 2207,2223 ---- } + /* Sanity check for tp_free. */ + if (PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) && + (type->tp_free == NULL || type->tp_free == _PyObject_Del)) { + /* This base class needs to call tp_free, but doesn't have + * one, or its tp_free is for non-gc'ed objects. + */ + PyErr_Format(PyExc_TypeError, "type '%.100s' participates in " + "gc and is a base type but has inappropriate " + "tp_free slot", + type->tp_name); + goto error; + } + /* if the type dictionary doesn't contain a __doc__, set it from the tp_doc slot. *************** *** 2749,2753 **** return Py_None; } ! static PyObject * wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) --- 2779,2783 ---- return Py_None; } ! static PyObject * wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) From tim_one@users.sourceforge.net Wed May 21 22:29:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 May 2003 14:29:49 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.770,1.771 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv24766/Misc Modified Files: NEWS Log Message: PyType_Ready(): Complain if the type is a base type, and gc'able, and tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.770 retrieving revision 1.771 diff -C2 -d -r1.770 -r1.771 *** NEWS 20 May 2003 04:59:55 -0000 1.770 --- NEWS 21 May 2003 21:29:46 -0000 1.771 *************** *** 76,79 **** --- 76,90 ---- ----- + - PyType_Ready(): If a type declares that it participates in gc + (Py_TPFLAGS_HAVE_GC), and its base class does not, and its base class's + tp_free slot is the default _PyObject_Del, and type does not define + a tp_free slot itself, _PyObject_GC_Del is assigned to type->tp_free. + Previously _PyObject_Del was inherited, which could at best lead to a + segfault. In addition, if even after this magic the type's tp_free + slot is _PyObject_Del or NULL, and the type is a base type + (Py_TPFLAGS_BASETYPE), TypeError is raised: since the type is a base + type, its dealloc function must call type->tp_free, and since the type + is gc'able, tp_free must not be NULL or _PyObject_Del. + New platforms ------------- From tim_one@users.sourceforge.net Wed May 21 22:29:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 May 2003 14:29:50 -0700 Subject: [Python-checkins] python/dist/src/Modules cPickle.c,2.144,2.145 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv24766/Modules Modified Files: cPickle.c Log Message: PyType_Ready(): Complain if the type is a base type, and gc'able, and tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots. Index: cPickle.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v retrieving revision 2.144 retrieving revision 2.145 diff -C2 -d -r2.144 -r2.145 *** cPickle.c 9 Apr 2003 21:25:30 -0000 2.144 --- cPickle.c 21 May 2003 21:29:47 -0000 2.145 *************** *** 2854,2858 **** Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); ! PyObject_GC_Del(self); } --- 2854,2858 ---- Py_XDECREF(self->dispatch_table); PyMem_Free(self->write_buf); ! self->ob_type->tp_free((PyObject *)self); } *************** *** 5213,5217 **** } ! PyObject_GC_Del(self); } --- 5213,5217 ---- } ! self->ob_type->tp_free((PyObject *)self); } *************** *** 5534,5537 **** --- 5534,5542 ---- #define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; + + if (PyType_Ready(&Unpicklertype) < 0) + return -1; + if (PyType_Ready(&Picklertype) < 0) + return -1; INIT_STR(__class__); From tim_one@users.sourceforge.net Wed May 21 22:29:50 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Wed, 21 May 2003 14:29:50 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.232,2.233 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv24766/Objects Modified Files: typeobject.c Log Message: PyType_Ready(): Complain if the type is a base type, and gc'able, and tp_free is NULL or PyObject_Del at the end. Because it's a base type it must call tp_free in its dealloc function, and because it's gc'able it must not call PyObject_Del. inherit_slots(): Don't inherit tp_free unless the type and its base agree about whether they're gc'able. If the type is gc'able and the base is not, and the base uses the default PyObject_Del for its tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate default for a gc'able type). cPickle.c: The Pickler and Unpickler types claim to be base classes and gc'able, but their dealloc functions didn't call tp_free. Repaired that. Also call PyType_Ready() on these typeobjects, so that the correct (PyObject_GC_Del) default memory-freeing function gets plugged into these types' tp_free slots. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.232 retrieving revision 2.233 diff -C2 -d -r2.232 -r2.233 *** typeobject.c 20 May 2003 02:40:12 -0000 2.232 --- typeobject.c 21 May 2003 21:29:48 -0000 2.233 *************** *** 3045,3050 **** COPYSLOT(tp_init); COPYSLOT(tp_alloc); - COPYSLOT(tp_free); COPYSLOT(tp_is_gc); } } --- 3045,3067 ---- COPYSLOT(tp_init); COPYSLOT(tp_alloc); COPYSLOT(tp_is_gc); + if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) == + (base->tp_flags & Py_TPFLAGS_HAVE_GC)) { + /* They agree about gc. */ + COPYSLOT(tp_free); + } + else if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) && + type->tp_free == NULL && + base->tp_free == _PyObject_Del) { + /* A bit of magic to plug in the correct default + * tp_free function when a derived class adds gc, + * didn't define tp_free, and the base uses the + * default non-gc tp_free. + */ + type->tp_free = PyObject_GC_Del; + } + /* else they didn't agree about gc, and there isn't something + * obvious to be done -- the type is on its own. + */ } } *************** *** 3148,3151 **** --- 3165,3181 ---- if (PyType_Check(b)) inherit_slots(type, (PyTypeObject *)b); + } + + /* Sanity check for tp_free. */ + if (PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) && + (type->tp_free == NULL || type->tp_free == PyObject_Del)) { + /* This base class needs to call tp_free, but doesn't have + * one, or its tp_free is for non-gc'ed objects. + */ + PyErr_Format(PyExc_TypeError, "type '%.100s' participates in " + "gc and is a base type but has inappropriate " + "tp_free slot", + type->tp_name); + goto error; } From jhylton@users.sourceforge.net Wed May 21 22:43:02 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 21 May 2003 14:43:02 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref6.tex,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv1662/Doc/ref Modified Files: ref6.tex Log Message: Move future statement here from appendix a. Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** ref6.tex 31 Mar 2003 14:53:03 -0000 1.63 --- ref6.tex 21 May 2003 21:43:00 -0000 1.64 *************** *** 739,742 **** --- 739,820 ---- \bifuncindex{__import__} + \subsection{Future statements \label{future}} + + A \dfn{future statement}\indexii{future}{statement} is a directive to + the compiler that a particular module should be compiled using syntax + or semantics that will be available in a specified future release of + Python. The future statement is intended to ease migration to future + versions of Python that introduce incompatible changes to the + language. It allows use of the new features on a per-module basis + before the release in which the feature becomes standard. + + \begin{productionlist}[*] + \production{future_statement} + {"from" "__future__" "import" feature ["as" name]} + \productioncont{("," feature ["as" name])*} + \production{feature}{identifier} + \production{name}{identifier} + \end{productionlist} + + A future statement must appear near the top of the module. The only + lines that can appear before a future statement are: + + \begin{itemize} + + \item the module docstring (if any), + \item comments, + \item blank lines, and + \item other future statements. + + \end{itemize} + + The features recognized by Python 2.3 are \samp{generators}, + \samp{division} and \samp{nested_scopes}. \samp{generators} and + \samp{nested_scopes} are redundant in 2.3 because they are always + enabled. + + A future statement is recognized and treated specially at compile + time: Changes to the semantics of core constructs are often + implemented by generating different code. It may even be the case + that a new feature introduces new incompatible syntax (such as a new + reserved word), in which case the compiler may need to parse the + module differently. Such decisions cannot be pushed off until + runtime. + + For any given release, the compiler knows which feature names have been + defined, and raises a compile-time error if a future statement contains + a feature not known to it. + + The direct runtime semantics are the same as for any import statement: + there is a standard module \module{__future__}, described later, and + it will be imported in the usual way at the time the future statement + is executed. + + The interesting runtime semantics depend on the specific feature + enabled by the future statement. + + Note that there is nothing special about the statement: + + \begin{verbatim} + import __future__ [as name] + \end{verbatim} + + That is not a future statement; it's an ordinary import statement with + no special semantics or syntax restrictions. + + Code compiled by an exec statement or calls to the builtin functions + \function{compile()} and \function{execfile()} that occur in a module + \module{M} containing a future statement will, by default, use the new + syntax or semantics associated with the future statement. This can, + starting with Python 2.2 be controlled by optional arguments to + \function{compile()} --- see the documentation of that function in the + library reference for details. + + A future statement typed at an interactive interpreter prompt will + take effect for the rest of the interpreter session. If an + interpreter is started with the \programopt{-i} option, is passed a + script name to execute, and the script includes a future statement, it + will be in effect in the interactive session started after the script + is executed. \section{The \keyword{global} statement \label{global}} From jhylton@users.sourceforge.net Wed May 21 22:45:03 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 21 May 2003 14:45:03 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib lib__future__.tex,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv3158/Doc/lib Added Files: lib__future__.tex Log Message: Add documentation for __future__ --- NEW FILE: lib__future__.tex --- \section{\module{__future__} --- Future statement definitions} \declaremodule[future]{standard}{__future__} \modulesynopsis{Future statement definitions} \module{__future__} is a real module, and serves three purposes: \begin{itemize} \item To avoid confusing existing tools that analyze import statements and expect to find the modules they're importing. \item To ensure that future_statements run under releases prior to 2.1 at least yield runtime exceptions (the import of \module{__future__} will fail, because there was no module of that name prior to 2.1). \item To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and can be inspected programatically via importing \module{__future__} and examining its contents. \end{itemize} Each statment in \file{__future__.py} is of the form: \begin{verbatim} FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease "," CompilerFlag ")" \end{verbatim} where, normally, OptionalRelease is less then MandatoryRelease, and both are 5-tuples of the same form as \code{sys.version_info}: \begin{verbatim} (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int PY_MINOR_VERSION, # the 1; an int PY_MICRO_VERSION, # the 0; an int PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string PY_RELEASE_SERIAL # the 3; an int ) \end{verbatim} OptionalRelease records the first release in which the feature was accepted. In the case of MandatoryReleases that have not yet occurred, MandatoryRelease predicts the release in which the feature will become part of the language. Else MandatoryRelease records when the feature became part of the language; in releases at or after that, modules no longer need a future statement to use the feature in question, but may continue to use such imports. MandatoryRelease may also be \code{None}, meaning that a planned feature got dropped. Instances of class \class{_Feature} have two corresponding methods, \method{getOptionalRelease()} and \method{getMandatoryRelease()}. CompilerFlag is the (bitfield) flag that should be passed in the fourth argument to the builtin function \function{compile()} to enable the feature in dynamically compiled code. This flag is stored in the \member{compiler_flag} attribute on \class{_Future} instances. No feature description will ever be deleted from \module{__future__}. From anthonybaxter@users.sourceforge.net Thu May 22 01:29:10 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Wed, 21 May 2003 17:29:10 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv3552 Modified Files: distref.tex Log Message: bit of fancy_getopt and the Command base class, as well as a start at the "implementing new commands" section. Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** distref.tex 20 May 2003 08:42:03 -0000 1.7 --- distref.tex 22 May 2003 00:29:07 -0000 1.8 *************** *** 416,420 **** library file \var{lib} and return the full path to that file. If \var{debug} is true, look for a debugging version (if that makes sense on ! the current platform). Return None if \var{lib} wasn't found in any of the specified directories. \end{methoddesc} --- 416,420 ---- library file \var{lib} and return the full path to that file. If \var{debug} is true, look for a debugging version (if that makes sense on ! the current platform). Return \code{None} if \var{lib} wasn't found in any of the specified directories. \end{methoddesc} *************** *** 486,490 **** \var{macros}, if given, must be a list of macro definitions. A macro definition is either a \var{(name, value)} 2-tuple or a \var{(name,)} 1-tuple. ! The former defines a macro; if the value is None, the macro is defined without an explicit value. The 1-tuple case undefines a macro. Later definitions/redefinitions/undefinitions take --- 486,490 ---- \var{macros}, if given, must be a list of macro definitions. A macro definition is either a \var{(name, value)} 2-tuple or a \var{(name,)} 1-tuple. ! The former defines a macro; if the value is \code{None}, the macro is defined without an explicit value. The 1-tuple case undefines a macro. Later definitions/redefinitions/undefinitions take *************** *** 1138,1151 **** \modulesynopsis{Additional getopt functionality } ! This module provides a wrapper around the standard \refmodule{getopt} module that ! provides the following ! additional features: \begin{itemize} \item short and long options are tied together ! \item options have help strings, so fancy_getopt could potentially create a complete usage summary \item options set attributes of a passed-in object \end{itemize} ! \warning{Should be replaced with optik (which is also now known as \refmodule{optparse})} \subsubsection{\module{distutils.filelist} -- The FileList class} --- 1138,1212 ---- \modulesynopsis{Additional getopt functionality } ! This module provides a wrapper around the standard \refmodule{getopt} ! module that provides the following additional features: ! \begin{itemize} \item short and long options are tied together ! \item options have help strings, so \function{fancy_getopt} could potentially ! create a complete usage summary \item options set attributes of a passed-in object + \item boolean options can have "negative aliases" -- eg. if \code{--quiet} + is the "negative alias" of \code{--verbose}, then \code{--quiet} on the + command line sets \var{verbose} to false + \end{itemize} ! \warning{Should be replaced with \module{optik} (which is also now known as \refmodule{optparse} in Python 2.3 and later).} ! ! \begin{funcdesc}{fancy_getopt}{options, negative_opt, object, args} ! Wrapper function. \var{options} is a list of ! \samp{(long_option, short_option, help_string)} 3-tuples as described in the ! constructor for \class{FancyGetopt}. \var{negative_opt} should be a dictionary ! mapping option names to option names, both the key and value should be in the ! \var{options} list. \var{object} is an object which will be used to store ! values (see the \method{getopt} method of the \class{FancyGetopt} class). ! \var{args} is the argument list. Will use \code{sys.argv[1:]} if you ! pass \code{None} as \var{args}. ! \end{funcdesc} ! ! \begin{funcdesc}{wrap_text}{text, width} ! Wraps \var{text} to less than \var{width} wide. ! ! \warning{Should be replaced with \refmodule{textwrap} (which is available ! in Python 2.3 and later).} ! \end{funcdesc} ! ! \begin{classdesc}{FancyGetopt}{\optional{option_table=\code{None}}} ! ! The option_table is a list of 3-tuples: ! \samp{(long_option, short_option, help_string)} ! ! If an option takes an argument, it's \var{long_option} should have \code{'='} ! appended; \var{short_option} should just be a single character, no \code{':'} ! in any case. \var{short_option} should be \code{None} if a \var{long_option} ! doesn't have a corresponding \var{short_option}. All option tuples must have ! long options. ! ! \begin{methoddesc}{getopt}{\optional{args=\code{None}, object=\code{None}}} ! Parse command-line options in args. Store as attributes on \var{object}. ! ! If \var{args} is \code{None} or not supplied, uses \code{sys.argv[1:]}. If ! \var{object} is \code{None} or not supplied, creates a new \class{OptionDummy} ! instance, stores option values there, and returns a tuple \samp{(args, ! object)}. If \var{object} is supplied, it is modified in place and ! \function{getopt()} just returns \var{args}; in both cases, the returned ! \var{args} is a modified copy of the passed-in \var{args} list, which ! is left untouched. ! % and args returned are? ! \end{methoddesc} ! ! \begin{methoddesc}{get_option_order}{} ! Returns the list of \samp{(option, value)} tuples processed by the ! previous run of \method{getopt()} Raises \exception{RuntimeError} if ! \method{getopt()} hasn't been called yet. ! \end{methoddesc} ! ! \begin{methoddesc}{generate_help}{\optional{header=\code{None}}} ! Generate help text (a list of strings, one per suggested line of ! output) from the option table for this \class{FancyGetopt} object. ! ! If supplied, prints the supplied \var{header} at the top of the help. ! \end{methoddesc} ! \end{classdesc} \subsubsection{\module{distutils.filelist} -- The FileList class} *************** *** 1215,1218 **** --- 1276,1302 ---- subpackage. } + This module supplies the abstract base class \class{Command}. + + \begin{classdesc}{Command}{dist} + Abstract base class for defining command classes, the "worker bees" + of the Distutils. A useful analogy for command classes is to think of + them as subroutines with local variables called \var{options}. The options + are "declared" in \method{initialize_options()} and "defined" (given their + final values, aka "finalized") in \method{finalize_options()}, both of which + must be defined by every command class. The distinction between the + two is necessary because option values might come from the outside + world (command line, config file, ...), and any options dependent on + other options must be computed after these outside influences have + been processed -- hence \method{finalize_options()}. The "body" of the + subroutine, where it does all its work based on the values of its + options, is the \method{run()} method, which must also be implemented by every + command class. + + The class constructor takes a single argument \var{dist}, a + \class{Distribution} instance. + + + \end{classdesc} + \subsubsection{\module{distutils.command} -- Individual Distutils commands} *************** *** 1333,1335 **** --- 1417,1460 ---- This section will go through the steps to create a new Distutils command. + + A new command lives in a module in the \module{distutils.command} + package. There is a sample template in that directory called + \file{command_template}. Copy this file to a new module with the + same name as the new command you're implementing. This module should + implement a class with the same name as the module (and the command). + So, for instance, to create the command \code{peel_banana} (so that users + can run \samp{setup.py peel_banana}), you'd copy \file{command_template} + to \file{distutils/command/peel_banana.py}, then edit it so that it's + implementing the class \class{peel_banana}, a subclass of + \class{distutils.cmd.Command}. + + Subclasses of \class{Command} must define the following methods. + + \begin{methoddesc}{initialize_options()} + Set default values for all the options that this command + supports. Note that these defaults may be overridden by other + commands, by the setup script, by config files, or by the + command-line. Thus, this is not the place to code dependencies + between options; generally, \method{initialize_options()} implementations + are just a bunch of \samp{self.foo = None} assignments. + \end{methoddesc} + + \begin{methoddesc}{finalize_options}{} + Set final values for all the options that this command supports. + This is always called as late as possible, ie. after any option + assignments from the command-line or from other commands have been + done. Thus, this is the place to to code option dependencies: if + \var{foo} depends on \var{bar}, then it is safe to set \var{foo} from + \var{bar} as long as \var{foo} still has the same value it was assigned in + \method{initialize_options()}. + \end{methoddesc} + \begin{methoddesc}{run}{} + A command's raison d'etre: carry out the action it exists to + perform, controlled by the options initialized in + \method{initialize_options()}, customized by other commands, the setup + script, the command-line, and config files, and finalized in + \method{finalize_options()}. All terminal output and filesystem + interaction should be done by \method{run()}. + \end{methoddesc} + From doerwalter@users.sourceforge.net Thu May 22 14:15:34 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 22 May 2003 06:15:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13636/Lib/test Modified Files: test_array.py Log Message: test_byteswap() fails on alphas, because treating the byte swapped bit patterns as floats/doubles results in floating point exceptions. Fix this by implementing a separate test_byteswap() for the floating point tests. This new test compares the tostring() values of both arrays instead of the arrays themselves. Discovered by Neal Norwitz. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** test_array.py 18 May 2003 03:15:08 -0000 1.22 --- test_array.py 22 May 2003 13:15:31 -0000 1.23 *************** *** 848,851 **** --- 848,868 ---- typecode = 'f' minitemsize = 4 + + def test_byteswap(self): + a = array.array(self.typecode, self.example) + self.assertRaises(TypeError, a.byteswap, 42) + if a.itemsize in (1, 2, 4, 8): + b = array.array(self.typecode, self.example) + b.byteswap() + if a.itemsize==1: + self.assertEqual(a, b) + else: + # On alphas treating the byte swapped bit patters as + # floats/doubles results in floating point exceptions + # => compare the 8bit string values instead + self.assertNotEqual(a.tostring(), b.tostring()) + b.byteswap() + self.assertEqual(a, b) + tests.append(FloatTest) From nnorwitz@users.sourceforge.net Thu May 22 14:29:18 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 22 May 2003 06:29:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_array.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25113/Lib/test Modified Files: test_array.py Log Message: Walter's last checkin also needs to work on doubles. * Move new test_byteswap into FPTest. * Remove extra lines at end of file. Index: test_array.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_array.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** test_array.py 22 May 2003 13:15:31 -0000 1.23 --- test_array.py 22 May 2003 13:29:15 -0000 1.24 *************** *** 845,852 **** self.assertAlmostEqual(entry1, entry2) - class FloatTest(FPTest): - typecode = 'f' - minitemsize = 4 - def test_byteswap(self): a = array.array(self.typecode, self.example) --- 845,848 ---- *************** *** 865,868 **** --- 861,867 ---- self.assertEqual(a, b) + class FloatTest(FPTest): + typecode = 'f' + minitemsize = 4 tests.append(FloatTest) *************** *** 877,881 **** if __name__=="__main__": test_main() - - - #main() --- 876,877 ---- From fdrake@users.sourceforge.net Thu May 22 14:59:32 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 06:59:32 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.16,1.235.2.1.2.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv8364 Modified Files: Tag: release22-maint Makefile Log Message: Start preparing the doc tree for 2.2.3. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.16 retrieving revision 1.235.2.1.2.17 diff -C2 -d -r1.235.2.1.2.16 -r1.235.2.1.2.17 *** Makefile 26 Nov 2002 22:14:19 -0000 1.235.2.1.2.16 --- Makefile 22 May 2003 13:59:30 -0000 1.235.2.1.2.17 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.2+ PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3 PYTHON= python From bwarsaw@users.sourceforge.net Thu May 22 15:44:34 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 07:44:34 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.60.2.1.2.9,2.60.2.1.2.10 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv30212 Modified Files: Tag: release22-maint patchlevel.h Log Message: Prepare for 2.2.3c1 (release candidate 1) Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.60.2.1.2.9 retrieving revision 2.60.2.1.2.10 diff -C2 -d -r2.60.2.1.2.9 -r2.60.2.1.2.10 *** patchlevel.h 14 Oct 2002 12:25:20 -0000 2.60.2.1.2.9 --- patchlevel.h 22 May 2003 14:44:31 -0000 2.60.2.1.2.10 *************** *** 22,31 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 2 ! #define PY_MICRO_VERSION 2 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.2.2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 22,31 ---- #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 2 ! #define PY_MICRO_VERSION 3 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.2.3c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From akuchling@users.sourceforge.net Thu May 22 15:46:14 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 22 May 2003 07:46:14 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29780 Modified Files: pdb.py Log Message: [Bug #741171] pdb crashes when enabling a non-existing breakpoint Check the supplied breakpoint number more carefully. (Incompatibility: before this patch, "enable -1" would enable the last breakpoint on the list; now -1 is not a legal ID. Not sure anyone would ever use negative indices...) 2.2 bugfix candidate, assuming making -1 illegal isn't considered a problem. Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** pdb.py 9 Apr 2003 19:36:34 -0000 1.64 --- pdb.py 22 May 2003 14:46:12 -0000 1.65 *************** *** 376,380 **** args = arg.split() for i in args: ! bp = bdb.Breakpoint.bpbynumber[int(i)] if bp: bp.enable() --- 376,390 ---- args = arg.split() for i in args: ! try: ! i = int(i) ! except ValueError: ! print 'Breakpoint index %r is not a number' % i ! continue ! ! if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): ! print 'No breakpoint numbered', i ! continue ! ! bp = bdb.Breakpoint.bpbynumber[i] if bp: bp.enable() *************** *** 383,387 **** args = arg.split() for i in args: ! bp = bdb.Breakpoint.bpbynumber[int(i)] if bp: bp.disable() --- 393,407 ---- args = arg.split() for i in args: ! try: ! i = int(i) ! except ValueError: ! print 'Breakpoint index %r is not a number' % i ! continue ! ! if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): ! print 'No breakpoint numbered', i ! continue ! ! bp = bdb.Breakpoint.bpbynumber[i] if bp: bp.disable() From fdrake@users.sourceforge.net Thu May 22 15:48:31 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 07:48:31 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.17,1.235.2.1.2.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv32452 Modified Files: Tag: release22-maint Makefile Log Message: the release manager has been fixed; this *will* be a release candidate Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.17 retrieving revision 1.235.2.1.2.18 diff -C2 -d -r1.235.2.1.2.17 -r1.235.2.1.2.18 *** Makefile 22 May 2003 13:59:30 -0000 1.235.2.1.2.17 --- Makefile 22 May 2003 14:48:28 -0000 1.235.2.1.2.18 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3 PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3c1 PYTHON= python From fdrake@users.sourceforge.net Thu May 22 15:50:30 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 07:50:30 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs license.tex,1.4.4.2,1.4.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv1008 Modified Files: Tag: release22-maint license.tex Log Message: update version history Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/license.tex,v retrieving revision 1.4.4.2 retrieving revision 1.4.4.3 diff -C2 -d -r1.4.4.2 -r1.4.4.3 *** license.tex 8 Apr 2002 21:48:20 -0000 1.4.4.2 --- license.tex 22 May 2003 14:50:27 -0000 1.4.4.3 *************** *** 38,41 **** --- 38,43 ---- \linev{2.1.3}{2.1.2}{2002}{PSF}{yes} \linev{2.2.1}{2.2}{2002}{PSF}{yes} + \linev{2.2.2}{2.2.1}{2002}{PSF}{yes} + \linev{2.2.3}{2.2.2}{2002-2003}{PSF}{yes} \end{tablev} From fdrake@users.sourceforge.net Thu May 22 15:56:39 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 07:56:39 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs boilerplate.tex,1.70.2.1.2.9,1.70.2.1.2.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv5163 Modified Files: Tag: release22-maint boilerplate.tex Log Message: update version/release information Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.70.2.1.2.9 retrieving revision 1.70.2.1.2.10 diff -C2 -d -r1.70.2.1.2.9 -r1.70.2.1.2.10 *** boilerplate.tex 22 Oct 2002 21:20:24 -0000 1.70.2.1.2.9 --- boilerplate.tex 22 May 2003 14:56:37 -0000 1.70.2.1.2.10 *************** *** 6,11 **** } ! \date{\today} % XXX update before release! ! \release{2.2.2+} % software release, not documentation ! \setreleaseinfo{} % empty for final release \setshortversion{2.2} % major.minor only for software --- 6,11 ---- } ! \date{\today} % XXX update before final release! ! \release{2.2.3} % software release, not documentation ! \setreleaseinfo{c1} % empty for final release \setshortversion{2.2} % major.minor only for software From fdrake@users.sourceforge.net Thu May 22 15:58:04 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 07:58:04 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs license.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv5877 Modified Files: license.tex Log Message: update version history Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/license.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** license.tex 26 Apr 2003 00:52:30 -0000 1.9 --- license.tex 22 May 2003 14:58:02 -0000 1.10 *************** *** 40,43 **** --- 40,44 ---- \linev{2.2.1}{2.2}{2002}{PSF}{yes} \linev{2.2.2}{2.2.1}{2002}{PSF}{yes} + \linev{2.2.3}{2.2.2}{2002-2003}{PSF}{yes} \linev{2.3}{2.2.2}{2002-2003}{PSF}{yes} \end{tablev} From fdrake@users.sourceforge.net Thu May 22 16:09:29 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 08:09:29 -0700 Subject: [Python-checkins] python/dist/src/Doc/html stdabout.dat,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory sc8-pr-cvs1:/tmp/cvs-serv10902 Modified Files: stdabout.dat Log Message: Minor elaboration in the information about reporting errors. Index: stdabout.dat =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/stdabout.dat,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** stdabout.dat 16 Sep 2000 14:16:57 -0000 1.5 --- stdabout.dat 22 May 2003 15:09:27 -0000 1.6 *************** *** 31,35 **** be sent by email to python-docs@python.org. If you find specific errors in ! this document, please report the bug at the Python Bug Tracker at SourceForge. --- 31,36 ---- be sent by email to python-docs@python.org. If you find specific errors in ! this document, either in the content or the presentation, please ! report the bug at the Python Bug Tracker at SourceForge. From fdrake@users.sourceforge.net Thu May 22 16:09:58 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 08:09:58 -0700 Subject: [Python-checkins] python/dist/src/Doc/html stdabout.dat,1.5,1.5.24.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/html In directory sc8-pr-cvs1:/tmp/cvs-serv11113 Modified Files: Tag: release22-maint stdabout.dat Log Message: Minor elaboration in the information about reporting errors. Index: stdabout.dat =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/html/stdabout.dat,v retrieving revision 1.5 retrieving revision 1.5.24.1 diff -C2 -d -r1.5 -r1.5.24.1 *** stdabout.dat 16 Sep 2000 14:16:57 -0000 1.5 --- stdabout.dat 22 May 2003 15:09:55 -0000 1.5.24.1 *************** *** 31,35 **** be sent by email to python-docs@python.org. If you find specific errors in ! this document, please report the bug at the Python Bug Tracker at SourceForge. --- 31,36 ---- be sent by email to python-docs@python.org. If you find specific errors in ! this document, either in the content or the presentation, please ! report the bug at the Python Bug Tracker at SourceForge. From bwarsaw@users.sourceforge.net Thu May 22 16:15:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 08:15:08 -0700 Subject: [Python-checkins] python/dist/src README,1.136.4.14,1.136.4.15 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv13590 Modified Files: Tag: release22-maint README Log Message: Twiddle the banner Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.136.4.14 retrieving revision 1.136.4.15 diff -C2 -d -r1.136.4.14 -r1.136.4.15 *** README 20 May 2003 21:49:31 -0000 1.136.4.14 --- README 22 May 2003 15:15:05 -0000 1.136.4.15 *************** *** 1,6 **** ! This is Python version 2.2.2 ============================ ! Copyright (c) 2001, 2002 Python Software Foundation. All rights reserved. --- 1,6 ---- ! This is Python version 2.2.3 ============================ ! Copyright (c) 2001, 2002, 2003 Python Software Foundation. All rights reserved. From bwarsaw@users.sourceforge.net Thu May 22 16:17:43 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 08:17:43 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv14871 Modified Files: LICENSE Log Message: Add historical note for Python 2.2.3 Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** LICENSE 2 Jan 2003 16:31:09 -0000 1.25 --- LICENSE 22 May 2003 15:17:40 -0000 1.26 *************** *** 42,45 **** --- 42,46 ---- 2.2.1 2.2 2002 PSF yes 2.2.2 2.2.1 2002 PSF yes + 2.2.3 2.2.2 2003 PSF yes 2.3 2.2.2 2002-2003 PSF yes From bwarsaw@users.sourceforge.net Thu May 22 16:21:08 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 08:21:08 -0700 Subject: [Python-checkins] python/dist/src LICENSE,1.18.16.6,1.18.16.7 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv17003 Modified Files: Tag: release22-maint LICENSE Log Message: Update Python release version and copyright years Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.18.16.6 retrieving revision 1.18.16.7 diff -C2 -d -r1.18.16.6 -r1.18.16.7 *** LICENSE 6 Oct 2002 04:14:17 -0000 1.18.16.6 --- LICENSE 22 May 2003 15:21:06 -0000 1.18.16.7 *************** *** 42,45 **** --- 42,46 ---- 2.2.1 2.2 2002 PSF yes 2.2.2 2.2.1 2002 PSF yes + 2.2.3 2.2.2 2003 PSF yes Footnotes: *************** *** 58,67 **** =============================================================== ! PSF LICENSE AGREEMENT FOR PYTHON 2.2.2 -------------------------------------- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and ! otherwise using Python 2.2.2 software in source or binary form and its associated documentation. --- 59,68 ---- =============================================================== ! PSF LICENSE AGREEMENT FOR PYTHON 2.2.3 -------------------------------------- 1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and ! otherwise using Python 2.2.3 software in source or binary form and its associated documentation. *************** *** 69,95 **** hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 2.2.2 alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) ! 2001, 2002 Python Software Foundation; All Rights Reserved" are ! retained in Python 2.2.2 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 2.2.2 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of ! the changes made to Python 2.2.2. ! 4. PSF is making Python 2.2.2 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.2.2 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 2.2.2 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ! A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.2.2, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. --- 70,96 ---- hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, ! prepare derivative works, distribute, and otherwise use Python 2.2.3 alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) ! 2001, 2002, 2003 Python Software Foundation; All Rights Reserved" are ! retained in Python 2.2.3 alone or in any derivative version prepared by Licensee. 3. In the event Licensee prepares a derivative work that is based on ! or incorporates Python 2.2.3 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of ! the changes made to Python 2.2.3. ! 4. PSF is making Python 2.2.3 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS ! FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.2.3 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS. 5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON ! 2.2.3 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS ! A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.2.3, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. *************** *** 103,107 **** products or services of Licensee, or any third party. ! 8. By copying, installing or otherwise using Python 2.2.2, Licensee agrees to be bound by the terms and conditions of this License Agreement. --- 104,108 ---- products or services of Licensee, or any third party. ! 8. By copying, installing or otherwise using Python 2.2.3, Licensee agrees to be bound by the terms and conditions of this License Agreement. From fdrake@users.sourceforge.net Thu May 22 16:28:25 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 08:28:25 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.18,1.235.2.1.2.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv20240 Modified Files: Tag: release22-maint Makefile Log Message: Correct dependency information -- the Python docs load the "About this document" text from html/stdabout.dat, not html/about.dat. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.18 retrieving revision 1.235.2.1.2.19 diff -C2 -d -r1.235.2.1.2.18 -r1.235.2.1.2.19 *** Makefile 22 May 2003 14:48:28 -0000 1.235.2.1.2.18 --- Makefile 22 May 2003 15:28:22 -0000 1.235.2.1.2.19 *************** *** 312,316 **** cp $< $@ ! $(INDEXFILES): $(COMMONPERL) html/about.dat tools/node2label.pl html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml --- 312,316 ---- cp $< $@ ! $(INDEXFILES): $(COMMONPERL) html/stdabout.dat tools/node2label.pl html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml *************** *** 394,398 **** isilo/whatsnew/$(WHATSNEW).html ! $(ISILOINDEXFILES): $(COMMONPERL) html/about.dat perl/isilo.perl isilo: isilo/python-api-$(RELEASE).pdb \ --- 394,398 ---- isilo/whatsnew/$(WHATSNEW).html ! $(ISILOINDEXFILES): $(COMMONPERL) html/stdabout.dat perl/isilo.perl isilo: isilo/python-api-$(RELEASE).pdb \ From fdrake@users.sourceforge.net Thu May 22 16:28:57 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 08:28:57 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.253,1.254 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv20466 Modified Files: Makefile Log Message: Correct dependency information -- the Python docs load the "About this document" text from html/stdabout.dat, not html/about.dat. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.253 retrieving revision 1.254 diff -C2 -d -r1.253 -r1.254 *** Makefile 24 Apr 2003 16:37:05 -0000 1.253 --- Makefile 22 May 2003 15:28:55 -0000 1.254 *************** *** 315,319 **** cp $< $@ ! $(INDEXFILES): $(COMMONPERL) html/about.dat tools/node2label.pl html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml --- 315,319 ---- cp $< $@ ! $(INDEXFILES): $(COMMONPERL) html/stdabout.dat tools/node2label.pl html/acks.html: ACKS $(TOOLSDIR)/support.py $(TOOLSDIR)/mkackshtml *************** *** 399,403 **** isilo/whatsnew/$(WHATSNEW).html ! $(ISILOINDEXFILES): $(COMMONPERL) html/about.dat perl/isilo.perl isilo: isilo/python-api.pdb \ --- 399,403 ---- isilo/whatsnew/$(WHATSNEW).html ! $(ISILOINDEXFILES): $(COMMONPERL) html/stdabout.dat perl/isilo.perl isilo: isilo/python-api.pdb \ From fdrake@users.sourceforge.net Thu May 22 16:30:25 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 22 May 2003 08:30:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs copyright.tex,1.12,1.12.18.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv21370 Modified Files: Tag: release22-maint copyright.tex Log Message: update copyright dates Index: copyright.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/copyright.tex,v retrieving revision 1.12 retrieving revision 1.12.18.1 diff -C2 -d -r1.12 -r1.12.18.1 *** copyright.tex 20 Jun 2001 21:34:35 -0000 1.12 --- copyright.tex 22 May 2003 15:30:22 -0000 1.12.18.1 *************** *** 1,3 **** ! Copyright \copyright{} 2001 Python Software Foundation. All rights reserved. --- 1,3 ---- ! Copyright \copyright{} 2001, 2002, 2003 Python Software Foundation. All rights reserved. From tim_one@users.sourceforge.net Thu May 22 16:30:38 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 May 2003 08:30:38 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv20102/python/PCbuild Modified Files: BUILDno.txt Log Message: Record 2.2.3c1 Windows build number. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** BUILDno.txt 24 Apr 2003 16:45:33 -0000 1.44 --- BUILDno.txt 22 May 2003 15:30:36 -0000 1.45 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 41 2.2.3c1 + 22-May-2003 40 2.3b1 25-Apr-2003 From tim_one@users.sourceforge.net Thu May 22 16:39:11 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 May 2003 08:39:11 -0700 Subject: [Python-checkins] python/dist/src/PC python_nt.rc,1.15.14.3,1.15.14.4 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv25624/PC Modified Files: Tag: release22-maint python_nt.rc Log Message: Assorted 2.2.3c1 and copyright changes specific to Windows. Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.15.14.3 retrieving revision 1.15.14.4 diff -C2 -d -r1.15.14.3 -r1.15.14.4 *** python_nt.rc 14 Oct 2002 15:07:34 -0000 1.15.14.3 --- python_nt.rc 22 May 2003 15:39:08 -0000 1.15.14.4 *************** *** 35,46 **** * following comment and #define are output from PCbuild\field3.py: * ! * For 2.2.2, ! * PY_MICRO_VERSION = 2 ! * PY_RELEASE_LEVEL = 'final' = 0xf ! * PY_RELEASE_SERIAL = 0 * ! * and 2*1000 + 15*10 + 0 = 2150 */ ! #define FIELD3 2150 /* e.g., 2.1a2 --- 35,46 ---- * following comment and #define are output from PCbuild\field3.py: * ! * For 2.2.3c1, ! * PY_MICRO_VERSION = 3 ! * PY_RELEASE_LEVEL = 'candidate' = 0xc ! * PY_RELEASE_SERIAL = 1 * ! * and 3*1000 + 12*10 + 1 = 3121 */ ! #define FIELD3 3121 /* e.g., 2.1a2 *************** *** 93,97 **** VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" ! VALUE "LegalCopyright", "Copyright © 2001-2002 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.\0" VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" --- 93,97 ---- VALUE "FileVersion", PYTHON_VERSION VALUE "InternalName", "Python DLL\0" ! VALUE "LegalCopyright", "Copyright © 2001-2003 Python Software Foundation. Copyright © 2000 BeOpen.com. Copyright © 1995-2001 CNRI. Copyright © 1991-1995 SMC.\0" VALUE "OriginalFilename", PYTHON_DLL_NAME "\0" VALUE "ProductName", "Python\0" From tim_one@users.sourceforge.net Thu May 22 16:39:12 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 May 2003 08:39:12 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.26.4.9,1.26.4.10 python20.wse,1.98.4.11,1.98.4.12 pythoncore.dsp,1.30.4.5,1.30.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv25624/PCbuild Modified Files: Tag: release22-maint BUILDno.txt python20.wse pythoncore.dsp Log Message: Assorted 2.2.3c1 and copyright changes specific to Windows. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.26.4.9 retrieving revision 1.26.4.10 diff -C2 -d -r1.26.4.9 -r1.26.4.10 *** BUILDno.txt 14 Oct 2002 15:02:11 -0000 1.26.4.9 --- BUILDno.txt 22 May 2003 15:39:09 -0000 1.26.4.10 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 41 2.2.3c1 + 22-May-2003 37 2.2.2 (final) 14-Oct-2002 Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.11 retrieving revision 1.98.4.12 diff -C2 -d -r1.98.4.11 -r1.98.4.12 *** python20.wse 22 Mar 2003 02:08:30 -0000 1.98.4.11 --- python20.wse 22 May 2003 15:39:09 -0000 1.98.4.12 *************** *** 2,6 **** item: Global Version=8.14 ! Title=Python 2.2.2 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=8.14 ! Title=Python 2.2.3 release candidate 1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 19,27 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.2.exe Dialogs Version=8 ! Version File=2.2.2 Version Description=Python Programming Language ! Version Copyright=©2002 Python Software Foundation Version Company=PythonLabs at Zope Corporation Crystal Format=10111100101100000010001001001001 --- 19,27 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.3c1.exe Dialogs Version=8 ! Version File=2.2.3c1 Version Description=Python Programming Language ! Version Copyright=©2003 Python Software Foundation Version Company=PythonLabs at Zope Corporation Crystal Format=10111100101100000010001001001001 *************** *** 65,69 **** item: Set Variable Variable=PYVER_STRING ! Value=2.2.2 end item: Remark --- 65,69 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.2.3c1 end item: Remark Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.30.4.5 retrieving revision 1.30.4.6 diff -C2 -d -r1.30.4.5 -r1.30.4.6 *** pythoncore.dsp 14 Oct 2002 15:03:43 -0000 1.30.4.5 --- pythoncore.dsp 22 May 2003 15:39:10 -0000 1.30.4.6 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=37 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=37 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=41 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=41 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From jhylton@users.sourceforge.net Thu May 22 16:47:07 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 08:47:07 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.286,2.287 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv29589 Modified Files: compile.c Log Message: Remove comment with very long lines that explained what the code used to do. XXX Please be careful when checking in patches to avoid checking in junk that explains what the patched code used to do. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.286 retrieving revision 2.287 diff -C2 -d -r2.286 -r2.287 *** compile.c 21 May 2003 17:34:50 -0000 2.286 --- compile.c 22 May 2003 15:47:02 -0000 2.287 *************** *** 4629,4635 **** } } ! if (list == NULL) /* There used to be a check here for the size of */ ! return 0; /* the list being 0, which would have leaked the */ ! /* list if that condition was ever possible. JRH */ /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. --- 4629,4635 ---- } } ! if (list == NULL) ! return 0; ! /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. From jhylton@users.sourceforge.net Thu May 22 17:22:35 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 09:22:35 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.287,2.288 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv15285 Modified Files: compile.c Log Message: Use macro to get length of list. Remove comment about how code used to work. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.287 retrieving revision 2.288 diff -C2 -d -r2.287 -r2.288 *** compile.c 22 May 2003 15:47:02 -0000 2.287 --- compile.c 22 May 2003 16:22:33 -0000 2.288 *************** *** 4968,4980 **** int pos = 0; ! if (list) ! if (PyList_SetSlice(list, 0, ! ((PyVarObject*)list)->ob_size, 0) < 0) return -1; - /* Yes, the above call CAN fail, even though it's reducing - the size of the list. The current implementation will - allocate temp memory equal to the size of the list: this - is avoidable in this specific case, but probably not - worth the effort of special-casing it. - JRH */ child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); --- 4968,4974 ---- int pos = 0; ! if (list && PyList_SetSlice(list, 0, ! PyList_GET_SIZE(list), 0) < 0) return -1; child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); From rhettinger@users.sourceforge.net Thu May 22 17:33:00 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 22 May 2003 09:33:00 -0700 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv20040 Modified Files: itertoolsmodule.c Log Message: Fixed dotted name assertion. Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** itertoolsmodule.c 3 May 2003 05:59:47 -0000 1.13 --- itertoolsmodule.c 22 May 2003 16:32:58 -0000 1.14 *************** *** 1833,1840 **** if (PyType_Ready(typelist[i]) < 0) return; ! name = strchr(typelist[i]->tp_name, '.') + 1; assert (name != NULL); Py_INCREF(typelist[i]); ! PyModule_AddObject(m, name, (PyObject *)typelist[i]); } } --- 1833,1840 ---- if (PyType_Ready(typelist[i]) < 0) return; ! name = strchr(typelist[i]->tp_name, '.'); assert (name != NULL); Py_INCREF(typelist[i]); ! PyModule_AddObject(m, name+1, (PyObject *)typelist[i]); } } From python@rcn.com Thu May 22 17:22:47 2003 From: python@rcn.com (Raymond Hettinger) Date: Thu, 22 May 2003 12:22:47 -0400 Subject: [Python-checkins] python/dist/src/Python compile.c,2.285,2.286 symtable.c,2.10,2.11 References: Message-ID: <000201c3207f$bc23bce0$125ffea9@oemcomputer> > Modified Files: > compile.c symtable.c > Log Message: > Fix for SF [ 734869 ] Lambda functions in list comprehensions > > The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter for the entire module. Repair by move tmpname into the symtable entry. > > Bugfix candidate. It would be great if this were backported to 2.2.3. I applying it directly with cvs -j but that led to an C assertion failure in: python_d regrtest.py test_symtable Raymond From jhylton@users.sourceforge.net Thu May 22 17:43:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 09:43:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_grammar.py,1.40,1.40.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv24293/Lib/test Modified Files: Tag: release22-maint test_grammar.py Log Message: Backport fix for SF bug 734869 and sundry compiler cleanups. Index: test_grammar.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_grammar.py,v retrieving revision 1.40 retrieving revision 1.40.6.1 diff -C2 -d -r1.40 -r1.40.6.1 *** test_grammar.py 9 Dec 2001 09:12:34 -0000 1.40 --- test_grammar.py 22 May 2003 16:43:03 -0000 1.40.6.1 *************** *** 693,696 **** --- 693,697 ---- print [(i, s) for i in nums for s in strs] print [(i, s) for i in nums for s in [f for f in strs if "n" in f]] + print [(lambda a:[a**i for i in range(a+1)])(j) for j in range(5)] def test_in_func(l): From jhylton@users.sourceforge.net Thu May 22 17:43:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 09:43:05 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_grammar,1.18,1.18.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv24293/Lib/test/output Modified Files: Tag: release22-maint test_grammar Log Message: Backport fix for SF bug 734869 and sundry compiler cleanups. Index: test_grammar =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_grammar,v retrieving revision 1.18 retrieving revision 1.18.12.1 diff -C2 -d -r1.18 -r1.18.12.1 *** test_grammar 26 Sep 2001 12:43:39 -0000 1.18 --- test_grammar 22 May 2003 16:43:03 -0000 1.18.12.1 *************** *** 61,64 **** --- 61,65 ---- [(1, 'Apple'), (1, 'Banana'), (1, 'Coconut'), (2, 'Apple'), (2, 'Banana'), (2, 'Coconut'), (3, 'Apple'), (3, 'Banana'), (3, 'Coconut'), (4, 'Apple'), (4, 'Banana'), (4, 'Coconut'), (5, 'Apple'), (5, 'Banana'), (5, 'Coconut')] [(1, 'Banana'), (1, 'Coconut'), (2, 'Banana'), (2, 'Coconut'), (3, 'Banana'), (3, 'Coconut'), (4, 'Banana'), (4, 'Coconut'), (5, 'Banana'), (5, 'Coconut')] + [[1], [1, 1], [1, 2, 4], [1, 3, 9, 27], [1, 4, 16, 64, 256]] [0, 0, 0] [[1, 2], [3, 4], [5, 6]] From jhylton@users.sourceforge.net Thu May 22 17:43:05 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 09:43:05 -0700 Subject: [Python-checkins] python/dist/src/Include symtable.h,2.9,2.9.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv24293/Include Modified Files: Tag: release22-maint symtable.h Log Message: Backport fix for SF bug 734869 and sundry compiler cleanups. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9 retrieving revision 2.9.16.1 diff -C2 -d -r2.9 -r2.9.16.1 *** symtable.h 11 Aug 2001 21:51:17 -0000 2.9 --- symtable.h 22 May 2003 16:43:03 -0000 2.9.16.1 *************** *** 29,33 **** int st_errors; /* number of errors */ char *st_private; /* name of current class or NULL */ - int st_tmpname; /* temporary name counter */ PyFutureFeatures *st_future; /* module's future features */ }; --- 29,32 ---- *************** *** 48,51 **** --- 47,51 ---- int ste_generator; /* true if namespace is a generator */ int ste_opt_lineno; /* lineno of last exec or import * */ + int ste_tmpname; /* temporary name counter */ struct symtable *ste_table; } PySymtableEntryObject; From jhylton@users.sourceforge.net Thu May 22 17:43:06 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 09:43:06 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.234.4.7,2.234.4.8 symtable.c,2.10,2.10.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24293/Python Modified Files: Tag: release22-maint compile.c symtable.c Log Message: Backport fix for SF bug 734869 and sundry compiler cleanups. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.234.4.7 retrieving revision 2.234.4.8 diff -C2 -d -r2.234.4.7 -r2.234.4.8 *** compile.c 3 May 2003 10:53:51 -0000 2.234.4.7 --- compile.c 22 May 2003 16:43:03 -0000 2.234.4.8 *************** *** 562,565 **** --- 562,566 ---- static void symtable_assign(struct symtable *, node *, int); static void symtable_list_comprehension(struct symtable *, node *); + static void symtable_list_for(struct symtable *, node *); static int symtable_update_free_vars(struct symtable *); *************** *** 1382,1385 **** --- 1383,1388 ---- /* listmaker: test list_for */ char tmpname[30]; + + REQ(n, listmaker); PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->c_tmpname); com_addoparg(c, BUILD_LIST, 0); *************** *** 4390,4396 **** } } ! if (list == NULL) /* There used to be a check here for the size of */ ! return 0; /* the list being 0, which would have leaked the */ ! /* list if that condition was ever possible. JRH */ /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. --- 4393,4399 ---- } } ! if (list == NULL) ! return 0; ! /* There are cellvars that are also arguments. Create a dict to replace cellvars and put the args at the front. *************** *** 4407,4410 **** --- 4410,4414 ---- if (PyDict_DelItem(*cellvars, PyList_GET_ITEM(list, i)) < 0) goto fail; + Py_DECREF(v); } pos = 0; *************** *** 4417,4420 **** --- 4421,4425 ---- if (PyDict_SetItem(d, v, w) < 0) { Py_DECREF(w); + v = NULL; goto fail; } *************** *** 4426,4429 **** --- 4431,4435 ---- fail: Py_DECREF(d); + Py_XDECREF(v); return -1; } *************** *** 4689,4693 **** st->st_nscopes = 0; st->st_errors = 0; - st->st_tmpname = 0; st->st_private = NULL; return st; --- 4695,4698 ---- *************** *** 4733,4745 **** int pos = 0; ! if (list) ! if (PyList_SetSlice(list, 0, ! ((PyVarObject*)list)->ob_size, 0) < 0) return -1; - /* Yes, the above call CAN fail, even though it's reducing - the size of the list. The current implementation will - allocate temp memory equal to the size of the list: this - is avoidable in this specific case, but probably not - worth the effort of special-casing it. - JRH */ child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); --- 4738,4744 ---- int pos = 0; ! if (list && PyList_SetSlice(list, 0, ! PyList_GET_SIZE(list), 0) < 0) return -1; child = (PySymtableEntryObject *) PyList_GET_ITEM(ste->ste_children, i); *************** *** 4891,4897 **** prev = st->st_cur; if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { - /* Py_DECREF(st->st_cur); */ - /* I believe the previous line would lead to a - double-DECREF when st is disposed - JRH */ st->st_errors++; return; --- 4890,4893 ---- *************** *** 5155,5164 **** goto loop; case list_iter: n = CHILD(n, 0); ! if (TYPE(n) == list_for) { ! st->st_tmpname++; ! symtable_list_comprehension(st, n); ! st->st_tmpname--; ! } else { REQ(n, list_if); symtable_node(st, CHILD(n, 1)); --- 5151,5160 ---- goto loop; case list_iter: + /* only occurs when there are multiple for loops + in a list comprehension */ n = CHILD(n, 0); ! if (TYPE(n) == list_for) ! symtable_list_for(st, n); ! else { REQ(n, list_if); symtable_node(st, CHILD(n, 1)); *************** *** 5188,5195 **** case listmaker: if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_for) { ! st->st_tmpname++; ! symtable_list_comprehension(st, CHILD(n, 1)); ! symtable_node(st, CHILD(n, 0)); ! st->st_tmpname--; break; } --- 5184,5188 ---- case listmaker: if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == list_for) { ! symtable_list_comprehension(st, n); break; } *************** *** 5230,5234 **** /* The next two functions parse the argument tuple. ! symtable_default_arg() checks for names in the default arguments, which are references in the defining scope. symtable_params() parses the parameter names, which are defined in the function's --- 5223,5227 ---- /* The next two functions parse the argument tuple. ! symtable_default_args() checks for names in the default arguments, which are references in the defining scope. symtable_params() parses the parameter names, which are defined in the function's *************** *** 5389,5396 **** symtable_list_comprehension(struct symtable *st, node *n) { char tmpname[30]; ! PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", st->st_tmpname); symtable_add_def(st, tmpname, DEF_LOCAL); symtable_assign(st, CHILD(n, 1), 0); symtable_node(st, CHILD(n, 3)); --- 5382,5402 ---- symtable_list_comprehension(struct symtable *st, node *n) { + /* listmaker: test list_for */ char tmpname[30]; ! REQ(n, listmaker); ! PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ! ++st->st_cur->ste_tmpname); symtable_add_def(st, tmpname, DEF_LOCAL); + symtable_list_for(st, CHILD(n, 1)); + symtable_node(st, CHILD(n, 0)); + --st->st_cur->ste_tmpname; + } + + static void + symtable_list_for(struct symtable *st, node *n) + { + REQ(n, list_for); + /* list_for: for v in expr [list_iter] */ symtable_assign(st, CHILD(n, 1), 0); symtable_node(st, CHILD(n, 3)); Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10 retrieving revision 2.10.6.1 diff -C2 -d -r2.10 -r2.10.6.1 *** symtable.c 10 Dec 2001 00:53:18 -0000 2.10 --- symtable.c 22 May 2003 16:43:04 -0000 2.10.6.1 *************** *** 62,65 **** --- 62,66 ---- ste->ste_optimized = 0; ste->ste_opt_lineno = 0; + ste->ste_tmpname = 0; ste->ste_lineno = lineno; switch (type) { From doerwalter@users.sourceforge.net Thu May 22 18:22:56 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 22 May 2003 10:22:56 -0700 Subject: [Python-checkins] python/dist/src/PC winsound.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv8733/PC Modified Files: winsound.c Log Message: sound_playsound() doesn't have to be visible externally, so make it static. Index: winsound.c =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/winsound.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** winsound.c 9 Apr 2003 19:38:08 -0000 1.12 --- winsound.c 22 May 2003 17:22:54 -0000 1.13 *************** *** 74,78 **** "Beep(frequency, duration) - Make a beep through the PC speaker."); ! PyObject * sound_playsound(PyObject *s, PyObject *args) { --- 74,78 ---- "Beep(frequency, duration) - Make a beep through the PC speaker."); ! static PyObject * sound_playsound(PyObject *s, PyObject *args) { From akuchling@users.sourceforge.net Thu May 22 18:25:24 2003 From: akuchling@users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu, 22 May 2003 10:25:24 -0700 Subject: [Python-checkins] python/dist/src/Lib pdb.py,1.51.24.4,1.51.24.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10049 Modified Files: Tag: release22-maint pdb.py Log Message: Backport fix for SF bug #741171: pdb crashes when enabling a non-existing breakpoint Index: pdb.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v retrieving revision 1.51.24.4 retrieving revision 1.51.24.5 diff -C2 -d -r1.51.24.4 -r1.51.24.5 *** pdb.py 13 Jan 2003 21:16:24 -0000 1.51.24.4 --- pdb.py 22 May 2003 17:25:21 -0000 1.51.24.5 *************** *** 368,372 **** args = arg.split() for i in args: ! bp = bdb.Breakpoint.bpbynumber[int(i)] if bp: bp.enable() --- 368,382 ---- args = arg.split() for i in args: ! try: ! i = int(i) ! except ValueError: ! print 'Breakpoint index %r is not a number' % i ! continue ! ! if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): ! print 'No breakpoint numbered', i ! continue ! ! bp = bdb.Breakpoint.bpbynumber[i] if bp: bp.enable() *************** *** 375,379 **** args = arg.split() for i in args: ! bp = bdb.Breakpoint.bpbynumber[int(i)] if bp: bp.disable() --- 385,399 ---- args = arg.split() for i in args: ! try: ! i = int(i) ! except ValueError: ! print 'Breakpoint index %r is not a number' % i ! continue ! ! if not (0 <= i < len(bdb.Breakpoint.bpbynumber)): ! print 'No breakpoint numbered', i ! continue ! ! bp = bdb.Breakpoint.bpbynumber[i] if bp: bp.disable() From rhettinger@users.sourceforge.net Thu May 22 18:30:51 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 22 May 2003 10:30:51 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.24.8.6,1.24.8.7 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12344 Modified Files: Tag: release22-maint urllib2.py Log Message: Backport Jeremy's fix: req.method should be req.get_method. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.24.8.6 retrieving revision 1.24.8.7 diff -C2 -d -r1.24.8.6 -r1.24.8.7 *** urllib2.py 5 May 2003 04:10:40 -0000 1.24.8.6 --- urllib2.py 22 May 2003 17:30:48 -0000 1.24.8.7 *************** *** 417,426 **** """ ! if (code in (301, 302, 303, 307) and req.method() in ("GET", "HEAD") or ! code in (302, 303) and req.method() == "POST"): ! # Strictly (according to RFC 2616), 302 in response to a POST ! # MUST NOT cause a redirection without confirmation from the user ! # (of urllib2, in this case). In practice, essentially all clients ! # do redirect in this case, so we do the same. return Request(newurl, headers=req.headers) else: --- 417,428 ---- """ ! m = req.get_method() ! if (code in (301, 302, 303, 307) and m in ("GET", "HEAD") ! or code in (302, 303) and m == "POST"): ! # Strictly (according to RFC 2616), 302 in response to a ! # POST MUST NOT cause a redirection without confirmation ! # from the user (of urllib2, in this case). In practice, ! # essentially all clients do redirect in this case, so we ! # do the same. return Request(newurl, headers=req.headers) else: From doerwalter@users.sourceforge.net Thu May 22 18:32:42 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 22 May 2003 10:32:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_mimetools,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv13285/Lib/test/output Removed Files: test_mimetools Log Message: Port test_mimetools.py to PyUnit and add various tests. >From SF patch #736962. --- test_mimetools DELETED --- From doerwalter@users.sourceforge.net Thu May 22 18:32:42 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu, 22 May 2003 10:32:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_mimetools.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv13285/Lib/test Modified Files: test_mimetools.py Log Message: Port test_mimetools.py to PyUnit and add various tests. >From SF patch #736962. Index: test_mimetools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_mimetools.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_mimetools.py 23 Jul 2002 19:03:57 -0000 1.3 --- test_mimetools.py 22 May 2003 17:32:40 -0000 1.4 *************** *** 1,18 **** ! from test.test_support import TestFailed ! import mimetools - import string,StringIO - start = string.ascii_letters + "=" + string.digits + "\n" - for enc in ['7bit','8bit','base64','quoted-printable']: - print enc, - i = StringIO.StringIO(start) - o = StringIO.StringIO() - mimetools.encode(i,o,enc) - i = StringIO.StringIO(o.getvalue()) - o = StringIO.StringIO() - mimetools.decode(i,o,enc) - if o.getvalue()==start: - print "PASS" - else: - print "FAIL" - print o.getvalue() --- 1,51 ---- ! import unittest ! from test import test_support ! ! import string, StringIO, mimetools, sets ! ! msgtext1 = mimetools.Message(StringIO.StringIO( ! """Content-Type: text/plain; charset=iso-8859-1; format=flowed ! Content-Transfer-Encoding: 8bit ! ! Foo! ! """)) ! ! class MimeToolsTest(unittest.TestCase): ! ! def test_decodeencode(self): ! start = string.ascii_letters + "=" + string.digits + "\n" ! for enc in ['7bit','8bit','base64','quoted-printable', ! 'uuencode', 'x-uuencode', 'uue', 'x-uue']: ! i = StringIO.StringIO(start) ! o = StringIO.StringIO() ! mimetools.encode(i, o, enc) ! i = StringIO.StringIO(o.getvalue()) ! o = StringIO.StringIO() ! mimetools.decode(i, o, enc) ! self.assertEqual(o.getvalue(), start) ! ! def test_boundary(self): ! s = sets.Set([""]) ! for i in xrange(100): ! nb = mimetools.choose_boundary() ! self.assert_(nb not in s) ! s.add(nb) ! ! def test_message(self): ! msg = mimetools.Message(StringIO.StringIO(msgtext1)) ! self.assertEqual(msg.gettype(), "text/plain") ! self.assertEqual(msg.getmaintype(), "text") ! self.assertEqual(msg.getsubtype(), "plain") ! self.assertEqual(msg.getplist(), ["charset=iso-8859-1", "format=flowed"]) ! self.assertEqual(msg.getparamnames(), ["charset", "format"]) ! self.assertEqual(msg.getparam("charset"), "iso-8859-1") ! self.assertEqual(msg.getparam("format"), "flowed") ! self.assertEqual(msg.getparam("spam"), None) ! self.assertEqual(msg.getencoding(), "8bit") ! ! def test_main(): ! test_support.run_unittest(MimeToolsTest) ! ! if __name__=="__main__": ! test_main() From bwarsaw@users.sourceforge.net Thu May 22 18:36:57 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 10:36:57 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.73.4.18,1.73.4.19 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv15054 Modified Files: Tag: release22-maint setup.py Log Message: Link the dbm module against gdbm if it exists and if no earlier library match was found. This fixes dbm on RedHat 9 and doesn't appear (so far ) to have any regressions on other *nixes. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.73.4.18 retrieving revision 1.73.4.19 diff -C2 -d -r1.73.4.18 -r1.73.4.19 *** setup.py 18 May 2003 13:42:58 -0000 1.73.4.18 --- setup.py 22 May 2003 17:36:54 -0000 1.73.4.19 *************** *** 407,410 **** --- 407,413 ---- exts.append( Extension('dbm', ['dbmmodule.c'], libraries = ['db1'] ) ) + elif self.compiler.find_library_file(lib_dirs, 'gdbm'): + exts.append( Extension('dbm', ['dbmmodule.c'], + libraries = ['gdbm'] ) ) else: exts.append( Extension('dbm', ['dbmmodule.c']) ) From jhylton@users.sourceforge.net Thu May 22 19:11:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 11:11:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_new.py,1.14,1.14.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28591/Lib/test Modified Files: Tag: release22-maint test_new.py Log Message: Backport fix for SF bug 692776. Add a tp_new slot to function objects that handles the case of a function requiring a closure. Put the function type in the new module, rather than having a function new.function(). Add tests. Index: test_new.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_new.py,v retrieving revision 1.14 retrieving revision 1.14.6.1 diff -C2 -d -r1.14 -r1.14.6.1 *** test_new.py 9 Dec 2001 10:19:25 -0000 1.14 --- test_new.py 22 May 2003 18:11:19 -0000 1.14.6.1 *************** *** 72,75 **** --- 72,99 ---- 'Could not create a proper function object') + # test the various extended flavors of function.new + def f(x): + def g(y): + return x + y + return g + g = f(4) + new.function(f.func_code, {}, "blah") + g2 = new.function(g.func_code, {}, "blah", (2,), g.func_closure) + verify(g2() == 6) + g3 = new.function(g.func_code, {}, "blah", None, g.func_closure) + verify(g3(5) == 9) + def test_closure(func, closure, exc): + try: + new.function(func.func_code, {}, "", None, closure) + except exc: + pass + else: + print "corrupt closure accepted" + + test_closure(g, None, TypeError) # invalid closure + test_closure(g, (1,), TypeError) # non-cell in closure + test_closure(g, (1, 1), ValueError) # closure is wrong size + test_closure(f, g.func_closure, ValueError) # no closure needed + print 'new.code()' # bogus test of new.code() From jhylton@users.sourceforge.net Thu May 22 19:11:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 11:11:23 -0700 Subject: [Python-checkins] python/dist/src/Objects funcobject.c,2.50.4.2,2.50.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv28591/Objects Modified Files: Tag: release22-maint funcobject.c Log Message: Backport fix for SF bug 692776. Add a tp_new slot to function objects that handles the case of a function requiring a closure. Put the function type in the new module, rather than having a function new.function(). Add tests. Index: funcobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/funcobject.c,v retrieving revision 2.50.4.2 retrieving revision 2.50.4.3 diff -C2 -d -r2.50.4.2 -r2.50.4.3 *** funcobject.c 9 May 2003 18:29:21 -0000 2.50.4.2 --- funcobject.c 22 May 2003 18:11:20 -0000 2.50.4.3 *************** *** 267,270 **** --- 267,372 ---- }; + static char func_doc[] = + "function(code, globals[, name[, argdefs[, closure]]])\n\ + \n\ + Create a function object from a code object and a dictionary.\n\ + The optional name string overrides the name from the code object.\n\ + The optional argdefs tuple specifies the default argument values.\n\ + The optional closure tuple supplies the bindings for free variables."; + + /* func_new() maintains the following invariants for closures. The + closure must correspond to the free variables of the code object. + + if len(code.co_freevars) == 0: + closure = NULL + else: + len(closure) == len(code.co_freevars) + for every elt in closure, type(elt) == cell + */ + + static PyObject * + func_new(PyTypeObject* type, PyObject* args, PyObject* kw) + { + PyCodeObject *code; + PyObject *globals; + PyObject *name = Py_None; + PyObject *defaults = Py_None; + PyObject *closure = Py_None; + PyFunctionObject *newfunc; + int nfree, nclosure; + static char *kwlist[] = {"code", "globals", "name", + "argdefs", "closure", 0}; + + if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!|OOO:function", + kwlist, + &PyCode_Type, &code, + &PyDict_Type, &globals, + &name, &defaults, &closure)) + return NULL; + if (name != Py_None && !PyString_Check(name)) { + PyErr_SetString(PyExc_TypeError, + "arg 3 (name) must be None or string"); + return NULL; + } + if (defaults != Py_None && !PyTuple_Check(defaults)) { + PyErr_SetString(PyExc_TypeError, + "arg 4 (defaults) must be None or tuple"); + return NULL; + } + nfree = PyTuple_GET_SIZE(code->co_freevars); + if (!PyTuple_Check(closure)) { + if (nfree && closure == Py_None) { + PyErr_SetString(PyExc_TypeError, + "arg 5 (closure) must be tuple"); + return NULL; + } + else if (closure != Py_None) { + PyErr_SetString(PyExc_TypeError, + "arg 5 (closure) must be None or tuple"); + return NULL; + } + } + + /* check that the closure is well-formed */ + nclosure = closure == Py_None ? 0 : PyTuple_GET_SIZE(closure); + if (nfree != nclosure) + return PyErr_Format(PyExc_ValueError, + "%s requires closure of length %d, not %d", + PyString_AS_STRING(code->co_name), + nfree, nclosure); + if (nclosure) { + int i; + for (i = 0; i < nclosure; i++) { + PyObject *o = PyTuple_GET_ITEM(closure, i); + if (!PyCell_Check(o)) { + return PyErr_Format(PyExc_TypeError, + "arg 5 (closure) expected cell, found %s", + o->ob_type->tp_name); + } + } + } + + newfunc = (PyFunctionObject *)PyFunction_New((PyObject *)code, + globals); + if (newfunc == NULL) + return NULL; + + if (name != Py_None) { + Py_INCREF(name); + Py_DECREF(newfunc->func_name); + newfunc->func_name = name; + } + if (defaults != Py_None) { + Py_INCREF(defaults); + newfunc->func_defaults = defaults; + } + if (closure != Py_None) { + Py_INCREF(closure); + newfunc->func_closure = closure; + } + + return (PyObject *)newfunc; + } + static void func_dealloc(PyFunctionObject *op) *************** *** 416,420 **** 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! 0, /* tp_doc */ (traverseproc)func_traverse, /* tp_traverse */ 0, /* tp_clear */ --- 518,522 ---- 0, /* tp_as_buffer */ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ ! func_doc, /* tp_doc */ (traverseproc)func_traverse, /* tp_traverse */ 0, /* tp_clear */ *************** *** 431,434 **** --- 533,539 ---- 0, /* tp_descr_set */ offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + func_new, /* tp_new */ }; From jhylton@users.sourceforge.net Thu May 22 19:11:23 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Thu, 22 May 2003 11:11:23 -0700 Subject: [Python-checkins] python/dist/src/Modules newmodule.c,2.37.8.1,2.37.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv28591/Modules Modified Files: Tag: release22-maint newmodule.c Log Message: Backport fix for SF bug 692776. Add a tp_new slot to function objects that handles the case of a function requiring a closure. Put the function type in the new module, rather than having a function new.function(). Add tests. Index: newmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Attic/newmodule.c,v retrieving revision 2.37.8.1 retrieving revision 2.37.8.2 diff -C2 -d -r2.37.8.1 -r2.37.8.2 *** newmodule.c 28 Jan 2002 15:03:36 -0000 2.37.8.1 --- newmodule.c 22 May 2003 18:11:20 -0000 2.37.8.2 *************** *** 54,99 **** } - static char new_function_doc[] = - "Create a function object from (CODE, GLOBALS, [NAME [, ARGDEFS]])."; - - static PyObject * - new_function(PyObject* unused, PyObject* args) - { - PyObject* code; - PyObject* globals; - PyObject* name = Py_None; - PyObject* defaults = Py_None; - PyFunctionObject* newfunc; - - if (!PyArg_ParseTuple(args, "O!O!|OO!:function", - &PyCode_Type, &code, - &PyDict_Type, &globals, - &name, - &PyTuple_Type, &defaults)) - return NULL; - if (name != Py_None && !PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, - "arg 3 (name) must be None or string"); - return NULL; - } - - newfunc = (PyFunctionObject *)PyFunction_New(code, globals); - if (newfunc == NULL) - return NULL; - - if (name != Py_None) { - Py_XINCREF(name); - Py_XDECREF(newfunc->func_name); - newfunc->func_name = name; - } - if (defaults != Py_None) { - Py_XINCREF(defaults); - Py_XDECREF(newfunc->func_defaults); - newfunc->func_defaults = defaults; - } - - return (PyObject *)newfunc; - } - static char new_code_doc[] = "Create a code object from (ARGCOUNT, NLOCALS, STACKSIZE, FLAGS, CODESTRING,\n" --- 54,57 ---- *************** *** 192,197 **** {"instancemethod", new_instancemethod, METH_VARARGS, new_im_doc}, - {"function", new_function, - METH_VARARGS, new_function_doc}, {"code", new_code, METH_VARARGS, new_code_doc}, --- 150,153 ---- *************** *** 211,215 **** initnew(void) { ! Py_InitModule4("new", new_methods, new_doc, (PyObject *)NULL, ! PYTHON_API_VERSION); } --- 167,174 ---- initnew(void) { ! PyObject *m; ! m = Py_InitModule4("new", new_methods, new_doc, (PyObject *)NULL, ! PYTHON_API_VERSION); ! if (m) ! PyModule_AddObject(m, "function", &PyFunction_Type); } From tim_one@users.sourceforge.net Thu May 22 19:45:49 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 22 May 2003 11:45:49 -0700 Subject: [Python-checkins] python/dist/src/Modules newmodule.c,2.37.8.2,2.37.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv15317/22/Modules Modified Files: Tag: release22-maint newmodule.c Log Message: Squash new compiler wng (mistmatching formal/actual pointer types). Index: newmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Attic/newmodule.c,v retrieving revision 2.37.8.2 retrieving revision 2.37.8.3 diff -C2 -d -r2.37.8.2 -r2.37.8.3 *** newmodule.c 22 May 2003 18:11:20 -0000 2.37.8.2 --- newmodule.c 22 May 2003 18:45:47 -0000 2.37.8.3 *************** *** 171,174 **** PYTHON_API_VERSION); if (m) ! PyModule_AddObject(m, "function", &PyFunction_Type); } --- 171,174 ---- PYTHON_API_VERSION); if (m) ! PyModule_AddObject(m, "function", (PyObject *)&PyFunction_Type); } From jeremy@alum.mit.edu Thu May 22 20:06:16 2003 From: jeremy@alum.mit.edu (Jeremy Hylton) Date: 22 May 2003 15:06:16 -0400 Subject: [Python-checkins] python/dist/src/Python compile.c,2.285,2.286 symtable.c,2.10,2.11 In-Reply-To: <000201c3207f$bc23bce0$125ffea9@oemcomputer> References: <000201c3207f$bc23bce0$125ffea9@oemcomputer> Message-ID: <1053630375.18668.293.camel@slothrop.zope.com> On Thu, 2003-05-22 at 12:22, Raymond Hettinger wrote: > > Modified Files: > > compile.c symtable.c > > Log Message: > > Fix for SF [ 734869 ] Lambda functions in list comprehensions > > > > The compiler was reseting the list comprehension tmpname counter for each function, but the symtable was using the same counter > for the entire module. Repair by move tmpname into the symtable entry. > > > > Bugfix candidate. > > It would be great if this were backported to 2.2.3. > I applying it directly with cvs -j but that led to an > C assertion failure in: python_d regrtest.py test_symtable It is backported! There are lots of unrelated changes in compile.c, so I applied the changes by hand. Jeremy From bwarsaw@users.sourceforge.net Thu May 22 20:13:39 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 12:13:39 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.80,1.337.2.4.2.81 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv1673 Modified Files: Tag: release22-maint NEWS Log Message: Go ahead and label this 2.2.3c1 Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.80 retrieving revision 1.337.2.4.2.81 diff -C2 -d -r1.337.2.4.2.80 -r1.337.2.4.2.81 *** NEWS 22 May 2003 18:55:13 -0000 1.337.2.4.2.80 --- NEWS 22 May 2003 19:13:35 -0000 1.337.2.4.2.81 *************** *** 1,4 **** ! What's New in Python 2.2.3 ? ! Release date: XX-XXX-2003 ============================ --- 1,4 ---- ! What's New in Python 2.2.3c1 ? ! Release date: 22-May-2003 ============================ From bwarsaw@users.sourceforge.net Thu May 22 19:55:16 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 11:55:16 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.79,1.337.2.4.2.80 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv21927 Modified Files: Tag: release22-maint NEWS Log Message: A bunch of NEWS file updates Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.79 retrieving revision 1.337.2.4.2.80 diff -C2 -d -r1.337.2.4.2.79 -r1.337.2.4.2.80 *** NEWS 21 May 2003 20:43:08 -0000 1.337.2.4.2.79 --- NEWS 22 May 2003 18:55:13 -0000 1.337.2.4.2.80 *************** *** 40,43 **** --- 40,45 ---- - Skip locale test on Mac OS X. + - Fixed some build problems related to Redhat Linux 9. + - Backported the "largefile" requirement for test_largefile on Mac OS X. *************** *** 45,48 **** --- 47,52 ---- more robust. + - Added new encodings for Ukrainian Cyrillic. + - SF #710576: Backport of fix for #663074, to implement per-interpreter codecs registries. This adds new members at the end of *************** *** 57,62 **** fixed. - Backported SF patch #676342: after using pdb, the readline command ! completion was botched. - Fix problem building on OSF1 because the compiler only accepted --- 61,70 ---- fixed. + - SF #645777: list.extend() works with any iterable and is no longer + experimental. + - Backported SF patch #676342: after using pdb, the readline command ! completion was botched. Backport fix for SF bug #741171, pdb ! crashes when enabling a non-existent breakpoint. - Fix problem building on OSF1 because the compiler only accepted *************** *** 120,123 **** --- 128,135 ---- could cause "exception set without error return" failures. + - Fixed an old bug in asyncore.py which could cause bogus read calls + on file descriptors after a signal is handled while blocked in + select(). + - SF #643260: __rpow__ wasn't being called. *************** *** 171,174 **** --- 183,197 ---- crashed gettext.GNUTranslations parsing. Also, export more symbols in the gettext module's __all__. + + - Other patch and bug fix backports: 734869, 497420, 728322, 730963, + 723831, 708604, 723136, 549141, 557704, 724751, 716969, 711835, + 697220, 710498, 706338, 659834, 695250, 672614, 707701, 698517, + 709428, 708201, 700798, 703471, 676990, 521782, 635570, 633359, + 610299, 491107, 687655, 684667, 642168, 682514, 675259, 654974, + 655271, 641111, 642742, 669553, 634866, 664183, 664044, 665570, + 430610, 427345, 658106, 643227, 649095, 646578, 637941, 639170, + 635929, 637807, 637810, 424106, 635595, 613605, 635656, 633560, + 632864, 618146, 632196, 616211, 577000, 546579, 626554, 606463, + 217195 From python@rcn.com Thu May 22 21:03:21 2003 From: python@rcn.com (Raymond Hettinger) Date: Thu, 22 May 2003 16:03:21 -0400 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.5,1.6 noddy2.c,1.1,1.2 noddy3.c,1.1,1.2 References: Message-ID: <006b01c3209d$3205c8a0$125ffea9@oemcomputer> Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.5,1.6 noddy2.c,1.1,1.2 noddy3.c,1.1,1.2 I think the module initialization code needs a line to incref the type before adding it to the module. Raymond Hettinger ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ##### ##### ##### ################################################################# ################################################################# ################################################################# From rhettinger@users.sourceforge.net Fri May 23 04:55:44 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 22 May 2003 20:55:44 -0700 Subject: [Python-checkins] python/dist/src/Modules _randommodule.c,1.5,1.6 itertoolsmodule.c,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13889 Modified Files: _randommodule.c itertoolsmodule.c Log Message: PyType_GenericAlloc is inherited from object. Index: _randommodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_randommodule.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** _randommodule.c 23 Apr 2003 00:14:18 -0000 1.5 --- _randommodule.c 23 May 2003 03:55:41 -0000 1.6 *************** *** 510,514 **** 0, /*tp_dictoffset*/ 0, /*tp_init*/ ! PyType_GenericAlloc, /*tp_alloc*/ random_new, /*tp_new*/ _PyObject_Del, /*tp_free*/ --- 510,514 ---- 0, /*tp_dictoffset*/ 0, /*tp_init*/ ! 0, /*tp_alloc*/ random_new, /*tp_new*/ _PyObject_Del, /*tp_free*/ Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** itertoolsmodule.c 22 May 2003 16:32:58 -0000 1.14 --- itertoolsmodule.c 23 May 2003 03:55:42 -0000 1.15 *************** *** 152,156 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ cycle_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 152,156 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ cycle_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 301,305 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ dropwhile_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 301,305 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ dropwhile_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 449,453 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ takewhile_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 449,453 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ takewhile_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 639,643 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ islice_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 639,643 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ islice_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 778,782 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ starmap_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 778,782 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ starmap_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 965,969 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ imap_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 965,969 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ imap_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 1100,1104 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ chain_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 1100,1104 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ chain_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 1249,1253 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ ifilter_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 1249,1253 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ ifilter_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 1398,1402 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ ifilterfalse_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 1398,1402 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ ifilterfalse_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 1482,1486 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ count_new, /* tp_new */ }; --- 1482,1486 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ count_new, /* tp_new */ }; *************** *** 1666,1670 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ izip_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 1666,1670 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ izip_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ *************** *** 1776,1780 **** 0, /* tp_dictoffset */ 0, /* tp_init */ ! PyType_GenericAlloc, /* tp_alloc */ repeat_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ --- 1776,1780 ---- 0, /* tp_dictoffset */ 0, /* tp_init */ ! 0, /* tp_alloc */ repeat_new, /* tp_new */ PyObject_GC_Del, /* tp_free */ From bwarsaw@users.sourceforge.net Fri May 23 04:37:14 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 20:37:14 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.60.2.1.2.10,2.60.2.1.2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv6206 Modified Files: Tag: release22-maint patchlevel.h Log Message: Bumping PY_VERSION Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.60.2.1.2.10 retrieving revision 2.60.2.1.2.11 diff -C2 -d -r2.60.2.1.2.10 -r2.60.2.1.2.11 *** patchlevel.h 22 May 2003 14:44:31 -0000 2.60.2.1.2.10 --- patchlevel.h 23 May 2003 03:37:11 -0000 2.60.2.1.2.11 *************** *** 27,31 **** /* Version as a string */ ! #define PY_VERSION "2.2.3c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 27,31 ---- /* Version as a string */ ! #define PY_VERSION "2.2.3c1+" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tismer@users.sourceforge.net Fri May 23 04:33:37 2003 From: tismer@users.sourceforge.net (tismer@users.sourceforge.net) Date: Thu, 22 May 2003 20:33:37 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.119,2.120 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv4647/dist/src/Include Modified Files: object.h Log Message: Generalized my type flags structure extension without being specific about the purpose. Increased my claim to two bits, hoping that nobody will complain about it. I'm taking the highest two bits, whatever the integer word size may be. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.119 retrieving revision 2.120 diff -C2 -d -r2.119 -r2.120 *** object.h 20 May 2003 15:14:31 -0000 2.119 --- object.h 23 May 2003 03:33:35 -0000 2.120 *************** *** 489,497 **** #define Py_TPFLAGS_HAVE_GC (1L<<14) ! /* Objects support special, non-recursive calls (reserved for Stackless) */ #ifdef STACKLESS ! #define Py_TPFLAGS_HAVE_NR_THINGS (1L<<31) #else ! #define Py_TPFLAGS_HAVE_NR_THINGS 0 #endif --- 489,497 ---- #define Py_TPFLAGS_HAVE_GC (1L<<14) ! /* These last two bits are preserved for Stackless Python */ #ifdef STACKLESS ! #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<(sizeof(int)*8-2)) #else ! #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 #endif *************** *** 504,508 **** Py_TPFLAGS_HAVE_ITER | \ Py_TPFLAGS_HAVE_CLASS | \ ! Py_TPFLAGS_HAVE_NR_THINGS | \ 0) --- 504,508 ---- Py_TPFLAGS_HAVE_ITER | \ Py_TPFLAGS_HAVE_CLASS | \ ! Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ 0) From gward@users.sourceforge.net Fri May 23 03:44:52 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 May 2003 19:44:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15847 Modified Files: libossaudiodev.tex Log Message: Lots of wordsmithing and typographical improvement. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** libossaudiodev.tex 3 May 2003 19:45:47 -0000 1.7 --- libossaudiodev.tex 23 May 2003 02:44:46 -0000 1.8 *************** *** 44,48 **** documentation for the OSS C API} \seetext{The module defines a large number of constants supplied by ! the OSS device driver; see \file{} on either Linux or FreeBSD for a listing .} \end{seealso} --- 44,48 ---- documentation for the OSS C API} \seetext{The module defines a large number of constants supplied by ! the OSS device driver; see \code{} on either Linux or FreeBSD for a listing .} \end{seealso} *************** *** 68,78 **** methods; see below for the complete list of methods. - Note the unusual calling syntax: the \emph{first} argument is optional, - and the second is required. This is a historical artifact for - compatibility with the older \module{linuxaudiodev} module which - \module{ossaudiodev} supersedes. % XXX it might also be motivated - % by my unfounded-but-still-possibly-true belief that the default - % audio device varies unpredictably across operating systems. -GW - \var{device} is the audio device filename to use. If it is not specified, this module first looks in the environment variable --- 68,71 ---- *************** *** 86,89 **** --- 79,89 ---- activity needed. Further, some soundcards are half-duplex: they can be opened for reading or writing, but not both at once. + + Note the unusual calling syntax: the \emph{first} argument is optional, + and the second is required. This is a historical artifact for + compatibility with the older \module{linuxaudiodev} module which + \module{ossaudiodev} supersedes. % XXX it might also be motivated + % by my unfounded-but-still-possibly-true belief that the default + % audio device varies unpredictably across operating systems. -GW \end{funcdesc} *************** *** 99,111 **** \subsection{Audio Device Objects \label{ossaudio-device-objects}} ! Setting up the device ! ! To set up the device, three functions must be called in the correct ! sequence: \begin{enumerate} ! \item \method{setfmt()} to set the output format, ! \item \method{channels()} to set the number of channels, and ! \item \method{speed()} to set the sample rate. \end{enumerate} The audio device objects are returned by \function{open()} define the --- 99,112 ---- \subsection{Audio Device Objects \label{ossaudio-device-objects}} ! Before you can write to or read from an audio device, you must call ! three methods in the correct order: \begin{enumerate} ! \item \method{setfmt()} to set the output format ! \item \method{channels()} to set the number of channels ! \item \method{speed()} to set the sample rate \end{enumerate} + Alternately, you can use the \method{setparameters()} method to set all + three audio parameters at once. This is more convenient, but may not be + as flexible in all cases. The audio device objects are returned by \function{open()} define the *************** *** 113,170 **** \begin{methoddesc}[audio device]{close}{} ! This method explicitly closes the device. It is useful in situations ! where deleting the object does not immediately close it since there are ! other references to it. A closed device should not be used again. \end{methoddesc} \begin{methoddesc}[audio device]{fileno}{} ! Returns the file descriptor associated with the device. \end{methoddesc} \begin{methoddesc}[audio device]{read}{size} ! Reads \var{size} samples from the audio input and returns them as a ! Python string. The function blocks until enough data is available. \end{methoddesc} \begin{methoddesc}[audio device]{write}{data} ! Writes Python string \var{data} to the audio device and returns the ! number of bytes written. If the audio device is opened in blocking ! mode, the entire string is always written. If the device is opened in ! nonblocking mode, some data may not be written---see ! \method{writeall()}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} ! Writes the entire Python string \var{data} to the audio device. If the ! device is opened in blocking mode, behaves identially to ! \method{write()}; in nonblocking mode, waits until the device becomes ! available before feeding it more data. Returns \code{None}, since the ! amount of data written is always equal to the amount of data supplied. \end{methoddesc} ! Simple IOCTLs: \begin{methoddesc}[audio device]{nonblock}{} ! Attempts to put the device into nonblocking mode. Once in nonblocking ! mode there is no way to return to blocking mode. ! Raises \exception{IOError} if the IOCTL failed. \end{methoddesc} \begin{methoddesc}[audio device]{getfmts}{} ! Returns a bitmask of the audio output formats supported by the soundcard. On a typical Linux system, these formats are: \begin{tableii}{l|l}{constant}{Format}{Description} \lineii{AFMT_MU_LAW} ! {a logarithmic encoding. This is the default format on ! \file{/dev/audio} and is the format used by Sun .au files.} \lineii{AFMT_A_LAW} {a logarithmic encoding} \lineii{AFMT_IMA_ADPCM} {a 4:1 compressed format defined by the Interactive Multimedia ! Association.} \lineii{AFMT_U8} ! {Unsigned, 8-bit audio.} \lineii{AFMT_S16_LE} {Unsigned, 16-bit audio, little-endian byte order (as used by --- 114,177 ---- \begin{methoddesc}[audio device]{close}{} ! Explicitly close the audio device. When you are done writing to or ! reading from an audio device, you should explicitly close it. A closed ! device cannot be used again. \end{methoddesc} \begin{methoddesc}[audio device]{fileno}{} ! Return the file descriptor associated with the device. \end{methoddesc} \begin{methoddesc}[audio device]{read}{size} ! Read \var{size} bytes from the audio input and return them as a Python ! string. Unlike most \UNIX{} device drivers, OSS audio devices in ! blocking mode (the default) will block \function{read()} until the ! entire requested amount of data is available. \end{methoddesc} \begin{methoddesc}[audio device]{write}{data} ! Write the Python string \var{data} to the audio device and return the ! number of bytes written. If the audio device is in blocking mode (the ! default), the entire string is always written (again, this is different ! from usual \UNIX{} device semantics). If the device is in non-blocking ! mode, some data may not be written---see \method{writeall()}. \end{methoddesc} \begin{methoddesc}[audio device]{writeall}{data} ! Write the entire Python string \var{data} to the audio device. If the ! device is in blocking mode (the default), behaves identically to ! \method{write()}; in non-blocking mode, \method{writeall()} waits until the ! audio device is able to accept data, writes as much data as it will ! accept, and repeats until \var{data} has been completely written. Has ! no return value, since the amount of data written is always equal to the ! amount of data supplied. \end{methoddesc} ! The following methods each map to exactly one ! \function{ioctl()} system call. If the underlying \function{ioctl()} ! fails, they all raise \exception{IOError}. \begin{methoddesc}[audio device]{nonblock}{} ! Put the device into non-blocking mode. Once in non-blocking mode, there ! is no way to return it to blocking mode. ! Corresponds to the \code{SNDCTL_DSP_NONBLOCK} ioctl. \end{methoddesc} \begin{methoddesc}[audio device]{getfmts}{} ! Return a bitmask of the audio output formats supported by the soundcard. On a typical Linux system, these formats are: \begin{tableii}{l|l}{constant}{Format}{Description} \lineii{AFMT_MU_LAW} ! {a logarithmic encoding (used by Sun \code{.au} files and ! \filenq{/dev/audio})} \lineii{AFMT_A_LAW} {a logarithmic encoding} \lineii{AFMT_IMA_ADPCM} {a 4:1 compressed format defined by the Interactive Multimedia ! Association} \lineii{AFMT_U8} ! {Unsigned, 8-bit audio} \lineii{AFMT_S16_LE} {Unsigned, 16-bit audio, little-endian byte order (as used by *************** *** 174,178 **** PowerPC, Sparc)} \lineii{AFMT_S8} ! {Signed, 8 bit audio.} \lineii{AFMT_U16_LE} {Signed, 16-bit little-endian audio} --- 181,185 ---- PowerPC, Sparc)} \lineii{AFMT_S8} ! {Signed, 8 bit audio} \lineii{AFMT_U16_LE} {Signed, 16-bit little-endian audio} *************** *** 183,194 **** support \constant{AFMT_U8}; the most common format used today is \constant{AFMT_S16_LE}. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} ! Used to set the current audio format to \var{format}---see ! \method{getfmts()} for a list. May also be used to return the current ! audio format---do this by passing an ``audio format'' of ! \constant{AFMT_QUERY}. Returns the audio format that the device was set ! to, which may not be the requested format. \end{methoddesc} --- 190,206 ---- support \constant{AFMT_U8}; the most common format used today is \constant{AFMT_S16_LE}. + + Corresponds to the \code{SNDCTL_DSP_GETFMTS} ioctl. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} ! Try to set the current audio format to \var{format}---see ! \method{getfmts()} for a list. Return the audio format that the device ! was set to, which may not be the requested format. May also be used to ! return the current audio format---do this by passing an ``audio format'' ! of ! \constant{AFMT_QUERY}. ! ! Corresponds to the \code{SNDCTL_DSP_SETFMT} ioctl. \end{methoddesc} *************** *** 201,216 **** \begin{methoddesc}[audio device]{speed}{samplerate} ! Sets the samplerate to \var{samplerate} samples per second and returns ! the rate actually set. Most sound devices don't support arbitrary ! sample rates. Common rates are: ! ! 8000---default rate ! 11025---speech recording ! 22050 ! 44100---Audio CD-quality (at 16 bits/sample and 2 channels) ! 96000---DVD-quality \end{methoddesc} ! \begin{methoddesc}[audio device]{sync} Waits until the sound device has played every byte in its buffer and returns. This also occurs when the sound device is closed. The OSS --- 213,229 ---- \begin{methoddesc}[audio device]{speed}{samplerate} ! Try to set the audio sampling rate to \var{samplerate} samples per ! second. Returns the rate actually set. Most sound devices don't ! support arbitrary sampling rates. Common rates are: ! \begin{tableii}{l|l}{textrm}{Rate}{Description} ! \lineii{8000}{default rate for \filenq{/dev/audio}} ! \lineii{11025}{speech recording} ! \lineii{22050}{} ! \lineii{44100}{CD quality audio (at 16 bits/sample and 2 channels)} ! \lineii{96000}{DVD quality audio (at 24 bits/sample)} ! \end{tableii} \end{methoddesc} ! \begin{methoddesc}[audio device]{sync}{} Waits until the sound device has played every byte in its buffer and returns. This also occurs when the sound device is closed. The OSS *************** *** 219,223 **** \end{methoddesc} ! \begin{methoddesc}[audio device]{reset} Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends --- 232,236 ---- \end{methoddesc} ! \begin{methoddesc}[audio device]{reset}{} Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends *************** *** 225,229 **** \end{methoddesc} ! \begin{methoddesc}[audio device]{post} To be used like a lightweight \method{sync()}, the \method{post()} IOCTL informs the audio device that there is a likely to be a pause in --- 238,242 ---- \end{methoddesc} ! \begin{methoddesc}[audio device]{post}{} To be used like a lightweight \method{sync()}, the \method{post()} IOCTL informs the audio device that there is a likely to be a pause in From gward@users.sourceforge.net Fri May 23 02:50:40 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 22 May 2003 18:50:40 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31065 Modified Files: ossaudiodev.c Log Message: Release the GIL around read(), write(), and select() calls. Bug spotted by Joerg Lehmann . Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** ossaudiodev.c 4 Apr 2003 01:47:42 -0000 1.26 --- ossaudiodev.c 23 May 2003 01:50:37 -0000 1.27 *************** *** 386,390 **** return NULL; cp = PyString_AS_STRING(rv); ! if ((count = read(self->fd, cp, size)) < 0) { PyErr_SetFromErrno(PyExc_IOError); Py_DECREF(rv); --- 386,395 ---- return NULL; cp = PyString_AS_STRING(rv); ! ! Py_BEGIN_ALLOW_THREADS ! count = read(self->fd, cp, size); ! Py_END_ALLOW_THREADS ! ! if (count < 0) { PyErr_SetFromErrno(PyExc_IOError); Py_DECREF(rv); *************** *** 405,409 **** return NULL; } ! if ((rv = write(self->fd, cp, size)) == -1) { return PyErr_SetFromErrno(PyExc_IOError); } else { --- 410,419 ---- return NULL; } ! ! Py_BEGIN_ALLOW_THREADS ! rv = write(self->fd, cp, size); ! Py_END_ALLOW_THREADS ! ! if (rv == -1) { return PyErr_SetFromErrno(PyExc_IOError); } else { *************** *** 436,445 **** --- 446,459 ---- while (size > 0) { + Py_BEGIN_ALLOW_THREADS select_rv = select(self->fd+1, NULL, &write_set_fds, NULL, NULL); + Py_END_ALLOW_THREADS assert(select_rv != 0); /* no timeout, can't expire */ if (select_rv == -1) return PyErr_SetFromErrno(PyExc_IOError); + Py_BEGIN_ALLOW_THREADS rv = write(self->fd, cp, size); + Py_END_ALLOW_THREADS if (rv == -1) { if (errno == EAGAIN) { /* buffer is full, try again */ From bwarsaw@users.sourceforge.net Thu May 22 22:33:28 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 22 May 2003 14:33:28 -0700 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4899 Modified Files: pep-0102.txt Log Message: Updates based on the Python 2.2.3 release. There may be more... Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0102.txt 12 Aug 2002 11:42:43 -0000 1.7 --- pep-0102.txt 22 May 2003 21:33:26 -0000 1.8 *************** *** 79,82 **** --- 79,87 ---- these are necessary for a new micro, minor or major release. + The LICENSE fie contains a table that describes the legal + heritage of Python; you should add an entry for the X.Y.Z + release you are now making. You should update this table in the + LICENSE file on the CVS trunk too. + ___ When the year changes, copyright legends need to be updated in many places, including the README and LICENSE files. *************** *** 148,154 **** You should not see any "M" files, but you may see several "P" ! files. I.e. you better not have any uncommitted changes in your ! working directory, but you may pick up some of Fred's or Tim's ! last minute changes. ___ Now tag the branch using a symbolic name like "rXYMaZ", --- 153,159 ---- You should not see any "M" files, but you may see several "P" ! and/or "U" files. I.e. you better not have any uncommitted ! changes in your working directory, but you may pick up some of ! Fred's or Tim's last minute changes. ___ Now tag the branch using a symbolic name like "rXYMaZ", *************** *** 156,159 **** --- 161,167 ---- % cvs tag r212 + Be sure to tag only the python/dist/src subdirectory of the + Python CVS tree! + ___ Change to a neutral directory, i.e. one in which you can do a fresh, virgin, cvs export of the branch. You will be creating a *************** *** 162,166 **** % cd ~ ! % cvs -d export -rr212 -d Python-2.1.2 python/dist/src ___ Generate the tarball. Note that we're not using the `z' option --- 170,174 ---- % cd ~ ! % cvs -d cvs.sf.net:/cvsroot/python export -rr212 -d Python-2.1.2 python/dist/src ___ Generate the tarball. Note that we're not using the `z' option *************** *** 205,246 **** include the announcement. ! ___ In the python.org web site CVS tree, cd to the X.Y ! subdirectory, and copy index.ht to new-index.ht. Be sure to ! do a "cvs update" first! % cd .../pydotorg ! % cvs -q up -P -d ! % cd 2.2 ! % cp index.ht new-index.ht ! ___ Edit the file for content: usually you can globally replace X.Ya(Z-1) with X.YaZ. However, you'll need to think about the "What's New?" section. ! ___ Copy the Misc/NEWS file to NEWS.txt in the X.Y directory for python.org; this contains the "full scoop" of changes to Python since the previous release for this version of Python. - If this is the first release in a series (e.g. 2.2.1c1) then - you'll need to create a new directory (e.g. 2.2.1). It's - probably best to copy the last directory across: - - % cp -r 2.2 2.2.1 - % rm -rf 2.2.1/CVS - % cvs add 2.2.1 - - and then make changes as needed. Verbiage from prereleases of - previous versions can be found in CVS if you're feeling uninspired. - ___ Also, update the MD5 checksums. ! ___ Preview the web page by doing a "make" -- NOT a "make install". ! View the page via a file: url. ___ Similarly, edit the ../index.ht file, i.e. the python.org home page. In the Big Blue Announcement Block, move the paragraph for the new version up to the top and boldify the phrase ! "Python X.YaZ is out". Edit for content, and preview as ! above. Do NOT do a "make install" yet! ___ Now we're waiting for the scp to creosote to finish. Da de da, --- 213,245 ---- include the announcement. ! ___ In the top of the python.org web site CVS tree, create a ! subdirectory for the X.Y.Z release. You can actually copy an ! earlier patch release's subdirectory, but be sure to delete ! the X.Y.Z/CVS directory and "cvs add X.Y.Z", for example: % cd .../pydotorg ! % cp -r 2.2.2 2.2.3 ! % rm -rf 2.2.3/CVS ! % cvs add 2.2.3 ! % cd 2.2.3 ! ___ Edit the files for content: usually you can globally replace X.Ya(Z-1) with X.YaZ. However, you'll need to think about the "What's New?" section. ! ___ Copy the Misc/NEWS file to NEWS.txt in the X.Y.Z directory for python.org; this contains the "full scoop" of changes to Python since the previous release for this version of Python. ___ Also, update the MD5 checksums. ! ___ Preview the web page by doing a "make" or "make install" (as ! long as you've created a new directory for this release!) ___ Similarly, edit the ../index.ht file, i.e. the python.org home page. In the Big Blue Announcement Block, move the paragraph for the new version up to the top and boldify the phrase ! "Python X.YaZ is out". Edit for content, and preview locally, ! but do NOT do a "make install" yet! ___ Now we're waiting for the scp to creosote to finish. Da de da, *************** *** 277,288 **** BDFL input for this step. ! ___ Now preview the new-index.ht file once more. IMPORTANT: follow ! every link on the page to make sure it goes where you expect it ! to go, and that what you expect to be there is there. ! ! ___ If everything looks good, move new-index.ht to index.ht and do a ! "make install" in this directory. Go up to the parent directory ! (i.e. the root of the web page hierarchy) and do a "make ! install" there too. You're release is now live! ___ Now it's time to write the announcement for the mailing lists. --- 276,282 ---- BDFL input for this step. ! ___ Go up to the parent directory (i.e. the root of the web page ! hierarchy) and do a "make install" there. You're release is now ! live! ___ Now it's time to write the announcement for the mailing lists. From nnorwitz@users.sourceforge.net Thu May 22 23:00:07 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 22 May 2003 15:00:07 -0700 Subject: [Python-checkins] python/dist/src/Python compile.c,2.288,2.289 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19514/Python Modified Files: compile.c Log Message: SF bug #644345, Poor error message for augmented assign Update error message. Hopefully this is clearer to some people. Index: compile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v retrieving revision 2.288 retrieving revision 2.289 diff -C2 -d -r2.288 -r2.289 *** compile.c 22 May 2003 16:22:33 -0000 2.288 --- compile.c 22 May 2003 22:00:04 -0000 2.289 *************** *** 2779,2783 **** if (assigning > OP_APPLY) { com_error(c, PyExc_SyntaxError, ! "augmented assign to tuple not possible"); return; } --- 2779,2783 ---- if (assigning > OP_APPLY) { com_error(c, PyExc_SyntaxError, ! "augmented assign to tuple literal not possible"); return; } *************** *** 2792,2796 **** if (assigning > OP_APPLY) { com_error(c, PyExc_SyntaxError, ! "augmented assign to list not possible"); return; } --- 2792,2796 ---- if (assigning > OP_APPLY) { com_error(c, PyExc_SyntaxError, ! "augmented assign to list literal not possible"); return; } From python@rcn.com Fri May 23 05:26:13 2003 From: python@rcn.com (Raymond Hettinger) Date: Fri, 23 May 2003 00:26:13 -0400 Subject: [Python-checkins] python/dist/src/Include object.h,2.119,2.120 References: Message-ID: <000201c320ef$9fe28140$125ffea9@oemcomputer> > I'm taking the highest two bits, whatever > the integer word size may be. I'm not sure that's a good idea. Future growth may require other bits in fixed positions and it would be a bummer to have to dodge Tismer's jumping bits ;-) Raymond Hettinger From rhettinger@users.sourceforge.net Fri May 23 09:51:53 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri, 23 May 2003 01:51:53 -0700 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32317 Modified Files: urllib2.py Log Message: iteritems() should not have been used for self.timeout which changes during the loop. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** urllib2.py 18 May 2003 02:25:07 -0000 1.46 --- urllib2.py 23 May 2003 08:51:51 -0000 1.47 *************** *** 1013,1017 **** t = time.time() if self.soonest <= t: ! for k, v in self.timeout.iteritems(): if v < t: self.cache[k].close() --- 1013,1017 ---- t = time.time() if self.soonest <= t: ! for k, v in self.timeout.items(): if v < t: self.cache[k].close() From doerwalter@users.sourceforge.net Fri May 23 11:01:10 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 23 May 2003 03:01:10 -0700 Subject: [Python-checkins] python/dist/src/Modules arraymodule.c,2.89,2.90 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv30268/Modules Modified Files: arraymodule.c Log Message: All calls to getarrayitem() (which is static) are done either in loops over the size of the array, or the callers check the index bounds themselves, so the index check never failed => Replace it with an assert(). Index: arraymodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/arraymodule.c,v retrieving revision 2.89 retrieving revision 2.90 diff -C2 -d -r2.89 -r2.90 *** arraymodule.c 18 May 2003 03:15:10 -0000 2.89 --- arraymodule.c 23 May 2003 10:01:07 -0000 2.90 *************** *** 448,455 **** assert(array_Check(op)); ap = (arrayobject *)op; ! if (i < 0 || i >= ap->ob_size) { ! PyErr_SetString(PyExc_IndexError, "array index out of range"); ! return NULL; ! } return (*ap->ob_descr->getitem)(ap, i); } --- 448,452 ---- assert(array_Check(op)); ap = (arrayobject *)op; ! assert(i>=0 && iob_size); return (*ap->ob_descr->getitem)(ap, i); } From doerwalter@users.sourceforge.net Fri May 23 11:08:05 2003 From: doerwalter@users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri, 23 May 2003 03:08:05 -0700 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv2114/nondist/peps Modified Files: pep-0102.txt Log Message: Fix typo. Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** pep-0102.txt 22 May 2003 21:33:26 -0000 1.8 --- pep-0102.txt 23 May 2003 10:08:03 -0000 1.9 *************** *** 79,83 **** these are necessary for a new micro, minor or major release. ! The LICENSE fie contains a table that describes the legal heritage of Python; you should add an entry for the X.Y.Z release you are now making. You should update this table in the --- 79,83 ---- these are necessary for a new micro, minor or major release. ! The LICENSE file contains a table that describes the legal heritage of Python; you should add an entry for the X.Y.Z release you are now making. You should update this table in the From tismer@tismer.com Fri May 23 13:37:00 2003 From: tismer@tismer.com (Christian Tismer) Date: Fri, 23 May 2003 14:37:00 +0200 Subject: [Python-checkins] python/dist/src/Include object.h,2.119,2.120 In-Reply-To: <000201c320ef$9fe28140$125ffea9@oemcomputer> References: <000201c320ef$9fe28140$125ffea9@oemcomputer> Message-ID: <3ECE15EC.2010803@tismer.com> Raymond Hettinger wrote: >>I'm taking the highest two bits, whatever >>the integer word size may be. > > > I'm not sure that's a good idea. Future growth > may require other bits in fixed positions and > it would be a bummer to have to dodge > Tismer's jumping bits ;-) Ok, so if nobody minds I will change that to two regular style bits? -- Christian Tismer :^) Mission Impossible 5oftware : Have a break! Take a ride on Python's Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/ 14109 Berlin : PGP key -> http://wwwkeys.pgp.net/ work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/ From tismer@users.sourceforge.net Fri May 23 13:47:40 2003 From: tismer@users.sourceforge.net (tismer@users.sourceforge.net) Date: Fri, 23 May 2003 05:47:40 -0700 Subject: [Python-checkins] python/dist/src/Include object.h,2.120,2.121 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv31407/Include Modified Files: object.h Log Message: After Raymond's remark, I changed the Stackless bits to two fixed bits, position 15 and 16. It is right, why should these be elsewhere. Index: object.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/object.h,v retrieving revision 2.120 retrieving revision 2.121 diff -C2 -d -r2.120 -r2.121 *** object.h 23 May 2003 03:33:35 -0000 2.120 --- object.h 23 May 2003 12:47:36 -0000 2.121 *************** *** 489,495 **** #define Py_TPFLAGS_HAVE_GC (1L<<14) ! /* These last two bits are preserved for Stackless Python */ #ifdef STACKLESS ! #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<(sizeof(int)*8-2)) #else #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 --- 489,495 ---- #define Py_TPFLAGS_HAVE_GC (1L<<14) ! /* These two bits are preserved for Stackless Python, next after this is 16 */ #ifdef STACKLESS ! #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15) #else #define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 From nnorwitz@users.sourceforge.net Fri May 23 15:35:27 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 23 May 2003 07:35:27 -0700 Subject: [Python-checkins] python/dist/src/Modules termios.c,2.36,2.37 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21998/Modules Modified Files: termios.c Log Message: Get test_ioctl to pass on HPUX 11. TIOCGPGRP and many other definitions come from bsdtty.h, so it needs to be included at least on HPUX. Index: termios.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/termios.c,v retrieving revision 2.36 retrieving revision 2.37 diff -C2 -d -r2.36 -r2.37 *** termios.c 2 Aug 2002 02:27:13 -0000 2.36 --- termios.c 23 May 2003 14:35:24 -0000 2.37 *************** *** 20,23 **** --- 20,27 ---- #include #endif + /* HP-UX requires that this be included to pick up TIOCGPGRP and friends */ + #ifdef HAVE_SYS_BSDTTY_H + #include + #endif PyDoc_STRVAR(termios__doc__, From nnorwitz@users.sourceforge.net Fri May 23 15:35:27 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri, 23 May 2003 07:35:27 -0700 Subject: [Python-checkins] python/dist/src configure,1.398,1.399 configure.in,1.409,1.410 pyconfig.h.in,1.79,1.80 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv21998 Modified Files: configure configure.in pyconfig.h.in Log Message: Get test_ioctl to pass on HPUX 11. TIOCGPGRP and many other definitions come from bsdtty.h, so it needs to be included at least on HPUX. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.398 retrieving revision 1.399 diff -C2 -d -r1.398 -r1.399 *** configure 11 May 2003 05:53:39 -0000 1.398 --- configure 23 May 2003 14:35:21 -0000 1.399 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.408 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.409 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 4129,4137 **** for ac_header in dlfcn.h fcntl.h grp.h limits.h langinfo.h \ libintl.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \ unistd.h utime.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ --- 4129,4138 ---- + for ac_header in dlfcn.h fcntl.h grp.h limits.h langinfo.h \ libintl.h locale.h ncurses.h poll.h pthread.h \ signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \ unistd.h utime.h \ ! sys/audioio.h sys/bsdtty.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ *************** *** 18202,18206 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 18203,18207 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.409 retrieving revision 1.410 diff -C2 -d -r1.409 -r1.410 *** configure.in 11 May 2003 05:53:41 -0000 1.409 --- configure.in 23 May 2003 14:35:23 -0000 1.410 *************** *** 807,811 **** signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \ unistd.h utime.h \ ! sys/audioio.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ --- 807,811 ---- signal.h stdarg.h stddef.h stdlib.h stropts.h termios.h thread.h \ unistd.h utime.h \ ! sys/audioio.h sys/bsdtty.h sys/file.h sys/lock.h sys/mkdev.h sys/modem.h \ sys/param.h sys/poll.h sys/select.h sys/socket.h sys/time.h sys/times.h \ sys/un.h sys/utsname.h sys/wait.h pty.h term.h libutil.h \ Index: pyconfig.h.in =================================================================== RCS file: /cvsroot/python/python/dist/src/pyconfig.h.in,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** pyconfig.h.in 3 May 2003 12:10:48 -0000 1.79 --- pyconfig.h.in 23 May 2003 14:35:23 -0000 1.80 *************** *** 495,498 **** --- 495,501 ---- #undef HAVE_SYS_AUDIOIO_H + /* Define to 1 if you have the header file. */ + #undef HAVE_SYS_BSDTTY_H + /* Define to 1 if you have the header file, and it defines `DIR'. */ From jackjansen@users.sourceforge.net Fri May 23 23:34:43 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 23 May 2003 15:34:43 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils unixccompiler.py,1.38.6.1,1.38.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv4016/Lib/distutils Modified Files: Tag: release22-maint unixccompiler.py Log Message: Backport of 1.48: on Mac OS X don't use -R for runtime_library_dirs, use -L in stead. Fixes #723495. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.38.6.1 retrieving revision 1.38.6.2 diff -C2 -d -r1.38.6.1 -r1.38.6.2 *** unixccompiler.py 17 Mar 2002 19:47:39 -0000 1.38.6.1 --- unixccompiler.py 23 May 2003 22:34:39 -0000 1.38.6.2 *************** *** 267,270 **** --- 267,273 ---- # we use this hack. compiler = os.path.basename(sysconfig.get_config_var("CC")) + if sys.platform[:6] == "darwin": + # MacOSX's linker doesn't understand the -R flag at all + return "-L" + dir if compiler == "gcc" or compiler == "g++": return "-Wl,-R" + dir From jackjansen@users.sourceforge.net Fri May 23 23:35:11 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri, 23 May 2003 15:35:11 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.81,1.337.2.4.2.82 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv4016/Misc Modified Files: Tag: release22-maint NEWS Log Message: Backport of 1.48: on Mac OS X don't use -R for runtime_library_dirs, use -L in stead. Fixes #723495. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.81 retrieving revision 1.337.2.4.2.82 diff -C2 -d -r1.337.2.4.2.81 -r1.337.2.4.2.82 *** NEWS 22 May 2003 19:13:35 -0000 1.337.2.4.2.81 --- NEWS 23 May 2003 22:34:36 -0000 1.337.2.4.2.82 *************** *** 179,182 **** --- 179,185 ---- - Distutils: Translate spaces in the machine name to underscores (Power Macintosh -> Power_Macintosh) + + - Distutils: on Mac OS X don't use -R for runtime_library_dirs, use + -L in stead (#723495). - Backported SF #658233, continuation lines in .mo file metadata From zujyjbiu8@hotmail.com Sat May 24 09:00:56 2003 From: zujyjbiu8@hotmail.com (Juliana Lutz) Date: Sat, 24 May 03 08:00:56 GMT Subject: [Python-checkins] Save thousands and refinance your home now! au Message-ID: This is a multi-part message in MIME format. --24A_EAAEBD_3D Content-Type: text/plain Content-Transfer-Encoding: quoted-printable FREE MORTGAGE QUOTE & BEST POSSIBLE RATES ! ------------------------------------------- There are over 89,000 mortgage companies in the U.S., which means the process of finding the best loan for you can be a very difficult one.Let us do the hard work for you! Simply spend 1 minute to fill out the short form, then press the submit button, and we take it from there... finding the best deals possible, and getting the lenders to contact you! It's short, it's simple, it's free, and it will save you thousands of dollars! * Home Improvement, Refinance, Second Mortgage, Home Equity Loans, and More! Even with less than perfect or NO credit! You will qualify for the best possible rate. Do NOT miss the chance to refinance at record low rates, so act now... http://www.mortage-area.com/3/index.asp?RefID=3D383102 remove me http://www.mortage-area.com/Auto/index.htm k zxrclz affnqjhdv g oqx eddtdr vnqlv mempghs ttw glyivtltei ifulxbj yi rial --24A_EAAEBD_3D-- From loewis@users.sourceforge.net Sat May 24 12:37:18 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 24 May 2003 04:37:18 -0700 Subject: [Python-checkins] python/dist/src/Lib/lib-tk Tkinter.py,1.174,1.175 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv28434 Modified Files: Tkinter.py Log Message: Convert tcl_version to str before comparing. Fixes #729317. Index: Tkinter.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/Tkinter.py,v retrieving revision 1.174 retrieving revision 1.175 diff -C2 -d -r1.174 -r1.175 *** Tkinter.py 17 Apr 2003 13:13:55 -0000 1.174 --- Tkinter.py 24 May 2003 11:37:15 -0000 1.175 *************** *** 1568,1572 **** "tk.h version (%s) doesn't match libtk.a version (%s)" \ % (_tkinter.TK_VERSION, tk_version) ! tcl_version = self.tk.getvar('tcl_version') if tcl_version != _tkinter.TCL_VERSION: raise RuntimeError, \ --- 1568,1573 ---- "tk.h version (%s) doesn't match libtk.a version (%s)" \ % (_tkinter.TK_VERSION, tk_version) ! # Under unknown circumstances, tcl_version gets coerced to float ! tcl_version = str(self.tk.getvar('tcl_version')) if tcl_version != _tkinter.TCL_VERSION: raise RuntimeError, \ From loewis@users.sourceforge.net Sat May 24 13:35:49 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 24 May 2003 05:35:49 -0700 Subject: [Python-checkins] python/dist/src configure,1.399,1.400 configure.in,1.410,1.411 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv10925 Modified Files: configure configure.in Log Message: Modified patch #742126: Don't define _XOPEN_SOURCE for OpenBSD 3.3. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.399 retrieving revision 1.400 diff -C2 -d -r1.399 -r1.400 *** configure 23 May 2003 14:35:21 -0000 1.399 --- configure 24 May 2003 12:35:45 -0000 1.400 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.409 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.410 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 909,913 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 909,913 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` *************** *** 1349,1353 **** # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. ! OpenBSD/2.* | OpenBSD/3.[012]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage --- 1349,1354 ---- # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. ! # Reconfirmed for OpenBSD 3.3 by Zachary Hamm. ! OpenBSD/2.* | OpenBSD/3.[0123]) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage *************** *** 18203,18207 **** # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` --- 18204,18208 ---- # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ! ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.410 retrieving revision 1.411 diff -C2 -d -r1.410 -r1.411 *** configure.in 23 May 2003 14:35:23 -0000 1.410 --- configure.in 24 May 2003 12:35:47 -0000 1.411 *************** *** 124,128 **** # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. ! OpenBSD/2.* | OpenBSD/3.@<:@012@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage --- 124,129 ---- # On OpenBSD, select(2) is not available if _XOPEN_SOURCE is defined, # even though select is a POSIX function. Reported by J. Ribbens. ! # Reconfirmed for OpenBSD 3.3 by Zachary Hamm. ! OpenBSD/2.* | OpenBSD/3.@<:@0123@:>@) define_xopen_source=no;; # On Solaris 2.6, sys/wait.h is inconsistent in the usage From rhettinger@users.sourceforge.net Sat May 24 18:26:05 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 24 May 2003 10:26:05 -0700 Subject: [Python-checkins] python/dist/src/Lib random.py,1.46,1.47 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv2347 Modified Files: random.py Log Message: 'sum' is no longer a good variable name. Use 'total' instead. Index: random.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/random.py,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** random.py 17 Jan 2003 17:23:22 -0000 1.46 --- random.py 24 May 2003 17:26:02 -0000 1.47 *************** *** 726,730 **** print n, 'times', funccall code = compile(funccall, funccall, 'eval') ! sum = 0.0 sqsum = 0.0 smallest = 1e10 --- 726,730 ---- print n, 'times', funccall code = compile(funccall, funccall, 'eval') ! total = 0.0 sqsum = 0.0 smallest = 1e10 *************** *** 733,737 **** for i in range(n): x = eval(code) ! sum = sum + x sqsum = sqsum + x*x smallest = min(x, smallest) --- 733,737 ---- for i in range(n): x = eval(code) ! total += x sqsum = sqsum + x*x smallest = min(x, smallest) *************** *** 739,743 **** t1 = time.time() print round(t1-t0, 3), 'sec,', ! avg = sum/n stddev = _sqrt(sqsum/n - avg*avg) print 'avg %g, stddev %g, min %g, max %g' % \ --- 739,743 ---- t1 = time.time() print round(t1-t0, 3), 'sec,', ! avg = total/n stddev = _sqrt(sqsum/n - avg*avg) print 'avg %g, stddev %g, min %g, max %g' % \ From jvr@users.sourceforge.net Sat May 24 21:14:26 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 24 May 2003 13:14:26 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules ColorPickermodule.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv23066 Modified Files: ColorPickermodule.c Log Message: modernized ColorPicker somewhat Index: ColorPickermodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ColorPickermodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ColorPickermodule.c 14 Jul 2000 22:16:36 -0000 1.3 --- ColorPickermodule.c 24 May 2003 20:14:24 -0000 1.4 *************** *** 22,26 **** --- 22,30 ---- ******************************************************************/ + #ifdef WITHOUT_FRAMEWORKS #include + #else + #include + #endif #include "Python.h" #include "macglue.h" From tim_one@users.sourceforge.net Sat May 24 21:18:26 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 24 May 2003 13:18:26 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.771,1.772 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv23294/Misc Modified Files: NEWS Log Message: SF bug 705231: Assertion failed, python aborts. float_pow(): Don't let the platform pow() raise -1.0 to an integer power anymore; at least glibc gets it wrong in some cases. Note that math.pow() will continue to deliver wrong (but platform-native) results in such cases. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.771 retrieving revision 1.772 diff -C2 -d -r1.771 -r1.772 *** NEWS 21 May 2003 21:29:46 -0000 1.771 --- NEWS 24 May 2003 20:18:24 -0000 1.772 *************** *** 13,16 **** --- 13,22 ---- ----------------- + - SF bug 705231: builtin pow() no longer lets the platform C pow() + raise -1.0 to integer powers, because (at least) glibc gets it wrong + in some cases. The result should be -1.0 if the power is odd and 1.0 + if the power is even, and any float with a sufficiently large exponent + is (mathematically) an exact even integer. + - The encoding attribute has been added for file objects, and set to the terminal encoding on Unix and Windows. From tim_one@users.sourceforge.net Sat May 24 21:18:26 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 24 May 2003 13:18:26 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_pow.py,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23294/Lib/test Modified Files: test_pow.py Log Message: SF bug 705231: Assertion failed, python aborts. float_pow(): Don't let the platform pow() raise -1.0 to an integer power anymore; at least glibc gets it wrong in some cases. Note that math.pow() will continue to deliver wrong (but platform-native) results in such cases. Index: test_pow.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pow.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_pow.py 1 May 2003 17:45:45 -0000 1.18 --- test_pow.py 24 May 2003 20:18:24 -0000 1.19 *************** *** 102,105 **** --- 102,122 ---- None ** TestRpow() # Won't fail when __rpow__ invoked. SF bug #643260. + def test_bug705231(self): + # -1.0 raised to an integer should never blow up. It did if the + # platform pow() was buggy, and Python didn't worm around it. + eq = self.assertEquals + a = -1.0 + eq(pow(a, 1.23e167), 1.0) + eq(pow(a, -1.23e167), 1.0) + for b in range(-10, 11): + eq(pow(a, float(b)), b & 1 and -1.0 or 1.0) + for n in range(0, 100): + fiveto = float(5 ** n) + # For small n, fiveto will be odd. Eventually we run out of + # mantissa bits, though, and thereafer fiveto will be even. + expected = fiveto % 2.0 and -1.0 or 1.0 + eq(pow(a, fiveto), expected) + eq(pow(a, -fiveto), expected) + eq(expected, 1.0) # else we didn't push fiveto to evenness def test_main(): From tim_one@users.sourceforge.net Sat May 24 21:18:26 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 24 May 2003 13:18:26 -0700 Subject: [Python-checkins] python/dist/src/Objects floatobject.c,2.122,2.123 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv23294/Objects Modified Files: floatobject.c Log Message: SF bug 705231: Assertion failed, python aborts. float_pow(): Don't let the platform pow() raise -1.0 to an integer power anymore; at least glibc gets it wrong in some cases. Note that math.pow() will continue to deliver wrong (but platform-native) results in such cases. Index: floatobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v retrieving revision 2.122 retrieving revision 2.123 diff -C2 -d -r2.122 -r2.123 *** floatobject.c 21 Mar 2003 17:10:03 -0000 2.122 --- floatobject.c 24 May 2003 20:18:24 -0000 2.123 *************** *** 573,580 **** return PyFloat_FromDouble(0.0); } ! if (iv < 0.0 && iw != floor(iw)) { ! PyErr_SetString(PyExc_ValueError, ! "negative number cannot be raised to a fractional power"); ! return NULL; } errno = 0; --- 573,609 ---- return PyFloat_FromDouble(0.0); } ! if (iv < 0.0) { ! /* Whether this is an error is a mess, and bumps into libm ! * bugs so we have to figure it out ourselves. ! */ ! if (iw != floor(iw)) { ! PyErr_SetString(PyExc_ValueError, "negative number " ! "cannot be raised to a fractional power"); ! return NULL; ! } ! /* iw is an exact integer, albeit perhaps a very large one. ! * -1 raised to an exact integer should never be exceptional. ! * Alas, some libms (chiefly glibc as of early 2003) return ! * NaN and set EDOM on pow(-1, large_int) if the int doesn't ! * happen to be representable in a *C* integer. That's a ! * bug; we let that slide in math.pow() (which currently ! * reflects all platform accidents), but not for Python's **. ! */ ! if (iv == -1.0 && !Py_IS_INFINITY(iw) && iw == iw) { ! /* XXX the "iw == iw" was to weed out NaNs. This ! * XXX doesn't actually work on all platforms. ! */ ! /* Return 1 if iw is even, -1 if iw is odd; there's ! * no guarantee that any C integral type is big ! * enough to hold iw, so we have to check this ! * indirectly. ! */ ! ix = floor(iw * 0.5) * 2.0; ! return PyFloat_FromDouble(ix == iw ? 1.0 : -1.0); ! } ! /* Else iv != -1.0, and overflow or underflow are possible. ! * Unless we're to write pow() ourselves, we have to trust ! * the platform to do this correctly. ! */ } errno = 0; *************** *** 584,589 **** Py_ADJUST_ERANGE1(ix); if (errno != 0) { ! assert(errno == ERANGE); ! PyErr_SetFromErrno(PyExc_OverflowError); return NULL; } --- 613,621 ---- Py_ADJUST_ERANGE1(ix); if (errno != 0) { ! /* We don't expect any errno value other than ERANGE, but ! * the range of libm bugs appears unbounded. ! */ ! PyErr_SetFromErrno(errno == ERANGE ? PyExc_OverflowError : ! PyExc_ValueError); return NULL; } From jvr@users.sourceforge.net Sat May 24 21:21:52 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sat, 24 May 2003 13:21:52 -0700 Subject: [Python-checkins] python/dist/src setup.py,1.166,1.167 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv25516 Modified Files: setup.py Log Message: Somehow ColorPicker has never been included or tested under darwin, but it works just fine. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.166 retrieving revision 1.167 diff -C2 -d -r1.166 -r1.167 *** setup.py 9 May 2003 09:05:19 -0000 1.166 --- setup.py 24 May 2003 20:21:50 -0000 1.167 *************** *** 777,780 **** --- 777,782 ---- extra_link_args=['-framework', 'CoreFoundation']) ) + exts.append( Extension('ColorPicker', ['ColorPickermodule.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('autoGIL', ['autoGIL.c'], extra_link_args=['-framework', 'CoreFoundation']) ) From tim_one@users.sourceforge.net Sun May 25 02:45:14 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 24 May 2003 18:45:14 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.772,1.773 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14651/Misc Modified Files: NEWS Log Message: SF 742860: WeakKeyDictionary __delitem__ uses iterkeys Someone review this, please! Final releases are getting close, Fred (the weakref guy) won't be around until Tuesday, and the pre-patch code can indeed raise spurious RuntimeErrors in the presence of threads or mutating comparison functions. See the bug report for my confusions: I can't see any reason for why __delitem__ iterated over the keys. The new one-liner implementation is much faster, can't raise RuntimeError, and should be better-behaved in all respects wrt threads. New tests test_weak_keyed_bad_delitem and test_weak_keyed_cascading_deletes fail before this patch. Bugfix candidate for 2.2.3 too, if someone else agrees with this patch. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.772 retrieving revision 1.773 diff -C2 -d -r1.772 -r1.773 *** NEWS 24 May 2003 20:18:24 -0000 1.772 --- NEWS 25 May 2003 01:45:11 -0000 1.773 *************** *** 13,16 **** --- 13,22 ---- ----------------- + - SF bug 742860: WeakKeyDictionary __delitem__ uses iterkeys. This + wasn't as threadsafe as it should be, was very inefficient, and could + raise RuntimeError if another thread mutated the dict during + __delitem__, or if a comparison function mutated it. A new + implementation of WeakKeyDictionary.__delitem__ repairs all that. + - SF bug 705231: builtin pow() no longer lets the platform C pow() raise -1.0 to integer powers, because (at least) glibc gets it wrong From tim_one@users.sourceforge.net Sun May 25 02:45:13 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 24 May 2003 18:45:13 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14651/Lib/test Modified Files: test_weakref.py Log Message: SF 742860: WeakKeyDictionary __delitem__ uses iterkeys Someone review this, please! Final releases are getting close, Fred (the weakref guy) won't be around until Tuesday, and the pre-patch code can indeed raise spurious RuntimeErrors in the presence of threads or mutating comparison functions. See the bug report for my confusions: I can't see any reason for why __delitem__ iterated over the keys. The new one-liner implementation is much faster, can't raise RuntimeError, and should be better-behaved in all respects wrt threads. New tests test_weak_keyed_bad_delitem and test_weak_keyed_cascading_deletes fail before this patch. Bugfix candidate for 2.2.3 too, if someone else agrees with this patch. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** test_weakref.py 2 May 2003 09:06:28 -0000 1.24 --- test_weakref.py 25 May 2003 01:45:11 -0000 1.25 *************** *** 517,520 **** --- 517,571 ---- self.assert_(d.items() == [('something else', o2)]) + def test_weak_keyed_bad_delitem(self): + d = weakref.WeakKeyDictionary() + o = Object('1') + # An attempt to delete an object that isn't there should raise + # KetError. It didn't before 2.3. + self.assertRaises(KeyError, d.__delitem__, o) + + def test_weak_keyed_cascading_deletes(self): + # SF bug 742860. For some reason, before 2.3 __delitem__ iterated + # over the keys via self.data.iterkeys(). If things vanished from + # the dict during this (or got added), that caused a RuntimeError. + + d = weakref.WeakKeyDictionary() + mutate = False + + class C(object): + def __init__(self, i): + self.value = i + def __hash__(self): + return hash(self.value) + def __eq__(self, other): + if mutate: + # Side effect that mutates the dict, by removing the + # last strong reference to a key. + del objs[-1] + return self.value == other.value + + objs = [C(i) for i in range(4)] + for o in objs: + d[o] = o.value + del o # now the only strong references to keys are in objs + # Find the order in which iterkeys sees the keys. + objs = d.keys() + # Reverse it, so that the iteration implementation of __delitem__ + # has to keep looping to find the first object we delete. + objs.reverse() + # Turn on mutation in C.__eq__. The first time thru the loop, + # under the iterkeys() business the first comparison will delete + # the last item iterkeys() would see, and that causes a + # RuntimeError: dictionary changed size during iteration + # when the iterkeys() loop goes around to try comparing the next + # key. After ths was fixed, it just deletes the last object *our* + # "for o in obj" loop would have gotten to. + mutate = True + count = 0 + for o in objs: + count += 1 + del d[o] + self.assertEqual(len(d), 0) + self.assertEqual(count, 2) + from test_userdict import TestMappingProtocol From tim_one@users.sourceforge.net Sun May 25 02:45:13 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sat, 24 May 2003 18:45:13 -0700 Subject: [Python-checkins] python/dist/src/Lib weakref.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14651/Lib Modified Files: weakref.py Log Message: SF 742860: WeakKeyDictionary __delitem__ uses iterkeys Someone review this, please! Final releases are getting close, Fred (the weakref guy) won't be around until Tuesday, and the pre-patch code can indeed raise spurious RuntimeErrors in the presence of threads or mutating comparison functions. See the bug report for my confusions: I can't see any reason for why __delitem__ iterated over the keys. The new one-liner implementation is much faster, can't raise RuntimeError, and should be better-behaved in all respects wrt threads. New tests test_weak_keyed_bad_delitem and test_weak_keyed_cascading_deletes fail before this patch. Bugfix candidate for 2.2.3 too, if someone else agrees with this patch. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** weakref.py 9 Mar 2003 07:05:13 -0000 1.19 --- weakref.py 25 May 2003 01:45:11 -0000 1.20 *************** *** 165,173 **** def __delitem__(self, key): ! for ref in self.data.iterkeys(): ! o = ref() ! if o == key: ! del self.data[ref] ! return def __getitem__(self, key): --- 165,169 ---- def __delitem__(self, key): ! del self.data[ref(key)] def __getitem__(self, key): From python@rcn.com Sun May 25 05:35:57 2003 From: python@rcn.com (Raymond Hettinger) Date: Sun, 25 May 2003 00:35:57 -0400 Subject: [Python-checkins] python/dist/src/Lib weakref.py,1.19,1.20 References: Message-ID: <000201c32277$59041c00$125ffea9@oemcomputer> > Someone review this, please! Final releases are getting close, Fred > (the weakref guy) won't be around until Tuesday, and the pre-patch > code can indeed raise spurious RuntimeErrors in the presence of > threads or mutating comparison functions. > > See the bug report for my confusions: I can't see any reason for why > __delitem__ iterated over the keys. Until reading the note on threads, I didn't see the error and thought the original code was valid because it returned after the deletion instead of continuing to loop through iterkeys. > The new one-liner implementation > is much faster, can't raise RuntimeError, and should be better-behaved > in all respects wrt threads. Yes, that solves the OP's problem. > Bugfix candidate for 2.2.3 too, if someone else agrees with this patch. The original code does its contortions to avoid raising a KeyError whenever the dictionary entry might have disappeared due to the ref count falling to zero and then a new, equal key was formed later. If the data disappeared, then, I think ref(key) will return None which is a bummer because that is then used (in your patch) as a lookup key. The safest approach (until Fred re-appears) is to keep the original approach but use keys() instead of iterkeys(). Then, wrap the actual deletion in a try / except KeyError to handle a thread race to delete the same weakref object. I'm sure there is a better way and will take another look tomorrow. Raymond Hettinger From tim_one@users.sourceforge.net Sun May 25 18:44:34 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 May 2003 10:44:34 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.773,1.774 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31411/Misc Modified Files: NEWS Log Message: Fleshed out WeakKeyDictionary.__delitem__ NEWS to cover issues raised on Python-Dev. Fixed typos in test comments. Added some trivial new test guts to show the parallelism (now) among __delitem__, __setitem__ and __getitem__ wrt error conditions. Still a bugfix candidate for 2.2.3 final, but waiting for Fred to get a chance to chime in. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.773 retrieving revision 1.774 diff -C2 -d -r1.773 -r1.774 *** NEWS 25 May 2003 01:45:11 -0000 1.773 --- NEWS 25 May 2003 17:44:31 -0000 1.774 *************** *** 13,21 **** ----------------- ! - SF bug 742860: WeakKeyDictionary __delitem__ uses iterkeys. This ! wasn't as threadsafe as it should be, was very inefficient, and could ! raise RuntimeError if another thread mutated the dict during ! __delitem__, or if a comparison function mutated it. A new ! implementation of WeakKeyDictionary.__delitem__ repairs all that. - SF bug 705231: builtin pow() no longer lets the platform C pow() --- 13,29 ---- ----------------- ! - SF bug 742860: "WeakKeyDictionary __delitem__ uses iterkeys". This ! wasn't threadsafe, was very inefficient (expected time O(len(dict)) ! instead of O(1)), and could raise a spurious RuntimeError if another ! thread mutated the dict during __delitem__, or if a comparison function ! mutated it. It also neglected to raise KeyError when the key wasn't ! present; didn't raise TypeError when the key wasn't of a weakly ! referencable type; and broke various more-or-less obscure dict ! invariants by using a sequence of equality comparisons over the whole ! set of dict keys instead of computing the key's hash code to narrow ! the search to those keys with the same hash code. All of these are ! considered to be bugs. A new implementation of __delitem__ repairs all ! that, but note that fixing these bugs may change visible behavior in ! code relying (whether intentionally or accidentally) on old behavior. - SF bug 705231: builtin pow() no longer lets the platform C pow() From tim_one@users.sourceforge.net Sun May 25 18:44:33 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Sun, 25 May 2003 10:44:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31411/Lib/test Modified Files: test_weakref.py Log Message: Fleshed out WeakKeyDictionary.__delitem__ NEWS to cover issues raised on Python-Dev. Fixed typos in test comments. Added some trivial new test guts to show the parallelism (now) among __delitem__, __setitem__ and __getitem__ wrt error conditions. Still a bugfix candidate for 2.2.3 final, but waiting for Fred to get a chance to chime in. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_weakref.py 25 May 2003 01:45:11 -0000 1.25 --- test_weakref.py 25 May 2003 17:44:31 -0000 1.26 *************** *** 521,526 **** o = Object('1') # An attempt to delete an object that isn't there should raise ! # KetError. It didn't before 2.3. self.assertRaises(KeyError, d.__delitem__, o) def test_weak_keyed_cascading_deletes(self): --- 521,533 ---- o = Object('1') # An attempt to delete an object that isn't there should raise ! # KeyError. It didn't before 2.3. self.assertRaises(KeyError, d.__delitem__, o) + self.assertRaises(KeyError, d.__getitem__, o) + + # If a key isn't of a weakly referencable type, __getitem__ and + # __setitem__ raise TypeError. __delitem__ should too. + self.assertRaises(TypeError, d.__delitem__, 13) + self.assertRaises(TypeError, d.__getitem__, 13) + self.assertRaises(TypeError, d.__setitem__, 13, 13) def test_weak_keyed_cascading_deletes(self): *************** *** 553,556 **** --- 560,564 ---- # has to keep looping to find the first object we delete. objs.reverse() + # Turn on mutation in C.__eq__. The first time thru the loop, # under the iterkeys() business the first comparison will delete *************** *** 558,562 **** # RuntimeError: dictionary changed size during iteration # when the iterkeys() loop goes around to try comparing the next ! # key. After ths was fixed, it just deletes the last object *our* # "for o in obj" loop would have gotten to. mutate = True --- 566,570 ---- # RuntimeError: dictionary changed size during iteration # when the iterkeys() loop goes around to try comparing the next ! # key. After this was fixed, it just deletes the last object *our* # "for o in obj" loop would have gotten to. mutate = True From rhettinger@users.sourceforge.net Sun May 25 18:59:40 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun, 25 May 2003 10:59:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/ext noddy.c,1.6,1.7 noddy2.c,1.2,1.3 noddy3.c,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv4904 Modified Files: noddy.c noddy2.c noddy3.c Log Message: Fix ref counts in initialization code. Index: noddy.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** noddy.c 16 May 2003 13:53:43 -0000 1.6 --- noddy.c 25 May 2003 17:59:37 -0000 1.7 *************** *** 66,69 **** --- 66,70 ---- "Example module that creates an extension type."); + Py_INCREF(&noddy_NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&noddy_NoddyType); } Index: noddy2.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy2.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** noddy2.c 16 May 2003 13:53:43 -0000 1.2 --- noddy2.c 25 May 2003 17:59:38 -0000 1.3 *************** *** 185,188 **** --- 185,189 ---- return; + Py_INCREF(&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); } Index: noddy3.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/noddy3.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** noddy3.c 16 May 2003 13:53:43 -0000 1.2 --- noddy3.c 25 May 2003 17:59:38 -0000 1.3 *************** *** 238,241 **** --- 238,242 ---- return; + Py_INCREF(&NoddyType); PyModule_AddObject(m, "Noddy", (PyObject *)&NoddyType); } From jvr@users.sourceforge.net Sun May 25 21:44:43 2003 From: jvr@users.sourceforge.net (jvr@users.sourceforge.net) Date: Sun, 25 May 2003 13:44:43 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE Wbase.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv6625 Modified Files: Wbase.py Log Message: fixed some DeprecationWarnings Index: Wbase.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/Wbase.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Wbase.py 5 Feb 2003 15:40:04 -0000 1.12 --- Wbase.py 25 May 2003 20:44:37 -0000 1.13 *************** *** 9,12 **** --- 9,16 ---- + def _intRect((l, t, r, b)): + return (int(l), int(t), int(r), int(b)) + + class Widget: *************** *** 116,120 **** width = pr - pl height = pb - pt ! self._bounds = Qd.OffsetRect(self._possize(width, height), pl, pt) else: # _possize must be a 4-tuple. This is where the algorithm by Peter Kriens and --- 120,124 ---- width = pr - pl height = pb - pt ! self._bounds = Qd.OffsetRect(_intRect(self._possize(width, height)), pl, pt) else: # _possize must be a 4-tuple. This is where the algorithm by Peter Kriens and *************** *** 572,576 **** Qd.PenMode(QuickDraw.srcXor) Qd.PenPat(Qd.GetQDGlobalsGray()) ! Qd.PaintRect(rect) lastpos = None while Evt.Button(): --- 576,580 ---- Qd.PenMode(QuickDraw.srcXor) Qd.PenPat(Qd.GetQDGlobalsGray()) ! Qd.PaintRect(_intRect(rect)) lastpos = None while Evt.Button(): *************** *** 581,585 **** continue Qd.PenPat(Qd.GetQDGlobalsGray()) ! Qd.PaintRect(rect) if self._direction: rect = l, pos - 1, r, pos --- 585,589 ---- continue Qd.PenPat(Qd.GetQDGlobalsGray()) ! Qd.PaintRect(_intRect(rect)) if self._direction: rect = l, pos - 1, r, pos *************** *** 587,595 **** rect = pos - 1, t, pos, b Qd.PenPat(Qd.GetQDGlobalsGray()) ! Qd.PaintRect(rect) lastpos = pos self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) ! Qd.PaintRect(rect) Qd.PenNormal() SetCursor("watch") --- 591,599 ---- rect = pos - 1, t, pos, b Qd.PenPat(Qd.GetQDGlobalsGray()) ! Qd.PaintRect(_intRect(rect)) lastpos = pos self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None) Evt.WaitNextEvent(0, 3) ! Qd.PaintRect(_intRect(rect)) Qd.PenNormal() SetCursor("watch") From jackjansen@users.sourceforge.net Sun May 25 23:00:20 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 25 May 2003 15:00:20 -0700 Subject: [Python-checkins] python/dist/src/Mac/scripts BuildApplet.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv2767/Mac/scripts Modified Files: BuildApplet.py Log Message: Added a --python option, which sets the python to be used in the #! line in the bootstrap script of the applet. Index: BuildApplet.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/scripts/BuildApplet.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** BuildApplet.py 24 Feb 2003 16:28:37 -0000 1.19 --- BuildApplet.py 25 May 2003 22:00:17 -0000 1.20 *************** *** 54,59 **** else: ! SHORTOPTS = "o:r:ne:v?" ! LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) --- 54,59 ---- else: ! SHORTOPTS = "o:r:ne:v?P" ! LONGOPTS=("output=", "resource=", "noargv", "extra=", "verbose", "help", "python=") try: options, args = getopt.getopt(sys.argv[1:], SHORTOPTS, LONGOPTS) *************** *** 79,82 **** --- 79,87 ---- arg = arg.split(':') extras.append(arg) + elif opt in ('-P', '--python'): + # This is a very dirty trick. We set sys.executable + # so that bundlebuilder will use this in the #! line + # for the applet bootstrap. + sys.executable = arg elif opt in ('-v', '--verbose'): verbose = Verbose() From jackjansen@users.sourceforge.net Sun May 25 23:00:20 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 25 May 2003 15:00:20 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac bundlebuilder.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv2767/Lib/plat-mac Modified Files: bundlebuilder.py Log Message: Added a --python option, which sets the python to be used in the #! line in the bootstrap script of the applet. Index: bundlebuilder.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/bundlebuilder.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** bundlebuilder.py 9 Apr 2003 13:25:42 -0000 1.25 --- bundlebuilder.py 25 May 2003 22:00:16 -0000 1.26 *************** *** 333,336 **** --- 333,339 ---- standalone = 0 + # If set, use this for #! lines in stead of sys.executable + python = None + # If True, add a real main program that emulates sys.argv before calling # mainprogram *************** *** 443,446 **** --- 446,451 ---- # /usr/bin/python hashbang = "/usr/bin/python" + elif self.python: + hashbang = self.python else: hashbang = os.path.realpath(sys.executable) *************** *** 707,710 **** --- 712,716 ---- --standalone build a standalone application, which is fully independent of a Python installation + --python=FILE Python to use in #! line in stead of current Python --lib=FILE shared library or framework to be copied into the bundle *************** *** 733,737 **** "link-exec", "help", "verbose", "quiet", "argv", "standalone", "exclude=", "include=", "package=", "strip", "iconfile=", ! "lib=") try: --- 739,743 ---- "link-exec", "help", "verbose", "quiet", "argv", "standalone", "exclude=", "include=", "package=", "strip", "iconfile=", ! "lib=", "python=") try: *************** *** 781,784 **** --- 787,792 ---- elif opt == '--standalone': builder.standalone = 1 + elif opt == '--python': + builder.python = arg elif opt in ('-x', '--exclude'): builder.excludeModules.append(arg) From jackjansen@users.sourceforge.net Sun May 25 23:01:34 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 25 May 2003 15:01:34 -0700 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.127,1.128 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv3700 Modified Files: Makefile.pre.in Log Message: Fixed the DESTDIR modifications to also allow MacOSX framework builds to be installed to a different location. This should make the OSX binary installer building a lot simpler. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.127 retrieving revision 1.128 diff -C2 -d -r1.127 -r1.128 *** Makefile.pre.in 16 May 2003 05:40:31 -0000 1.127 --- Makefile.pre.in 25 May 2003 22:01:31 -0000 1.128 *************** *** 591,595 **** altbininstall: $(BUILDPYTHON) @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \ ! if test ! -f $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \ echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \ exit 1; \ --- 591,595 ---- altbininstall: $(BUILDPYTHON) @if test "$(PYTHONFRAMEWORKDIR)" != no-framework; then \ ! if test ! -f $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current/Resources/Info.plist; then \ echo 'Framework build: use "make frameworkinstall" in stead of "make install"'; \ exit 1; \ *************** *** 836,854 **** @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ if test ! -d $(DESTDIR)$$i; then \ ! echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ done ! $(LN) -fsn include/python$(VERSION) $(prefix)/Headers ! $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(prefix)/Resources/Info.plist ! $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(prefix)/Resources/version.plist $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ ! $(prefix)/Resources/English.lproj/InfoPlist.strings ! $(LN) -fsn $(VERSION) $(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current ! $(LN) -fsn Versions/Current/Python $(PYTHONFRAMEWORKINSTALLDIR)/Python ! $(LN) -fsn Versions/Current/Headers $(PYTHONFRAMEWORKINSTALLDIR)/Headers ! $(LN) -fsn Versions/Current/Resources $(PYTHONFRAMEWORKINSTALLDIR)/Resources ! $(INSTALL_DATA) $(LDLIBRARY) $(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) # This installs Mac/Lib into the framework --- 836,854 ---- @for i in $(prefix)/Resources/English.lproj $(prefix)/lib; do\ if test ! -d $(DESTDIR)$$i; then \ ! echo "Creating directory $(DESTDIR)$$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ done ! $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers ! $(INSTALL_DATA) $(RESSRCDIR)/Info.plist $(DESTDIR)$(prefix)/Resources/Info.plist ! $(INSTALL_DATA) $(RESSRCDIR)/version.plist $(DESTDIR)$(prefix)/Resources/version.plist $(INSTALL_DATA) $(RESSRCDIR)/English.lproj/InfoPlist.strings \ ! $(DESTDIR)$(prefix)/Resources/English.lproj/InfoPlist.strings ! $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current ! $(LN) -fsn Versions/Current/Python $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Python ! $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers ! $(LN) -fsn Versions/Current/Resources $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Resources ! $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(PYTHONFRAMEWORKPREFIX)/$(LDLIBRARY) # This installs Mac/Lib into the framework *************** *** 856,860 **** $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \ BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) # This installs the IDE, the Launcher and other apps into /Applications --- 856,861 ---- $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installmacsubtree \ BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. prefix=$(prefix) LIBDEST=$(LIBDEST) \ ! DESTDIR=$(DESTDIR) # This installs the IDE, the Launcher and other apps into /Applications *************** *** 862,866 **** $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. # This install the unix python and pythonw tools in /usr/local/bin --- 863,867 ---- $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) # This install the unix python and pythonw tools in /usr/local/bin *************** *** 868,872 **** $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. dstroot=$(PYTHONFRAMEWORKPREFIX)/../.. # This installs IDLE --- 869,873 ---- $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) # This installs IDLE From jackjansen@users.sourceforge.net Sun May 25 23:01:34 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun, 25 May 2003 15:01:34 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX Makefile,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX In directory sc8-pr-cvs1:/tmp/cvs-serv3700/Mac/OSX Modified Files: Makefile Log Message: Fixed the DESTDIR modifications to also allow MacOSX framework builds to be installed to a different location. This should make the OSX binary installer building a lot simpler. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Makefile,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Makefile 9 May 2003 15:08:39 -0000 1.40 --- Makefile 25 May 2003 22:01:32 -0000 1.41 *************** *** 6,18 **** builddir = ../.. srcdir = ../.. ! dstroot=/. ! prefix=$(dstroot)/Library/Frameworks/Python.framework/Versions/$(VERSION) LIBDEST=$(prefix)/lib/python$(VERSION) BUILDPYTHON=$(builddir)/python.exe # These are normally glimpsed from the previous set ! bindir=$(dstroot)/usr/local/bin PYTHONAPPSPATH=/Applications/MacPython-$(VERSION) ! PYTHONAPPSDIR=$(dstroot)$(PYTHONAPPSPATH) APPINSTALLDIR=$(prefix)/Resources/Python.app --- 6,18 ---- builddir = ../.. srcdir = ../.. ! prefix=/Library/Frameworks/Python.framework/Versions/$(VERSION) LIBDEST=$(prefix)/lib/python$(VERSION) BUILDPYTHON=$(builddir)/python.exe + DESTDIR= # These are normally glimpsed from the previous set ! bindir=/usr/local/bin PYTHONAPPSPATH=/Applications/MacPython-$(VERSION) ! PYTHONAPPSDIR=$(PYTHONAPPSPATH) APPINSTALLDIR=$(prefix)/Resources/Python.app *************** *** 60,64 **** cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ pbxbuild -target PythonLauncher -buildstyle Deployment \ ! DSTROOT=$(dstroot) INSTALL_PATH=$(PYTHONAPPSPATH) install install_Python: --- 60,64 ---- cd $(srcdir)/Mac/OSX/PythonLauncher/PythonLauncher.pbproj ; \ pbxbuild -target PythonLauncher -buildstyle Deployment \ ! DSTROOT=$(DESTDIR) INSTALL_PATH=$(PYTHONAPPSPATH) install install_Python: *************** *** 67,79 **** fi @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ ! if test ! -d $$i; then \ ! echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ fi;\ done @for i in $(APPSUBDIRS); do \ ! if test ! -d $(APPINSTALLDIR)/Contents/$$i; then \ ! echo "Creating directory $(APPINSTALLDIR)/Contents/$$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(APPINSTALLDIR)/Contents/$$i; \ else true; \ fi; \ --- 67,79 ---- fi @for i in $(PYTHONAPPSDIR) $(APPINSTALLDIR) $(APPINSTALLDIR)/Contents; do \ ! if test ! -d $(DESTDIR)$$i; then \ ! echo "Creating directory $(DESTDIR)$$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ fi;\ done @for i in $(APPSUBDIRS); do \ ! if test ! -d $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; then \ ! echo "Creating directory $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$(APPINSTALLDIR)/Contents/$$i; \ else true; \ fi; \ *************** *** 83,87 **** a=$(APPTEMPLATE)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(APPINSTALLDIR)/Contents/$$d; \ for i in $$a/*; \ do \ --- 83,87 ---- a=$(APPTEMPLATE)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(DESTDIR)$(APPINSTALLDIR)/Contents/$$d; \ for i in $$a/*; \ do \ *************** *** 107,138 **** done; \ done ! $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(APPINSTALLDIR)/Contents/MacOS/python ! install_IDE: $(INSTALLED_PYTHONW) ! @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ else \ ! echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ ! $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/PythonIDE.app --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ fi ! install_PackageManager: $(INSTALLED_PYTHONW) ! @if ! $(INSTALLED_PYTHONW) -c "import waste"; then \ echo PackageManager needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ else \ ! echo $(INSTALLED_PYTHONW) $(bundlebuilder) \ ! --builddir $(PYTHONAPPSDIR)/ \ --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ --creator Pimp build; \ ! $(INSTALLED_PYTHONW) $(bundlebuilder) \ ! --builddir $(PYTHONAPPSDIR)/ \ --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ --- 107,142 ---- done; \ done ! $(INSTALL_PROGRAM) $(STRIPFLAG) $(BUILDPYTHON) $(DESTDIR)$(APPINSTALLDIR)/Contents/MacOS/python ! install_IDE: ! @if ! $(BUILDPYTHON) -c "import waste"; then \ echo PythonIDE needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ else \ ! echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --python $(INSTALLED_PYTHONW) \ ! --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py ; \ ! $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --python $(INSTALLED_PYTHONW) \ ! --output $(DESTDIR)$(PYTHONAPPSDIR)/PythonIDE.app --noargv \ $(srcdir)/Mac/Tools/IDE/PythonIDE.py; \ fi ! install_PackageManager: ! @if ! $(BUILDPYTHON) -c "import waste"; then \ echo PackageManager needs the \"waste\" extension module; \ echo See Mac/OSX/README for details; \ else \ ! echo $(BUILDPYTHON) $(bundlebuilder) \ ! --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ ! --python $(INSTALLED_PYTHONW) \ --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ --iconfile $(srcdir)/Mac/Tools/IDE/PackageManager.icns \ --creator Pimp build; \ ! $(BUILDPYTHON) $(bundlebuilder) \ ! --builddir $(DESTDIR)$(PYTHONAPPSDIR)/ \ ! --python $(INSTALLED_PYTHONW) \ --resource $(srcdir)/Mac/Tools/IDE/PythonIDE.rsrc \ --mainprogram $(srcdir)/Mac/Tools/IDE/PackageManager.py \ *************** *** 141,155 **** fi ! install_IDLE: $(INSTALLED_PYTHONW) ! @if ! $(INSTALLED_PYTHONW) -c "import _tkinter"; then \ echo IDLE needs the \"Tkinter\" extension module; \ echo See Mac/OSX/README for details; \ else \ ! echo $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/IDLE.app \ --extra $(srcdir)/Tools/idle \ $(srcdir)/Tools/idle/idle ; \ ! $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/IDLE.app \ --extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \ $(srcdir)/Tools/idle/idle ; \ --- 145,161 ---- fi ! install_IDLE: ! @if ! $(BUILDPYTHON) -c "import _tkinter"; then \ echo IDLE needs the \"Tkinter\" extension module; \ echo See Mac/OSX/README for details; \ else \ ! echo $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --python $(INSTALLED_PYTHONW) \ ! --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ --extra $(srcdir)/Tools/idle \ $(srcdir)/Tools/idle/idle ; \ ! $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --python $(INSTALLED_PYTHONW) \ ! --output $(DESTDIR)$(PYTHONAPPSDIR)/IDLE.app \ --extra $(srcdir)/Tools/idle:Contents/Resources/idlelib \ $(srcdir)/Tools/idle/idle ; \ *************** *** 157,163 **** ! install_BuildApplet: $(INSTALLED_PYTHONW) ! $(INSTALLED_PYTHONW) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --output $(PYTHONAPPSDIR)/BuildApplet.app \ $(srcdir)/Mac/scripts/BuildApplet.py --- 163,170 ---- ! install_BuildApplet: ! $(BUILDPYTHON) $(srcdir)/Mac/scripts/BuildApplet.py \ ! --python $(INSTALLED_PYTHONW) \ ! --output $(DESTDIR)$(PYTHONAPPSDIR)/BuildApplet.app \ $(srcdir)/Mac/scripts/BuildApplet.py *************** *** 169,175 **** @for i in $(MACTOOLSDEST); \ do \ ! if test ! -d $$i; then \ ! echo "Creating directory $$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $$i; \ else true; \ fi; \ --- 176,182 ---- @for i in $(MACTOOLSDEST); \ do \ ! if test ! -d $(DESTDIR)$$i; then \ ! echo "Creating directory $(DESTDIR)$$i"; \ ! $(INSTALL) -d -m $(DIRMODE) $(DESTDIR)$$i; \ else true; \ fi; \ *************** *** 179,183 **** a=$(MACTOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(MACTOOLSDEST)/$$d; \ if test ! -d $$b; then \ echo "Creating directory $$b"; \ --- 186,190 ---- a=$(MACTOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ if test ! -d $$b; then \ echo "Creating directory $$b"; \ *************** *** 190,194 **** a=$(MACTOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(MACTOOLSDEST)/$$d; \ for i in $$a/*; \ do \ --- 197,201 ---- a=$(MACTOOLSSRC)/$$d; \ if test ! -d $$a; then continue; else true; fi; \ ! b=$(DESTDIR)$(MACTOOLSDEST)/$$d; \ for i in $$a/*; \ do \ *************** *** 216,222 **** ! $(BUILDPYTHON) $(CACHERSRC) -v $(MACLIBDEST) $(MACTOOLSDEST) ! $(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST) ! $(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(MACTOOLSDEST) # --- 223,229 ---- ! $(BUILDPYTHON) $(CACHERSRC) -v $(DESTDIR)$(MACLIBDEST) $(DESTDIR)$(MACTOOLSDEST) ! $(BUILDPYTHON) -Wi -tt $(compileall) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) ! $(BUILDPYTHON) -O -Wi -tt $(compileall) -x badsyntax $(DESTDIR)$(MACTOOLSDEST) # *************** *** 229,238 **** # At least this rule will give an error if it doesn't exist. ! installunixtools: $(INSTALLED_PYTHON) $(INSTALLED_PYTHONW) ! $(INSTALL) -d $(bindir) ! $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(bindir)/python$(VERSION) ! $(INSTALL_SYMLINK) python$(VERSION) $(bindir)/python echo "#!/bin/sh" > pythonw.sh echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh ! $(INSTALL) pythonw.sh $(bindir)/pythonw$(VERSION) ! $(INSTALL_SYMLINK) pythonw$(VERSION) $(bindir)/pythonw --- 236,245 ---- # At least this rule will give an error if it doesn't exist. ! installunixtools: ! $(INSTALL) -d $(DESTDIR)$(bindir) ! $(INSTALL_SYMLINK) $(INSTALLED_PYTHON) $(DESTDIR)$(bindir)/python$(VERSION) ! $(INSTALL_SYMLINK) python$(VERSION) $(DESTDIR)$(bindir)/python echo "#!/bin/sh" > pythonw.sh echo "exec \"$(INSTALLED_PYTHONW)\" \"\$$@\"" >> pythonw.sh ! $(INSTALL) pythonw.sh $(DESTDIR)$(bindir)/pythonw$(VERSION) ! $(INSTALL_SYMLINK) pythonw$(VERSION) $(DESTDIR)$(bindir)/pythonw From gward@users.sourceforge.net Mon May 26 02:51:36 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Sun, 25 May 2003 18:51:36 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4170 Modified Files: libossaudiodev.tex Log Message: More wordsmithing and cleanup. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** libossaudiodev.tex 23 May 2003 02:44:46 -0000 1.8 --- libossaudiodev.tex 26 May 2003 01:51:33 -0000 1.9 *************** *** 75,81 **** \var{mode} is one of \code{'r'} for read-only (record) access, \code{'w'} for write-only (playback) access and \code{'rw'} for both. ! Since many soundcards only allow one process to have the recorder or ! player open at a time it is a good idea to open the device only for the ! activity needed. Further, some soundcards are half-duplex: they can be opened for reading or writing, but not both at once. --- 75,81 ---- \var{mode} is one of \code{'r'} for read-only (record) access, \code{'w'} for write-only (playback) access and \code{'rw'} for both. ! Since many sound cards only allow one process to have the recorder or ! player open at a time, it is a good idea to open the device only for the ! activity needed. Further, some sound cards are half-duplex: they can be opened for reading or writing, but not both at once. *************** *** 110,114 **** as flexible in all cases. ! The audio device objects are returned by \function{open()} define the following methods: --- 110,114 ---- as flexible in all cases. ! The audio device objects returned by \function{open()} define the following methods: *************** *** 139,160 **** \begin{methoddesc}[audio device]{writeall}{data} ! Write the entire Python string \var{data} to the audio device. If the ! device is in blocking mode (the default), behaves identically to ! \method{write()}; in non-blocking mode, \method{writeall()} waits until the ! audio device is able to accept data, writes as much data as it will ! accept, and repeats until \var{data} has been completely written. Has ! no return value, since the amount of data written is always equal to the ! amount of data supplied. \end{methoddesc} The following methods each map to exactly one ! \function{ioctl()} system call. If the underlying \function{ioctl()} ! fails, they all raise \exception{IOError}. \begin{methoddesc}[audio device]{nonblock}{} Put the device into non-blocking mode. Once in non-blocking mode, there is no way to return it to blocking mode. - - Corresponds to the \code{SNDCTL_DSP_NONBLOCK} ioctl. \end{methoddesc} --- 139,161 ---- \begin{methoddesc}[audio device]{writeall}{data} ! Write the entire Python string \var{data} to the audio device: waits ! until the audio device is able to accept data, writes as much data as it ! will accept, and repeats until \var{data} has been completely written. ! If the device is in blocking mode (the default), this has the same ! effect as \method{write()}; \method{writeall()} is only useful in ! non-blocking mode. Has no return value, since the amount of data ! written is always equal to the amount of data supplied. \end{methoddesc} The following methods each map to exactly one ! \function{ioctl()} system call. The correspondence is obvious: for ! example, \method{setfmt()} corresponds to the \code{SNDCTL_DSP_SETFMT} ! ioctl, and \method{sync()} to \code{SNDCTL_DSP_SYNC} (this can be useful ! when consulting the OSS documentation). If the underlying ! \function{ioctl()} fails, they all raise \exception{IOError}. \begin{methoddesc}[audio device]{nonblock}{} Put the device into non-blocking mode. Once in non-blocking mode, there is no way to return it to blocking mode. \end{methoddesc} *************** *** 190,210 **** support \constant{AFMT_U8}; the most common format used today is \constant{AFMT_S16_LE}. - - Corresponds to the \code{SNDCTL_DSP_GETFMTS} ioctl. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} Try to set the current audio format to \var{format}---see ! \method{getfmts()} for a list. Return the audio format that the device was set to, which may not be the requested format. May also be used to return the current audio format---do this by passing an ``audio format'' of \constant{AFMT_QUERY}. - - Corresponds to the \code{SNDCTL_DSP_SETFMT} ioctl. \end{methoddesc} \begin{methoddesc}[audio device]{channels}{num_channels} ! Sets the number of output channels to \var{num_channels}. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. --- 191,207 ---- support \constant{AFMT_U8}; the most common format used today is \constant{AFMT_S16_LE}. \end{methoddesc} \begin{methoddesc}[audio device]{setfmt}{format} Try to set the current audio format to \var{format}---see ! \method{getfmts()} for a list. Returns the audio format that the device was set to, which may not be the requested format. May also be used to return the current audio format---do this by passing an ``audio format'' of \constant{AFMT_QUERY}. \end{methoddesc} \begin{methoddesc}[audio device]{channels}{num_channels} ! Set the number of output channels to \var{num_channels}. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. *************** *** 226,237 **** \begin{methoddesc}[audio device]{sync}{} ! Waits until the sound device has played every byte in its buffer and ! returns. This also occurs when the sound device is closed. The OSS ! documentation recommends simply closing and re-opening the device rather ! than using \method{sync()}. \end{methoddesc} \begin{methoddesc}[audio device]{reset}{} ! Immediately stops and playing or recording and returns the device to a state where it can accept commands. The OSS documentation recommends closing and re-opening the device after calling \method{reset()}. --- 223,234 ---- \begin{methoddesc}[audio device]{sync}{} ! Wait until the sound device has played every byte in its buffer. (This ! happens implicitly when the device is closed.) The OSS documentation ! recommends closing and re-opening the device rather than using ! \method{sync()}. \end{methoddesc} \begin{methoddesc}[audio device]{reset}{} ! Immediately stop playing or recording and return the device to a state where it can accept commands. The OSS documentation recommends closing and re-opening the device after calling \method{reset()}. *************** *** 239,246 **** \begin{methoddesc}[audio device]{post}{} ! To be used like a lightweight \method{sync()}, the \method{post()} ! IOCTL informs the audio device that there is a likely to be a pause in ! the audio output---i.e., after playing a spot sound effect, before ! waiting for user input, or before doing disk I/O. \end{methoddesc} --- 236,243 ---- \begin{methoddesc}[audio device]{post}{} ! Tell the driver that there is likely to be a pause in the output, making ! it possible for the device to handle the pause more intelligently. You ! might use this after playing a spot sound effect, before waiting for ! user input, or before doing disk I/O. \end{methoddesc} From loewis@users.sourceforge.net Mon May 26 06:15:38 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 25 May 2003 22:15:38 -0700 Subject: [Python-checkins] python/dist/src/Misc python.man,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17917 Modified Files: python.man Log Message: Remove -U from argument list. Index: python.man =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/python.man,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** python.man 9 Aug 2002 13:37:31 -0000 1.26 --- python.man 26 May 2003 05:15:35 -0000 1.27 *************** *** 33,39 **** .B \-u ] - [ - .B \-U - ] .br [ --- 33,36 ---- From loewis@users.sourceforge.net Mon May 26 06:37:54 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sun, 25 May 2003 22:37:54 -0700 Subject: [Python-checkins] python/dist/src configure,1.400,1.401 configure.in,1.411,1.412 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv23731 Modified Files: configure configure.in Log Message: Patch #742741: Check for true in different paths, support -pthread. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.400 retrieving revision 1.401 diff -C2 -d -r1.400 -r1.401 *** configure 24 May 2003 12:35:45 -0000 1.400 --- configure 26 May 2003 05:37:50 -0000 1.401 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.410 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.411 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 3950,3953 **** --- 3950,4015 ---- fi + if test $ac_cv_kthread = no + then + # -pthread, if available, provides the right #defines + # and linker options to make pthread_create available + # Some compilers won't report that they do not support -pthread, + # so we need to run a program to see whether it really made the + # function available. + echo "$as_me:$LINENO: checking whether $CC accepts -pthread" >&5 + echo $ECHO_N "checking whether $CC accepts -pthread... $ECHO_C" >&6 + if test "${ac_cv_thread+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + ac_save_cc="$CC" + CC="$CC -pthread" + if test "$cross_compiling" = yes; then + ac_cv_pthread=no + else + cat >conftest.$ac_ext <<_ACEOF + #line $LINENO "configure" + #include "confdefs.h" + + #include + + void* routine(void* p){return NULL;} + + int main(){ + pthread_t p; + if(pthread_create(&p,NULL,routine,NULL)!=0) + return 1; + (void)pthread_detach(p); + return 0; + } + + _ACEOF + rm -f conftest$ac_exeext + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_pthread=yes + else + echo "$as_me: program exited with status $ac_status" >&5 + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ( exit $ac_status ) + ac_cv_pthread=no + fi + rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + fi + CC="$ac_save_cc" + fi + + echo "$as_me:$LINENO: result: $ac_cv_pthread" >&5 + echo "${ECHO_T}$ac_cv_pthread" >&6 + fi + # checks for header files *************** *** 9203,9206 **** --- 9265,9270 ---- elif test "$ac_cv_kthread" = "yes" then CC="$CC -Kthread" + elif test "$ac_cv_pthread" = "yes" + then CC="$CC -pthread" fi echo "$as_me:$LINENO: checking for pthread_t" >&5 *************** *** 10223,10226 **** --- 10287,10299 ---- posix_threads=yes THREADOBJ="Python/thread.o" + elif test "$ac_cv_pthread" = "yes" + then + CC="$CC -pthread" + cat >>confdefs.h <<\_ACEOF + #define WITH_THREAD 1 + _ACEOF + + posix_threads=yes + THREADOBJ="Python/thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" *************** *** 11233,11237 **** ! if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then --- 11306,11454 ---- ! echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 ! echo $ECHO_N "checking for usconfig in -lmpc... $ECHO_C" >&6 ! if test "${ac_cv_lib_mpc_usconfig+set}" = set; then ! echo $ECHO_N "(cached) $ECHO_C" >&6 ! else ! ac_check_lib_save_LIBS=$LIBS ! LIBS="-lmpc $LIBS" ! cat >conftest.$ac_ext <<_ACEOF ! #line $LINENO "configure" ! #include "confdefs.h" ! ! /* Override any gcc2 internal prototype to avoid an error. */ ! #ifdef __cplusplus ! extern "C" ! #endif ! /* We use char because int might match the return type of a gcc2 ! builtin and then its argument prototype would still apply. */ ! char usconfig (); ! #ifdef F77_DUMMY_MAIN ! # ifdef __cplusplus ! extern "C" ! # endif ! int F77_DUMMY_MAIN() { return 1; } ! #endif ! int ! main () ! { ! usconfig (); ! ; ! return 0; ! } ! _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ! (eval $ac_link) 2>&5 ! ac_status=$? ! echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ! (eval $ac_try) 2>&5 ! ac_status=$? ! echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); }; }; then ! ac_cv_lib_mpc_usconfig=yes ! else ! echo "$as_me: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! ac_cv_lib_mpc_usconfig=no ! fi ! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ! LIBS=$ac_check_lib_save_LIBS ! fi ! echo "$as_me:$LINENO: result: $ac_cv_lib_mpc_usconfig" >&5 ! echo "${ECHO_T}$ac_cv_lib_mpc_usconfig" >&6 ! if test $ac_cv_lib_mpc_usconfig = yes; then ! cat >>confdefs.h <<\_ACEOF ! #define WITH_THREAD 1 ! _ACEOF ! ! LIBS="$LIBS -lmpc" ! THREADOBJ="Python/thread.o" ! USE_THREAD_MODULE="" ! fi ! ! ! if test "$posix_threads" != "yes"; then ! echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 ! echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6 ! if test "${ac_cv_lib_thread_thr_create+set}" = set; then ! echo $ECHO_N "(cached) $ECHO_C" >&6 ! else ! ac_check_lib_save_LIBS=$LIBS ! LIBS="-lthread $LIBS" ! cat >conftest.$ac_ext <<_ACEOF ! #line $LINENO "configure" ! #include "confdefs.h" ! ! /* Override any gcc2 internal prototype to avoid an error. */ ! #ifdef __cplusplus ! extern "C" ! #endif ! /* We use char because int might match the return type of a gcc2 ! builtin and then its argument prototype would still apply. */ ! char thr_create (); ! #ifdef F77_DUMMY_MAIN ! # ifdef __cplusplus ! extern "C" ! # endif ! int F77_DUMMY_MAIN() { return 1; } ! #endif ! int ! main () ! { ! thr_create (); ! ; ! return 0; ! } ! _ACEOF ! rm -f conftest.$ac_objext conftest$ac_exeext ! if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ! (eval $ac_link) 2>&5 ! ac_status=$? ! echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); } && ! { ac_try='test -s conftest$ac_exeext' ! { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 ! (eval $ac_try) 2>&5 ! ac_status=$? ! echo "$as_me:$LINENO: \$? = $ac_status" >&5 ! (exit $ac_status); }; }; then ! ac_cv_lib_thread_thr_create=yes ! else ! echo "$as_me: failed program was:" >&5 ! cat conftest.$ac_ext >&5 ! ac_cv_lib_thread_thr_create=no ! fi ! rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext ! LIBS=$ac_check_lib_save_LIBS ! fi ! echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 ! echo "${ECHO_T}$ac_cv_lib_thread_thr_create" >&6 ! if test $ac_cv_lib_thread_thr_create = yes; then ! cat >>confdefs.h <<\_ACEOF ! #define WITH_THREAD 1 ! _ACEOF ! ! LIBS="$LIBS -lthread" ! THREADOBJ="Python/thread.o" ! USE_THREAD_MODULE="" ! fi ! ! fi ! ! if test "$USE_THREAD_MODULE" != "#" ! then ! # If the above checks didn't disable threads, (at least) OSF1 ! # needs this '-threads' argument during linking. ! case $ac_sys_system in ! OSF1) LDLAST=-threads;; ! esac ! fi ! fi ! ! if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then *************** *** 11244,11252 **** # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in SunOS/5.8) cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_POSIX_SEMAPHORES 1 _ACEOF ! ;; esac --- 11461,11476 ---- # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in + SunOS/5.6) + cat >>confdefs.h <<\_ACEOF + #define HAVE_PTHREAD_DESTRUCTOR 1 + _ACEOF + + ;; SunOS/5.8) cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_POSIX_SEMAPHORES 1 _ACEOF ! ! ;; esac *************** *** 11384,11543 **** done - fi - - echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 - echo $ECHO_N "checking for usconfig in -lmpc... $ECHO_C" >&6 - if test "${ac_cv_lib_mpc_usconfig+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS - LIBS="-lmpc $LIBS" - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ - char usconfig (); - #ifdef F77_DUMMY_MAIN - # ifdef __cplusplus - extern "C" - # endif - int F77_DUMMY_MAIN() { return 1; } - #endif - int - main () - { - usconfig (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_mpc_usconfig=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_lib_mpc_usconfig=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi - echo "$as_me:$LINENO: result: $ac_cv_lib_mpc_usconfig" >&5 - echo "${ECHO_T}$ac_cv_lib_mpc_usconfig" >&6 - if test $ac_cv_lib_mpc_usconfig = yes; then - cat >>confdefs.h <<\_ACEOF - #define WITH_THREAD 1 - _ACEOF - - LIBS="$LIBS -lmpc" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE="" - fi - - - if test "$posix_threads" != "yes"; then - echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 - echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6 - if test "${ac_cv_lib_thread_thr_create+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 - else - ac_check_lib_save_LIBS=$LIBS - LIBS="-lthread $LIBS" - cat >conftest.$ac_ext <<_ACEOF - #line $LINENO "configure" - #include "confdefs.h" - - /* Override any gcc2 internal prototype to avoid an error. */ - #ifdef __cplusplus - extern "C" - #endif - /* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ - char thr_create (); - #ifdef F77_DUMMY_MAIN - # ifdef __cplusplus - extern "C" - # endif - int F77_DUMMY_MAIN() { return 1; } - #endif - int - main () - { - thr_create (); - ; - return 0; - } - _ACEOF - rm -f conftest.$ac_objext conftest$ac_exeext - if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_thread_thr_create=yes - else - echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_lib_thread_thr_create=no - fi - rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS=$ac_check_lib_save_LIBS - fi - echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 - echo "${ECHO_T}$ac_cv_lib_thread_thr_create" >&6 - if test $ac_cv_lib_thread_thr_create = yes; then - cat >>confdefs.h <<\_ACEOF - #define WITH_THREAD 1 - _ACEOF - - LIBS="$LIBS -lthread" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE="" fi - fi - - if test "$USE_THREAD_MODULE" != "#" - then - # If the above checks didn't disable threads, (at least) OSF1 - # needs this '-threads' argument during linking. - case $ac_sys_system in - OSF1) LDLAST=-threads;; - esac - fi - - if test "$posix_threads" = yes -a \ - "$ac_sys_system" = "SunOS" -a \ - "$ac_sys_release" = "5.6"; then - - cat >>confdefs.h <<\_ACEOF - #define HAVE_PTHREAD_DESTRUCTOR 1 - _ACEOF - - fi - - fi # Check for enable-ipv6 --- 11608,11613 ---- *************** *** 12593,12596 **** --- 12663,12708 ---- rm -f conftest.$ac_objext conftest.$ac_ext + for ac_prog in true + do + # Extract the first word of "$ac_prog", so it can be a program name with args. + set dummy $ac_prog; ac_word=$2 + echo "$as_me:$LINENO: checking for $ac_word" >&5 + echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 + if test "${ac_cv_prog_TRUE+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 + else + if test -n "$TRUE"; then + ac_cv_prog_TRUE="$TRUE" # Let the user override the test. + else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR + for as_dir in $PATH + do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_TRUE="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi + done + done + + fi + fi + TRUE=$ac_cv_prog_TRUE + if test -n "$TRUE"; then + echo "$as_me:$LINENO: result: $TRUE" >&5 + echo "${ECHO_T}$TRUE" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 + echo "${ECHO_T}no" >&6 + fi + + test -n "$TRUE" && break + done + test -n "$TRUE" || TRUE="/bin/true" + + echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 echo $ECHO_N "checking for inet_aton in -lc... $ECHO_C" >&6 *************** *** 12649,12653 **** echo "${ECHO_T}$ac_cv_lib_c_inet_aton" >&6 if test $ac_cv_lib_c_inet_aton = yes; then ! /bin/true else --- 12761,12765 ---- echo "${ECHO_T}$ac_cv_lib_c_inet_aton" >&6 if test $ac_cv_lib_c_inet_aton = yes; then ! $ac_cv_prog_TRUE else *************** *** 18075,18078 **** --- 18187,18191 ---- s,@DYNLOADFILE@,$DYNLOADFILE,;t t s,@MACHDEP_OBJS@,$MACHDEP_OBJS,;t t + s,@TRUE@,$TRUE,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@HAVE_GETHOSTBYNAME_R_6_ARG@,$HAVE_GETHOSTBYNAME_R_6_ARG,;t t Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.411 retrieving revision 1.412 diff -C2 -d -r1.411 -r1.412 *** configure.in 24 May 2003 12:35:47 -0000 1.411 --- configure.in 26 May 2003 05:37:51 -0000 1.412 *************** *** 793,796 **** --- 793,827 ---- fi + if test $ac_cv_kthread = no + then + # -pthread, if available, provides the right #defines + # and linker options to make pthread_create available + # Some compilers won't report that they do not support -pthread, + # so we need to run a program to see whether it really made the + # function available. + AC_MSG_CHECKING(whether $CC accepts -pthread) + AC_CACHE_VAL(ac_cv_thread, + [ac_save_cc="$CC" + CC="$CC -pthread" + AC_TRY_RUN([ + #include + + void* routine(void* p){return NULL;} + + int main(){ + pthread_t p; + if(pthread_create(&p,NULL,routine,NULL)!=0) + return 1; + (void)pthread_detach(p); + return 0; + } + ], + ac_cv_pthread=yes, + ac_cv_pthread=no, + ac_cv_pthread=no) + CC="$ac_save_cc"]) + AC_MSG_RESULT($ac_cv_pthread) + fi + dnl # check for ANSI or K&R ("traditional") preprocessor dnl AC_MSG_CHECKING(for C preprocessor type) *************** *** 983,986 **** --- 1014,1019 ---- elif test "$ac_cv_kthread" = "yes" then CC="$CC -Kthread" + elif test "$ac_cv_pthread" = "yes" + then CC="$CC -pthread" fi AC_MSG_CHECKING(for pthread_t) *************** *** 1416,1419 **** --- 1449,1458 ---- posix_threads=yes THREADOBJ="Python/thread.o" + elif test "$ac_cv_pthread" = "yes" + then + CC="$CC -pthread" + AC_DEFINE(WITH_THREAD) + posix_threads=yes + THREADOBJ="Python/thread.o" else if test ! -z "$with_threads" -a -d "$with_threads" *************** *** 1511,1515 **** ])])])])])])])])])])]) ! if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then AC_DEFINE(_POSIX_THREADS, 1, --- 1550,1576 ---- ])])])])])])])])])])]) ! AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) ! LIBS="$LIBS -lmpc" ! THREADOBJ="Python/thread.o" ! USE_THREAD_MODULE=""]) ! ! if test "$posix_threads" != "yes"; then ! AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) ! LIBS="$LIBS -lthread" ! THREADOBJ="Python/thread.o" ! USE_THREAD_MODULE=""]) ! fi ! ! if test "$USE_THREAD_MODULE" != "#" ! then ! # If the above checks didn't disable threads, (at least) OSF1 ! # needs this '-threads' argument during linking. ! case $ac_sys_system in ! OSF1) LDLAST=-threads;; ! esac ! fi ! fi ! ! if test "$posix_threads" = "yes"; then if test "$unistd_defines_pthreads" = "no"; then AC_DEFINE(_POSIX_THREADS, 1, *************** *** 1520,1525 **** # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, ! Define if the Posix semaphores do not work on your system);; esac --- 1581,1590 ---- # Bug 662787: Using semaphores causes unexplicable hangs on Solaris 8. case $ac_sys_system/$ac_sys_release in + SunOS/5.6) AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, + Defined for Solaris 2.6 bug in pthread header.) + ;; SunOS/5.8) AC_DEFINE(HAVE_BROKEN_POSIX_SEMAPHORES, 1, ! Define if the Posix semaphores do not work on your system) ! ;; esac *************** *** 1547,1582 **** fi AC_CHECK_FUNCS(pthread_sigmask) - fi - - AC_CHECK_LIB(mpc, usconfig, [AC_DEFINE(WITH_THREAD) - LIBS="$LIBS -lmpc" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE=""]) - - if test "$posix_threads" != "yes"; then - AC_CHECK_LIB(thread, thr_create, [AC_DEFINE(WITH_THREAD) - LIBS="$LIBS -lthread" - THREADOBJ="Python/thread.o" - USE_THREAD_MODULE=""]) - fi - - if test "$USE_THREAD_MODULE" != "#" - then - # If the above checks didn't disable threads, (at least) OSF1 - # needs this '-threads' argument during linking. - case $ac_sys_system in - OSF1) LDLAST=-threads;; - esac - fi - - if test "$posix_threads" = yes -a \ - "$ac_sys_system" = "SunOS" -a \ - "$ac_sys_release" = "5.6"; then - AC_DEFINE(HAVE_PTHREAD_DESTRUCTOR, 1, - [Defined for Solaris 2.6 bug in pthread header.]) - fi - fi # Check for enable-ipv6 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) --- 1612,1618 ---- fi AC_CHECK_FUNCS(pthread_sigmask) fi + # Check for enable-ipv6 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) *************** *** 1978,1984 **** ) dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv dnl On others, they are in the C library, so we to take no action ! AC_CHECK_LIB(c, inet_aton, [/bin/true], AC_CHECK_LIB(resolv, inet_aton) ) --- 2014,2023 ---- ) + dnl check for true + AC_CHECK_PROGS(TRUE, true, /bin/true) + dnl On some systems (e.g. Solaris 9), hstrerror and inet_aton are in -lresolv dnl On others, they are in the C library, so we to take no action ! AC_CHECK_LIB(c, inet_aton, [$ac_cv_prog_TRUE], AC_CHECK_LIB(resolv, inet_aton) ) From anthonybaxter@users.sourceforge.net Mon May 26 09:00:39 2003 From: anthonybaxter@users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Mon, 26 May 2003 01:00:39 -0700 Subject: [Python-checkins] python/nondist/sandbox/distutilsref distref.tex,1.8,1.9 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/distutilsref In directory sc8-pr-cvs1:/tmp/cvs-serv7882 Modified Files: distref.tex Log Message: doco for: distutils.text_file distutils.Command.sub_commands Index: distref.tex =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/distutilsref/distref.tex,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** distref.tex 22 May 2003 00:29:07 -0000 1.8 --- distref.tex 26 May 2003 08:00:36 -0000 1.9 *************** *** 1255,1261 **** \modulesynopsis{provides the TextFile class, a simple interface to text files} ! This module provides the \class{TextFile} class, which gives an interface to text files ! that (optionally) takes care of stripping comments, ignoring blank ! lines, and joining lines with backslashes. --- 1255,1372 ---- \modulesynopsis{provides the TextFile class, a simple interface to text files} ! This module provides the \class{TextFile} class, which gives an interface ! to text files that (optionally) takes care of stripping comments, ignoring ! blank lines, and joining lines with backslashes. ! ! \begin{classdesc}{TextFile}{\optional{filename=\code{None}, file=\code{None}, **options}} ! This class provides a file-like object that takes care of all ! the things you commonly want to do when processing a text file ! that has some line-by-line syntax: strip comments (as long as \code{#} ! is your comment character), skip blank lines, join adjacent lines by ! escaping the newline (ie. backslash at end of line), strip ! leading and/or trailing whitespace. All of these are optional ! and independently controllable. ! ! The class provides a \method{warn()} method so you can generate ! warning messages that report physical line number, even if the ! logical line in question spans multiple physical lines. Also ! provides \method{unreadline()} for implementing line-at-a-time lookahead. ! ! \class{TextFile} instances are create with either \var{filename}, \var{file}, ! or both. \exception{RuntimeError} is raised if both are \code{None}. ! \var{filename} should be a string, and \var{file} a file object (or ! something that provides \method{readline()} and \method{close()} ! methods). It is recommended that you supply at least \var{filename}, ! so that \class{TextFile} can include it in warning messages. If ! \var{file} is not supplied, TextFile creates its own using the ! \var{open()} builtin. ! ! The options are all boolean, and affect the values returned by ! \var{readline()} ! ! \begin{tableiii}{c|l|l}{option name}{option name}{description}{default} ! \lineiii{strip_comments}{ ! strip from "\#" to end-of-line, as well as any whitespace ! leading up to the "\#" -- unless it is escaped by a backslash} ! {true} ! \lineiii{lstrip_ws}{ ! strip leading whitespace from each line before returning it} ! {false} ! \lineiii{rstrip_ws}{ ! strip trailing whitespace (including line terminator!) from ! each line before returning it.} ! {true} ! \lineiii{skip_blanks}{ ! skip lines that are empty *after* stripping comments and ! whitespace. (If both lstrip_ws and rstrip_ws are false, ! then some lines may consist of solely whitespace: these will ! *not* be skipped, even if \var{skip_blanks} is true.)} ! {true} ! \lineiii{join_lines}{ ! if a backslash is the last non-newline character on a line ! after stripping comments and whitespace, join the following line ! to it to form one "logical line"; if N consecutive lines end ! with a backslash, then N+1 physical lines will be joined to ! form one logical line.} ! {false} ! \lineiii{collapse_join}{ ! strip leading whitespace from lines that are joined to their ! predecessor; only matters if \samp{(join_lines and not lstrip_ws)}} ! {false} ! \end{tableiii} ! ! Note that since \var{rstrip_ws} can strip the trailing newline, the ! semantics of \method{readline()} must differ from those of the builtin file ! object's \method{readline()} method! In particular, \method{readline()} ! returns \code{None} for end-of-file: an empty string might just be a ! blank line (or an all-whitespace line), if \var{rstrip_ws} is true ! but \var{skip_blanks} is not. ! ! \begin{methoddesc}{open}{filename} ! Open a new file \var{filename}. This overrides any \var{file} or ! \var{filename} constructor arguments. ! \end{methoddesc} ! ! \begin{methoddesc}{close}{} ! Close the current file and forget everything we know about it (including ! the filename and the current line number). ! \end{methoddesc} ! ! \begin{methoddesc}{warn}{msg\optional{,line=\code{None}}} ! Print (to stderr) a warning message tied to the current logical ! line in the current file. If the current logical line in the ! file spans multiple physical lines, the warning refers to the ! whole range, e.g. \samp{"lines 3-5"}. If \var{line} is supplied, ! it overrides the current line number; it may be a list or tuple ! to indicate a range of physical lines, or an integer for a ! single physical line. ! \end{methoddesc} ! ! \begin{methoddesc}{readline}{} ! Read and return a single logical line from the current file (or ! from an internal buffer if lines have previously been "unread" ! with \method{unreadline()}). If the \var{join_lines} option ! is true, this may involve reading multiple physical lines ! concatenated into a single string. Updates the current line number, ! so calling \method{warn()} after \method{readline()} emits a warning ! about the physical line(s) just read. Returns \code{None} on end-of-file, ! since the empty string can occur if \var{rstrip_ws} is true but ! \var{strip_blanks} is not. ! \end{methoddesc} ! \begin{methoddesc}{readlines}{} ! Read and return the list of all logical lines remaining in the current file. ! This updates the current line number to the last line of the file. ! \end{methoddesc} ! \begin{methoddesc}{unreadline}{line} ! Push \var{line} (a string) onto an internal buffer that will be ! checked by future \method{readline()} calls. Handy for implementing ! a parser with line-at-a-time lookahead. Note that lines that are "unread" ! with \method{unreadline} are not subsequently re-cleansed (whitespace ! stripped, or whatever) when read with \method{readline}. If multiple ! calls are made to \method{unreadline} before a call to \method{readline}, ! the lines will be returned most in most recent first order. ! \end{methoddesc} ! ! \end{classdesc} *************** *** 1267,1272 **** This part of Distutils implements the various Distutils commands, such ! as 'build', 'install' \&c. ! \subsubsection{\module{distutils.cmd} -- Abstract base class for Distutils commands} --- 1378,1383 ---- This part of Distutils implements the various Distutils commands, such ! as \code{build}, \code{install} \&c. Each command is implemented as a ! separate module, with the command name as the name of the module. \subsubsection{\module{distutils.cmd} -- Abstract base class for Distutils commands} *************** *** 1296,1300 **** \class{Distribution} instance. - \end{classdesc} --- 1407,1410 ---- *************** *** 1411,1420 **** \modulesynopsis{Register a module with the Python Package Index} ! The \code{register} command registers the package with the Python Package Index. ! This is described more in \pep{301}. \subsubsection{Creating a new Distutils command} ! This section will go through the steps to create a new Distutils command. A new command lives in a module in the \module{distutils.command} --- 1521,1530 ---- \modulesynopsis{Register a module with the Python Package Index} ! The \code{register} command registers the package with the Python Package ! Index. This is described in more detail in \pep{301}. \subsubsection{Creating a new Distutils command} ! This section outlines the steps to create a new Distutils command. A new command lives in a module in the \module{distutils.command} *************** *** 1458,1460 **** --- 1568,1585 ---- \end{methoddesc} + \var{sub_commands} formalizes the notion of a "family" of commands, + eg. \code{install} as the parent with sub-commands \code{install_lib}, + \code{install_headers}, etc. The parent of a family of commands + defines \var{sub_commands} as a class attribute; it's a list of + 2-tuples \samp{(command_name, predicate)}, with \var{command_name} a string + and \var{predicate} an unbound method, a string or None. + \var{predicate} is a method of the parent command that + determines whether the corresponding command is applicable in the + current situation. (Eg. we \code{install_headers} is only applicable if + we have any C header files to install.) If \var{predicate} is None, + that command is always applicable. + + \var{sub_commands} is usually defined at the *end* of a class, because + predicates can be unbound methods, so they must already have been + defined. The canonical example is the \code{install} command. From Jack.Jansen@cwi.nl Mon May 26 10:16:27 2003 From: Jack.Jansen@cwi.nl (Jack Jansen) Date: Mon, 26 May 2003 11:16:27 +0200 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.232,2.233 In-Reply-To: Message-ID: On Wednesday, May 21, 2003, at 23:29 Europe/Amsterdam, tim_one@users.sourceforge.net wrote: > inherit_slots(): Don't inherit tp_free unless the type and its base > agree about whether they're gc'able. If the type is gc'able and the > base is not, and the base uses the default PyObject_Del for its > tp_free, give the type PyObject_GC_Del for its tp_free (the appropriate > default for a gc'able type). Is it reasonable that in the normal course of events a type and basetype disagree on GC'ability? Because if it isn't shouldn't we print a warning or something (at least in debug builds)? -- Jack Jansen, , http://www.cwi.nl/~jack If I can't dance I don't want to be part of your revolution -- Emma Goldman From tim_one@email.msn.com Mon May 26 13:16:09 2003 From: tim_one@email.msn.com (Tim Peters) Date: Mon, 26 May 2003 08:16:09 -0400 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.232,2.233 In-Reply-To: Message-ID: [Tim] >> inherit_slots(): Don't inherit tp_free unless the type and its base >> agree about whether they're gc'able. If the type is gc'able and the >> base is not, and the base uses the default PyObject_Del for its >> tp_free, give the type PyObject_GC_Del for its tp_free (the >> appropriate default for a gc'able type). [Jack Jansen] > Is it reasonable that in the normal course of events a type and > basetype disagree on GC'ability? Yes, because by default all types inherit from "object", which isn't gc'able, so by default every gc'able type disagrees with its base class about gc'ability. For gc'able types constructed dynamically (e.g., almost all classes defined via Python code), Python was already inserting PyObject_GC_Del by magic. But it wasn't for statically defined types written in C. That's what the patch changed. Jim Fulton bumped into this when defining new gc'able types in C, and getting segfaults due to them inheriting PyObject_Del from object. > Because if it isn't shouldn't we print a warning or something (at > least in debug builds)? I'm afraid it's so common it would be viewed as a nuisance complaint. From nnorwitz@users.sourceforge.net Mon May 26 14:49:57 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 26 May 2003 06:49:57 -0700 Subject: [Python-checkins] python/dist/src/Lib pydoc.py,1.82,1.83 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv29886/Lib Modified Files: pydoc.py Log Message: Fix SF bug #735694, Pydoc.py fixes links Modified the patch some. Fixed invalid link in UNICODE (to STRING). Also updates some references. Index: pydoc.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v retrieving revision 1.82 retrieving revision 1.83 diff -C2 -d -r1.82 -r1.83 *** pydoc.py 3 May 2003 09:09:01 -0000 1.82 --- pydoc.py 26 May 2003 13:49:54 -0000 1.83 *************** *** 1438,1442 **** 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), ! 'UNICODE': ('ref/strings', 'encodings unicode TYPES STRING'), 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), 'INTEGER': ('ref/integers', 'int range'), --- 1438,1442 ---- 'STRINGMETHODS': ('lib/string-methods', 'STRINGS FORMATTING'), 'FORMATTING': ('lib/typesseq-strings', 'OPERATORS'), ! 'UNICODE': ('ref/strings', 'encodings unicode SEQUENCES STRINGMETHODS FORMATTING TYPES'), 'NUMBERS': ('ref/numbers', 'INTEGER FLOAT COMPLEX TYPES'), 'INTEGER': ('ref/integers', 'int range'), *************** *** 1470,1480 **** 'MAPPINGMETHODS': ('ref/sequence-types', 'MAPPINGS SPECIALMETHODS'), 'NUMBERMETHODS': ('ref/numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS'), ! 'EXECUTION': ('ref/naming', ''), ! 'NAMESPACES': ('ref/naming', 'global ASSIGNMENT DELETION'), 'SCOPING': 'NAMESPACES', 'FRAMES': 'NAMESPACES', 'EXCEPTIONS': ('ref/exceptions', 'try except finally raise'), ! 'COERCIONS': 'CONVERSIONS', ! 'CONVERSIONS': ('ref/conversions', ''), 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), --- 1470,1481 ---- 'MAPPINGMETHODS': ('ref/sequence-types', 'MAPPINGS SPECIALMETHODS'), 'NUMBERMETHODS': ('ref/numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT SPECIALMETHODS'), ! 'EXECUTION': ('ref/execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), ! 'NAMESPACES': ('ref/naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'), ! 'DYNAMICFEATURES': ('ref/dynamic-features', ''), 'SCOPING': 'NAMESPACES', 'FRAMES': 'NAMESPACES', 'EXCEPTIONS': ('ref/exceptions', 'try except finally raise'), ! 'COERCIONS': ('ref/coercion-rules','CONVERSIONS'), ! 'CONVERSIONS': ('ref/conversions', 'COERCIONS'), 'IDENTIFIERS': ('ref/identifiers', 'keywords SPECIALIDENTIFIERS'), 'SPECIALIDENTIFIERS': ('ref/id-classes', ''), From 5p6vkvf4cr3@juno.com Mon May 26 15:50:59 2003 From: 5p6vkvf4cr3@juno.com (Billie Dempsey) Date: Mon, 26 May 03 14:50:59 GMT Subject: [Python-checkins] Re: Free Digital Cable TV cgecprano y wofkg Message-ID: This is a multi-part message in MIME format. --91_C___54E Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Get Free Cable TV Pay-Per-Views for only $45 now! That's right, most sites are selling this amazing digital filter descrambler for $100+. We are offering a limited deal for less than $45 a filter! Think about the $1000's you will save in Free Tv for only $45. Is there a catch? No. The only factor is that you need digital cable. If you do not have it then simply upgrade & you'll be saving $100's a month in Free events & Movies! *Bonus: Get a Free cell/cordless Phone Shield/Booster with your order! A $20 value FREE with order. ACT NOW !!! Click Here as offer expires soon--> http://www.b2nmghjt.com/xcart/customer/product.php?productid=3D16144&partn= er=3Daffil10&r=3Dcable1 ""OPT-OUT"" system in compliance with state laws. If you wish to "OPT-OUT" from this mailing as well as the lists of thousands of other email providers please visit http://www.b2nmghjt.com/1/ 1 fakdbk u z z olfrlbsyv spal ag eu ynq vgnnadhpz jp gr ds dtgmzfn lg f --91_C___54E-- From nnorwitz@users.sourceforge.net Mon May 26 15:11:58 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon, 26 May 2003 07:11:58 -0700 Subject: [Python-checkins] python/dist/src configure,1.401,1.402 configure.in,1.412,1.413 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv7540 Modified Files: configure configure.in Log Message: SF patch #719359, fix test_long failure on OSF/1 with vendor cc This also fixes several other bugs and patches by providing the proper arguments to cc: 738066 and 741806 need -ieee, 693094 needs -std Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.401 retrieving revision 1.402 diff -C2 -d -r1.401 -r1.402 *** configure 26 May 2003 05:37:50 -0000 1.401 --- configure 26 May 2003 14:11:52 -0000 1.402 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.411 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.412 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 3649,3652 **** --- 3649,3655 ---- BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca " ;; + OSF*) + BASECFLAGS="$BASECFLAGS -ieee -std" + ;; SCO_SV*) BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5" Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.412 retrieving revision 1.413 diff -C2 -d -r1.412 -r1.413 *** configure.in 26 May 2003 05:37:51 -0000 1.412 --- configure.in 26 May 2003 14:11:55 -0000 1.413 *************** *** 647,650 **** --- 647,653 ---- BASECFLAGS="$BASECFLAGS -K pentium,host,inline,loop_unroll,alloca " ;; + OSF*) + BASECFLAGS="$BASECFLAGS -ieee -std" + ;; SCO_SV*) BASECFLAGS="$BASECFLAGS -belf -Ki486 -DSCO5" From a9t2atoy4q5r@ntd.com Tue May 27 10:38:32 2003 From: a9t2atoy4q5r@ntd.com (Louie Whitfield) Date: Tue, 27 May 03 09:38:32 GMT Subject: [Python-checkins] Restore hair growth and color pfzhx r Message-ID: <2$e4-zhv8$hm2-t1z5k567g@njfg4cn0r> This is a multi-part message in MIME format. --F.1FFF2E.0.5B68.E8 Content-Type: text/html; Content-Transfer-Encoding: quoted-printable 3D"" fgagllhrjll uosyqgvasaixroayerlle ox bmkakh hgkxb --F.1FFF2E.0.5B68.E8-- From niemeyer@users.sourceforge.net Mon May 26 22:19:50 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 26 May 2003 14:19:50 -0700 Subject: [Python-checkins] python/dist/src/Modules Setup.dist,1.39,1.40 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv25680 Modified Files: Setup.dist Log Message: Fixed minor typo in Setup.dist. Index: Setup.dist =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/Setup.dist,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** Setup.dist 3 Apr 2003 04:49:12 -0000 1.39 --- Setup.dist 26 May 2003 21:19:47 -0000 1.40 *************** *** 418,422 **** #DBINC=$(DB)/include #DBLIB=$(DB)/lib ! #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER # Historical Berkeley DB 1.85 --- 418,422 ---- #DBINC=$(DB)/include #DBLIB=$(DB)/lib ! #_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) # Historical Berkeley DB 1.85 From gward@users.sourceforge.net Mon May 26 23:47:33 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Mon, 26 May 2003 15:47:33 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv23816 Modified Files: ossaudiodev.c Log Message: Release the GIL in two more methods: * sync(), because it waits for hardware buffers to flush, which can take several seconds depending on cirumstances (according to the OSS docs) * close(), because it does an implicit sync() Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** ossaudiodev.c 23 May 2003 01:50:37 -0000 1.27 --- ossaudiodev.c 26 May 2003 22:47:30 -0000 1.28 *************** *** 354,358 **** oss_sync(oss_audio_t *self, PyObject *args) { ! return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); } --- 354,363 ---- oss_sync(oss_audio_t *self, PyObject *args) { ! int rv; ! ! Py_BEGIN_ALLOW_THREADS ! rv = _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); ! Py_END_ALLOW_THREADS ! return rv; } *************** *** 479,483 **** --- 484,490 ---- if (self->fd >= 0) { + Py_BEGIN_ALLOW_THREADS close(self->fd); + Py_END_ALLOW_THREADS self->fd = -1; } From niemeyer@users.sourceforge.net Tue May 27 00:52:33 2003 From: niemeyer@users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Mon, 26 May 2003 16:52:33 -0700 Subject: [Python-checkins] python/dist/src/Tools/freeze freeze.py,1.44,1.45 Message-ID: Update of /cvsroot/python/python/dist/src/Tools/freeze In directory sc8-pr-cvs1:/tmp/cvs-serv11043 Modified Files: freeze.py Log Message: modulefinder.py is not a freeze private module anymore. Index: freeze.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** freeze.py 18 Mar 2003 18:48:17 -0000 1.44 --- freeze.py 26 May 2003 23:52:30 -0000 1.45 *************** *** 90,93 **** --- 90,94 ---- # Import standard modules + import modulefinder import getopt import os *************** *** 98,102 **** import checkextensions - import modulefinder import makeconfig import makefreeze --- 99,102 ---- From gward@users.sourceforge.net Tue May 27 02:57:23 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Mon, 26 May 2003 18:57:23 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13318 Modified Files: ossaudiodev.c Log Message: Oops, move the GIL release/reacquire from oss_sync() to _do_ioctl_0(): that way it applies to *only* the ioctl() call, and also happens for the other blocking ioctls (POST, RESET). Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** ossaudiodev.c 26 May 2003 22:47:30 -0000 1.28 --- ossaudiodev.c 27 May 2003 01:57:21 -0000 1.29 *************** *** 292,295 **** --- 292,296 ---- { char argfmt[32] = ":"; + int rv; assert(strlen(fname) <= 30); *************** *** 298,302 **** return NULL; ! if (ioctl(fd, cmd, 0) == -1) return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); --- 299,311 ---- return NULL; ! /* According to hannu@opensound.com, all three of the ioctls that ! use this function can block, so release the GIL. This is ! especially important for SYNC, which can block for several ! seconds. */ ! Py_BEGIN_ALLOW_THREADS ! rv = ioctl(fd, cmd, 0); ! Py_END_ALLOW_THREADS ! ! if (rv == -1) return PyErr_SetFromErrno(PyExc_IOError); Py_INCREF(Py_None); *************** *** 354,363 **** oss_sync(oss_audio_t *self, PyObject *args) { ! int rv; ! ! Py_BEGIN_ALLOW_THREADS ! rv = _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); ! Py_END_ALLOW_THREADS ! return rv; } --- 363,367 ---- oss_sync(oss_audio_t *self, PyObject *args) { ! return _do_ioctl_0(self->fd, args, "sync", SNDCTL_DSP_SYNC); } From rhettinger@users.sourceforge.net Tue May 27 07:30:54 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon, 26 May 2003 23:30:54 -0700 Subject: [Python-checkins] python/dist/src/Lib shelve.py,1.23,1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20010 Modified Files: shelve.py Log Message: Fixup bare try/except. Index: shelve.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/shelve.py,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** shelve.py 20 May 2003 05:15:55 -0000 1.23 --- shelve.py 27 May 2003 06:30:52 -0000 1.24 *************** *** 141,145 **** try: self.dict.close() ! except: pass self.dict = 0 --- 141,145 ---- try: self.dict.close() ! except AttributeError: pass self.dict = 0 From jackjansen@users.sourceforge.net Tue May 27 15:10:40 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 07:10:40 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv13862 Modified Files: PackageManager.py Log Message: Added Help menu. Fixes #731635 Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PackageManager.py 22 Apr 2003 13:53:33 -0000 1.9 --- PackageManager.py 27 May 2003 14:10:37 -0000 1.10 *************** *** 111,114 **** --- 111,115 ---- self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') self.makeopenwindowsmenu() + self.makehelpmenu() self._menustocheck = [closeitem, undoitem, cutitem, copyitem, pasteitem, *************** *** 116,119 **** --- 117,131 ---- runitem, homepageitem] + def makehelpmenu(self): + python_app = os.path.join(sys.prefix, 'Resources/Python.app') + help_source = os.path.join(python_app, 'Contents/Resources/English.lproj/Documentation') + hashelp = os.path.isdir(help_source) + + self.helpmenu = m = self.gethelpmenu() + helpitem1 = FrameWork.MenuItem(m, "PackageManager Help", None, self.domenu_packmanhelp) + helpitem1.enable(hashelp) + helpitem2 = FrameWork.MenuItem(m, "MacPython Help", None, self.domenu_pythonhelp) + helpitem2.enable(hashelp) + def quitevent(self, theAppleEvent, theReply): self._quit() *************** *** 199,202 **** --- 211,222 ---- print "Save" + def domenu_pythonhelp(self, *args): + from Carbon import AH + AH.AHGotoPage("MacPython Help", None, None) + + def domenu_packmanhelp(self, *args): + from Carbon import AH + AH.AHGotoPage("MacPython Help", "packman.html", None) + def _quit(self): ## import PyConsole, PyEdit From bwarsaw@users.sourceforge.net Tue May 27 15:36:05 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue, 27 May 2003 07:36:05 -0700 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.2.spec,1.1.2.3,1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1:/tmp/cvs-serv27334 Modified Files: Tag: release22-maint python-2.2.spec Log Message: Spec file update from Sean Reifschneider. Index: python-2.2.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/Attic/python-2.2.spec,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** python-2.2.spec 7 Oct 2002 05:53:29 -0000 1.1.2.3 --- python-2.2.spec 27 May 2003 14:36:02 -0000 1.1.2.4 *************** *** 6,10 **** # "python2"? # Valid values: [none/2/2.2] ! %define config_binsuffix 2.2.2b1 # Build tkinter? "auto" enables it if /usr/bin/wish exists. --- 6,10 ---- # "python2"? # Valid values: [none/2/2.2] ! %define config_binsuffix 2 # Build tkinter? "auto" enables it if /usr/bin/wish exists. *************** *** 26,30 **** %define name python ! %define version 2.2.2b1 %define release 1 %define __prefix /usr --- 26,30 ---- %define name python ! %define version 2.2.3 %define release 1 %define __prefix /usr *************** *** 52,56 **** BuildRoot: /var/tmp/%{name}-%{version}-root BuildPrereq: expat-devel - BuildPrereq: /usr/include/db1/db.h BuildPrereq: gdbm-devel Prefix: %{__prefix} --- 52,55 ---- From jhylton@users.sourceforge.net Tue May 27 17:16:44 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue, 27 May 2003 09:16:44 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_hmac.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7241 Modified Files: test_hmac.py Log Message: Add more tests from RFC 2202. Index: test_hmac.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_hmac.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_hmac.py 1 May 2003 17:45:37 -0000 1.7 --- test_hmac.py 27 May 2003 16:16:41 -0000 1.8 *************** *** 1,3 **** --- 1,4 ---- import hmac + import sha import unittest from test import test_support *************** *** 5,14 **** class TestVectorsTestCase(unittest.TestCase): ! def test_vectors(self): # Test the HMAC module against test vectors from the RFC. def md5test(key, data, digest): h = hmac.HMAC(key, data) ! self.failUnless(h.hexdigest().upper() == digest.upper()) md5test(chr(0x0b) * 16, --- 6,15 ---- class TestVectorsTestCase(unittest.TestCase): ! def test_md5_vectors(self): # Test the HMAC module against test vectors from the RFC. def md5test(key, data, digest): h = hmac.HMAC(key, data) ! self.assertEqual(h.hexdigest().upper(), digest.upper()) md5test(chr(0x0b) * 16, *************** *** 23,26 **** --- 24,79 ---- chr(0xDD)*50, "56be34521d144c88dbb8c733f0e8b3f6") + + md5test("".join([chr(i) for i in range(1, 26)]), + chr(0xCD) * 50, + "697eaf0aca3a3aea3a75164746ffaa79") + + md5test(chr(0x0C) * 16, + "Test With Truncation", + "56461ef2342edc00f9bab995690efd4c") + + md5test(chr(0xAA) * 80, + "Test Using Larger Than Block-Size Key - Hash Key First", + "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd") + + md5test(chr(0xAA) * 80, + ("Test Using Larger Than Block-Size Key " + "and Larger Than One Block-Size Data"), + "6f630fad67cda0ee1fb1f562db3aa53e") + + def test_sha_vectors(self): + def shatest(key, data, digest): + h = hmac.HMAC(key, data, digestmod=sha) + self.assertEqual(h.hexdigest().upper(), digest.upper()) + + shatest(chr(0x0b) * 20, + "Hi There", + "b617318655057264e28bc0b6fb378c8ef146be00") + + shatest("Jefe", + "what do ya want for nothing?", + "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79") + + shatest(chr(0xAA)*20, + chr(0xDD)*50, + "125d7342b9ac11cd91a39af48aa17b4f63f175d3") + + shatest("".join([chr(i) for i in range(1, 26)]), + chr(0xCD) * 50, + "4c9007f4026250c6bc8414f9bf50c86c2d7235da") + + shatest(chr(0x0C) * 20, + "Test With Truncation", + "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04") + + shatest(chr(0xAA) * 80, + "Test Using Larger Than Block-Size Key - Hash Key First", + "aa4ae5e15272d00e95705637ce8a3b55ed402112") + + shatest(chr(0xAA) * 80, + ("Test Using Larger Than Block-Size Key " + "and Larger Than One Block-Size Data"), + "e8e99d0f45237d786d6bbaa7965c7808bbff1a91") + class ConstructorTestCase(unittest.TestCase): From jackjansen@users.sourceforge.net Tue May 27 22:39:59 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 14:39:59 -0700 Subject: [Python-checkins] python/dist/src/Python mactoolboxglue.c,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19773/Python Modified Files: mactoolboxglue.c Log Message: Added functions CFObj_New and CFObj_Convert, general functions to convert between CF objects and their Python representation. Fixes 734695. Index: mactoolboxglue.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/mactoolboxglue.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mactoolboxglue.c 17 Apr 2003 20:44:18 -0000 1.19 --- mactoolboxglue.c 27 May 2003 21:39:56 -0000 1.20 *************** *** 594,597 **** --- 594,600 ---- GLUE_NEW(WindowPtr, WinObj_WhichWindow, "Carbon.Win") + GLUE_CONVERT(CFTypeRef, CFObj_Convert, "Carbon.CF") + GLUE_NEW(CFTypeRef, CFObj_New, "Carbon.CF") + GLUE_CONVERT(CFTypeRef, CFTypeRefObj_Convert, "Carbon.CF") GLUE_NEW(CFTypeRef, CFTypeRefObj_New, "Carbon.CF") From jackjansen@users.sourceforge.net Tue May 27 22:39:59 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 14:39:59 -0700 Subject: [Python-checkins] python/dist/src/Include pymactoolbox.h,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv19773/Include Modified Files: pymactoolbox.h Log Message: Added functions CFObj_New and CFObj_Convert, general functions to convert between CF objects and their Python representation. Fixes 734695. Index: pymactoolbox.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/pymactoolbox.h,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pymactoolbox.h 17 Jan 2003 23:11:15 -0000 1.7 --- pymactoolbox.h 27 May 2003 21:39:57 -0000 1.8 *************** *** 179,182 **** --- 179,184 ---- /* CF exports */ + extern PyObject *CFObj_New(CFTypeRef); + extern int CFObj_Convert(PyObject *, CFTypeRef *); extern PyObject *CFTypeRefObj_New(CFTypeRef); extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *); From jackjansen@users.sourceforge.net Tue May 27 22:40:00 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 14:40:00 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.20,1.21 cfsupport.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory sc8-pr-cvs1:/tmp/cvs-serv19773/Mac/Modules/cf Modified Files: _CFmodule.c cfsupport.py Log Message: Added functions CFObj_New and CFObj_Convert, general functions to convert between CF objects and their Python representation. Fixes 734695. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** _CFmodule.c 3 Mar 2003 13:12:58 -0000 1.20 --- _CFmodule.c 27 May 2003 21:39:58 -0000 1.21 *************** *** 37,40 **** --- 37,45 ---- #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_CFObj_New(CFTypeRef); + extern int _CFObj_Convert(PyObject *, CFTypeRef *); + #define CFObj_New _CFObj_New + #define CFObj_Convert _CFObj_Convert + extern PyObject *_CFTypeRefObj_New(CFTypeRef); extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *); *************** *** 122,126 **** } - static PyObject *CF_Error; --- 127,130 ---- *************** *** 1458,1462 **** if (v == Py_None) { *p_itself = NULL; return 1; } if (PyString_Check(v)) { ! char *cStr = PyString_AsString(v); *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; --- 1462,1468 ---- if (v == Py_None) { *p_itself = NULL; return 1; } if (PyString_Check(v)) { ! char *cStr; ! if (!PyArg_Parse(v, "es", "ascii", &cStr)) ! return NULL; *p_itself = CFStringCreateWithCString((CFAllocatorRef)NULL, cStr, kCFStringEncodingASCII); return 1; *************** *** 4291,4294 **** --- 4297,4342 ---- + + + /* Routines to convert any CF type to/from the corresponding CFxxxObj */ + PyObject *CFObj_New(CFTypeRef itself) + { + if (itself == NULL) + { + PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL"); + return NULL; + } + if (CFGetTypeID(itself) == CFArrayGetTypeID()) return CFArrayRefObj_New((CFArrayRef)itself); + if (CFGetTypeID(itself) == CFDictionaryGetTypeID()) return CFDictionaryRefObj_New((CFDictionaryRef)itself); + if (CFGetTypeID(itself) == CFDataGetTypeID()) return CFDataRefObj_New((CFDataRef)itself); + if (CFGetTypeID(itself) == CFStringGetTypeID()) return CFStringRefObj_New((CFStringRef)itself); + if (CFGetTypeID(itself) == CFURLGetTypeID()) return CFURLRefObj_New((CFURLRef)itself); + /* XXXX Or should we use PyCF_CF2Python here?? */ + return CFTypeRefObj_New(itself); + } + int CFObj_Convert(PyObject *v, CFTypeRef *p_itself) + { + + if (v == Py_None) { *p_itself = NULL; return 1; } + /* Check for other CF objects here */ + + if (!CFTypeRefObj_Check(v) && + !CFArrayRefObj_Check(v) && + !CFMutableArrayRefObj_Check(v) && + !CFDictionaryRefObj_Check(v) && + !CFMutableDictionaryRefObj_Check(v) && + !CFDataRefObj_Check(v) && + !CFMutableDataRefObj_Check(v) && + !CFStringRefObj_Check(v) && + !CFMutableStringRefObj_Check(v) && + !CFURLRefObj_Check(v) ) + { + /* XXXX Or should we use PyCF_Python2CF here?? */ + PyErr_SetString(PyExc_TypeError, "CF object required"); + return 0; + } + *p_itself = ((CFTypeRefObject *)v)->ob_itself; + return 1; + } Index: cfsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** cfsupport.py 3 Mar 2003 13:19:43 -0000 1.21 --- cfsupport.py 27 May 2003 21:39:58 -0000 1.22 *************** *** 59,62 **** --- 59,67 ---- #ifdef USE_TOOLBOX_OBJECT_GLUE + extern PyObject *_CFObj_New(CFTypeRef); + extern int _CFObj_Convert(PyObject *, CFTypeRef *); + #define CFObj_New _CFObj_New + #define CFObj_Convert _CFObj_Convert + extern PyObject *_CFTypeRefObj_New(CFTypeRef); extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *); *************** *** 143,147 **** --- 148,195 ---- return CFURLRefObj_Convert(v, p_itself); } + """ + + finalstuff = finalstuff + """ + + /* Routines to convert any CF type to/from the corresponding CFxxxObj */ + PyObject *CFObj_New(CFTypeRef itself) + { + if (itself == NULL) + { + PyErr_SetString(PyExc_RuntimeError, "cannot wrap NULL"); + return NULL; + } + if (CFGetTypeID(itself) == CFArrayGetTypeID()) return CFArrayRefObj_New((CFArrayRef)itself); + if (CFGetTypeID(itself) == CFDictionaryGetTypeID()) return CFDictionaryRefObj_New((CFDictionaryRef)itself); + if (CFGetTypeID(itself) == CFDataGetTypeID()) return CFDataRefObj_New((CFDataRef)itself); + if (CFGetTypeID(itself) == CFStringGetTypeID()) return CFStringRefObj_New((CFStringRef)itself); + if (CFGetTypeID(itself) == CFURLGetTypeID()) return CFURLRefObj_New((CFURLRef)itself); + /* XXXX Or should we use PyCF_CF2Python here?? */ + return CFTypeRefObj_New(itself); + } + int CFObj_Convert(PyObject *v, CFTypeRef *p_itself) + { + + if (v == Py_None) { *p_itself = NULL; return 1; } + /* Check for other CF objects here */ + if (!CFTypeRefObj_Check(v) && + !CFArrayRefObj_Check(v) && + !CFMutableArrayRefObj_Check(v) && + !CFDictionaryRefObj_Check(v) && + !CFMutableDictionaryRefObj_Check(v) && + !CFDataRefObj_Check(v) && + !CFMutableDataRefObj_Check(v) && + !CFStringRefObj_Check(v) && + !CFMutableStringRefObj_Check(v) && + !CFURLRefObj_Check(v) ) + { + /* XXXX Or should we use PyCF_Python2CF here?? */ + PyErr_SetString(PyExc_TypeError, "CF object required"); + return 0; + } + *p_itself = ((CFTypeRefObject *)v)->ob_itself; + return 1; + } """ From jackjansen@users.sourceforge.net Tue May 27 23:47:57 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 15:47:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Doc/HelpIndexingTool Help_Indexing_Tool_Suite.py,NONE,1.1 Miscellaneous_Standards.py,NONE,1.1 Required_Suite.py,NONE,1.1 Standard_Suite.py,NONE,1.1 __init__.py,NONE,1.1 odds_and_ends.py,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Doc/HelpIndexingTool In directory sc8-pr-cvs1:/tmp/cvs-serv14891/HelpIndexingTool Added Files: Help_Indexing_Tool_Suite.py Miscellaneous_Standards.py Required_Suite.py Standard_Suite.py __init__.py odds_and_ends.py Log Message: Alternate fix for #728744: use OSA and Apple Help Indexing Tool's idleStatus indicator to wait for the help indexing to finish. --- NEW FILE: Help_Indexing_Tool_Suite.py --- """Suite Help Indexing Tool Suite: Special events that just the Help Indexing Tool supports. Level 0, version 0 Generated from /Developer/Applications/Apple Help Indexing Tool.app AETE/AEUT resource version 1/1, language 0, script 0 """ import aetools import MacOS _code = 'HIT ' class Help_Indexing_Tool_Suite_Events: def turn_anchor_indexing(self, _object, _attributes={}, **_arguments): """turn anchor indexing: Turns anchor indexing on or off. Required argument: \xd2on\xd3 or \xd2off\xd3, to turn anchor indexing on or off Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'HIT ' _subcode = 'tAnc' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_turn_remote_root = { 'with_root_url' : 'rURL', } def turn_remote_root(self, _object, _attributes={}, **_arguments): """turn remote root: Turn usage of remote root for content on the web on or off. If turning \xd2on\xd3, supply a string as second parameter. Required argument: \xd2on\xd3 or \xd2off\xd3, to turn remote root on or off Keyword argument with_root_url: The remote root to use, in the form of \xd2http://www.apple.com/help/\xd3. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'HIT ' _subcode = 'tRem' aetools.keysubst(_arguments, self._argmap_turn_remote_root) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def use_tokenizer(self, _object, _attributes={}, **_arguments): """use tokenizer: Tells the indexing tool which tokenizer to use. Required argument: Specify \xd2English\xd3, \xd2European\xd3, \xd2Japanese\xd3, \xd2Korean\xd3, or \xd2Simple\xd3. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'HIT ' _subcode = 'uTok' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] class application(aetools.ComponentItem): """application - Application class """ want = 'capp' class _Prop_idleStatus(aetools.NProperty): """idleStatus - """ which = 'sIdl' want = 'bool' application._superclassnames = [] application._privpropdict = { 'idleStatus' : _Prop_idleStatus, } application._privelemdict = { } # # Indices of types declared in this module # _classdeclarations = { 'capp' : application, } _propdeclarations = { 'sIdl' : _Prop_idleStatus, } _compdeclarations = { } _enumdeclarations = { } --- NEW FILE: Miscellaneous_Standards.py --- """Suite Miscellaneous Standards: Useful events that aren\xd5t in any other suite Level 0, version 0 Generated from /Developer/Applications/Apple Help Indexing Tool.app AETE/AEUT resource version 1/1, language 0, script 0 """ import aetools import MacOS _code = 'misc' class Miscellaneous_Standards_Events: def revert(self, _object, _attributes={}, **_arguments): """revert: Revert an object to the most recently saved version Required argument: object to revert Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'rvrt' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] # # Indices of types declared in this module # _classdeclarations = { } _propdeclarations = { } _compdeclarations = { } _enumdeclarations = { } --- NEW FILE: Required_Suite.py --- """Suite Required Suite: Terms that every application should support Level 1, version 1 Generated from /Developer/Applications/Apple Help Indexing Tool.app AETE/AEUT resource version 1/1, language 0, script 0 """ import aetools import MacOS _code = 'reqd' from StdSuites.Required_Suite import * class Required_Suite_Events(Required_Suite_Events): pass # # Indices of types declared in this module # _classdeclarations = { } _propdeclarations = { } _compdeclarations = { } _enumdeclarations = { } --- NEW FILE: Standard_Suite.py --- """Suite Standard Suite: Common terms for most applications Level 1, version 1 Generated from /Developer/Applications/Apple Help Indexing Tool.app AETE/AEUT resource version 1/1, language 0, script 0 """ import aetools import MacOS _code = 'CoRe' from StdSuites.Standard_Suite import * class Standard_Suite_Events(Standard_Suite_Events): _argmap_close = { 'saving' : 'savo', 'in_' : 'kfil', } def close(self, _object, _attributes={}, **_arguments): """close: Close an object Required argument: the objects to close Keyword argument saving: specifies whether or not changes should be saved before closing Keyword argument in_: the file in which to save the object Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'clos' aetools.keysubst(_arguments, self._argmap_close) _arguments['----'] = _object aetools.enumsubst(_arguments, 'savo', _Enum_savo) _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def data_size(self, _object, _attributes={}, **_arguments): """data size: Return the size in bytes of an object Required argument: the object whose data size is to be returned Keyword argument _attributes: AppleEvent attribute dictionary Returns: the size of the object in bytes """ _code = 'core' _subcode = 'dsiz' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def get(self, _object, _attributes={}, **_arguments): """get: Get the data for an object Required argument: the object whose data is to be returned Keyword argument _attributes: AppleEvent attribute dictionary Returns: The data from the object """ _code = 'core' _subcode = 'getd' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_make = { 'new' : 'kocl', 'at' : 'insh', 'with_data' : 'data', 'with_properties' : 'prdt', } def make(self, _no_object=None, _attributes={}, **_arguments): """make: Make a new element Keyword argument new: the class of the new element Keyword argument at: the location at which to insert the element Keyword argument with_data: the initial data for the element Keyword argument with_properties: the initial values for the properties of the element Keyword argument _attributes: AppleEvent attribute dictionary Returns: Object specifier for the new element """ _code = 'core' _subcode = 'crel' aetools.keysubst(_arguments, self._argmap_make) if _no_object != None: raise TypeError, 'No direct arg expected' _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def open(self, _object, _attributes={}, **_arguments): """open: Open the specified object(s) Required argument: Objects to open. Can be a list of files or an object specifier. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'odoc' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] def print_(self, _object, _attributes={}, **_arguments): """print: Print the specified object(s) Required argument: Objects to print. Can be a list of files or an object specifier. Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'aevt' _subcode = 'pdoc' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_save = { 'in_' : 'kfil', 'as' : 'fltp', } def save(self, _object, _attributes={}, **_arguments): """save: save a set of objects Required argument: Objects to save. Keyword argument in_: the file in which to save the object(s) Keyword argument as: the file type of the document in which to save the data Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'save' aetools.keysubst(_arguments, self._argmap_save) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] _argmap_set = { 'to' : 'data', } def set(self, _object, _attributes={}, **_arguments): """set: Set an object\xd5s data Required argument: the object to change Keyword argument to: the new value Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'core' _subcode = 'setd' aetools.keysubst(_arguments, self._argmap_set) _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] class application(aetools.ComponentItem): """application - An application program """ want = 'capp' # element 'cwin' as ['indx', 'name', 'rele'] # element 'docu' as ['name'] class window(aetools.ComponentItem): """window - A Window """ want = 'cwin' class _Prop_bounds(aetools.NProperty): """bounds - the boundary rectangle for the window """ which = 'pbnd' want = 'qdrt' class _Prop_closeable(aetools.NProperty): """closeable - Does the window have a close box? """ which = 'hclb' want = 'bool' class _Prop_floating(aetools.NProperty): """floating - Does the window float? """ which = 'isfl' want = 'bool' class _Prop_index(aetools.NProperty): """index - the number of the window """ which = 'pidx' want = 'long' class _Prop_modal(aetools.NProperty): """modal - Is the window modal? """ which = 'pmod' want = 'bool' class _Prop_name(aetools.NProperty): """name - the title of the window """ which = 'pnam' want = 'itxt' class _Prop_position(aetools.NProperty): """position - upper left coordinates of window """ which = 'ppos' want = 'QDpt' class _Prop_resizable(aetools.NProperty): """resizable - Is the window resizable? """ which = 'prsz' want = 'bool' class _Prop_titled(aetools.NProperty): """titled - Does the window have a title bar? """ which = 'ptit' want = 'bool' class _Prop_visible(aetools.NProperty): """visible - is the window visible? """ which = 'pvis' want = 'bool' class _Prop_zoomable(aetools.NProperty): """zoomable - Is the window zoomable? """ which = 'iszm' want = 'bool' class _Prop_zoomed(aetools.NProperty): """zoomed - Is the window zoomed? """ which = 'pzum' want = 'bool' class document(aetools.ComponentItem): """document - A Document """ want = 'docu' class _Prop_modified(aetools.NProperty): """modified - Has the document been modified since the last save? """ which = 'imod' want = 'bool' application._superclassnames = [] application._privpropdict = { } application._privelemdict = { 'document' : document, 'window' : window, } window._superclassnames = [] window._privpropdict = { 'bounds' : _Prop_bounds, 'closeable' : _Prop_closeable, 'floating' : _Prop_floating, 'index' : _Prop_index, 'modal' : _Prop_modal, 'name' : _Prop_name, 'position' : _Prop_position, 'resizable' : _Prop_resizable, 'titled' : _Prop_titled, 'visible' : _Prop_visible, 'zoomable' : _Prop_zoomable, 'zoomed' : _Prop_zoomed, } window._privelemdict = { } document._superclassnames = [] document._privpropdict = { 'modified' : _Prop_modified, 'name' : _Prop_name, } document._privelemdict = { } _Enum_savo = { 'yes' : 'yes ', # Save objects now 'no' : 'no ', # Do not save objects 'ask' : 'ask ', # Ask the user whether to save } # # Indices of types declared in this module # _classdeclarations = { 'capp' : application, 'cwin' : window, 'docu' : document, } _propdeclarations = { 'hclb' : _Prop_closeable, 'imod' : _Prop_modified, 'isfl' : _Prop_floating, 'iszm' : _Prop_zoomable, 'pbnd' : _Prop_bounds, 'pidx' : _Prop_index, 'pmod' : _Prop_modal, 'pnam' : _Prop_name, 'ppos' : _Prop_position, 'prsz' : _Prop_resizable, 'ptit' : _Prop_titled, 'pvis' : _Prop_visible, 'pzum' : _Prop_zoomed, } _compdeclarations = { } _enumdeclarations = { 'savo' : _Enum_savo, } --- NEW FILE: __init__.py --- """ Package generated from /Developer/Applications/Apple Help Indexing Tool.app """ import aetools Error = aetools.Error import Standard_Suite import Help_Indexing_Tool_Suite import odds_and_ends import Miscellaneous_Standards import Required_Suite _code_to_module = { 'CoRe' : Standard_Suite, 'HIT ' : Help_Indexing_Tool_Suite, 'Odds' : odds_and_ends, 'misc' : Miscellaneous_Standards, 'reqd' : Required_Suite, } _code_to_fullname = { 'CoRe' : ('HelpIndexingTool.Standard_Suite', 'Standard_Suite'), 'HIT ' : ('HelpIndexingTool.Help_Indexing_Tool_Suite', 'Help_Indexing_Tool_Suite'), 'Odds' : ('HelpIndexingTool.odds_and_ends', 'odds_and_ends'), 'misc' : ('HelpIndexingTool.Miscellaneous_Standards', 'Miscellaneous_Standards'), 'reqd' : ('HelpIndexingTool.Required_Suite', 'Required_Suite'), } from Standard_Suite import * from Help_Indexing_Tool_Suite import * from odds_and_ends import * from Miscellaneous_Standards import * from Required_Suite import * def getbaseclasses(v): if not getattr(v, '_propdict', None): v._propdict = {} v._elemdict = {} for superclassname in getattr(v, '_superclassnames', []): superclass = eval(superclassname) getbaseclasses(superclass) v._propdict.update(getattr(superclass, '_propdict', {})) v._elemdict.update(getattr(superclass, '_elemdict', {})) v._propdict.update(getattr(v, '_privpropdict', {})) v._elemdict.update(getattr(v, '_privelemdict', {})) import StdSuites # # Set property and element dictionaries now that all classes have been defined # getbaseclasses(window) getbaseclasses(application) getbaseclasses(document) getbaseclasses(application) # # Indices of types declared in this module # _classdeclarations = { 'cwin' : window, 'capp' : application, 'docu' : document, 'capp' : application, } class HelpIndexingTool(Standard_Suite_Events, Help_Indexing_Tool_Suite_Events, odds_and_ends_Events, Miscellaneous_Standards_Events, Required_Suite_Events, aetools.TalkTo): _signature = 'hiti' _moduleName = 'HelpIndexingTool' --- NEW FILE: odds_and_ends.py --- """Suite odds and ends: Things that should be in some standard suite, but aren\xd5t Level 1, version 1 Generated from /Developer/Applications/Apple Help Indexing Tool.app AETE/AEUT resource version 1/1, language 0, script 0 """ import aetools import MacOS _code = 'Odds' class odds_and_ends_Events: def select(self, _object=None, _attributes={}, **_arguments): """select: Select the specified object Required argument: the object to select Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'slct' if _arguments: raise TypeError, 'No optional args expected' _arguments['----'] = _object _reply, _arguments, _attributes = self.send(_code, _subcode, _arguments, _attributes) if _arguments.get('errn', 0): raise aetools.Error, aetools.decodeerror(_arguments) # XXXX Optionally decode result if _arguments.has_key('----'): return _arguments['----'] # # Indices of types declared in this module # _classdeclarations = { } _propdeclarations = { } _compdeclarations = { } _enumdeclarations = { } From jackjansen@users.sourceforge.net Tue May 27 23:47:57 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 15:47:57 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Doc setup.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv14891 Modified Files: setup.py Log Message: Alternate fix for #728744: use OSA and Apple Help Indexing Tool's idleStatus indicator to wait for the help indexing to finish. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/OSX/Doc/setup.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** setup.py 16 Mar 2003 22:09:22 -0000 1.2 --- setup.py 27 May 2003 22:47:54 -0000 1.3 *************** *** 25,30 **** from distutils import sysconfig, dep_util from distutils.util import change_root - class DocBuild(build): def initialize_options(self): --- 25,32 ---- from distutils import sysconfig, dep_util from distutils.util import change_root + import HelpIndexingTool + import Carbon.File + import time class DocBuild(build): def initialize_options(self): *************** *** 112,115 **** --- 114,138 ---- self.spawn('open', '-a', app , self.build_dest) print "Please wait until Apple Help Indexing Tool finishes before installing" + + def makeHelpIndex(self): + app = HelpIndexingTool.HelpIndexingTool(start=1) + app.open(Carbon.File.FSSpec(self.build_dest)) + sys.stderr.write("Waiting for Help Indexing Tool to start...") + while 1: + # This is bad design in the suite generation code! + idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus()) + time.sleep(10) + if not idle: break + sys.stderr.write(".") + sys.stderr.write("\n") + sys.stderr.write("Waiting for Help Indexing Tool to finish...") + while 1: + # This is bad design in the suite generation code! + idle = app._get(HelpIndexingTool.Help_Indexing_Tool_Suite._Prop_idleStatus()) + time.sleep(10) + if idle: break + sys.stderr.write(".") + sys.stderr.write("\n") + def run(self): From jackjansen@users.sourceforge.net Tue May 27 23:46:51 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue, 27 May 2003 15:46:51 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Doc/HelpIndexingTool - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Doc/HelpIndexingTool In directory sc8-pr-cvs1:/tmp/cvs-serv14799/HelpIndexingTool Log Message: Directory /cvsroot/python/python/dist/src/Mac/OSX/Doc/HelpIndexingTool added to the repository From eprice@users.sourceforge.net Tue May 27 23:46:43 2003 From: eprice@users.sourceforge.net (eprice@users.sourceforge.net) Date: Tue, 27 May 2003 15:46:43 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal/tests abs.decTest,1.1,1.2 add.decTest,1.1,1.2 base.decTest,1.1,1.2 clamp.decTest,1.1,1.2 compare.decTest,1.1,1.2 decimal64.decTest,1.1,1.2 divide.decTest,1.1,1.2 divideint.decTest,1.1,1.2 inexact.decTest,1.1,1.2 integer.decTest,1.1,1.2 max.decTest,1.1,1.2 min.decTest,1.1,1.2 minus.decTest,1.1,1.2 multiply.decTest,1.1,1.2 normalize.decTest,1.1,1.2 plus.decTest,1.1,1.2 power.decTest,1.1,1.2 randomBound32.decTest,1.1,1.2 randoms.decTest,1.1,1.2 remainder.decTest,1.1,1.2 remainderNear.decTest,1.1,1.2 rescale.decTest,1.1,1.2 rounding.decTest,1.1,1.2 squareroot.decTest,1.1,1.2 subtract.decTest,1.1,1.2 testall.decTest,1.1,1.2 trim.decTest,1.1,1.2 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal/tests In directory sc8-pr-cvs1:/tmp/cvs-serv14021/tests Modified Files: abs.decTest add.decTest base.decTest clamp.decTest compare.decTest decimal64.decTest divide.decTest divideint.decTest inexact.decTest integer.decTest max.decTest min.decTest minus.decTest multiply.decTest normalize.decTest plus.decTest power.decTest randomBound32.decTest randoms.decTest remainder.decTest remainderNear.decTest rescale.decTest rounding.decTest squareroot.decTest subtract.decTest testall.decTest trim.decTest Log Message: Updating tests since the new ones are incompatible with the old ones. Index: abs.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/abs.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** abs.decTest 2 May 2003 23:07:35 -0000 1.1 --- abs.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of tests primarily tests the existence of the operator. --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of tests primarily tests the existence of the operator. Index: add.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/add.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** add.decTest 2 May 2003 23:07:35 -0000 1.1 --- add.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 precision: 9 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 precision: 9 *************** *** 752,756 **** addx733 add 0 -0 -> 0 addx734 add -0 0 -> 0 ! addx735 add -0 -0 -> -0 -- IEEE 854 exception addx736 add 1 -1 -> 0 --- 752,756 ---- addx733 add 0 -0 -> 0 addx734 add -0 0 -> 0 ! addx735 add -0 -0 -> -0 -- IEEE 854 special case addx736 add 1 -1 -> 0 Index: base.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/base.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** base.decTest 2 May 2003 23:07:35 -0000 1.1 --- base.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This file tests base conversions from string to a decimal number --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This file tests base conversions from string to a decimal number Index: clamp.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/clamp.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** clamp.decTest 2 May 2003 23:07:35 -0000 1.1 --- clamp.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of tests uses the same limits as the 8-byte concrete --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of tests uses the same limits as the 8-byte concrete Index: compare.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/compare.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** compare.decTest 2 May 2003 23:07:35 -0000 1.1 --- compare.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- Note that we cannot assume add/subtract tests cover paths adequately, --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- Note that we cannot assume add/subtract tests cover paths adequately, Index: decimal64.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/decimal64.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** decimal64.decTest 2 May 2003 23:07:35 -0000 1.1 --- decimal64.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of tests is for the eight-byte concrete representation. --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of tests is for the eight-byte concrete representation. Index: divide.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/divide.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** divide.decTest 2 May 2003 23:07:35 -0000 1.1 --- divide.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 *************** *** 184,201 **** divx306 divide 0 7E+6 -> 0.000000 divx307 divide 0 7E+7 -> 0E-7 ! divx308 divide 0 70E-5 -> 0E+4 ! divx309 divide 0 70E-1 -> 0 ! divx310 divide 0 70E+0 -> 0.0 ! divx311 divide 0 70E+1 -> 0.00 ! divx312 divide 0 70E+5 -> 0.000000 ! divx313 divide 0 70E+6 -> 0E-7 ! divx314 divide 0 70E+7 -> 0E-8 ! divx315 divide 0 700E-5 -> 0E+3 ! divx316 divide 0 700E-1 -> 0.0 ! divx317 divide 0 700E+0 -> 0.00 ! divx318 divide 0 700E+1 -> 0.000 ! divx319 divide 0 700E+5 -> 0E-7 ! divx320 divide 0 700E+6 -> 0E-8 ! divx321 divide 0 700E+7 -> 0E-9 divx331 divide 0E-3 7E-5 -> 0E+2 --- 184,202 ---- divx306 divide 0 7E+6 -> 0.000000 divx307 divide 0 7E+7 -> 0E-7 ! divx308 divide 0 70E-5 -> 0E+5 ! divx309 divide 0 70E-1 -> 0E+1 ! divx310 divide 0 70E+0 -> 0 ! divx311 divide 0 70E+1 -> 0.0 ! divx312 divide 0 70E+5 -> 0.00000 ! divx313 divide 0 70E+6 -> 0.000000 ! divx314 divide 0 70E+7 -> 0E-7 ! divx315 divide 0 700E-5 -> 0E+5 ! divx316 divide 0 700E-1 -> 0E+1 ! divx317 divide 0 700E+0 -> 0 ! divx318 divide 0 700E+1 -> 0.0 ! divx319 divide 0 700E+5 -> 0.00000 ! divx320 divide 0 700E+6 -> 0.000000 ! divx321 divide 0 700E+7 -> 0E-7 ! divx322 divide 0 700E+77 -> 0E-77 divx331 divide 0E-3 7E-5 -> 0E+2 *************** *** 224,241 **** divx354 divide 0E-92 7E+6 -> 0E-98 divx355 divide 0E-92 7E+7 -> 0E-98 Clamped ! divx356 divide 0E-92 777E-1 -> 0E-93 ! divx357 divide 0E-92 777E+1 -> 0E-95 ! divx358 divide 0E-92 777E+3 -> 0E-97 ! divx359 divide 0E-92 777E+4 -> 0E-98 ! divx360 divide 0E-92 777E+5 -> 0E-98 Clamped ! divx361 divide 0E+92 7E+1 -> 0E+91 ! divx362 divide 0E+92 7E+0 -> 0E+92 ! divx363 divide 0E+92 7E-1 -> 0E+92 Clamped ! divx364 divide 0E+92 777E+1 -> 0E+89 ! divx365 divide 0E+92 777E-1 -> 0E+91 ! divx366 divide 0E+92 777E-2 -> 0E+92 ! divx367 divide 0E+92 777E-3 -> 0E+92 Clamped ! divx368 divide 0E+92 777E-4 -> 0E+92 Clamped -- input rounding checks --- 225,259 ---- divx354 divide 0E-92 7E+6 -> 0E-98 divx355 divide 0E-92 7E+7 -> 0E-98 Clamped ! divx356 divide 0E-92 777E-1 -> 0E-91 ! divx357 divide 0E-92 777E+1 -> 0E-93 ! divx358 divide 0E-92 777E+3 -> 0E-95 ! divx359 divide 0E-92 777E+4 -> 0E-96 ! divx360 divide 0E-92 777E+5 -> 0E-97 ! divx361 divide 0E-92 777E+6 -> 0E-98 ! divx362 divide 0E-92 777E+7 -> 0E-98 Clamped ! divx363 divide 0E-92 7E+92 -> 0E-98 Clamped ! divx371 divide 0E-92 700E-1 -> 0E-91 ! divx372 divide 0E-92 700E+1 -> 0E-93 ! divx373 divide 0E-92 700E+3 -> 0E-95 ! divx374 divide 0E-92 700E+4 -> 0E-96 ! divx375 divide 0E-92 700E+5 -> 0E-97 ! divx376 divide 0E-92 700E+6 -> 0E-98 ! divx377 divide 0E-92 700E+7 -> 0E-98 Clamped ! ! divx381 divide 0E+92 7E+1 -> 0E+91 ! divx382 divide 0E+92 7E+0 -> 0E+92 ! divx383 divide 0E+92 7E-1 -> 0E+92 Clamped ! divx384 divide 0E+90 777E+1 -> 0E+89 ! divx385 divide 0E+90 777E-1 -> 0E+91 ! divx386 divide 0E+90 777E-2 -> 0E+92 ! divx387 divide 0E+90 777E-3 -> 0E+92 Clamped ! divx388 divide 0E+90 777E-4 -> 0E+92 Clamped ! ! divx391 divide 0E+90 700E+1 -> 0E+89 ! divx392 divide 0E+90 700E-1 -> 0E+91 ! divx393 divide 0E+90 700E-2 -> 0E+92 ! divx394 divide 0E+90 700E-3 -> 0E+92 Clamped ! divx395 divide 0E+90 700E-4 -> 0E+92 Clamped -- input rounding checks *************** *** 286,290 **** divx452 divide 1 1234567896 -> 8.10000003434400E-10 Inexact Rounded ! -- some suggested by Dan Zuras divx460 divide 3e0 2e0 -> 1.5 divx461 divide 30e-1 2e0 -> 1.5 --- 304,308 ---- divx452 divide 1 1234567896 -> 8.10000003434400E-10 Inexact Rounded ! -- some from IEEE discussions divx460 divide 3e0 2e0 -> 1.5 divx461 divide 30e-1 2e0 -> 1.5 *************** *** 310,313 **** --- 328,349 ---- divx483 divide 1 10E-33 -> 1E+32 + -- RMS discussion table + maxexponent: 96 + minexponent: -95 + precision: 7 + + divx484 divide 0e5 1e3 -> 0E+2 + divx485 divide 0e5 2e3 -> 0E+2 + divx486 divide 0e5 10e2 -> 0E+3 + divx487 divide 0e5 20e2 -> 0E+3 + divx488 divide 0e5 100e1 -> 0E+4 + divx489 divide 0e5 200e1 -> 0E+4 + + divx491 divide 1e5 1e3 -> 1E+2 + divx492 divide 1e5 2e3 -> 5E+1 + divx493 divide 1e5 10e2 -> 1E+2 + divx494 divide 1e5 20e2 -> 5E+1 + divx495 divide 1e5 100e1 -> 1E+2 + divx496 divide 1e5 200e1 -> 5E+1 -- tryzeros cases *************** *** 316,321 **** maxExponent: 92 minexponent: -92 ! divx496 divide 0E+86 1000E-13 -> 0E+92 Clamped ! divx497 divide 0E-98 1000E+13 -> 0E-98 Clamped precision: 9 --- 352,357 ---- maxExponent: 92 minexponent: -92 ! divx497 divide 0E+86 1000E-13 -> 0E+92 Clamped ! divx498 divide 0E-98 1000E+13 -> 0E-98 Clamped precision: 9 *************** *** 335,378 **** precision: 9 ! divx531 divide 1 2 -> 0.5 ! divx532 divide 1.0 2 -> 0.5 ! divx533 divide 1.00 2 -> 0.50 ! divx534 divide 1.000 2 -> 0.500 ! divx535 divide 1.0000 2 -> 0.5000 ! divx536 divide 1.00000 2 -> 0.50000 ! divx537 divide 1.000000 2 -> 0.500000 ! divx538 divide 1.0000000 2 -> 0.5000000 ! divx539 divide 1.00 2.00 -> 0.5 ! divx541 divide 2 1 -> 2 ! divx542 divide 2 1.0 -> 2 ! divx543 divide 2 1.00 -> 2 ! divx544 divide 2 1.000 -> 2 ! divx545 divide 2 1.0000 -> 2 ! divx546 divide 2 1.00000 -> 2 ! divx547 divide 2 1.000000 -> 2 ! divx548 divide 2 1.0000000 -> 2 ! divx549 divide 2.00 1.00 -> 2 - divx550 divide 2.40 2 -> 1.20 - divx551 divide 2.40 4 -> 0.60 - divx552 divide 2.40 10 -> 0.24 - divx553 divide 2.40 2.0 -> 1.2 - divx554 divide 2.40 4.0 -> 0.6 - divx555 divide 2.40 10.0 -> 0.24 - divx556 divide 2.40 2.00 -> 1.2 - divx557 divide 2.40 4.00 -> 0.6 - divx558 divide 2.40 10.00 -> 0.24 - divx559 divide 0.9 0.1 -> 9 - divx560 divide 0.9 0.01 -> 9E+1 - divx561 divide 0.9 0.001 -> 9E+2 - divx562 divide 5 2 -> 2.5 - divx563 divide 5 2.0 -> 2.5 - divx564 divide 5 2.00 -> 2.5 - divx565 divide 5 20 -> 0.25 - divx566 divide 5 20.0 -> 0.25 - divx567 divide 2.400 2 -> 1.200 - divx568 divide 2.400 2.0 -> 1.20 - divx569 divide 2.400 2.400 -> 1 -- +ve exponent precision: 5 --- 371,424 ---- precision: 9 ! divx511 divide 1 2 -> 0.5 ! divx512 divide 1.0 2 -> 0.5 ! divx513 divide 1.00 2 -> 0.50 ! divx514 divide 1.000 2 -> 0.500 ! divx515 divide 1.0000 2 -> 0.5000 ! divx516 divide 1.00000 2 -> 0.50000 ! divx517 divide 1.000000 2 -> 0.500000 ! divx518 divide 1.0000000 2 -> 0.5000000 ! divx519 divide 1.00 2.00 -> 0.5 ! divx521 divide 2 1 -> 2 ! divx522 divide 2 1.0 -> 2 ! divx523 divide 2 1.00 -> 2 ! divx524 divide 2 1.000 -> 2 ! divx525 divide 2 1.0000 -> 2 ! divx526 divide 2 1.00000 -> 2 ! divx527 divide 2 1.000000 -> 2 ! divx528 divide 2 1.0000000 -> 2 ! divx529 divide 2.00 1.00 -> 2 ! ! divx530 divide 2.40 2 -> 1.20 ! divx531 divide 2.40 4 -> 0.60 ! divx532 divide 2.40 10 -> 0.24 ! divx533 divide 2.40 2.0 -> 1.2 ! divx534 divide 2.40 4.0 -> 0.6 ! divx535 divide 2.40 10.0 -> 0.24 ! divx536 divide 2.40 2.00 -> 1.2 ! divx537 divide 2.40 4.00 -> 0.6 ! divx538 divide 2.40 10.00 -> 0.24 ! divx539 divide 0.9 0.1 -> 9 ! divx540 divide 0.9 0.01 -> 9E+1 ! divx541 divide 0.9 0.001 -> 9E+2 ! divx542 divide 5 2 -> 2.5 ! divx543 divide 5 2.0 -> 2.5 ! divx544 divide 5 2.00 -> 2.5 ! divx545 divide 5 20 -> 0.25 ! divx546 divide 5 20.0 -> 0.25 ! divx547 divide 2.400 2 -> 1.200 ! divx548 divide 2.400 2.0 -> 1.20 ! divx549 divide 2.400 2.400 -> 1 ! ! divx550 divide 240 1 -> 240 ! divx551 divide 240 10 -> 24 ! divx552 divide 240 100 -> 2.4 ! divx553 divide 240 1000 -> 0.24 ! divx554 divide 2400 1 -> 2400 ! divx555 divide 2400 10 -> 240 ! divx556 divide 2400 100 -> 24 ! divx557 divide 2400 1000 -> 2.4 -- +ve exponent precision: 5 *************** *** 508,515 **** divx758 divide 1.0 -0 -> -Infinity Division_by_zero ! divx761 divide 0 -1.0 -> -0 ! divx762 divide -0 -1.0 -> 0 ! divx763 divide 0 1.0 -> 0 ! divx764 divide -0 1.0 -> -0 divx765 divide -1 0.0 -> -Infinity Division_by_zero divx766 divide -1 -0.0 -> Infinity Division_by_zero --- 554,561 ---- divx758 divide 1.0 -0 -> -Infinity Division_by_zero ! divx761 divide 0 -1.0 -> -0E+1 ! divx762 divide -0 -1.0 -> 0E+1 ! divx763 divide 0 1.0 -> 0E+1 ! divx764 divide -0 1.0 -> -0E+1 divx765 divide -1 0.0 -> -Infinity Division_by_zero divx766 divide -1 -0.0 -> Infinity Division_by_zero *************** *** 517,524 **** divx768 divide 1 -0.0 -> -Infinity Division_by_zero ! divx771 divide 0.0 -1.0 -> -0.0 ! divx772 divide -0.0 -1.0 -> 0.0 ! divx773 divide 0.0 1.0 -> 0.0 ! divx774 divide -0.0 1.0 -> -0.0 divx775 divide -1.0 0.0 -> -Infinity Division_by_zero divx776 divide -1.0 -0.0 -> Infinity Division_by_zero --- 563,570 ---- divx768 divide 1 -0.0 -> -Infinity Division_by_zero ! divx771 divide 0.0 -1.0 -> -0 ! divx772 divide -0.0 -1.0 -> 0 ! divx773 divide 0.0 1.0 -> 0 ! divx774 divide -0.0 1.0 -> -0 divx775 divide -1.0 0.0 -> -Infinity Division_by_zero divx776 divide -1.0 -0.0 -> Infinity Division_by_zero *************** *** 535,545 **** divx786 divide Inf 1000 -> Infinity divx787 divide Inf Inf -> NaN Invalid_operation ! divx788 divide -1000 Inf -> -0 divx789 divide -Inf Inf -> NaN Invalid_operation ! divx790 divide -1 Inf -> -0 ! divx791 divide -0 Inf -> -0 ! divx792 divide 0 Inf -> 0 ! divx793 divide 1 Inf -> 0 ! divx794 divide 1000 Inf -> 0 divx795 divide Inf Inf -> NaN Invalid_operation --- 581,591 ---- divx786 divide Inf 1000 -> Infinity divx787 divide Inf Inf -> NaN Invalid_operation ! divx788 divide -1000 Inf -> -0E-1007 Clamped divx789 divide -Inf Inf -> NaN Invalid_operation ! divx790 divide -1 Inf -> -0E-1007 Clamped ! divx791 divide -0 Inf -> -0E-1007 Clamped ! divx792 divide 0 Inf -> 0E-1007 Clamped ! divx793 divide 1 Inf -> 0E-1007 Clamped ! divx794 divide 1000 Inf -> 0E-1007 Clamped divx795 divide Inf Inf -> NaN Invalid_operation *************** *** 552,562 **** divx806 divide -Inf 1000 -> -Infinity divx807 divide -Inf Inf -> NaN Invalid_operation ! divx808 divide -1000 Inf -> -0 divx809 divide -Inf -Inf -> NaN Invalid_operation ! divx810 divide -1 -Inf -> 0 ! divx811 divide -0 -Inf -> 0 ! divx812 divide 0 -Inf -> -0 ! divx813 divide 1 -Inf -> -0 ! divx814 divide 1000 -Inf -> -0 divx815 divide Inf -Inf -> NaN Invalid_operation --- 598,608 ---- divx806 divide -Inf 1000 -> -Infinity divx807 divide -Inf Inf -> NaN Invalid_operation ! divx808 divide -1000 Inf -> -0E-1007 Clamped divx809 divide -Inf -Inf -> NaN Invalid_operation ! divx810 divide -1 -Inf -> 0E-1007 Clamped ! divx811 divide -0 -Inf -> 0E-1007 Clamped ! divx812 divide 0 -Inf -> -0E-1007 Clamped ! divx813 divide 1 -Inf -> -0E-1007 Clamped ! divx814 divide 1000 -Inf -> -0E-1007 Clamped divx815 divide Inf -Inf -> NaN Invalid_operation Index: divideint.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/divideint.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** divideint.decTest 2 May 2003 23:07:35 -0000 1.1 --- divideint.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: inexact.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/inexact.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** inexact.decTest 2 May 2003 23:07:35 -0000 1.1 --- inexact.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: integer.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/integer.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** integer.decTest 2 May 2003 23:07:35 -0000 1.1 --- integer.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of tests tests the extended specification 'round-to-integer' --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of tests tests the extended specification 'round-to-integer' *************** *** 76,79 **** --- 76,81 ---- intx051 integer -1.8 -> -2 Rounded Inexact intx052 integer -1.9 -> -2 Rounded Inexact + intx053 integer 10E+30 -> NaN Invalid_operation + intx054 integer -10E+30 -> NaN Invalid_operation -- numbers around precision *************** *** 89,94 **** intx069 integer '56267E+3' -> '56267000' intx070 integer '56267E+4' -> '562670000' ! intx071 integer '56267E+5' -> Infinity Overflow Inexact Rounded ! intx072 integer '56267E+6' -> Infinity Overflow Inexact Rounded intx080 integer '-56267E-10' -> '-0' Inexact Rounded intx081 integer '-56267E-5' -> '-1' Inexact Rounded --- 91,96 ---- intx069 integer '56267E+3' -> '56267000' intx070 integer '56267E+4' -> '562670000' ! intx071 integer '56267E+5' -> NaN Invalid_operation ! intx072 integer '56267E+6' -> NaN Invalid_operation intx080 integer '-56267E-10' -> '-0' Inexact Rounded intx081 integer '-56267E-5' -> '-1' Inexact Rounded *************** *** 101,110 **** intx089 integer '-56267E+3' -> '-56267000' intx090 integer '-56267E+4' -> '-562670000' ! intx091 integer '-56267E+5' -> -Infinity Overflow Inexact Rounded ! intx092 integer '-56267E+6' -> -Infinity Overflow Inexact Rounded -- specials and zeros ! intx120 integer 'Inf' -> 'Infinity' ! intx121 integer '-Inf' -> '-Infinity' intx122 integer NaN -> NaN intx123 integer sNaN -> NaN Invalid_operation --- 103,112 ---- intx089 integer '-56267E+3' -> '-56267000' intx090 integer '-56267E+4' -> '-562670000' ! intx091 integer '-56267E+5' -> NaN Invalid_operation ! intx092 integer '-56267E+6' -> NaN Invalid_operation -- specials and zeros ! intx120 integer 'Inf' -> NaN Invalid_operation ! intx121 integer '-Inf' -> NaN Invalid_operation intx122 integer NaN -> NaN intx123 integer sNaN -> NaN Invalid_operation Index: max.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/max.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** max.decTest 2 May 2003 23:07:35 -0000 1.1 --- max.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- we assume that base comparison is tested in compare.decTest, so --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- we assume that base comparison is tested in compare.decTest, so Index: min.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/min.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** min.decTest 2 May 2003 23:07:35 -0000 1.1 --- min.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- we assume that base comparison is tested in compare.decTest, so --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- we assume that base comparison is tested in compare.decTest, so Index: minus.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/minus.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** minus.decTest 2 May 2003 23:07:35 -0000 1.1 --- minus.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of tests primarily tests the existence of the operator. --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of tests primarily tests the existence of the operator. Index: multiply.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/multiply.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** multiply.decTest 2 May 2003 23:07:35 -0000 1.1 --- multiply.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: normalize.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/normalize.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** normalize.decTest 2 May 2003 23:07:35 -0000 1.1 --- normalize.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: plus.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/plus.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** plus.decTest 2 May 2003 23:07:35 -0000 1.1 --- plus.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of tests primarily tests the existence of the operator. --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of tests primarily tests the existence of the operator. Index: power.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/power.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** power.decTest 2 May 2003 23:07:35 -0000 1.1 --- power.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- This set of testcases tests raising numbers to an integer power only. --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- This set of testcases tests raising numbers to an integer power only. *************** *** 252,255 **** --- 252,273 ---- precision: 999999995 powx254 power 2 12 -> 4096 + + -- zeros + maxexponent: +96 + minexponent: -95 + precision: 7 + powx260 power 0E-34 3 -> 0E-101 Clamped + powx261 power 0E-33 3 -> 0E-99 + powx262 power 0E-32 3 -> 0E-96 + powx263 power 0E-30 3 -> 0E-90 + powx264 power 0E-10 3 -> 0E-30 + powx265 power 0E-1 3 -> 0.000 + powx266 power 0E+0 3 -> 0 + powx267 power 0 3 -> 0 + powx268 power 0E+1 3 -> 0E+3 + powx269 power 0E+10 3 -> 0E+30 + powx270 power 0E+30 3 -> 0E+90 + powx271 power 0E+32 3 -> 0E+96 + powx272 power 0E+33 3 -> 0E+96 Clamped -- overflow and underflow tests Index: randomBound32.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/randomBound32.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** randomBound32.decTest 2 May 2003 23:07:35 -0000 1.1 --- randomBound32.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- These testcases test calculations at precisions 31, 32, and 33, to --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- These testcases test calculations at precisions 31, 32, and 33, to Index: randoms.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/randoms.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** randoms.decTest 2 May 2003 23:07:35 -0000 1.1 --- randoms.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: remainder.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/remainder.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** remainder.decTest 2 May 2003 23:07:35 -0000 1.1 --- remainder.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: remainderNear.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/remainderNear.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** remainderNear.decTest 2 May 2003 23:07:35 -0000 1.1 --- remainderNear.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: rescale.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/rescale.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rescale.decTest 2 May 2003 23:07:35 -0000 1.1 --- rescale.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 *************** *** 79,84 **** resx066 rescale -0.1 0 -> -0 Inexact Rounded resx067 rescale -0 5 -> -0E+5 ! resx068 rescale +35236450.6 -2 -> Infinity Overflow Inexact Rounded ! resx069 rescale -35236450.6 -2 -> -Infinity Overflow Inexact Rounded resx070 rescale 217 -1 -> 217.0 resx071 rescale 217 0 -> 217 --- 79,84 ---- resx066 rescale -0.1 0 -> -0 Inexact Rounded resx067 rescale -0 5 -> -0E+5 ! resx068 rescale +35236450.6 -2 -> NaN Invalid_operation ! resx069 rescale -35236450.6 -2 -> NaN Invalid_operation resx070 rescale 217 -1 -> 217.0 resx071 rescale 217 0 -> 217 *************** *** 133,137 **** resx141 rescale +1 -2 -> 1.00 resx142 rescale +10 -2 -> 10.00 ! resx143 rescale 1E+10 -2 -> Infinity Overflow Inexact Rounded resx144 rescale 1E-10 -2 -> 0.00 Inexact Rounded resx145 rescale 1E-3 -2 -> 0.00 Inexact Rounded --- 133,137 ---- resx141 rescale +1 -2 -> 1.00 resx142 rescale +10 -2 -> 10.00 ! resx143 rescale 1E+10 -2 -> NaN Invalid_operation resx144 rescale 1E-10 -2 -> 0.00 Inexact Rounded resx145 rescale 1E-3 -2 -> 0.00 Inexact Rounded *************** *** 188,192 **** resx251 rescale 1E+9 +1 -> 1.00000000E+9 -- underneath this is E+1 -- next one tries to add 9 zeros ! resx252 rescale 1E+10 +1 -> Infinity Overflow Inexact Rounded resx253 rescale 1E-10 +1 -> 0E+1 Inexact Rounded resx254 rescale 1E-2 +1 -> 0E+1 Inexact Rounded --- 188,192 ---- resx251 rescale 1E+9 +1 -> 1.00000000E+9 -- underneath this is E+1 -- next one tries to add 9 zeros ! resx252 rescale 1E+10 +1 -> NaN Invalid_operation resx253 rescale 1E-10 +1 -> 0E+1 Inexact Rounded resx254 rescale 1E-2 +1 -> 0E+1 Inexact Rounded *************** *** 310,321 **** resx380 rescale 352364.506 -2 -> 352364.51 Inexact Rounded resx381 rescale 3523645.06 -2 -> 3523645.06 ! resx382 rescale 35236450.6 -2 -> Infinity Overflow Inexact Rounded ! resx383 rescale 352364506 -2 -> Infinity Overflow Inexact Rounded resx384 rescale -352364.506 -2 -> -352364.51 Inexact Rounded resx385 rescale -3523645.06 -2 -> -3523645.06 ! resx386 rescale -35236450.6 -2 -> -Infinity Overflow Inexact Rounded ! resx387 rescale -352364506 -2 -> -Infinity Overflow Inexact Rounded -- some 9999 round-up cases resx400 rescale 9.999 -5 -> 9.99900 resx401 rescale 9.999 -4 -> 9.9990 --- 310,337 ---- resx380 rescale 352364.506 -2 -> 352364.51 Inexact Rounded resx381 rescale 3523645.06 -2 -> 3523645.06 ! resx382 rescale 35236450.6 -2 -> NaN Invalid_operation ! resx383 rescale 352364506 -2 -> NaN Invalid_operation resx384 rescale -352364.506 -2 -> -352364.51 Inexact Rounded resx385 rescale -3523645.06 -2 -> -3523645.06 ! resx386 rescale -35236450.6 -2 -> NaN Invalid_operation ! resx387 rescale -352364506 -2 -> NaN Invalid_operation ! ! rounding: down ! resx389 rescale 35236450.6 -2 -> NaN Invalid_operation ! -- ? should that one instead have been: ! -- resx389 rescale 35236450.6 -2 -> NaN Invalid_operation ! rounding: half_up ! ! -- and a few more from e-mail discussions ! precision: 7 ! resx391 rescale 12.34567 -3 -> 12.346 Inexact Rounded ! resx392 rescale 123.4567 -3 -> 123.457 Inexact Rounded ! resx393 rescale 1234.567 -3 -> 1234.567 ! resx394 rescale 12345.67 -3 -> NaN Invalid_operation ! resx395 rescale 123456.7 -3 -> NaN Invalid_operation ! resx396 rescale 1234567. -3 -> NaN Invalid_operation -- some 9999 round-up cases + precision: 9 resx400 rescale 9.999 -5 -> 9.99900 resx401 rescale 9.999 -4 -> 9.9990 *************** *** 360,364 **** precision: 8 ! resx449 rescale 9.999E-15 -23 -> Infinity Inexact Rounded Overflow resx450 rescale 9.999E-15 -22 -> 9.9990000E-15 resx451 rescale 9.999E-15 -21 -> 9.999000E-15 --- 376,380 ---- precision: 8 ! resx449 rescale 9.999E-15 -23 -> NaN Invalid_operation resx450 rescale 9.999E-15 -22 -> 9.9990000E-15 resx451 rescale 9.999E-15 -21 -> 9.999000E-15 *************** *** 441,448 **** resx526 rescale 123.456 12345678903 -> NaN Invalid_operation -- next four are "won't fit" overflows ! resx527 rescale 1.234 -999999E+3 -> Infinity Overflow Inexact Rounded ! resx528 rescale 123.456 -999999E+3 -> Infinity Overflow Inexact Rounded ! resx529 rescale 1.234 -999999999 -> Infinity Overflow Inexact Rounded ! resx530 rescale 123.456 -999999999 -> Infinity Overflow Inexact Rounded resx531 rescale 123.456 -1000000014 -> NaN Invalid_operation resx532 rescale 123.456 -12345678903 -> NaN Invalid_operation --- 457,464 ---- resx526 rescale 123.456 12345678903 -> NaN Invalid_operation -- next four are "won't fit" overflows ! resx527 rescale 1.234 -999999E+3 -> NaN Invalid_operation ! resx528 rescale 123.456 -999999E+3 -> NaN Invalid_operation ! resx529 rescale 1.234 -999999999 -> NaN Invalid_operation ! resx530 rescale 123.456 -999999999 -> NaN Invalid_operation resx531 rescale 123.456 -1000000014 -> NaN Invalid_operation resx532 rescale 123.456 -12345678903 -> NaN Invalid_operation *************** *** 459,464 **** resx545 rescale 0 -999 -> 0E-999 -- next two are "won't fit" overflows ! resx546 rescale 1.234 -999 -> Infinity Overflow Inexact Rounded ! resx547 rescale 1.234 -1000 -> Infinity Overflow Inexact Rounded resx548 rescale 1.234 -5000 -> NaN Invalid_operation -- [more below] --- 475,480 ---- resx545 rescale 0 -999 -> 0E-999 -- next two are "won't fit" overflows ! resx546 rescale 1.234 -999 -> NaN Invalid_operation ! resx547 rescale 1.234 -1000 -> NaN Invalid_operation resx548 rescale 1.234 -5000 -> NaN Invalid_operation -- [more below] *************** *** 483,491 **** -- Specials resx580 rescale Inf -Inf -> NaN Invalid_operation ! resx581 rescale Inf -1000 -> Infinity ! resx582 rescale Inf -1 -> Infinity ! resx583 rescale Inf 0 -> Infinity ! resx584 rescale Inf 1 -> Infinity ! resx585 rescale Inf 1000 -> Infinity resx586 rescale Inf Inf -> NaN Invalid_operation resx587 rescale -1000 Inf -> NaN Invalid_operation --- 499,507 ---- -- Specials resx580 rescale Inf -Inf -> NaN Invalid_operation ! resx581 rescale Inf -1000 -> NaN Invalid_operation ! resx582 rescale Inf -1 -> NaN Invalid_operation ! resx583 rescale Inf 0 -> NaN Invalid_operation ! resx584 rescale Inf 1 -> NaN Invalid_operation ! resx585 rescale Inf 1000 -> NaN Invalid_operation resx586 rescale Inf Inf -> NaN Invalid_operation resx587 rescale -1000 Inf -> NaN Invalid_operation *************** *** 496,508 **** resx592 rescale 1000 Inf -> NaN Invalid_operation resx593 rescale Inf Inf -> NaN Invalid_operation ! resx594 rescale Inf -0 -> Infinity resx595 rescale -0 Inf -> NaN Invalid_operation resx600 rescale -Inf -Inf -> NaN Invalid_operation ! resx601 rescale -Inf -1000 -> -Infinity ! resx602 rescale -Inf -1 -> -Infinity ! resx603 rescale -Inf 0 -> -Infinity ! resx604 rescale -Inf 1 -> -Infinity ! resx605 rescale -Inf 1000 -> -Infinity resx606 rescale -Inf Inf -> NaN Invalid_operation resx607 rescale -1000 Inf -> NaN Invalid_operation --- 512,524 ---- resx592 rescale 1000 Inf -> NaN Invalid_operation resx593 rescale Inf Inf -> NaN Invalid_operation ! resx594 rescale Inf -0 -> NaN Invalid_operation resx595 rescale -0 Inf -> NaN Invalid_operation resx600 rescale -Inf -Inf -> NaN Invalid_operation ! resx601 rescale -Inf -1000 -> NaN Invalid_operation ! resx602 rescale -Inf -1 -> NaN Invalid_operation ! resx603 rescale -Inf 0 -> NaN Invalid_operation ! resx604 rescale -Inf 1 -> NaN Invalid_operation ! resx605 rescale -Inf 1000 -> NaN Invalid_operation resx606 rescale -Inf Inf -> NaN Invalid_operation resx607 rescale -1000 Inf -> NaN Invalid_operation *************** *** 513,517 **** resx612 rescale 1000 -Inf -> NaN Invalid_operation resx613 rescale Inf -Inf -> NaN Invalid_operation ! resx614 rescale -Inf -0 -> -Infinity resx615 rescale -0 -Inf -> NaN Invalid_operation --- 529,533 ---- resx612 rescale 1000 -Inf -> NaN Invalid_operation resx613 rescale Inf -Inf -> NaN Invalid_operation ! resx614 rescale -Inf -0 -> NaN Invalid_operation resx615 rescale -0 -Inf -> NaN Invalid_operation *************** *** 524,528 **** resx627 rescale NaN Inf -> NaN Invalid_operation resx628 rescale NaN NaN -> NaN ! resx629 rescale -Inf NaN -> NaN resx630 rescale -1000 NaN -> NaN resx631 rescale -1 NaN -> NaN --- 540,544 ---- resx627 rescale NaN Inf -> NaN Invalid_operation resx628 rescale NaN NaN -> NaN ! resx629 rescale -Inf NaN -> NaN Invalid_operation resx630 rescale -1000 NaN -> NaN resx631 rescale -1 NaN -> NaN *************** *** 530,534 **** resx633 rescale 1 NaN -> NaN resx634 rescale 1000 NaN -> NaN ! resx635 rescale Inf NaN -> NaN resx636 rescale NaN -0 -> NaN resx637 rescale -0 NaN -> NaN --- 546,550 ---- resx633 rescale 1 NaN -> NaN resx634 rescale 1000 NaN -> NaN ! resx635 rescale Inf NaN -> NaN Invalid_operation resx636 rescale NaN -0 -> NaN resx637 rescale -0 NaN -> NaN Index: rounding.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/rounding.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** rounding.decTest 2 May 2003 23:07:35 -0000 1.1 --- rounding.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- These tests require that implementations take account of residues in --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- These tests require that implementations take account of residues in Index: squareroot.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/squareroot.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** squareroot.decTest 2 May 2003 23:07:35 -0000 1.1 --- squareroot.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 [...1882 lines suppressed...] sqtx803 squareroot 1E-18 -> 1E-9 precision: 11 -- Etiny=-19 ! sqtx804 squareroot 1E-19 -> 3.162277660E-10 Underflow Subnormal Inexact Rounded ! sqtx805 squareroot 10E-19 -> 1E-9 precision: 12 -- Etiny=-20 sqtx806 squareroot 10E-20 -> 3.1622776602E-10 Underflow Subnormal Inexact Rounded *************** *** 2912,2916 **** precision: 13 -- Etiny=-21 sqtx808 squareroot 1E-21 -> 3.1622776602E-11 Underflow Subnormal Inexact Rounded ! sqtx809 squareroot 10E-21 -> 1E-10 Subnormal Rounded precision: 14 -- Etiny=-22 sqtx810 squareroot 1E-21 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded --- 2924,2928 ---- precision: 13 -- Etiny=-21 sqtx808 squareroot 1E-21 -> 3.1622776602E-11 Underflow Subnormal Inexact Rounded ! sqtx809 squareroot 10E-21 -> 1E-10 Subnormal precision: 14 -- Etiny=-22 sqtx810 squareroot 1E-21 -> 3.16227766017E-11 Underflow Subnormal Inexact Rounded Index: subtract.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/subtract.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** subtract.decTest 2 May 2003 23:07:35 -0000 1.1 --- subtract.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 Index: testall.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/testall.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** testall.decTest 2 May 2003 23:07:35 -0000 1.1 --- testall.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 -- core tests (using Extended: 1) -------------------------------------- --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 -- core tests (using Extended: 1) -------------------------------------- Index: trim.decTest =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/tests/trim.decTest,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** trim.decTest 2 May 2003 23:07:35 -0000 1.1 --- trim.decTest 27 May 2003 22:46:40 -0000 1.2 *************** *** 18,22 **** -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.21 extended: 1 --- 18,22 ---- -- mfc@uk.ibm.com -- ------------------------------------------------------------------------ ! version: 2.23 extended: 1 From eprice@users.sourceforge.net Tue May 27 23:46:42 2003 From: eprice@users.sourceforge.net (eprice@users.sourceforge.net) Date: Tue, 27 May 2003 15:46:42 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv14021 Modified Files: Decimal.py Log Message: Updating tests since the new ones are incompatible with the old ones. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Decimal.py 27 May 2003 22:27:01 -0000 1.7 --- Decimal.py 27 May 2003 22:46:40 -0000 1.8 *************** *** 1904,1908 **** --- 1904,1910 ---- else: exp = self._exp // 2 + context.prec += ans._exp - exp ans = ans.rescale(Decimal(exp), context=context) + context.prec = firstprec context.regard_flags(flags) context.Emax, context.Emin = Emax, Emin From eprice@users.sourceforge.net Tue May 27 23:27:04 2003 From: eprice@users.sourceforge.net (eprice@users.sourceforge.net) Date: Tue, 27 May 2003 15:27:04 -0700 Subject: [Python-checkins] python/nondist/sandbox/decimal Decimal.py,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/sandbox/decimal In directory sc8-pr-cvs1:/tmp/cvs-serv7566 Modified Files: Decimal.py Log Message: Bug-fix, style-fix. Index: Decimal.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/decimal/Decimal.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Decimal.py 21 May 2003 16:20:23 -0000 1.6 --- Decimal.py 27 May 2003 22:27:01 -0000 1.7 *************** *** 155,159 **** # rounding: is set to round-half-even (IEEE 854 4.1) - DEFAULT_CONTEXT = EXTENDED_DEFAULT_CONTEXT --- 155,158 ---- *************** *** 170,174 **** # Power's increased prec can't go above this in test cases. [...1231 lines suppressed...] --- 2502,2505 ---- *************** *** 2558,2566 **** mantissa = tuple(tmp) - return (sign, mantissa, exp) - def _floatToString(x): """Return float x as exact decimal string. --- 2562,2568 ---- *************** *** 2677,2680 **** DEFAULT_ROUNDING_DECISION = decision SetDefaultContext() - - --- 2679,2680 ---- From greg@users.sourceforge.net Wed May 28 08:56:48 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Wed, 28 May 2003 00:56:48 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26102 Modified Files: libbsddb.tex Log Message: Include a link to the pybsddb web documentation for the modern object oriented DbEnv & Db object BerkeleyDB interface. Include a note about Sleepycat's BerkeleyDB license with regards to distributing it within non-opensource applications and include a link to their website for license details. Document that 'r' is the default flag for the legacy bsddb btopen(), hashopen(), and rnopen() functions. This is apparently different than the dbm libraries in other languages according to Bug #732951. Changing the default from 'r' to 'c' would break backwards compatibility with legacy bsddb applications; documenting the default should suffice. Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libbsddb.tex 6 May 2003 20:39:55 -0000 1.9 --- libbsddb.tex 28 May 2003 07:56:45 -0000 1.10 *************** *** 15,29 **** serialize them somehow, typically using marshal.dumps or pickle.dumps. ! There are two incompatible versions of the underlying library. ! Version 1.85 is widely available, but has some known bugs. Version 2 ! is not quite as widely used, but does offer some improvements. The ! \module{bsddb} module uses the 1.85 interface. Starting with Python ! 2.0, the \program{configure} script can usually determine the ! version of the library which is available and build it correctly. If ! you have difficulty getting \program{configure} to do the right thing, ! run it with the \longprogramopt{help} option to get information about ! additional options that can help. On Windows, you will need to define ! the \code{HAVE_DB_185_H} macro if you are building Python from source ! and using version 2 of the DB library. The \module{bsddb} module defines the following functions that create --- 15,40 ---- serialize them somehow, typically using marshal.dumps or pickle.dumps. ! Starting with Python 2.3 the \module{bsddb} module requires the ! Berkeley DB library version 3.1 or later (it is known to work with 3.1 ! thru 4.1 at the time of this writing). ! ! NOTE: BerkeleyDB has its own license which may apply to you if you ! intend to distribute your application outside of your organization in ! a non-opensource manner. Visit Sleepycat Software's website to read ! the full license. ! ! \begin{seealso} ! \seeurl{http://pybsddb.sourceforge.net/}{Website with documentation ! for the new python Berkeley DB interface that closely mirrors the ! sleepycat object oriented interface provided in Berkeley DB 3 and 4.} ! \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the ! modern Berkeley DB library. They offer support and sell licenses for ! proprietary software using BerkeleyDB.} ! \end{seealso} ! ! The following is a description of the legacy \module{bsddb} interface ! compatible with the old python bsddb module. For details about the more ! modern Db and DbEnv object oriented interface see the above mentioned ! pybsddb URL. The \module{bsddb} module defines the following functions that create *************** *** 42,46 **** \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be ! \character{r} (read only), \character{w} (read-write), \character{c} (read-write - create if necessary) or \character{n} (read-write - truncate to zero length). The other --- 53,57 ---- \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be ! \character{r} (read only, default), \character{w} (read-write) , \character{c} (read-write - create if necessary) or \character{n} (read-write - truncate to zero length). The other *************** *** 58,62 **** \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be ! \character{r} (read only), \character{w} (read-write), \character{c} (read-write - create if necessary) or \character{n} (read-write - truncate to zero length). The other --- 69,73 ---- \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be ! \character{r} (read only, default), \character{w} (read-write), \character{c} (read-write - create if necessary) or \character{n} (read-write - truncate to zero length). The other *************** *** 74,78 **** \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be ! \character{r} (read only), \character{w} (read-write), \character{c} (read-write - create if necessary) or \character{n} (read-write - truncate to zero length). The other --- 85,89 ---- \var{filename}. The optional \var{flag} identifies the mode used to open the file. It may be ! \character{r} (read only, default), \character{w} (read-write), \character{c} (read-write - create if necessary) or \character{n} (read-write - truncate to zero length). The other From greg@users.sourceforge.net Wed May 28 09:26:46 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Wed, 28 May 2003 01:26:46 -0700 Subject: [Python-checkins] python/dist/src/Lib/bsddb/test test_thread.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/bsddb/test In directory sc8-pr-cvs1:/tmp/cvs-serv16258 Modified Files: test_thread.py Log Message: Wrap the cursor functions with dbutils.DeadlockWrap to deal with the expected DBLockDeadLockErrors. Index: test_thread.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/bsddb/test/test_thread.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_thread.py 28 Jan 2003 17:20:44 -0000 1.5 --- test_thread.py 28 May 2003 08:26:43 -0000 1.6 *************** *** 268,277 **** c = d.cursor() count = 0 ! rec = c.first() while rec: count += 1 key, data = rec self.assertEqual(self.makeData(key), data) ! rec = c.next() if verbose: print "%s: found %d records" % (name, count) --- 268,277 ---- c = d.cursor() count = 0 ! rec = dbutils.DeadlockWrap(c.first) while rec: count += 1 key, data = rec self.assertEqual(self.makeData(key), data) ! rec = dbutils.DeadlockWrap(c.next) if verbose: print "%s: found %d records" % (name, count) From jhylton@users.sourceforge.net Wed May 28 12:51:14 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 28 May 2003 04:51:14 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref refa1.tex,1.12,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv5883/Doc/ref Removed Files: refa1.tex Log Message: --- refa1.tex DELETED --- From jhylton@users.sourceforge.net Wed May 28 12:57:55 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 28 May 2003 04:57:55 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuture.tex,NONE,1.1 lib.tex,1.221,1.222 lib__future__.tex,1.1,NONE Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10414 Modified Files: lib.tex Added Files: libfuture.tex Removed Files: lib__future__.tex Log Message: Rename lib__future__.tex to libfuture.tex and add link in lib.tex. --- NEW FILE: libfuture.tex --- \section{\module{__future__} --- Future statement definitions} \declaremodule[future]{standard}{__future__} \modulesynopsis{Future statement definitions} \module{__future__} is a real module, and serves three purposes: \begin{itemize} \item To avoid confusing existing tools that analyze import statements and expect to find the modules they're importing. \item To ensure that future_statements run under releases prior to 2.1 at least yield runtime exceptions (the import of \module{__future__} will fail, because there was no module of that name prior to 2.1). \item To document when incompatible changes were introduced, and when they will be --- or were --- made mandatory. This is a form of executable documentation, and can be inspected programatically via importing \module{__future__} and examining its contents. \end{itemize} Each statment in \file{__future__.py} is of the form: \begin{verbatim} FeatureName = "_Feature(" OptionalRelease "," MandatoryRelease "," CompilerFlag ")" \end{verbatim} where, normally, OptionalRelease is less then MandatoryRelease, and both are 5-tuples of the same form as \code{sys.version_info}: \begin{verbatim} (PY_MAJOR_VERSION, # the 2 in 2.1.0a3; an int PY_MINOR_VERSION, # the 1; an int PY_MICRO_VERSION, # the 0; an int PY_RELEASE_LEVEL, # "alpha", "beta", "candidate" or "final"; string PY_RELEASE_SERIAL # the 3; an int ) \end{verbatim} OptionalRelease records the first release in which the feature was accepted. In the case of MandatoryReleases that have not yet occurred, MandatoryRelease predicts the release in which the feature will become part of the language. Else MandatoryRelease records when the feature became part of the language; in releases at or after that, modules no longer need a future statement to use the feature in question, but may continue to use such imports. MandatoryRelease may also be \code{None}, meaning that a planned feature got dropped. Instances of class \class{_Feature} have two corresponding methods, \method{getOptionalRelease()} and \method{getMandatoryRelease()}. CompilerFlag is the (bitfield) flag that should be passed in the fourth argument to the builtin function \function{compile()} to enable the feature in dynamically compiled code. This flag is stored in the \member{compiler_flag} attribute on \class{_Future} instances. No feature description will ever be deleted from \module{__future__}. Index: lib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/lib.tex,v retrieving revision 1.221 retrieving revision 1.222 diff -C2 -d -r1.221 -r1.222 *** lib.tex 7 May 2003 22:02:16 -0000 1.221 --- lib.tex 28 May 2003 11:57:51 -0000 1.222 *************** *** 102,105 **** --- 102,106 ---- \input{libbltin} % really __builtin__ \input{libmain} % really __main__ + \input{libfuture} % really __future__ \input{libstrings} % String Services --- lib__future__.tex DELETED --- From jhylton@users.sourceforge.net Wed May 28 13:04:41 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 28 May 2003 05:04:41 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv14899 Modified Files: ref.tex Log Message: Appendix was removed. Index: ref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ref.tex 20 Jun 2001 21:37:34 -0000 1.36 --- ref.tex 28 May 2003 12:04:38 -0000 1.37 *************** *** 59,65 **** \input{ref8} % Top-level components - \appendix - \input{refa1} % Future statements and nested scopes - \chapter{History and License} \input{license} --- 59,62 ---- From jhylton@users.sourceforge.net Wed May 28 13:10:17 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 28 May 2003 05:10:17 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile.deps,1.107,1.108 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv18206 Modified Files: Makefile.deps Log Message: Update dependencies. Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.107 retrieving revision 1.108 diff -C2 -d -r1.107 -r1.108 *** Makefile.deps 9 May 2003 14:45:04 -0000 1.107 --- Makefile.deps 28 May 2003 12:10:14 -0000 1.108 *************** *** 79,84 **** ref/ref6.tex \ ref/ref7.tex \ ! ref/ref8.tex \ ! ref/refa1.tex # LaTeX source files for the Python Library Reference --- 79,83 ---- ref/ref6.tex \ ref/ref7.tex \ ! ref/ref8.tex # LaTeX source files for the Python Library Reference *************** *** 126,129 **** --- 125,129 ---- lib/libbltin.tex \ lib/libmain.tex \ + lib/libfuture.tex \ lib/libstrings.tex \ lib/libstring.tex \ From jhylton@users.sourceforge.net Wed May 28 13:12:59 2003 From: jhylton@users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed, 28 May 2003 05:12:59 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref.tex,1.37,1.38 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv20095 Modified Files: ref.tex Log Message: Oops. License is still an appendix. Index: ref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref.tex,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** ref.tex 28 May 2003 12:04:38 -0000 1.37 --- ref.tex 28 May 2003 12:12:55 -0000 1.38 *************** *** 59,62 **** --- 59,64 ---- \input{ref8} % Top-level components + \appendix + \chapter{History and License} \input{license} From barry@python.org Wed May 28 14:28:08 2003 From: barry@python.org (Barry Warsaw) Date: 28 May 2003 09:28:08 -0400 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.9,1.10 In-Reply-To: References: Message-ID: <1054128488.15437.6.camel@anthem> On Wed, 2003-05-28 at 03:56, greg@users.sourceforge.net wrote: > ! NOTE: BerkeleyDB has its own license which may apply to you if you > ! intend to distribute your application outside of your organization in > ! a non-opensource manner. Visit Sleepycat Software's website to read > ! the full license. I'm a little concerned about the wording of this. Every time I've asked Sleepycat about it, they've told me that as long as you use BerkeleyDB via the Python bindings, and because Python is OSS, there are no restrictions on its use. You can't separate BerkeleyDB from Python and use it in a commercial product, but then why would you want to? But it is fine to use BerkeleyDB-in-Python in a non-open source product without requiring a separate license. That is at least my understanding of the arrangement. But the wording above would lead me to beleive otherwise. -Barry From rhettinger@users.sourceforge.net Wed May 28 15:05:37 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 28 May 2003 07:05:37 -0700 Subject: [Python-checkins] python/dist/src/Objects enumobject.c,1.6,1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25462/Objects Modified Files: enumobject.c Log Message: * Beefed-up tests * Allow tuple re-use * Call tp_iternext directly Index: enumobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/enumobject.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** enumobject.c 21 Apr 2003 20:26:25 -0000 1.6 --- enumobject.c 28 May 2003 14:05:34 -0000 1.7 *************** *** 7,10 **** --- 7,11 ---- long en_index; /* current index of enumeration */ PyObject* en_sit; /* secondary iterator of enumeration */ + PyObject* en_result; /* result tuple */ } enumobject; *************** *** 31,34 **** --- 32,45 ---- return NULL; } + en->en_result = PyTuple_New(2); + if (en->en_result == NULL) { + Py_DECREF(en->en_sit); + Py_DECREF(en); + return NULL; + } + Py_INCREF(Py_None); + PyTuple_SET_ITEM(en->en_result, 0, Py_None); + Py_INCREF(Py_None); + PyTuple_SET_ITEM(en->en_result, 1, Py_None); return (PyObject *)en; } *************** *** 39,42 **** --- 50,54 ---- PyObject_GC_UnTrack(en); Py_XDECREF(en->en_sit); + Py_XDECREF(en->en_result); en->ob_type->tp_free(en); } *************** *** 45,50 **** enum_traverse(enumobject *en, visitproc visit, void *arg) { ! if (en->en_sit) ! return visit(en->en_sit, arg); return 0; } --- 57,72 ---- enum_traverse(enumobject *en, visitproc visit, void *arg) { ! int err; ! ! if (en->en_sit) { ! err = visit(en->en_sit, arg); ! if (err) ! return err; ! } ! if (en->en_result) { ! err = visit(en->en_result, arg); ! if (err) ! return err; ! } return 0; } *************** *** 53,78 **** enum_next(enumobject *en) { - PyObject *result; PyObject *next_index; PyObject *next_item; ! result = PyTuple_New(2); ! if (result == NULL) return NULL; next_index = PyInt_FromLong(en->en_index); if (next_index == NULL) { ! Py_DECREF(result); return NULL; } ! PyTuple_SET_ITEM(result, 0, next_index); ! next_item = PyIter_Next(en->en_sit); ! if (next_item == NULL) { ! Py_DECREF(result); ! return NULL; } ! ! en->en_index++; PyTuple_SET_ITEM(result, 1, next_item); return result; --- 75,107 ---- enum_next(enumobject *en) { PyObject *next_index; PyObject *next_item; + PyObject *result = en->en_result; + PyObject *it = en->en_sit; ! next_item = (*it->ob_type->tp_iternext)(it); ! if (next_item == NULL) return NULL; next_index = PyInt_FromLong(en->en_index); if (next_index == NULL) { ! Py_DECREF(next_item); return NULL; } ! en->en_index++; ! if (result->ob_refcnt == 1) { ! Py_INCREF(result); ! Py_DECREF(PyTuple_GET_ITEM(result, 0)); ! Py_DECREF(PyTuple_GET_ITEM(result, 1)); ! } else { ! result = PyTuple_New(2); ! if (result == NULL) { ! Py_DECREF(next_index); ! Py_DECREF(next_item); ! return NULL; ! } } ! PyTuple_SET_ITEM(result, 0, next_index); PyTuple_SET_ITEM(result, 1, next_item); return result; From rhettinger@users.sourceforge.net Wed May 28 15:05:36 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 28 May 2003 07:05:36 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_enumerate.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25462/Lib/test Modified Files: test_enumerate.py Log Message: * Beefed-up tests * Allow tuple re-use * Call tp_iternext directly Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_enumerate.py 1 May 2003 17:45:37 -0000 1.4 --- test_enumerate.py 28 May 2003 14:05:32 -0000 1.5 *************** *** 1,8 **** import unittest from test import test_support - seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] - class G: 'Sequence using __getitem__' --- 1,7 ---- import unittest + from sets import Set from test import test_support class G: 'Sequence using __getitem__' *************** *** 66,100 **** enum = enumerate def test_basicfunction(self): ! self.assertEqual(type(self.enum(seq)), self.enum) ! e = self.enum(seq) self.assertEqual(iter(e), e) ! self.assertEqual(list(self.enum(seq)), res) self.enum.__doc__ def test_getitemseqn(self): ! self.assertEqual(list(self.enum(G(seq))), res) e = self.enum(G('')) self.assertRaises(StopIteration, e.next) def test_iteratorseqn(self): ! self.assertEqual(list(self.enum(I(seq))), res) e = self.enum(I('')) self.assertRaises(StopIteration, e.next) def test_iteratorgenerator(self): ! self.assertEqual(list(self.enum(Ig(seq))), res) e = self.enum(Ig('')) self.assertRaises(StopIteration, e.next) def test_noniterable(self): ! self.assertRaises(TypeError, self.enum, X(seq)) def test_illformediterable(self): ! self.assertRaises(TypeError, list, self.enum(N(seq))) def test_exception_propagation(self): ! self.assertRaises(ZeroDivisionError, list, self.enum(E(seq))) class MyEnum(enumerate): --- 65,111 ---- enum = enumerate + seq, res = 'abc', [(0,'a'), (1,'b'), (2,'c')] def test_basicfunction(self): ! self.assertEqual(type(self.enum(self.seq)), self.enum) ! e = self.enum(self.seq) self.assertEqual(iter(e), e) ! self.assertEqual(list(self.enum(self.seq)), self.res) self.enum.__doc__ def test_getitemseqn(self): ! self.assertEqual(list(self.enum(G(self.seq))), self.res) e = self.enum(G('')) self.assertRaises(StopIteration, e.next) def test_iteratorseqn(self): ! self.assertEqual(list(self.enum(I(self.seq))), self.res) e = self.enum(I('')) self.assertRaises(StopIteration, e.next) def test_iteratorgenerator(self): ! self.assertEqual(list(self.enum(Ig(self.seq))), self.res) e = self.enum(Ig('')) self.assertRaises(StopIteration, e.next) def test_noniterable(self): ! self.assertRaises(TypeError, self.enum, X(self.seq)) def test_illformediterable(self): ! self.assertRaises(TypeError, list, self.enum(N(self.seq))) def test_exception_propagation(self): ! self.assertRaises(ZeroDivisionError, list, self.enum(E(self.seq))) ! ! def test_argumentcheck(self): ! self.assertRaises(TypeError, self.enum) # no arguments ! self.assertRaises(TypeError, self.enum, 1) # wrong type (not iterable) ! self.assertRaises(TypeError, self.enum, 'abc', 2) # too many arguments ! ! def test_tuple_reuse(self): ! # Tests an implementation detail where tuple is reused ! # whenever nothing else holds a reference to it ! self.assertEqual(len(Set(map(id, list(self.seq)))), len(self.seq)) ! self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq))) class MyEnum(enumerate): *************** *** 105,111 **** enum = MyEnum ! def test_main(): ! test_support.run_unittest(EnumerateTestCase, SubclassTestCase) if __name__ == "__main__": ! test_main() --- 116,142 ---- enum = MyEnum ! class TestEmpty(EnumerateTestCase): ! ! seq, res = '', [] ! ! class TestBig(EnumerateTestCase): ! ! seq = range(10,20000,2) ! res = zip(range(20000), seq) ! ! ! def test_main(verbose=None): ! testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig) ! test_support.run_unittest(*testclasses) ! ! # verify reference counting ! import sys ! if verbose and hasattr(sys, "gettotalrefcount"): ! counts = [None] * 5 ! for i in xrange(len(counts)): ! test_support.run_unittest(*testclasses) ! counts[i] = sys.gettotalrefcount() ! print counts if __name__ == "__main__": ! test_main(verbose=True) From rhettinger@users.sourceforge.net Wed May 28 15:10:49 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed, 28 May 2003 07:10:49 -0700 Subject: [Python-checkins] python/dist/src/Objects dictnotes.txt,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv29234 Modified Files: dictnotes.txt Log Message: Add notes on use cases with paired accesses to the same key. Index: dictnotes.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictnotes.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** dictnotes.txt 5 May 2003 21:31:51 -0000 1.3 --- dictnotes.txt 28 May 2003 14:10:46 -0000 1.4 *************** *** 29,39 **** Repeated writes to a smaller set of keys. Single read of each key. * Removing duplicates from a sequence. dict.fromkeys(seqn).keys() * Counting elements in a sequence. ! for e in seqn: d[e]=d.get(e,0) + 1 ! * Accumulating items in a dictionary of lists. ! for k, v in itemseqn: d.setdefault(k, []).append(v) Membership Testing --- 29,51 ---- Repeated writes to a smaller set of keys. Single read of each key. + Some use cases have two consecutive accesses to the same key. * Removing duplicates from a sequence. dict.fromkeys(seqn).keys() + * Counting elements in a sequence. ! for e in seqn: ! d[e] = d.get(e,0) + 1 ! ! * Accumulating references in a dictionary of lists: ! ! for pagenumber, page in enumerate(pages): ! for word in page: ! d.setdefault(word, []).append(pagenumber) ! ! Note, the second example is a use case characterized by a get and set ! to the same key. There are similar used cases with a __contains__ ! followed by a get, set, or del to the same key. Part of the ! justification for d.setdefault is combining the two lookups into one. Membership Testing *************** *** 45,49 **** Dynamic Mappings ! Characterized by deletions interspersed with adds and replacments. Performance benefits greatly from the re-use of dummy entries. --- 57,61 ---- Dynamic Mappings ! Characterized by deletions interspersed with adds and replacements. Performance benefits greatly from the re-use of dummy entries. *************** *** 142,145 **** --- 154,160 ---- in cache. + * In use cases with paired accesses to the same key, the second access + is always in cache and gets no benefit from efforts to further improve + cache locality. Optimizing the Search of Small Dictionaries *************** *** 185,189 **** a more sparse environment than before. The preconditions for this strategy arise whenever a dictionary is created from a key or item ! sequence of known length. 3) If the key space is large and the access pattern is known to be random, --- 200,204 ---- a more sparse environment than before. The preconditions for this strategy arise whenever a dictionary is created from a key or item ! sequence and the number of unique keys is known. 3) If the key space is large and the access pattern is known to be random, *************** *** 219,220 **** --- 234,245 ---- so that dictionary iteration can proceed in len(d) steps instead of (mp->mask + 1) steps. + + + Caching Lookups + --------------- + The idea is to exploit key access patterns by anticipating future lookups + based of previous lookups. + + The simplest incarnation is to save the most recently accessed entry. + This gives optimal performance for use cases where every get is followed + by a set or del to the same key. From greg@electricrain.com Wed May 28 17:18:05 2003 From: greg@electricrain.com (Gregory P. Smith) Date: Wed, 28 May 2003 09:18:05 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.9,1.10 In-Reply-To: <1054128488.15437.6.camel@anthem> References: <1054128488.15437.6.camel@anthem> Message-ID: <20030528161805.GJ32748@zot.electricrain.com> On Wed, May 28, 2003 at 09:28:08AM -0400, Barry Warsaw wrote: > On Wed, 2003-05-28 at 03:56, greg@users.sourceforge.net wrote: > > > ! NOTE: BerkeleyDB has its own license which may apply to you if you > > ! intend to distribute your application outside of your organization in > > ! a non-opensource manner. Visit Sleepycat Software's website to read > > ! the full license. > > I'm a little concerned about the wording of this. Every time I've asked > Sleepycat about it, they've told me that as long as you use BerkeleyDB > via the Python bindings, and because Python is OSS, there are no > restrictions on its use. You can't separate BerkeleyDB from Python and > use it in a commercial product, but then why would you want to? But it > is fine to use BerkeleyDB-in-Python in a non-open source product without > requiring a separate license. > > That is at least my understanding of the arrangement. But the wording > above would lead me to beleive otherwise. > > -Barry Really? I'll remove that note from the documentation since that's what sleepycat has told you. I wrote that note based solely on my own reading of the BerkeleyDB license without asking sleepycat for any clarifications. If they choose to consider python the OSS application that BerkeleyDB is being distributed as part of the interpretation makes sense. (If they sold/supported/maintained the pybsddb wrapper themselves they could choose otherwise) From greg@users.sourceforge.net Wed May 28 17:20:06 2003 From: greg@users.sourceforge.net (greg@users.sourceforge.net) Date: Wed, 28 May 2003 09:20:06 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27471 Modified Files: libbsddb.tex Log Message: Remove the note about the BerkeleyDB license. Barry indicates that sleepycat has told him that since python is OSS and berkeleydb is being distributed with python for the bsddb library all is fine. Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** libbsddb.tex 28 May 2003 07:56:45 -0000 1.10 --- libbsddb.tex 28 May 2003 16:20:03 -0000 1.11 *************** *** 19,27 **** thru 4.1 at the time of this writing). - NOTE: BerkeleyDB has its own license which may apply to you if you - intend to distribute your application outside of your organization in - a non-opensource manner. Visit Sleepycat Software's website to read - the full license. - \begin{seealso} \seeurl{http://pybsddb.sourceforge.net/}{Website with documentation --- 19,22 ---- *************** *** 29,34 **** sleepycat object oriented interface provided in Berkeley DB 3 and 4.} \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the ! modern Berkeley DB library. They offer support and sell licenses for ! proprietary software using BerkeleyDB.} \end{seealso} --- 24,28 ---- sleepycat object oriented interface provided in Berkeley DB 3 and 4.} \seeurl{http://www.sleepycat.com/}{Sleepycat Software produces the ! modern Berkeley DB library.} \end{seealso} From barry@python.org Wed May 28 18:21:26 2003 From: barry@python.org (Barry Warsaw) Date: 28 May 2003 13:21:26 -0400 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex,1.9,1.10 In-Reply-To: <20030528161805.GJ32748@zot.electricrain.com> References: <1054128488.15437.6.camel@anthem> <20030528161805.GJ32748@zot.electricrain.com> Message-ID: <1054142486.10580.3.camel@barry> On Wed, 2003-05-28 at 12:18, Gregory P. Smith wrote: > If they choose to consider python the OSS application that BerkeleyDB is > being distributed as part of the interpretation makes sense. Not for Python specifically, but they told me that for open source programming languages, that's exactly the determination they've made. -Barry From jackjansen@users.sourceforge.net Wed May 28 19:56:33 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 May 2003 11:56:33 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.21,1.22 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv24804 Modified Files: pimp.py Log Message: - Added a scheme whereby pimp can update itself, by importing a module pimp_update if it exists. Upped the version number to indicate this. Fixes #731626. - Added -V (print version) and -u (specify database URL) options when run as a command line tool. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** pimp.py 6 May 2003 13:07:32 -0000 1.21 --- pimp.py 28 May 2003 18:56:30 -0000 1.22 *************** *** 27,31 **** import shutil ! __all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main"] _scriptExc_NotInstalled = "pimp._scriptExc_NotInstalled" --- 27,32 ---- import shutil ! __all__ = ["PimpPreferences", "PimpDatabase", "PimpPackage", "main", ! "PIMP_VERSION", "main"] _scriptExc_NotInstalled = "pimp._scriptExc_NotInstalled" *************** *** 35,39 **** NO_EXECUTE=0 ! PIMP_VERSION="0.1" # Flavors: --- 36,40 ---- NO_EXECUTE=0 ! PIMP_VERSION="0.2" # Flavors: *************** *** 253,260 **** dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc ! if not included: ! self._version = dict.get('Version', '0.1') ! if self._version != PIMP_VERSION: ! sys.stderr.write("Warning: database version %s does not match %s\n" % (self._version, PIMP_VERSION)) self._maintainer = dict.get('Maintainer', '') --- 254,268 ---- dict = plistlib.Plist.fromFile(fp) # Test here for Pimp version, etc ! if included: ! version = dict.get('Version') ! if version and version > self._version: ! sys.stderr.write("Warning: included database %s is for pimp version %s\n" % ! (url, version)) ! else: ! self._version = dict.get('Version') ! if not self._version: ! sys.stderr.write("Warning: database has no Version information\n") ! elif self._version > PIMP_VERSION: ! sys.stderr.write("Warning: database version %s newer than pimp version %s\n" % (self._version, PIMP_VERSION)) self._maintainer = dict.get('Maintainer', '') *************** *** 886,898 **** print " pimp [options] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" ! print " -D dir Set destination directory (default: site-packages)" sys.exit(1) try: ! opts, args = getopt.getopt(sys.argv[1:], "slifvdD:") ! except getopt.Error: _help() if not opts and not args: --- 894,910 ---- print " pimp [options] -i package ... Install packages" print " pimp -d Dump database to stdout" + print " pimp -V Print version number" print "Options:" print " -v Verbose" print " -f Force installation" ! print " -D dir Set destination directory" ! print " (default: %s)" % DEFAULT_INSTALLDIR ! print " -u url URL for database" ! print " (default: %s)" % DEFAULT_PIMPDATABASE sys.exit(1) try: ! opts, args = getopt.getopt(sys.argv[1:], "slifvdD:Vu:") ! except getopt.GetoptError: _help() if not opts and not args: *************** *** 915,918 **** --- 927,934 ---- _help() mode = 'dump' + if o == '-V': + if mode: + _help() + mode = 'version' if o == '-i': mode = 'install' *************** *** 923,930 **** if o == '-D': prefargs['installDir'] = a if not mode: _help() ! _run(mode, verbose, force, args, prefargs) ! if __name__ == '__main__': main() --- 939,968 ---- if o == '-D': prefargs['installDir'] = a + if o == '-u': + prefargs['pimpDatabase'] = a if not mode: _help() ! if mode == 'version': ! print 'Pimp version %s; module name is %s' % (PIMP_VERSION, __name__) ! else: ! _run(mode, verbose, force, args, prefargs) ! ! # Finally, try to update ourselves to a newer version. ! # If the end-user updates pimp through pimp the new version ! # will be called pimp_update and live in site-packages ! # or somewhere similar ! if __name__ != 'pimp_update': ! try: ! import pimp_update ! except ImportError: ! pass ! else: ! if pimp_update.PIMP_VERSION <= PIMP_VERSION: ! import warnings ! warnings.warn("pimp_update is version %s, not newer than pimp version %s" % ! (pimp_update.PIMP_VERSION, PIMP_VERSION)) ! else: ! from pimp_update import * ! if __name__ == '__main__': main() From jackjansen@users.sourceforge.net Wed May 28 19:57:54 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed, 28 May 2003 11:57:54 -0700 Subject: [Python-checkins] python/dist/src/Mac/OSX/Dist example-pimp-database.plist,NONE,1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/OSX/Dist In directory sc8-pr-cvs1:/tmp/cvs-serv25800 Added Files: example-pimp-database.plist Log Message: Example database for Package Manager. --- NEW FILE: example-pimp-database.plist --- Description Enter database description Maintainer Enter your email address Packages Description Enter package description Download-URL Enter URL for archive download, delete for pseudo-pkgs Flavor Enter binary or source Home-page Enter URL of human-readable webpage Install-command Enter shell commands to run for installation Install-test Enter Python code to test for already installed MD5Sum Enter checksum of package archive Name Enter name of package Post-install-command Enter shell command to run after install Pre-install-command Enter shell command to run before install Prerequisites Enter human-readable recipy for pseudo-dependencies Flavor Enter optional flavor for real dependency Name Enter name for real dependency Version Version Enter version string for package Version 0.1 From yf5vs0u6u@yahoo.com Thu May 29 00:31:49 2003 From: yf5vs0u6u@yahoo.com (Nelson Nicholas) Date: Wed, 28 May 03 23:31:49 GMT Subject: [Python-checkins] Rates? h h Message-ID: This is a multi-part message in MIME format. --57A_ECAF9F3DF_A2DDB. Content-Type: text/plain Content-Transfer-Encoding: quoted-printable FREE MORTGAGE QUOTE & BEST POSSIBLE RATES ! ------------------------------------------- There are over 89,000 mortgage companies in the U.S., which means the process of finding the best loan for you can be a very difficult one.Let us do the hard work for you! Simply spend 1 minute to fill out the short form, then press the submit button, and we take it from there... finding the best deals possible, and getting the lenders to contact you! It's short, it's simple, it's free, and it will save you thousands of dollars! * Home Improvement, Refinance, Second Mortgage, Home Equity Loans, and More! Even with less than perfect or NO credit! You will qualify for the best possible rate. Do NOT miss the chance to refinance at record low rates, so act now... http://mymortagenow.com/3/index.asp?RefID=3D383102 remove me http://www.mortage-area.com/Auto/index.htm kl enmp zcgsm kgdhsmdzigara omznk l --57A_ECAF9F3DF_A2DDB.-- From bwarsaw@users.sourceforge.net Thu May 29 00:03:32 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 28 May 2003 16:03:32 -0700 Subject: [Python-checkins] python/dist/src/Lib weakref.py,1.15.8.1,1.15.8.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30946/Lib Modified Files: Tag: release22-maint weakref.py Log Message: The backport gets Fred's seal of approval: SF 742860: WeakKeyDictionary __delitem__ uses iterkeys Someone review this, please! Final releases are getting close, Fred (the weakref guy) won't be around until Tuesday, and the pre-patch code can indeed raise spurious RuntimeErrors in the presence of threads or mutating comparison functions. See the bug report for my confusions: I can't see any reason for why __delitem__ iterated over the keys. The new one-liner implementation is much faster, can't raise RuntimeError, and should be better-behaved in all respects wrt threads. New tests test_weak_keyed_bad_delitem and test_weak_keyed_cascading_deletes fail before this patch. Backported the tests and the patch. Index: weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/weakref.py,v retrieving revision 1.15.8.1 retrieving revision 1.15.8.2 diff -C2 -d -r1.15.8.1 -r1.15.8.2 *** weakref.py 23 Aug 2002 16:29:01 -0000 1.15.8.1 --- weakref.py 28 May 2003 23:03:29 -0000 1.15.8.2 *************** *** 153,161 **** def __delitem__(self, key): ! for ref in self.data.iterkeys(): ! o = ref() ! if o == key: ! del self.data[ref] ! return def __getitem__(self, key): --- 153,157 ---- def __delitem__(self, key): ! del self.data[ref(key)] def __getitem__(self, key): From bwarsaw@users.sourceforge.net Thu May 29 00:03:32 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Wed, 28 May 2003 16:03:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py,1.17.4.1,1.17.4.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv30946/Lib/test Modified Files: Tag: release22-maint test_weakref.py Log Message: The backport gets Fred's seal of approval: SF 742860: WeakKeyDictionary __delitem__ uses iterkeys Someone review this, please! Final releases are getting close, Fred (the weakref guy) won't be around until Tuesday, and the pre-patch code can indeed raise spurious RuntimeErrors in the presence of threads or mutating comparison functions. See the bug report for my confusions: I can't see any reason for why __delitem__ iterated over the keys. The new one-liner implementation is much faster, can't raise RuntimeError, and should be better-behaved in all respects wrt threads. New tests test_weak_keyed_bad_delitem and test_weak_keyed_cascading_deletes fail before this patch. Backported the tests and the patch. Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.17.4.1 retrieving revision 1.17.4.2 diff -C2 -d -r1.17.4.1 -r1.17.4.2 *** test_weakref.py 23 Aug 2002 16:29:27 -0000 1.17.4.1 --- test_weakref.py 28 May 2003 23:03:30 -0000 1.17.4.2 *************** *** 503,506 **** --- 503,564 ---- self.assert_(d.items() == [('something else', o2)]) + def test_weak_keyed_bad_delitem(self): + d = weakref.WeakKeyDictionary() + o = Object('1') + # An attempt to delete an object that isn't there should raise + # KeyError. It didn't before 2.3. + self.assertRaises(KeyError, d.__delitem__, o) + self.assertRaises(KeyError, d.__getitem__, o) + + # If a key isn't of a weakly referencable type, __getitem__ and + # __setitem__ raise TypeError. __delitem__ should too. + self.assertRaises(TypeError, d.__delitem__, 13) + self.assertRaises(TypeError, d.__getitem__, 13) + self.assertRaises(TypeError, d.__setitem__, 13, 13) + + def test_weak_keyed_cascading_deletes(self): + # SF bug 742860. For some reason, before 2.3 __delitem__ iterated + # over the keys via self.data.iterkeys(). If things vanished from + # the dict during this (or got added), that caused a RuntimeError. + + d = weakref.WeakKeyDictionary() + mutate = False + + class C(object): + def __init__(self, i): + self.value = i + def __hash__(self): + return hash(self.value) + def __eq__(self, other): + if mutate: + # Side effect that mutates the dict, by removing the + # last strong reference to a key. + del objs[-1] + return self.value == other.value + + objs = [C(i) for i in range(4)] + for o in objs: + d[o] = o.value + del o # now the only strong references to keys are in objs + # Find the order in which iterkeys sees the keys. + objs = d.keys() + # Reverse it, so that the iteration implementation of __delitem__ + # has to keep looping to find the first object we delete. + objs.reverse() + + # Turn on mutation in C.__eq__. The first time thru the loop, + # under the iterkeys() business the first comparison will delete + # the last item iterkeys() would see, and that causes a + # RuntimeError: dictionary changed size during iteration + # when the iterkeys() loop goes around to try comparing the next + # key. After this was fixed, it just deletes the last object *our* + # "for o in obj" loop would have gotten to. + mutate = True + count = 0 + for o in objs: + count += 1 + del d[o] + self.assertEqual(len(d), 0) + self.assertEqual(count, 2) def test_main(): From nnorwitz@users.sourceforge.net Thu May 29 01:17:06 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 28 May 2003 17:17:06 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.159,1.160 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22503/Modules Modified Files: _tkinter.c Log Message: Fix SF #745055, Memory leak in _tkinter.c/Tkapp_SplitList() Also fix a memory leak in Tkapp_Split. This needs to be backported. I'll leave it up to Barry whether this is for 2.2.3 or 2.2.4. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** _tkinter.c 19 May 2003 19:57:42 -0000 1.159 --- _tkinter.c 29 May 2003 00:17:03 -0000 1.160 *************** *** 1885,1893 **** return NULL; ! if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR) return Tkinter_Error(self); if (!(v = PyTuple_New(argc))) ! return NULL; for (i = 0; i < argc; i++) { --- 1885,1896 ---- return NULL; ! if (Tcl_SplitList(Tkapp_Interp(self), list, ! &argc, &argv) == TCL_ERROR) { ! PyMem_Free(list); return Tkinter_Error(self); + } if (!(v = PyTuple_New(argc))) ! goto finally; for (i = 0; i < argc; i++) { *************** *** 1902,1905 **** --- 1905,1909 ---- finally: ckfree(FREECAST argv); + PyMem_Free(list); return v; } *************** *** 1908,1911 **** --- 1912,1916 ---- Tkapp_Split(PyObject *self, PyObject *args) { + PyObject *v; char *list; *************** *** 1919,1923 **** if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list)) return NULL; ! return Split(list); } --- 1924,1930 ---- if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list)) return NULL; ! v = Split(list); ! PyMem_Free(list); ! return v; } From gward@users.sourceforge.net Thu May 29 01:23:19 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 28 May 2003 17:23:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_ossaudiodev.py,1.4,1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv25309 Modified Files: test_ossaudiodev.py Log Message: Rename 'a' (the audio device) to 'dsp' everywhere. Index: test_ossaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ossaudiodev.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_ossaudiodev.py 14 Feb 2003 19:29:22 -0000 1.4 --- test_ossaudiodev.py 29 May 2003 00:23:17 -0000 1.5 *************** *** 33,37 **** def play_sound_file(data, rate, ssize, nchannels): try: ! a = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): --- 33,37 ---- def play_sound_file(data, rate, ssize, nchannels): try: ! dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): *************** *** 46,90 **** # at least check that these methods can be invoked ! a.bufsize() ! a.obufcount() ! a.obuffree() ! a.getptr() ! a.fileno() # set parameters based on .au file headers ! a.setparameters(rate, 16, nchannels, fmt) ! a.write(data) ! a.flush() ! a.close() def test_errors(): ! a = ossaudiodev.open("w") ! size = 8 fmt = ossaudiodev.AFMT_U8 rate = 8000 nchannels = 1 try: ! a.setparameters(-1, size, nchannels, fmt) ! except ValueError, msg: print msg try: ! a.setparameters(rate, -2, nchannels, fmt) ! except ValueError, msg: print msg try: ! a.setparameters(rate, size, 3, fmt) ! except ValueError, msg: print msg try: ! a.setparameters(rate, size, nchannels, 177) ! except ValueError, msg: print msg try: ! a.setparameters(rate, size, nchannels, ossaudiodev.AFMT_U16_LE) ! except ValueError, msg: print msg try: ! a.setparameters(rate, 16, nchannels, fmt) ! except ValueError, msg: print msg --- 46,89 ---- # at least check that these methods can be invoked ! dsp.bufsize() ! dsp.obufcount() ! dsp.obuffree() ! dsp.getptr() ! dsp.fileno() # set parameters based on .au file headers ! dsp.setparameters(fmt, nchannels, rate) ! dsp.write(data) ! dsp.flush() ! dsp.close() def test_errors(): ! dsp = ossaudiodev.open("w") fmt = ossaudiodev.AFMT_U8 rate = 8000 nchannels = 1 try: ! dsp.setparameters(fmt, nchannels, -1) ! except ossaudiodev.error, msg: print msg try: ! dsp.setparameters(fmt, nchannels, rate) ! except ossaudiodev.error, msg: print msg try: ! dsp.setparameters(fmt, 3, rate) ! except ossaudiodev.error, msg: print msg try: ! dsp.setparameters(177, nchannels, rate) ! except ossaudiodev.error, msg: print msg try: ! dsp.setparameters(ossaudiodev.AFMT_U16_LE, nchannels, rate) ! except ossaudiodev.error, msg: print msg try: ! dsp.setparameters(rate, nchannels, fmt) ! except ossaudiodev.error, msg: print msg From gward@users.sourceforge.net Thu May 29 02:27:42 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 28 May 2003 18:27:42 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_ossaudiodev.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv11957/Lib/test Modified Files: test_ossaudiodev.py Log Message: Renamed test_errors() to test_setparameters() and completely rewrote it to test the new setparameters() interface. Modified play_sound_file() to print the elapsed time taken to play the test sample (to the nearest 0.1 sec). Index: test_ossaudiodev.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_ossaudiodev.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_ossaudiodev.py 29 May 2003 00:23:17 -0000 1.5 --- test_ossaudiodev.py 29 May 2003 01:27:39 -0000 1.6 *************** *** 54,95 **** # set parameters based on .au file headers dsp.setparameters(fmt, nchannels, rate) dsp.write(data) - dsp.flush() dsp.close() ! def test_errors(): dsp = ossaudiodev.open("w") ! fmt = ossaudiodev.AFMT_U8 ! rate = 8000 ! nchannels = 1 ! try: ! dsp.setparameters(fmt, nchannels, -1) ! except ossaudiodev.error, msg: ! print msg ! try: ! dsp.setparameters(fmt, nchannels, rate) ! except ossaudiodev.error, msg: ! print msg ! try: ! dsp.setparameters(fmt, 3, rate) ! except ossaudiodev.error, msg: ! print msg ! try: ! dsp.setparameters(177, nchannels, rate) ! except ossaudiodev.error, msg: ! print msg ! try: ! dsp.setparameters(ossaudiodev.AFMT_U16_LE, nchannels, rate) ! except ossaudiodev.error, msg: ! print msg ! try: ! dsp.setparameters(rate, nchannels, fmt) ! except ossaudiodev.error, msg: ! print msg def test(): (data, rate, ssize, nchannels) = read_sound_file(findfile('audiotest.au')) play_sound_file(data, rate, ssize, nchannels) ! test_errors() test() --- 54,119 ---- # set parameters based on .au file headers dsp.setparameters(fmt, nchannels, rate) + t1 = time.time() + print "playing test sound file..." dsp.write(data) dsp.close() + t2 = time.time() + print "elapsed time: %.1f sec" % (t2-t1) ! def test_setparameters(): dsp = ossaudiodev.open("w") ! ! # Two configurations for testing: ! # config1 (8-bit, mono, 8 kHz) should work on even the most ! # ancient and crufty sound card, but maybe not on special- ! # purpose high-end hardware ! # config2 (16-bit, stereo, 44.1kHz) should work on all but the ! # most ancient and crufty hardware ! config1 = (ossaudiodev.AFMT_U8, 1, 8000) ! config2 = (ossaudiodev.AFMT_S16_NE, 2, 44100) ! ! for config in [config1, config2]: ! (fmt, channels, rate) = config ! if (dsp.setfmt(fmt) == fmt and ! dsp.channels(channels) == channels and ! dsp.speed(rate) == rate): ! break ! else: ! raise RuntimeError("unable to set audio sampling parameters: " ! "you must have really weird audio hardware") ! ! # setparameters() should be able to set this configuration in ! # either strict or non-strict mode. ! result = dsp.setparameters(fmt, channels, rate, False) ! assert result == (fmt, channels, rate), \ ! "setparameters%r: returned %r" % (config + result) ! result = dsp.setparameters(fmt, channels, rate, True) ! assert result == (fmt, channels, rate), \ ! "setparameters%r: returned %r" % (config + result) ! ! # Now try some configurations that are presumably bogus: eg. 300 ! # channels currently exceeds even Hollywood's ambitions, and ! # negative sampling rate is utter nonsense. setparameters() should ! # accept these in non-strict mode, returning something other than ! # was requested, but should barf in strict mode. ! for config in [(fmt, 300, rate), # ridiculous nchannels ! (fmt, -5, rate), # impossible nchannels ! (fmt, channels, -50), # impossible rate ! ]: ! (fmt, channels, rate) = config ! result = dsp.setparameters(fmt, channels, rate, False) ! assert result != config, \ ! "setparameters: unexpectedly got requested configuration" ! ! try: ! result = dsp.setparameters(fmt, channels, rate, True) ! raise AssertionError("setparameters: expected OSSAudioError") ! except ossaudiodev.OSSAudioError, err: ! print "setparameters: got OSSAudioError as expected" def test(): (data, rate, ssize, nchannels) = read_sound_file(findfile('audiotest.au')) play_sound_file(data, rate, ssize, nchannels) ! test_setparameters() test() From gward@users.sourceforge.net Thu May 29 02:29:30 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 28 May 2003 18:29:30 -0700 Subject: [Python-checkins] python/dist/src/Lib/test/output test_ossaudiodev,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv12849 Modified Files: test_ossaudiodev Log Message: Test script changed. Index: test_ossaudiodev =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_ossaudiodev,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_ossaudiodev 8 Jan 2003 01:23:01 -0000 1.1 --- test_ossaudiodev 29 May 2003 01:29:28 -0000 1.2 *************** *** 1,7 **** test_ossaudiodev ! expected rate >= 0, not -1 ! expected sample size >= 0, not -2 ! nchannels must be 1 or 2, not 3 ! unknown audio encoding: 177 ! for linear unsigned 16-bit little-endian audio, expected sample size 16, not 8 ! for linear unsigned 8-bit audio, expected sample size 8, not 16 --- 1,6 ---- test_ossaudiodev ! playing test sound file... ! elapsed time: 2.9 sec ! setparameters: got OSSAudioError as expected ! setparameters: got OSSAudioError as expected ! setparameters: got OSSAudioError as expected From gward@users.sourceforge.net Thu May 29 02:39:35 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 28 May 2003 18:39:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libossaudiodev.tex,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15526/lib Modified Files: libossaudiodev.tex Log Message: Rewrite the description of setparameters() so it actually reflects the code (which has also been recently overhauled, so that it can be documented without embarassment). 'error' has been renamed to 'OSSAudioError'. Minor wordsmithing. Index: libossaudiodev.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libossaudiodev.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** libossaudiodev.tex 26 May 2003 01:51:33 -0000 1.9 --- libossaudiodev.tex 29 May 2003 01:39:32 -0000 1.10 *************** *** 50,54 **** \module{ossaudiodev} defines the following variables and functions: ! \begin{excdesc}{error} This exception is raised on certain errors. The argument is a string describing what went wrong. --- 50,54 ---- \module{ossaudiodev} defines the following variables and functions: ! \begin{excdesc}{OSSAudioError} This exception is raised on certain errors. The argument is a string describing what went wrong. *************** *** 57,61 **** \cfunction{open()}, \cfunction{write()}, or \cfunction{ioctl()}, it raises \exception{IOError}. Errors detected directly by ! \module{ossaudiodev} result in \exception{ossaudiodev.error}.) \end{excdesc} --- 57,64 ---- \cfunction{open()}, \cfunction{write()}, or \cfunction{ioctl()}, it raises \exception{IOError}. Errors detected directly by ! \module{ossaudiodev} result in \exception{OSSAudioError}.) ! ! (For backwards compatibility, the exception class is also available as ! \code{ossaudiodev.error}.) \end{excdesc} *************** *** 202,207 **** \end{methoddesc} ! \begin{methoddesc}[audio device]{channels}{num_channels} ! Set the number of output channels to \var{num_channels}. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. --- 205,210 ---- \end{methoddesc} ! \begin{methoddesc}[audio device]{channels}{nchannels} ! Set the number of output channels to \var{nchannels}. A value of 1 indicates monophonic sound, 2 stereophonic. Some devices may have more than 2 channels, and some high-end devices may not support mono. *************** *** 242,255 **** \end{methoddesc} ! Convenience methods ! \begin{methoddesc}[audio device]{setparameters}{samplerate,num_channels,format,emulate} ! Initialise the sound device in one method. \var{samplerate}, ! \var{channels} and \var{format} should be as specified in the ! \method{speed()}, \method{channels()} and \method{setfmt()} ! methods. If \var{emulate} is true, attempt to find the closest matching ! format instead, otherwise raise ValueError if the device does not ! support the format. The default is to raise ValueError on unsupported ! formats. \end{methoddesc} --- 245,275 ---- \end{methoddesc} ! The following convenience methods combine several ioctls, or one ioctl ! and some simple calculations. ! \begin{methoddesc}[audio device]{setparameters} ! {format, nchannels, samplerate \optional{, strict=False}} ! ! Set the key audio sampling parameters---sample format, number of ! channels, and sampling rate---in one method call. \var{format}, ! \var{nchannels}, and \var{samplerate} should be as specified in the ! \method{setfmt()}, \method{channels()}, and \method{speed()} ! methods. If \var{strict} is true, \method{setparameters()} checks to ! see if each parameter was actually set to the requested value, and ! raises \exception{OSSAudioError} if not. Returns a tuple (\var{format}, ! \var{nchannels}, \var{samplerate}) indicating the parameter values that ! were actually set by the device driver (i.e., the same as the return ! valus of \method{setfmt()}, \method{channels()}, and \method{speed()}). ! ! For example, ! \begin{verbatim} ! (fmt, channels, rate) = dsp.setparameters(fmt, channels, rate) ! \end{verbatim} ! is equivalent to ! \begin{verbatim} ! fmt = dsp.setfmt(fmt) ! channels = dsp.channels(channels) ! rate = dsp.rate(channels) ! \end{verbatim} \end{methoddesc} From gward@users.sourceforge.net Thu May 29 02:41:54 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Wed, 28 May 2003 18:41:54 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv16486/Doc/api Modified Files: exceptions.tex Log Message: Typo fix. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** exceptions.tex 6 Dec 2002 22:42:13 -0000 1.13 --- exceptions.tex 29 May 2003 01:41:51 -0000 1.14 *************** *** 130,134 **** \begin{cfuncdesc}{PyObject*}{PyErr_Format}{PyObject *exception, const char *format, \moreargs} ! This function sets the error indicator and returns \NULL.. \var{exception} should be a Python exception (string or class, not an instance). \var{format} should be a string, containing format --- 130,134 ---- \begin{cfuncdesc}{PyObject*}{PyErr_Format}{PyObject *exception, const char *format, \moreargs} ! This function sets the error indicator and returns \NULL. \var{exception} should be a Python exception (string or class, not an instance). \var{format} should be a string, containing format From nnorwitz@users.sourceforge.net Thu May 29 03:10:33 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 28 May 2003 19:10:33 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libinspect.tex,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv24802/Doc/lib Modified Files: libinspect.tex Log Message: isdatadescriptor() was added recently. Index: libinspect.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libinspect.tex,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** libinspect.tex 3 May 2003 09:09:01 -0000 1.12 --- libinspect.tex 29 May 2003 02:10:31 -0000 1.13 *************** *** 185,188 **** --- 185,189 ---- (properties, getsets, and members have both of these attributes), but this is not guaranteed. + \versionadded{2.3} \end{funcdesc} From nnorwitz@users.sourceforge.net Thu May 29 03:17:24 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 28 May 2003 19:17:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/api exceptions.tex,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv26664/api Modified Files: exceptions.tex Log Message: SF bug #719367, string exceptions are deprecated Remove references to string based exceptions in the doc. Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** exceptions.tex 29 May 2003 01:41:51 -0000 1.14 --- exceptions.tex 29 May 2003 02:17:22 -0000 1.15 *************** *** 103,107 **** \NULL, the error indicator is cleared. Do not pass a \NULL{} type and non-\NULL{} value or traceback. The exception type should be a ! string or class. Do not pass an invalid exception type or value. (Violating these rules will cause subtle problems later.) This call takes away a reference to each object: you must own a reference to --- 103,107 ---- \NULL, the error indicator is cleared. Do not pass a \NULL{} type and non-\NULL{} value or traceback. The exception type should be a ! class. Do not pass an invalid exception type or value. (Violating these rules will cause subtle problems later.) This call takes away a reference to each object: you must own a reference to *************** *** 131,135 **** const char *format, \moreargs} This function sets the error indicator and returns \NULL. ! \var{exception} should be a Python exception (string or class, not an instance). \var{format} should be a string, containing format codes, similar to \cfunction{printf()}. The \code{width.precision} --- 131,135 ---- const char *format, \moreargs} This function sets the error indicator and returns \NULL. ! \var{exception} should be a Python exception (class, not an instance). \var{format} should be a string, containing format codes, similar to \cfunction{printf()}. The \code{width.precision} From nnorwitz@users.sourceforge.net Thu May 29 03:17:24 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 28 May 2003 19:17:24 -0700 Subject: [Python-checkins] python/dist/src/Doc/doc doc.tex,1.71,1.72 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/doc In directory sc8-pr-cvs1:/tmp/cvs-serv26664/doc Modified Files: doc.tex Log Message: SF bug #719367, string exceptions are deprecated Remove references to string based exceptions in the doc. Index: doc.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/doc/doc.tex,v retrieving revision 1.71 retrieving revision 1.72 diff -C2 -d -r1.71 -r1.72 *** doc.tex 10 Oct 2002 18:24:50 -0000 1.71 --- doc.tex 29 May 2003 02:17:22 -0000 1.72 *************** *** 609,614 **** \begin{envdesc}{excdesc}{\p{name}} ! Describe an exception. This may be either a string exception or ! a class exception. In the case of class exceptions, the constructor parameters are not described; use \env{excclassdesc} to describe an exception class and its constructor. --- 609,613 ---- \begin{envdesc}{excdesc}{\p{name}} ! Describe an exception. In the case of class exceptions, the constructor parameters are not described; use \env{excclassdesc} to describe an exception class and its constructor. *************** *** 1499,1503 **** \begin{macrodesc}{exindex}{\p{exception}} Add a reference to an exception named \var{exception}. The ! exception may be either string- or class-based. \end{macrodesc} --- 1498,1502 ---- \begin{macrodesc}{exindex}{\p{exception}} Add a reference to an exception named \var{exception}. The ! exception should be class-based. \end{macrodesc} From nnorwitz@users.sourceforge.net Thu May 29 03:17:25 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 28 May 2003 19:17:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libexcs.tex,1.51,1.52 libsys.tex,1.63,1.64 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26664/lib Modified Files: libexcs.tex libsys.tex Log Message: SF bug #719367, string exceptions are deprecated Remove references to string based exceptions in the doc. Index: libexcs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libexcs.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** libexcs.tex 13 May 2003 14:13:58 -0000 1.51 --- libexcs.tex 29 May 2003 02:17:22 -0000 1.52 *************** *** 5,12 **** ! Exceptions can be class objects or string objects. Though most ! exceptions have been string objects in past versions of Python, in ! Python 1.5 and newer versions, all standard exceptions have been ! converted to class objects, and users are encouraged to do the same. The exceptions are defined in the module \module{exceptions}. This module never needs to be imported explicitly: the exceptions are --- 5,9 ---- ! Exceptions should be class objects. The exceptions are defined in the module \module{exceptions}. This module never needs to be imported explicitly: the exceptions are *************** *** 14,17 **** --- 11,21 ---- module. + \begin{notice} + In past versions of Python string exceptions were supported. In + Python 1.5 and newer versions, all standard exceptions have been + converted to class objects and users are encouraged to do the same. + String exceptions will raise a \code{PendingDeprecationWarning}. + In future versions, support for string exceptions will be removed. + Two distinct string objects with the same value are considered different exceptions. This is done to force programmers to use exception names *************** *** 20,23 **** --- 24,28 ---- not a requirement for user-defined exceptions or exceptions defined by library modules. + \end{notice} For class exceptions, in a \keyword{try}\stindex{try} statement with Index: libsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsys.tex,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** libsys.tex 5 Mar 2003 15:13:38 -0000 1.63 --- libsys.tex 29 May 2003 02:17:23 -0000 1.64 *************** *** 92,96 **** values returned are \code{(\var{type}, \var{value}, \var{traceback})}. Their meaning is: \var{type} gets the exception ! type of the exception being handled (a string or class object); \var{value} gets the exception parameter (its \dfn{associated value} or the second argument to \keyword{raise}, which is always a class --- 92,96 ---- values returned are \code{(\var{type}, \var{value}, \var{traceback})}. Their meaning is: \var{type} gets the exception ! type of the exception being handled (a class object); \var{value} gets the exception parameter (its \dfn{associated value} or the second argument to \keyword{raise}, which is always a class From nnorwitz@users.sourceforge.net Thu May 29 03:17:25 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed, 28 May 2003 19:17:25 -0700 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.35,1.36 ref6.tex,1.64,1.65 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv26664/ref Modified Files: ref4.tex ref6.tex Log Message: SF bug #719367, string exceptions are deprecated Remove references to string based exceptions in the doc. Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** ref4.tex 18 Oct 2002 15:03:42 -0000 1.35 --- ref4.tex 29 May 2003 02:17:23 -0000 1.36 *************** *** 184,193 **** exception)}{\ttindex{SystemExit}}. ! Exceptions are identified by string objects or class instances. ! Selection of a matching except clause is based on object identity ! (i.e., two different string objects with the same value represent ! different exceptions!) For string exceptions, the \keyword{except} ! clause must reference the same string object. For class exceptions, ! the \keyword{except} clause must reference the same class or a base class of it. --- 184,190 ---- exception)}{\ttindex{SystemExit}}. ! Exceptions are identified by class instances. ! Selection of a matching except clause is based on object identity. ! The \keyword{except} clause must reference the same class or a base class of it. Index: ref6.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref6.tex,v retrieving revision 1.64 retrieving revision 1.65 diff -C2 -d -r1.64 -r1.65 *** ref6.tex 21 May 2003 21:43:00 -0000 1.64 --- ref6.tex 29 May 2003 02:17:23 -0000 1.65 *************** *** 522,528 **** If no expressions are present, \keyword{raise} re-raises the last ! expression that was active in the current scope. If no exception has ! been active in the current scope, an exception is raised that ! indicates indicates that this is the error. \index{exception} \indexii{raising}{exception} --- 522,527 ---- If no expressions are present, \keyword{raise} re-raises the last ! expression that was active in the current scope. If no exception is ! active in the current scope, an exception is raised indicating this error. \index{exception} \indexii{raising}{exception} *************** *** 545,551 **** constructor. The instance so created by calling the constructor is used as the exception value. - - If the first object is a string, the string object is the exception - type, and the second object becomes the exception value. If a third object is present and not \code{None}, it must be a --- 544,547 ---- From rhettinger@users.sourceforge.net Thu May 29 08:19:00 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 29 May 2003 00:19:00 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py,1.11,1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv6991 Modified Files: test_itertools.py Log Message: Test ability to handle various type of iterators. Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_itertools.py 16 May 2003 23:16:36 -0000 1.11 --- test_itertools.py 29 May 2003 07:18:57 -0000 1.12 *************** *** 7,11 **** def onearg(x): 'Test function of one argument' ! return x def errfunc(*args): --- 7,11 ---- def onearg(x): 'Test function of one argument' ! return 2*x def errfunc(*args): *************** *** 22,25 **** --- 22,29 ---- return x%2==0 + def isOdd(x): + 'Test predicate' + return x%2==1 + class StopNow: 'Class emulating an empty iterable.' *************** *** 29,32 **** --- 33,37 ---- raise StopIteration + class TestBasicOps(unittest.TestCase): def test_chain(self): *************** *** 81,86 **** --- 86,95 ---- self.assertEqual([tuple(list(pair)) for pair in izip('abc', 'def')], zip('abc', 'def')) + self.assertEqual([pair for pair in izip('abc', 'def')], + zip('abc', 'def')) ids = map(id, izip('abc', 'def')) self.assertEqual(min(ids), max(ids)) + ids = map(id, list(izip('abc', 'def'))) + self.assertEqual(len(dict.fromkeys(ids)), len(ids)) def test_repeat(self): *************** *** 189,194 **** self.assertRaises(StopIteration, f(lambda x:x, StopNow()).next) ! libreftest = """ Doctest for examples in the library reference, libitertools.tex --- 198,377 ---- self.assertRaises(StopIteration, f(lambda x:x, StopNow()).next) + def R(seqn): + 'Regular generator' + for i in seqn: + yield i + + class G: + 'Sequence using __getitem__' + def __init__(self, seqn): + self.seqn = seqn + def __getitem__(self, i): + return self.seqn[i] ! class I: ! 'Sequence using iterator protocol' ! def __init__(self, seqn): ! self.seqn = seqn ! self.i = 0 ! def __iter__(self): ! return self ! def next(self): ! if self.i >= len(self.seqn): raise StopIteration ! v = self.seqn[self.i] ! self.i += 1 ! return v ! ! class Ig: ! 'Sequence using iterator protocol defined with a generator' ! def __init__(self, seqn): ! self.seqn = seqn ! self.i = 0 ! def __iter__(self): ! for val in self.seqn: ! yield val ! ! class X: ! 'Missing __getitem__ and __iter__' ! def __init__(self, seqn): ! self.seqn = seqn ! self.i = 0 ! def next(self): ! if self.i >= len(self.seqn): raise StopIteration ! v = self.seqn[self.i] ! self.i += 1 ! return v ! ! class N: ! 'Iterator missing next()' ! def __init__(self, seqn): ! self.seqn = seqn ! self.i = 0 ! def __iter__(self): ! return self ! ! class E: ! 'Test propagation of exceptions' ! def __init__(self, seqn): ! self.seqn = seqn ! self.i = 0 ! def __iter__(self): ! return self ! def next(self): ! 3/0 ! ! class S: ! 'Test immediate stop' ! def __init__(self, seqn): ! pass ! def __iter__(self): ! return self ! def next(self): ! raise StopIteration ! ! def L(seqn): ! 'Test multiple tiers of iterators' ! return chain(imap(lambda x:x, R(Ig(G(seqn))))) ! ! ! class TestVariousIteratorArgs(unittest.TestCase): ! ! def test_chain(self): ! for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! self.assertEqual(list(chain(g(s))), list(g(s))) ! self.assertEqual(list(chain(g(s), g(s))), list(g(s))+list(g(s))) ! self.assertRaises(TypeError, chain, X(s)) ! self.assertRaises(TypeError, list, chain(N(s))) ! self.assertRaises(ZeroDivisionError, list, chain(E(s))) ! ! def test_cycle(self): ! for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! tgtlen = len(s) * 3 ! expected = list(g(s))*3 ! actual = list(islice(cycle(g(s)), tgtlen)) ! self.assertEqual(actual, expected) ! self.assertRaises(TypeError, cycle, X(s)) ! self.assertRaises(TypeError, list, cycle(N(s))) ! self.assertRaises(ZeroDivisionError, list, cycle(E(s))) ! ! def test_ifilter(self): ! for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! self.assertEqual(list(ifilter(isEven, g(s))), filter(isEven, g(s))) ! self.assertRaises(TypeError, ifilter, isEven, X(s)) ! self.assertRaises(TypeError, list, ifilter(isEven, N(s))) ! self.assertRaises(ZeroDivisionError, list, ifilter(isEven, E(s))) ! ! def test_ifilterfalse(self): ! for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! self.assertEqual(list(ifilterfalse(isEven, g(s))), filter(isOdd, g(s))) ! self.assertRaises(TypeError, ifilterfalse, isEven, X(s)) ! self.assertRaises(TypeError, list, ifilterfalse(isEven, N(s))) ! self.assertRaises(ZeroDivisionError, list, ifilterfalse(isEven, E(s))) ! ! def test_izip(self): ! for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! self.assertEqual(list(izip(g(s))), zip(g(s))) ! self.assertEqual(list(izip(g(s), g(s))), zip(g(s), g(s))) ! self.assertRaises(TypeError, izip, X(s)) ! self.assertRaises(TypeError, list, izip(N(s))) ! self.assertRaises(ZeroDivisionError, list, izip(E(s))) ! ! def test_imap(self): ! for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): ! for g in (G, I, Ig, S, L, R): ! self.assertEqual(list(imap(onearg, g(s))), map(onearg, g(s))) ! self.assertEqual(list(imap(operator.pow, g(s), g(s))), map(operator.pow, g(s), g(s))) ! self.assertRaises(TypeError, imap, onearg, X(s)) ! self.assertRaises(TypeError, list, imap(onearg, N(s))) ! self.assertRaises(ZeroDivisionError, list, imap(onearg, E(s))) ! ! def test_islice(self): ! for s in ("12345", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! self.assertEqual(list(islice(g(s),1,None,2)), list(g(s))[1::2]) ! self.assertRaises(TypeError, islice, X(s), 10) ! self.assertRaises(TypeError, list, islice(N(s), 10)) ! self.assertRaises(ZeroDivisionError, list, islice(E(s), 10)) ! ! def test_starmap(self): ! for s in (range(10), range(0), range(100), (7,11), xrange(20,50,5)): ! for g in (G, I, Ig, S, L, R): ! ss = zip(s, s) ! self.assertEqual(list(starmap(operator.pow, g(ss))), map(operator.pow, g(s), g(s))) ! self.assertRaises(TypeError, starmap, operator.pow, X(ss)) ! self.assertRaises(TypeError, list, starmap(operator.pow, N(ss))) ! self.assertRaises(ZeroDivisionError, list, starmap(operator.pow, E(ss))) ! ! def test_takewhile(self): ! for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! tgt = [] ! for elem in g(s): ! if not isEven(elem): break ! tgt.append(elem) ! self.assertEqual(list(takewhile(isEven, g(s))), tgt) ! self.assertRaises(TypeError, takewhile, isEven, X(s)) ! self.assertRaises(TypeError, list, takewhile(isEven, N(s))) ! self.assertRaises(ZeroDivisionError, list, takewhile(isEven, E(s))) ! ! def test_dropwhile(self): ! for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): ! for g in (G, I, Ig, S, L, R): ! tgt = [] ! for elem in g(s): ! if not tgt and isOdd(elem): continue ! tgt.append(elem) ! self.assertEqual(list(dropwhile(isOdd, g(s))), tgt) ! self.assertRaises(TypeError, dropwhile, isOdd, X(s)) ! self.assertRaises(TypeError, list, dropwhile(isOdd, N(s))) ! self.assertRaises(ZeroDivisionError, list, dropwhile(isOdd, E(s))) ! ! ! libreftest = """ Doctest for examples in the library reference: libitertools.tex *************** *** 308,312 **** def test_main(verbose=None): ! test_support.run_unittest(TestBasicOps) # verify reference counting --- 491,496 ---- def test_main(verbose=None): ! test_classes = (TestBasicOps, TestVariousIteratorArgs) ! test_support.run_unittest(*test_classes) # verify reference counting *************** *** 314,318 **** counts = [None] * 5 for i in xrange(len(counts)): ! test_support.run_unittest(TestBasicOps) counts[i] = sys.gettotalrefcount() print counts --- 498,502 ---- counts = [None] * 5 for i in xrange(len(counts)): ! test_support.run_unittest(*test_classes) counts[i] = sys.gettotalrefcount() print counts From rhettinger@users.sourceforge.net Thu May 29 08:20:32 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu, 29 May 2003 00:20:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_enumerate.py,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7494 Modified Files: test_enumerate.py Log Message: Fix typo so that the test actually calls the tested function. Index: test_enumerate.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_enumerate.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** test_enumerate.py 28 May 2003 14:05:32 -0000 1.5 --- test_enumerate.py 29 May 2003 07:20:29 -0000 1.6 *************** *** 106,110 **** # Tests an implementation detail where tuple is reused # whenever nothing else holds a reference to it ! self.assertEqual(len(Set(map(id, list(self.seq)))), len(self.seq)) self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq))) --- 106,110 ---- # Tests an implementation detail where tuple is reused # whenever nothing else holds a reference to it ! self.assertEqual(len(Set(map(id, list(enumerate(self.seq))))), len(self.seq)) self.assertEqual(len(Set(map(id, enumerate(self.seq)))), min(1,len(self.seq))) From fdrake@users.sourceforge.net Thu May 29 14:46:48 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 29 May 2003 06:46:48 -0700 Subject: [Python-checkins] python/nondist/peps pep-0304.txt,1.11,1.12 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv4666 Modified Files: pep-0304.txt Log Message: Try to repair markup buglet. Index: pep-0304.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0304.txt,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** pep-0304.txt 31 Jan 2003 20:50:46 -0000 1.11 --- pep-0304.txt 29 May 2003 13:46:46 -0000 1.12 *************** *** 46,50 **** of bytecode files is suppressed altogether. ! - If defined and one of the following is true:: * it does not refer to a directory, --- 46,50 ---- of bytecode files is suppressed altogether. ! - If defined and one of the following is true: * it does not refer to a directory, From gvanrossum@users.sourceforge.net Thu May 29 15:21:32 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:21:32 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.30,1.113.4.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv19775 Modified Files: Tag: release22-maint test_descr.py Log Message: Add testcase for SF 742911. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.30 retrieving revision 1.113.4.31 diff -C2 -d -r1.113.4.30 -r1.113.4.31 *** test_descr.py 13 Jan 2003 20:17:13 -0000 1.113.4.30 --- test_descr.py 29 May 2003 14:21:29 -0000 1.113.4.31 *************** *** 3145,3148 **** --- 3145,3171 ---- veris(type(C.__dict__), type(B.__dict__)) + def weakref_segfault(): + # SF 742911 + if verbose: + print "Testing weakref segfault..." + + import weakref + + class Provoker: + def __init__(self, referrent): + self.ref = weakref.ref(referrent) + + def __del__(self): + x = self.ref() + print x + return x + + class Oops(object): + pass + + o = Oops() + o.whatever = Provoker(o) + del o + def test_main(): *************** *** 3210,3213 **** --- 3233,3237 ---- subclass_right_op() dict_type_with_metaclass() + weakref_segfault() if verbose: print "All OK" From gvanrossum@users.sourceforge.net Thu May 29 15:27:01 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:27:01 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.191,1.192 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21678 Modified Files: test_descr.py Log Message: Add testcase for SF 742911. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.191 retrieving revision 1.192 diff -C2 -d -r1.191 -r1.192 *** test_descr.py 16 Apr 2003 20:02:22 -0000 1.191 --- test_descr.py 29 May 2003 14:26:57 -0000 1.192 *************** *** 3872,3877 **** --- 3872,3901 ---- raise TestFailed, "Carlo Verre __delattr__ succeeded!" + def weakref_segfault(): + # SF 742911 + if verbose: + print "Testing weakref segfault..." + + import weakref + + class Provoker: + def __init__(self, referrent): + self.ref = weakref.ref(referrent) + + def __del__(self): + x = self.ref() + print x + return x + + class Oops(object): + pass + + o = Oops() + o.whatever = Provoker(o) + del o + def test_main(): + weakref_segfault() # Must be first, somehow do_this_first() class_docstrings() From gvanrossum@users.sourceforge.net Thu May 29 15:28:25 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:28:25 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.36,2.126.4.37 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv22112 Modified Files: Tag: release22-maint typeobject.c Log Message: Fix for SF 742911. We now clear the weakrefs *before* calling __del__ or emptying __dict__, just as we do for classic classes. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.36 retrieving revision 2.126.4.37 diff -C2 -d -r2.126.4.36 -r2.126.4.37 *** typeobject.c 21 May 2003 20:43:10 -0000 2.126.4.36 --- typeobject.c 29 May 2003 14:28:22 -0000 2.126.4.37 *************** *** 430,437 **** destructor basedealloc; ! /* This exists so we can DECREF self->ob_type */ ! ! if (call_finalizer(self) < 0) ! return; /* Find the nearest base with a different tp_dealloc --- 430,434 ---- destructor basedealloc; ! /* This function exists so we can DECREF self->ob_type */ /* Find the nearest base with a different tp_dealloc *************** *** 446,449 **** --- 443,453 ---- } + /* If we added weaklist, we clear it */ + if (type->tp_weaklistoffset && !base->tp_weaklistoffset) + PyObject_ClearWeakRefs(self); + + if (call_finalizer(self) < 0) + return; + /* If we added a dict, DECREF it */ if (type->tp_dictoffset && !base->tp_dictoffset) { *************** *** 457,464 **** } } - - /* If we added weaklist, we clear it */ - if (type->tp_weaklistoffset && !base->tp_weaklistoffset) - PyObject_ClearWeakRefs(self); /* Finalize GC if the base doesn't do GC and we do */ --- 461,464 ---- From gvanrossum@users.sourceforge.net Thu May 29 15:29:26 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:29:26 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.233,2.234 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv22604 Modified Files: typeobject.c Log Message: Fix for SF 742911. We now clear the weakrefs *before* calling __del__ or emptying __dict__, just as we do for classic classes. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.233 retrieving revision 2.234 diff -C2 -d -r2.233 -r2.234 *** typeobject.c 21 May 2003 21:29:48 -0000 2.233 --- typeobject.c 29 May 2003 14:29:23 -0000 2.234 *************** *** 639,649 **** _PyObject_GC_TRACK(self); /* We'll untrack for real later */ - /* Maybe call finalizer; exit early if resurrected */ - if (type->tp_del) { - type->tp_del(self); - if (self->ob_refcnt > 0) - goto endlabel; - } - /* Find the nearest base with a different tp_dealloc and clear slots while we're at it */ --- 639,642 ---- *************** *** 656,659 **** --- 649,664 ---- } + /* If we added a weaklist, we clear it. Do this *before* calling + the finalizer (__del__) or clearing the instance dict. */ + if (type->tp_weaklistoffset && !base->tp_weaklistoffset) + PyObject_ClearWeakRefs(self); + + /* Maybe call finalizer; exit early if resurrected */ + if (type->tp_del) { + type->tp_del(self); + if (self->ob_refcnt > 0) + goto endlabel; + } + /* If we added a dict, DECREF it */ if (type->tp_dictoffset && !base->tp_dictoffset) { *************** *** 667,674 **** } } - - /* If we added weaklist, we clear it */ - if (type->tp_weaklistoffset && !base->tp_weaklistoffset) - PyObject_ClearWeakRefs(self); /* Finalize GC if the base doesn't do GC and we do */ --- 672,675 ---- From gvanrossum@users.sourceforge.net Thu May 29 15:30:51 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:30:51 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.192,1.193 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23275 Modified Files: test_descr.py Log Message: Remove debug code from weakref_segfault(). Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.192 retrieving revision 1.193 diff -C2 -d -r1.192 -r1.193 *** test_descr.py 29 May 2003 14:26:57 -0000 1.192 --- test_descr.py 29 May 2003 14:30:49 -0000 1.193 *************** *** 3885,3890 **** def __del__(self): x = self.ref() - print x - return x class Oops(object): --- 3885,3888 ---- From gvanrossum@users.sourceforge.net Thu May 29 15:31:47 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:31:47 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.31,1.113.4.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23690 Modified Files: Tag: release22-maint test_descr.py Log Message: Remove debug code from weakref_segfault(). Also move the call of the test to the top; the crash is caused by a double free. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.31 retrieving revision 1.113.4.32 diff -C2 -d -r1.113.4.31 -r1.113.4.32 *** test_descr.py 29 May 2003 14:21:29 -0000 1.113.4.31 --- test_descr.py 29 May 2003 14:31:42 -0000 1.113.4.32 *************** *** 3158,3163 **** def __del__(self): x = self.ref() - print x - return x class Oops(object): --- 3158,3161 ---- *************** *** 3170,3173 **** --- 3168,3172 ---- def test_main(): + weakref_segfault() # Must be first, somehow class_docstrings() lists() *************** *** 3233,3237 **** subclass_right_op() dict_type_with_metaclass() - weakref_segfault() if verbose: print "All OK" --- 3232,3235 ---- From gvanrossum@users.sourceforge.net Thu May 29 15:37:00 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 07:37:00 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.40,1.41 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25905 Modified Files: socket.py Log Message: I saw errors from _fileobject.__del__ about missing self._sock. This can happen if __init__ doesn't complete. Fix it by adding a try/except to __del__. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** socket.py 10 May 2003 07:36:54 -0000 1.40 --- socket.py 29 May 2003 14:36:57 -0000 1.41 *************** *** 233,237 **** def __del__(self): ! self.close() def flush(self): --- 233,241 ---- def __del__(self): ! try: ! self.close() ! except: ! # close() may fail if __init__ didn't complete ! pass def flush(self): From bwarsaw@users.sourceforge.net Thu May 29 16:13:21 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 May 2003 08:13:21 -0700 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.126.4.37,2.126.4.38 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv7838 Modified Files: Tag: release22-maint typeobject.c Log Message: Backport patch 2.206: ---------------------------- revision 2.206 date: 2003/02/11 16:25:43; author: gvanrossum; state: Exp; lines: +9 -0 Add basic arg sanity checking to wrap_descr_get(). This is called when Python code calls a descriptor's __get__ method. It should translate None to NULL in both argument positions, and insist that at least one of the argument positions is not NULL after this transformation. ---------------------------- which fixes SF bug # 736892, forcing function to act like an unbound method dumps core. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.126.4.37 retrieving revision 2.126.4.38 diff -C2 -d -r2.126.4.37 -r2.126.4.38 *** typeobject.c 29 May 2003 14:28:22 -0000 2.126.4.37 --- typeobject.c 29 May 2003 15:13:18 -0000 2.126.4.38 *************** *** 2750,2753 **** --- 2750,2762 ---- if (!PyArg_ParseTuple(args, "O|O", &obj, &type)) return NULL; + if (obj == Py_None) + obj = NULL; + if (type == Py_None) + type = NULL; + if (type == NULL &&obj == NULL) { + PyErr_SetString(PyExc_TypeError, + "__get__(None, None) is invalid"); + return NULL; + } return (*func)(self, obj, type); } From bwarsaw@users.sourceforge.net Thu May 29 16:14:55 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 May 2003 08:14:55 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_descr.py,1.113.4.32,1.113.4.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv8466 Modified Files: Tag: release22-maint test_descr.py Log Message: crash_in_get_sf736892(): A test of SF 736892, forcing function to act like an unbound method dumps core. Index: test_descr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v retrieving revision 1.113.4.32 retrieving revision 1.113.4.33 diff -C2 -d -r1.113.4.32 -r1.113.4.33 *** test_descr.py 29 May 2003 14:31:42 -0000 1.113.4.32 --- test_descr.py 29 May 2003 15:14:52 -0000 1.113.4.33 *************** *** 3167,3170 **** --- 3167,3183 ---- + def crash_in_get_sf736892(): + def func(): + pass + + try: + f = func.__get__(None) + except TypeError: + pass + else: + # should not get here + f(1) # crash + + def test_main(): weakref_segfault() # Must be first, somehow *************** *** 3232,3235 **** --- 3245,3249 ---- subclass_right_op() dict_type_with_metaclass() + crash_in_get_sf736892() if verbose: print "All OK" From fdrake@users.sourceforge.net Thu May 29 19:49:35 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 29 May 2003 11:49:35 -0700 Subject: [Python-checkins] python/dist/src/Doc Makefile,1.235.2.1.2.19,1.235.2.1.2.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv31779 Modified Files: Tag: release22-maint Makefile Log Message: Set release information for Python 2.2.3. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.235.2.1.2.19 retrieving revision 1.235.2.1.2.20 diff -C2 -d -r1.235.2.1.2.19 -r1.235.2.1.2.20 *** Makefile 22 May 2003 15:28:22 -0000 1.235.2.1.2.19 --- Makefile 29 May 2003 18:49:32 -0000 1.235.2.1.2.20 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3c1 PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.2.3 PYTHON= python From fdrake@users.sourceforge.net Thu May 29 19:49:35 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 29 May 2003 11:49:35 -0700 Subject: [Python-checkins] python/dist/src/Doc/texinputs boilerplate.tex,1.70.2.1.2.10,1.70.2.1.2.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/texinputs In directory sc8-pr-cvs1:/tmp/cvs-serv31779/texinputs Modified Files: Tag: release22-maint boilerplate.tex Log Message: Set release information for Python 2.2.3. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/texinputs/boilerplate.tex,v retrieving revision 1.70.2.1.2.10 retrieving revision 1.70.2.1.2.11 diff -C2 -d -r1.70.2.1.2.10 -r1.70.2.1.2.11 *** boilerplate.tex 22 May 2003 14:56:37 -0000 1.70.2.1.2.10 --- boilerplate.tex 29 May 2003 18:49:32 -0000 1.70.2.1.2.11 *************** *** 6,11 **** } ! \date{\today} % XXX update before final release! \release{2.2.3} % software release, not documentation ! \setreleaseinfo{c1} % empty for final release \setshortversion{2.2} % major.minor only for software --- 6,11 ---- } ! \date{30 May 2003} % XXX update before final release! \release{2.2.3} % software release, not documentation ! \setreleaseinfo{} % empty for final release \setshortversion{2.2} % major.minor only for software From tim_one@users.sourceforge.net Thu May 29 19:50:48 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 29 May 2003 11:50:48 -0700 Subject: [Python-checkins] python/dist/src/Lib socket.py,1.16.4.2,1.16.4.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31391/Lib Modified Files: Tag: release22-maint socket.py Log Message: Give the Windows socket wrapper function default values for its 'family' and 'type' arguments. This improves x-platform compatibility (e.g., on Unix systems socket() already supported these default arguments). No need to do anything here for 2.3 -- it already fixed this glitch in a different way. Index: socket.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/socket.py,v retrieving revision 1.16.4.2 retrieving revision 1.16.4.3 diff -C2 -d -r1.16.4.2 -r1.16.4.3 *** socket.py 23 Dec 2002 16:26:15 -0000 1.16.4.2 --- socket.py 29 May 2003 18:50:45 -0000 1.16.4.3 *************** *** 53,57 **** _realsocketcall = _socket.socket ! def socket(family, type, proto=0): return _socketobject(_realsocketcall(family, type, proto)) --- 53,57 ---- _realsocketcall = _socket.socket ! def socket(family=AF_INET, type=SOCK_STREAM, proto=0): return _socketobject(_realsocketcall(family, type, proto)) From nnorwitz@users.sourceforge.net Thu May 29 19:58:25 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 29 May 2003 11:58:25 -0700 Subject: [Python-checkins] python/dist/src/Modules _tkinter.c,1.121.6.2,1.121.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv2938/Modules Modified Files: Tag: release22-maint _tkinter.c Log Message: Backport 1.160: Fix SF #745055, Memory leak in _tkinter.c/Tkapp_SplitList() Also fix a memory leak in Tkapp_Split. Index: _tkinter.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_tkinter.c,v retrieving revision 1.121.6.2 retrieving revision 1.121.6.3 diff -C2 -d -r1.121.6.2 -r1.121.6.3 *** _tkinter.c 11 Feb 2003 23:19:35 -0000 1.121.6.2 --- _tkinter.c 29 May 2003 18:58:23 -0000 1.121.6.3 *************** *** 1195,1204 **** return NULL; ! if (Tcl_SplitList(Tkapp_Interp(self), list, &argc, &argv) == TCL_ERROR) return Tkinter_Error(self); if (!(v = PyTuple_New(argc))) ! return NULL; ! for (i = 0; i < argc; i++) { PyObject *s = PyString_FromString(argv[i]); --- 1195,1207 ---- return NULL; ! if (Tcl_SplitList(Tkapp_Interp(self), list, ! &argc, &argv) == TCL_ERROR) { ! PyMem_Free(list); return Tkinter_Error(self); + } if (!(v = PyTuple_New(argc))) ! goto finally; ! for (i = 0; i < argc; i++) { PyObject *s = PyString_FromString(argv[i]); *************** *** 1212,1215 **** --- 1215,1219 ---- finally: ckfree(FREECAST argv); + PyMem_Free(list); return v; } *************** *** 1218,1226 **** Tkapp_Split(PyObject *self, PyObject *args) { char *list; if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list)) return NULL; ! return Split(list); } --- 1222,1233 ---- Tkapp_Split(PyObject *self, PyObject *args) { + PyObject *v; char *list; if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list)) return NULL; ! v = Split(list); ! PyMem_Free(list); ! return v; } From nnorwitz@users.sourceforge.net Thu May 29 20:03:47 2003 From: nnorwitz@users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Thu, 29 May 2003 12:03:47 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.82,1.337.2.4.2.83 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv5391/Misc Modified Files: Tag: release22-maint NEWS Log Message: Add section for 2.2.3 final and memory leak plug for tkinter Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.82 retrieving revision 1.337.2.4.2.83 diff -C2 -d -r1.337.2.4.2.82 -r1.337.2.4.2.83 *** NEWS 23 May 2003 22:34:36 -0000 1.337.2.4.2.82 --- NEWS 29 May 2003 19:03:43 -0000 1.337.2.4.2.83 *************** *** 1,2 **** --- 1,9 ---- + What's New in Python 2.2.3 (final) ? + Release date: 30-May-2003 + ==================================== + + - SF #745055: Fix memory leaks in Tkapp_Split and Tkapp_SplitList. + + What's New in Python 2.2.3c1 ? Release date: 22-May-2003 From gvanrossum@users.sourceforge.net Thu May 29 20:21:41 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Thu, 29 May 2003 12:21:41 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.83,1.337.2.4.2.84 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv12979 Modified Files: Tag: release22-maint NEWS Log Message: All the news that's fit to print (I reviewed the CVS log since the bump of patchlevel.h). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.83 retrieving revision 1.337.2.4.2.84 diff -C2 -d -r1.337.2.4.2.83 -r1.337.2.4.2.84 *** NEWS 29 May 2003 19:03:43 -0000 1.337.2.4.2.83 --- NEWS 29 May 2003 19:21:38 -0000 1.337.2.4.2.84 *************** *** 5,8 **** --- 5,23 ---- - SF #745055: Fix memory leaks in Tkapp_Split and Tkapp_SplitList. + - On Posix systems, as of Python 2.2, the arguments for + socket.socket() default to AF_INET, SOCK_STREAM. This is now so for + the Windows-specific wrapper in socket.py as well. + + - Backport SF #736892: Add argument sanity checking for __get__(). + + - SF #742911: Fix segfault due to clearing weak references too late + for new-style class instances. + + - Backport SF 742860: new, improved __delitem__ for WeakKeyDictionary. + + - RPM spec file update from Sean Reifschneider. + + - Mac OS X specific backports for distutils/unixccompiler.py. + What's New in Python 2.2.3c1 ? From tim_one@users.sourceforge.net Thu May 29 20:26:09 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 29 May 2003 12:26:09 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.84,1.337.2.4.2.85 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14517/Misc Modified Files: Tag: release22-maint NEWS Log Message: Fleshed out the WeakKeyDictionary.__delitem__ news, since this can change visible behavior. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.84 retrieving revision 1.337.2.4.2.85 diff -C2 -d -r1.337.2.4.2.84 -r1.337.2.4.2.85 *** NEWS 29 May 2003 19:21:38 -0000 1.337.2.4.2.84 --- NEWS 29 May 2003 19:26:06 -0000 1.337.2.4.2.85 *************** *** 15,18 **** --- 15,30 ---- - Backport SF 742860: new, improved __delitem__ for WeakKeyDictionary. + This old __delitem__ wasn't threadsafe, was very inefficient (expected + time O(len(dict)) instead of O(1)), and could raise a spurious + RuntimeError if another thread mutated the dict during __delitem__, or if + a comparison function mutated it. It also neglected to raise KeyError + when the key wasn't present; didn't raise TypeError when the key wasn't + of a weakly referencable type; and broke various more-or-less obscure + dict invariants by using a sequence of equality comparisons over the + whole set of dict keys instead of computing the key's hash code to + narrow the search to those keys with the same hash code. All of these + are considered to be bugs. A new implementation of __delitem__ repairs + all that, but note that fixing these bugs may change visible behavior + in code relying (whether intentionally or accidentally) on old behavior. - RPM spec file update from Sean Reifschneider. *************** *** 201,207 **** - Distutils: Translate spaces in the machine name to underscores (Power Macintosh -> Power_Macintosh) ! - Distutils: on Mac OS X don't use -R for runtime_library_dirs, use ! -L in stead (#723495). - Backported SF #658233, continuation lines in .mo file metadata --- 213,219 ---- - Distutils: Translate spaces in the machine name to underscores (Power Macintosh -> Power_Macintosh) ! - Distutils: on Mac OS X don't use -R for runtime_library_dirs, use ! -L in stead (#723495). - Backported SF #658233, continuation lines in .mo file metadata From tim_one@users.sourceforge.net Thu May 29 20:31:19 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu, 29 May 2003 12:31:19 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.85,1.337.2.4.2.86 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17377/misc Modified Files: Tag: release22-maint NEWS Log Message: Typo repair. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.85 retrieving revision 1.337.2.4.2.86 diff -C2 -d -r1.337.2.4.2.85 -r1.337.2.4.2.86 *** NEWS 29 May 2003 19:26:06 -0000 1.337.2.4.2.85 --- NEWS 29 May 2003 19:31:15 -0000 1.337.2.4.2.86 *************** *** 15,19 **** - Backport SF 742860: new, improved __delitem__ for WeakKeyDictionary. ! This old __delitem__ wasn't threadsafe, was very inefficient (expected time O(len(dict)) instead of O(1)), and could raise a spurious RuntimeError if another thread mutated the dict during __delitem__, or if --- 15,19 ---- - Backport SF 742860: new, improved __delitem__ for WeakKeyDictionary. ! The old __delitem__ wasn't threadsafe, was very inefficient (expected time O(len(dict)) instead of O(1)), and could raise a spurious RuntimeError if another thread mutated the dict during __delitem__, or if *************** *** 25,29 **** narrow the search to those keys with the same hash code. All of these are considered to be bugs. A new implementation of __delitem__ repairs ! all that, but note that fixing these bugs may change visible behavior in code relying (whether intentionally or accidentally) on old behavior. --- 25,29 ---- narrow the search to those keys with the same hash code. All of these are considered to be bugs. A new implementation of __delitem__ repairs ! all that, but note that fixing these bugs may change visible behavior in code relying (whether intentionally or accidentally) on old behavior. From bwarsaw@users.sourceforge.net Thu May 29 20:39:37 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 May 2003 12:39:37 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.19,1.20 __init__.py,1.28,1.29 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv20867/Lib/email Modified Files: Generator.py __init__.py Log Message: _make_boundary(): Fix for SF bug #745478, broken boundary calculation in some locales. This code simplifies the boundary algorithm to use randint() which is what we wanted anyway. Bump package version to 2.5.3. Backport candidate for Python 2.2.3 Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Generator.py 7 Mar 2003 15:43:17 -0000 1.19 --- Generator.py 29 May 2003 19:39:33 -0000 1.20 *************** *** 6,9 **** --- 6,10 ---- import re + import sys import time import locale *************** *** 357,365 **** # Helper def _make_boundary(text=None): # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! dp = locale.localeconv().get('decimal_point', '.') ! boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '==' if text is None: return boundary --- 358,369 ---- # Helper + _width = len(repr(sys.maxint-1)) + _fmt = '%%0%dd' % _width + def _make_boundary(text=None): # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! token = random.randint(0, sys.maxint-1) ! boundary = ('=' * 15) + (_fmt % token) + '==' if text is None: return boundary Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** __init__.py 8 May 2003 03:34:58 -0000 1.28 --- __init__.py 29 May 2003 19:39:33 -0000 1.29 *************** *** 5,9 **** """ ! __version__ = '2.5.2' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.3' __all__ = [ From fdrake@users.sourceforge.net Thu May 29 20:46:32 2003 From: fdrake@users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu, 29 May 2003 12:46:32 -0700 Subject: [Python-checkins] python/dist/src/Doc/tools mkpkglist,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv23583 Modified Files: mkpkglist Log Message: Include both tags in the thead, not just the first. Index: mkpkglist =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mkpkglist,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mkpkglist 14 Oct 2002 15:45:11 -0000 1.3 --- mkpkglist 29 May 2003 19:46:29 -0000 1.4 *************** *** 42,48 **** Content ! Format ! ! ZIPGZipBZip2 ''' --- 42,47 ---- Content ! Format ! ZIPGZipBZip2 ''' From bwarsaw@users.sourceforge.net Thu May 29 21:09:34 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu, 29 May 2003 13:09:34 -0700 Subject: [Python-checkins] python/dist/src/Lib/email Generator.py,1.6.10.4,1.6.10.5 __init__.py,1.4.10.7,1.4.10.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv5302/Lib/email Modified Files: Tag: release22-maint Generator.py __init__.py Log Message: Backport from 2.3 trunk: _make_boundary(): Fix for SF bug #745478, broken boundary calculation in some locales. This code simplifies the boundary algorithm to use randint() which is what we wanted anyway. Bump package version to 2.5.3. Index: Generator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Generator.py,v retrieving revision 1.6.10.4 retrieving revision 1.6.10.5 diff -C2 -d -r1.6.10.4 -r1.6.10.5 *** Generator.py 21 Mar 2003 21:09:31 -0000 1.6.10.4 --- Generator.py 29 May 2003 20:09:30 -0000 1.6.10.5 *************** *** 6,9 **** --- 6,10 ---- import re + import sys import time import locale *************** *** 357,365 **** # Helper def _make_boundary(text=None): # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! dp = locale.localeconv().get('decimal_point', '.') ! boundary = ('=' * 15) + repr(random.random()).split(dp)[1] + '==' if text is None: return boundary --- 358,369 ---- # Helper + _width = len(repr(sys.maxint-1)) + _fmt = '%%0%dd' % _width + def _make_boundary(text=None): # Craft a random boundary. If text is given, ensure that the chosen # boundary doesn't appear in the text. ! token = random.randint(0, sys.maxint-1) ! boundary = ('=' * 15) + (_fmt % token) + '==' if text is None: return boundary Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.4.10.7 retrieving revision 1.4.10.8 diff -C2 -d -r1.4.10.7 -r1.4.10.8 *** __init__.py 8 May 2003 04:00:05 -0000 1.4.10.7 --- __init__.py 29 May 2003 20:09:31 -0000 1.4.10.8 *************** *** 5,9 **** """ ! __version__ = '2.5.2' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.3' __all__ = [ From gward@users.sourceforge.net Thu May 29 22:53:08 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 29 May 2003 14:53:08 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.29,1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv7583a/Modules Modified Files: ossaudiodev.c Log Message: Completely change the interface to setparameters(): * it no longer takes ssize, which served no purpose apart from scolding you if you got it wrong * changed the order of the three remaining required arguments to (format, channels, rate) to match the order in which they must be set * replaced the optional argument 'emulate' with 'strict': if strict true, and the audio device does not accept the requested sampling parameters, raise OSSAudioError * return a tuple (format, channels, rate) reflecting the sampling parameters that were actually set Change the canonical name of ossaudiodev.error to ossaudiodev.OSSAudioError (keep an alias for backwards compatibility). Remove 'audio_types' list and 'n_audio_types' (no longer needed now that setparameters() no longer has an 'ssize' argument to police). Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ossaudiodev.c 27 May 2003 01:57:21 -0000 1.29 --- ossaudiodev.c 29 May 2003 21:53:06 -0000 1.30 *************** *** 59,85 **** } oss_mixer_t; - /* XXX several format defined in soundcard.h are not supported, - including _NE (native endian) options and S32 options - */ - - static struct { - int a_bps; - uint32_t a_fmt; - char *a_name; - } audio_types[] = { - { 8, AFMT_MU_LAW, "logarithmic mu-law 8-bit audio" }, - { 8, AFMT_A_LAW, "logarithmic A-law 8-bit audio" }, - { 8, AFMT_U8, "linear unsigned 8-bit audio" }, - { 8, AFMT_S8, "linear signed 8-bit audio" }, - { 16, AFMT_U16_BE, "linear unsigned 16-bit big-endian audio" }, - { 16, AFMT_U16_LE, "linear unsigned 16-bit little-endian audio" }, - { 16, AFMT_S16_BE, "linear signed 16-bit big-endian audio" }, - { 16, AFMT_S16_LE, "linear signed 16-bit little-endian audio" }, - #ifdef AFMT_S16_NE - { 16, AFMT_S16_NE, "linear signed 16-bit native-endian audio" }, - #endif - }; - - static int n_audio_types = sizeof(audio_types) / sizeof(audio_types[0]); static PyTypeObject OSSAudioType; --- 59,62 ---- *************** *** 229,232 **** --- 206,213 ---- + /* ---------------------------------------------------------------------- + * Helper functions + */ + /* _do_ioctl_1() is a private helper function used for the OSS ioctls -- SNDCTL_DSP_{SETFMT,CHANNELS,SPEED} -- that that are called from C *************** *** 255,262 **** - /* ---------------------------------------------------------------------- - * Helper functions - */ - /* _do_ioctl_1_internal() is a wrapper for ioctls that take no inputs but return an output -- ie. we need to pass a pointer to a local C --- 236,239 ---- *************** *** 267,271 **** way. */ - static PyObject * _do_ioctl_1_internal(int fd, PyObject *args, char *fname, int cmd) --- 244,247 ---- *************** *** 512,575 **** oss_setparameters(oss_audio_t *self, PyObject *args) { ! int rate, ssize, nchannels, n, fmt, emulate=0; ! if (!PyArg_ParseTuple(args, "iiii|i:setparameters", ! &rate, &ssize, &nchannels, &fmt, &emulate)) ! return NULL; ! ! if (rate < 0) { ! PyErr_Format(PyExc_ValueError, "expected rate >= 0, not %d", ! rate); ! return NULL; ! } ! if (ssize < 0) { ! PyErr_Format(PyExc_ValueError, "expected sample size >= 0, not %d", ! ssize); return NULL; } ! if (nchannels != 1 && nchannels != 2) { ! PyErr_Format(PyExc_ValueError, "nchannels must be 1 or 2, not %d", ! nchannels); ! return NULL; } ! for (n = 0; n < n_audio_types; n++) ! if (fmt == audio_types[n].a_fmt) ! break; ! if (n == n_audio_types) { ! PyErr_Format(PyExc_ValueError, "unknown audio encoding: %d", fmt); ! return NULL; } ! if (audio_types[n].a_bps != ssize) { ! PyErr_Format(PyExc_ValueError, ! "for %s, expected sample size %d, not %d", ! audio_types[n].a_name, audio_types[n].a_bps, ssize); ! return NULL; } ! if (emulate == 0) { ! if ((self->afmts & audio_types[n].a_fmt) == 0) { ! PyErr_Format(PyExc_ValueError, ! "%s format not supported by device", ! audio_types[n].a_name); ! return NULL; ! } ! } ! if (ioctl(self->fd, SNDCTL_DSP_SETFMT, ! &audio_types[n].a_fmt) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); ! return NULL; } ! if (ioctl(self->fd, SNDCTL_DSP_CHANNELS, &nchannels) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); ! return NULL; } ! if (ioctl(self->fd, SNDCTL_DSP_SPEED, &rate) == -1) { ! PyErr_SetFromErrno(PyExc_IOError); return NULL; ! } ! ! Py_INCREF(Py_None); ! return Py_None; } --- 488,542 ---- oss_setparameters(oss_audio_t *self, PyObject *args) { ! int wanted_fmt, wanted_channels, wanted_rate, strict=0; ! int fmt, channels, rate; ! PyObject * rv; /* return tuple (fmt, channels, rate) */ ! if (!PyArg_ParseTuple(args, "iii|i:setparameters", ! &wanted_fmt, &wanted_channels, &wanted_rate, ! &strict)) return NULL; + + fmt = wanted_fmt; + if (ioctl(self->fd, SNDCTL_DSP_SETFMT, &fmt) == -1) { + return PyErr_SetFromErrno(PyExc_IOError); } ! if (strict && fmt != wanted_fmt) { ! return PyErr_Format ! (OSSAudioError, ! "unable to set requested format (wanted %d, got %d)", ! wanted_fmt, fmt); } ! channels = wanted_channels; ! if (ioctl(self->fd, SNDCTL_DSP_CHANNELS, &channels) == -1) { ! return PyErr_SetFromErrno(PyExc_IOError); } ! if (strict && channels != wanted_channels) { ! return PyErr_Format ! (OSSAudioError, ! "unable to set requested channels (wanted %d, got %d)", ! wanted_channels, channels); } ! rate = wanted_rate; ! if (ioctl(self->fd, SNDCTL_DSP_SPEED, &rate) == -1) { ! return PyErr_SetFromErrno(PyExc_IOError); } ! if (strict && rate != wanted_rate) { ! return PyErr_Format ! (OSSAudioError, ! "unable to set requested rate (wanted %d, got %d)", ! wanted_rate, rate); } ! ! /* Construct the return value: a (fmt, channels, rate) tuple that ! tells what the audio hardware was actually set to. */ ! rv = PyTuple_New(3); ! if (rv == NULL) return NULL; ! PyTuple_SET_ITEM(rv, 0, PyInt_FromLong(fmt)); ! PyTuple_SET_ITEM(rv, 1, PyInt_FromLong(channels)); ! PyTuple_SET_ITEM(rv, 2, PyInt_FromLong(rate)); ! return rv; } *************** *** 970,976 **** m = Py_InitModule("ossaudiodev", ossaudiodev_methods); ! OSSAudioError = PyErr_NewException("ossaudiodev.error", NULL, NULL); ! if (OSSAudioError) PyModule_AddObject(m, "error", OSSAudioError); /* Build 'control_labels' and 'control_names' lists and add them --- 937,945 ---- m = Py_InitModule("ossaudiodev", ossaudiodev_methods); ! OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL); ! if (OSSAudioError) { PyModule_AddObject(m, "error", OSSAudioError); + PyModule_AddObject(m, "OSSAudioError", OSSAudioError); + } /* Build 'control_labels' and 'control_names' lists and add them From gward@users.sourceforge.net Thu May 29 22:55:44 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 29 May 2003 14:55:44 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13726 Modified Files: ossaudiodev.c Log Message: Change _ssize() so it doesn't rely on sizeof(char) or sizeof(short): 8 bits is 1 byte, and that isn't about to change any time soon. (I hope!) Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** ossaudiodev.c 29 May 2003 21:53:06 -0000 1.30 --- ossaudiodev.c 29 May 2003 21:55:41 -0000 1.31 *************** *** 555,559 **** case AFMT_U8: case AFMT_S8: ! *ssize = sizeof(char); break; case AFMT_S16_LE: --- 555,559 ---- case AFMT_U8: case AFMT_S8: ! *ssize = 1; /* 8 bit formats: 1 byte */ break; case AFMT_S16_LE: *************** *** 561,565 **** case AFMT_U16_LE: case AFMT_U16_BE: ! *ssize = sizeof(short); break; case AFMT_MPEG: --- 561,565 ---- case AFMT_U16_LE: case AFMT_U16_BE: ! *ssize = 2; /* 16 bit formats: 1 byte */ break; case AFMT_MPEG: From jackjansen@users.sourceforge.net Thu May 29 23:07:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 May 2003 15:07:29 -0700 Subject: [Python-checkins] python/dist/src/Lib/plat-mac pimp.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac In directory sc8-pr-cvs1:/tmp/cvs-serv20960/Lib/plat-mac Modified Files: pimp.py Log Message: - Get the database from a different place. - Added support for multi-line descriptions. Doesn't look nice yet in Package Manager. Index: pimp.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/pimp.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** pimp.py 28 May 2003 18:56:30 -0000 1.22 --- pimp.py 29 May 2003 22:07:27 -0000 1.23 *************** *** 45,49 **** DEFAULT_BUILDDIR='/tmp' DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() ! DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform() def _cmd(output, dir, *cmditems): --- 45,49 ---- DEFAULT_BUILDDIR='/tmp' DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib() ! DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp-0.2/pimp-%s.plist" % distutils.util.get_platform() def _cmd(output, dir, *cmditems): *************** *** 267,271 **** % (self._version, PIMP_VERSION)) self._maintainer = dict.get('Maintainer', '') ! self._description = dict.get('Description', '') self._appendPackages(dict['Packages']) others = dict.get('Include', []) --- 267,271 ---- % (self._version, PIMP_VERSION)) self._maintainer = dict.get('Maintainer', '') ! self._description = dict.get('Description', '').strip() self._appendPackages(dict['Packages']) others = dict.get('Include', []) *************** *** 391,395 **** def version(self): return self._dict.get('Version') def flavor(self): return self._dict.get('Flavor') ! def description(self): return self._dict['Description'] def homepage(self): return self._dict.get('Home-page') def downloadURL(self): return self._dict.get('Download-URL') --- 391,395 ---- def version(self): return self._dict.get('Version') def flavor(self): return self._dict.get('Flavor') ! def description(self): return self._dict['Description'].strip() def homepage(self): return self._dict.get('Home-page') def downloadURL(self): return self._dict.get('Download-URL') *************** *** 826,830 **** pkg = db.find(pkgname) if pkg: ! description = pkg.description() pkgname = pkg.fullname() else: --- 826,830 ---- pkg = db.find(pkgname) if pkg: ! description = pkg.description().split('\r\n')[0] pkgname = pkg.fullname() else: *************** *** 837,840 **** --- 837,843 ---- except KeyError: pass + description = pkg.description() + description = '\n\t\t\t\t\t'.join(description.split('\r\n')) + print "\tDescription:\t%s" % description elif mode =='status': if not args: From jackjansen@users.sourceforge.net Thu May 29 23:07:29 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Thu, 29 May 2003 15:07:29 -0700 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PackageManager.py,1.10,1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv20960/Mac/Tools/IDE Modified Files: PackageManager.py Log Message: - Get the database from a different place. - Added support for multi-line descriptions. Doesn't look nice yet in Package Manager. Index: PackageManager.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PackageManager.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PackageManager.py 27 May 2003 14:10:37 -0000 1.10 --- PackageManager.py 29 May 2003 22:07:27 -0000 1.11 *************** *** 306,310 **** status, _ = pkg.installed() description = pkg.description() ! rv.append((status, name, description)) return rv --- 306,311 ---- status, _ = pkg.installed() description = pkg.description() ! description_line1 = description.split('\n')[0] ! rv.append((status, name, description_line1)) return rv *************** *** 334,340 **** def setupwidgets(self): INSTALL_POS = -30 ! STATUS_POS = INSTALL_POS - 70 ! self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0) self.w.titlebar = W.TextBox((4, 8, 60, 18), 'Packages:') self.w.hidden_button = W.CheckBox((-100, 4, 0, 18), 'Show Hidden', self.updatestatus) --- 335,342 ---- def setupwidgets(self): + DESCRIPTION_HEIGHT = 140 INSTALL_POS = -30 ! STATUS_POS = INSTALL_POS - (70 + DESCRIPTION_HEIGHT) ! self.w = W.Window((580, 600), "Python Install Manager", minsize = (400, 400), tabbable = 0) self.w.titlebar = W.TextBox((4, 8, 60, 18), 'Packages:') self.w.hidden_button = W.CheckBox((-100, 4, 0, 18), 'Show Hidden', self.updatestatus) *************** *** 342,350 **** self.w.packagebrowser = W.MultiList((4, 24, 0, STATUS_POS-2), data, self.listhit, cols=3) ! self.w.installed_l = W.TextBox((4, STATUS_POS, 60, 12), 'Installed:') ! self.w.installed = W.TextBox((64, STATUS_POS, 0, 12), '') ! self.w.message_l = W.TextBox((4, STATUS_POS+20, 60, 12), 'Status:') ! self.w.message = W.TextBox((64, STATUS_POS+20, 0, 12), '') self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage) self.w.divline = W.HorizontalLine((0, INSTALL_POS-4, 0, 0)) --- 344,354 ---- self.w.packagebrowser = W.MultiList((4, 24, 0, STATUS_POS-2), data, self.listhit, cols=3) ! self.w.installed_l = W.TextBox((4, STATUS_POS, 70, 12), 'Installed:') ! self.w.installed = W.TextBox((74, STATUS_POS, 0, 12), '') ! self.w.message_l = W.TextBox((4, STATUS_POS+20, 70, 12), 'Status:') ! self.w.message = W.TextBox((74, STATUS_POS+20, 0, 12), '') self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage) + self.w.description_l = W.TextBox((4, STATUS_POS+70, 70, 12), 'Description:') + self.w.description = W.EditText((74, STATUS_POS+70, 0, DESCRIPTION_HEIGHT-4)) self.w.divline = W.HorizontalLine((0, INSTALL_POS-4, 0, 0)) *************** *** 356,359 **** --- 360,364 ---- self.w.install_button = W.Button((4, INSTALL_POS+4, 56, 18), 'Install:', self.do_install) self.w.open() + self.w.description.enable(0) def updatestatus(self): *************** *** 367,370 **** --- 372,376 ---- self.w.install_button.enable(0) self.w.homepage_button.enable(0) + self.w.description.set('') self.w.verbose_button.enable(0) self.w.recursive_button.enable(0) *************** *** 379,382 **** --- 385,392 ---- self.w.install_button.enable(installed != "yes" or self.w.force_button.get()) self.w.homepage_button.enable(not not self.packages[sel].homepage()) + description = self.packages[sel].description() + description = description.split('\r\n') + description = '\r'.join(description) + self.w.description.set(description) self.w.verbose_button.enable(1) self.w.recursive_button.enable(1) From nas@python.ca Thu May 29 23:45:15 2003 From: nas@python.ca (Neil Schemenauer) Date: Thu, 29 May 2003 15:45:15 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.30,1.31 In-Reply-To: References: Message-ID: <20030529224515.GA30615@glacier.arctrix.com> gward@users.sourceforge.net wrote: > *************** > *** 555,559 **** > case AFMT_U8: > case AFMT_S8: > ! *ssize = sizeof(char); > break; > case AFMT_S16_LE: sizeof(char) is, by definition, 1. > case AFMT_U16_BE: > ! *ssize = sizeof(short); > break; > case AFMT_MPEG: > --- 561,565 ---- > case AFMT_U16_LE: > case AFMT_U16_BE: > ! *ssize = 2; /* 16 bit formats: 1 byte */ > break; > case AFMT_MPEG: That comment is confusing. Is the code expecting an integer with at least 16 bits? If that's true then the code is correct (since 1 byte can hold at least 8 bits). However, I would have expected the comment to say "2 bytes". Neil From gward@users.sourceforge.net Fri May 30 00:44:48 2003 From: gward@users.sourceforge.net (gward@users.sourceforge.net) Date: Thu, 29 May 2003 16:44:48 -0700 Subject: [Python-checkins] python/dist/src/Modules ossaudiodev.c,1.31,1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv15387 Modified Files: ossaudiodev.c Log Message: Comment fix. Index: ossaudiodev.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/ossaudiodev.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** ossaudiodev.c 29 May 2003 21:55:41 -0000 1.31 --- ossaudiodev.c 29 May 2003 23:44:44 -0000 1.32 *************** *** 561,565 **** case AFMT_U16_LE: case AFMT_U16_BE: ! *ssize = 2; /* 16 bit formats: 1 byte */ break; case AFMT_MPEG: --- 561,565 ---- case AFMT_U16_LE: case AFMT_U16_BE: ! *ssize = 2; /* 16 bit formats: 2 byte */ break; case AFMT_MPEG: From gvanrossum@users.sourceforge.net Fri May 30 14:41:10 2003 From: gvanrossum@users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Fri, 30 May 2003 06:41:10 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.60.2.1.2.11,2.60.2.1.2.12 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv7679 Modified Files: Tag: release22-maint patchlevel.h Log Message: Bump the version to 2.2.3 (final). Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.60.2.1.2.11 retrieving revision 2.60.2.1.2.12 diff -C2 -d -r2.60.2.1.2.11 -r2.60.2.1.2.12 *** patchlevel.h 23 May 2003 03:37:11 -0000 2.60.2.1.2.11 --- patchlevel.h 30 May 2003 13:41:07 -0000 2.60.2.1.2.12 *************** *** 23,31 **** #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 3 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 1 /* Version as a string */ ! #define PY_VERSION "2.2.3c1+" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,31 ---- #define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 3 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.2.3" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From tim_one@users.sourceforge.net Fri May 30 16:23:02 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 May 2003 08:23:02 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.26.4.10,1.26.4.11 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv25784/PCbuild Modified Files: Tag: release22-maint BUILDno.txt Log Message: Updated Windows buildno for 2.2.3 final. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.26.4.10 retrieving revision 1.26.4.11 diff -C2 -d -r1.26.4.10 -r1.26.4.11 *** BUILDno.txt 22 May 2003 15:39:09 -0000 1.26.4.10 --- BUILDno.txt 30 May 2003 15:22:59 -0000 1.26.4.11 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 42 2.2.3 (final) + 30-May-2003 41 2.2.3c1 22-May-2003 From tim_one@users.sourceforge.net Fri May 30 16:23:23 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 May 2003 08:23:23 -0700 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.45,1.46 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv26025/PCbuild Modified Files: BUILDno.txt Log Message: Updated Windows buildno for 2.2.3 final. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** BUILDno.txt 22 May 2003 15:30:36 -0000 1.45 --- BUILDno.txt 30 May 2003 15:23:21 -0000 1.46 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 42 2.2.3 (final) + 30-May-2003 41 2.2.3c1 22-May-2003 From tim_one@users.sourceforge.net Fri May 30 16:43:37 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 May 2003 08:43:37 -0700 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp,1.30.4.6,1.30.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv3178 Modified Files: Tag: release22-maint pythoncore.dsp Log Message: Update the buildno diplayed by Windows Python 2.2.3. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.30.4.6 retrieving revision 1.30.4.7 diff -C2 -d -r1.30.4.6 -r1.30.4.7 *** pythoncore.dsp 22 May 2003 15:39:10 -0000 1.30.4.6 --- pythoncore.dsp 30 May 2003 15:43:34 -0000 1.30.4.7 *************** *** 740,748 **** !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=41 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=41 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" --- 740,748 ---- !IF "$(CFG)" == "pythoncore - Win32 Release" ! # ADD CPP /D BUILD=42 !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" ! # ADD CPP /D BUILD=42 !ELSEIF "$(CFG)" == "pythoncore - Win32 Alpha Debug" From tim_one@users.sourceforge.net Fri May 30 17:12:42 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 May 2003 09:12:42 -0700 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse,1.98.4.12,1.98.4.13 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv19653/PCbuild Modified Files: Tag: release22-maint python20.wse Log Message: Update Windows installer for 2.2.3. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.98.4.12 retrieving revision 1.98.4.13 diff -C2 -d -r1.98.4.12 -r1.98.4.13 *** python20.wse 22 May 2003 15:39:09 -0000 1.98.4.12 --- python20.wse 30 May 2003 16:12:40 -0000 1.98.4.13 *************** *** 2,6 **** item: Global Version=8.14 ! Title=Python 2.2.3 release candidate 1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=8.14 ! Title=Python 2.2.3 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 19,25 **** Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.3c1.exe Dialogs Version=8 ! Version File=2.2.3c1 Version Description=Python Programming Language Version Copyright=©2003 Python Software Foundation --- 19,25 ---- Patch Threshold=85 Patch Memory=4000 ! EXE Filename=Python-2.2.3.exe Dialogs Version=8 ! Version File=2.2.3 Version Description=Python Programming Language Version Copyright=©2003 Python Software Foundation *************** *** 65,69 **** item: Set Variable Variable=PYVER_STRING ! Value=2.2.3c1 end item: Remark --- 65,69 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.2.3 end item: Remark From tim_one@users.sourceforge.net Fri May 30 17:02:00 2003 From: tim_one@users.sourceforge.net (tim_one@users.sourceforge.net) Date: Fri, 30 May 2003 09:02:00 -0700 Subject: [Python-checkins] python/dist/src/PC python_nt.rc,1.15.14.4,1.15.14.5 Message-ID: Update of /cvsroot/python/python/dist/src/PC In directory sc8-pr-cvs1:/tmp/cvs-serv11973/PC Modified Files: Tag: release22-maint python_nt.rc Log Message: Update the Windows DLL resource info for 2.2.3. Index: python_nt.rc =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/python_nt.rc,v retrieving revision 1.15.14.4 retrieving revision 1.15.14.5 diff -C2 -d -r1.15.14.4 -r1.15.14.5 *** python_nt.rc 22 May 2003 15:39:08 -0000 1.15.14.4 --- python_nt.rc 30 May 2003 16:01:58 -0000 1.15.14.5 *************** *** 35,46 **** * following comment and #define are output from PCbuild\field3.py: * ! * For 2.2.3c1, * PY_MICRO_VERSION = 3 ! * PY_RELEASE_LEVEL = 'candidate' = 0xc ! * PY_RELEASE_SERIAL = 1 * ! * and 3*1000 + 12*10 + 1 = 3121 */ ! #define FIELD3 3121 /* e.g., 2.1a2 --- 35,46 ---- * following comment and #define are output from PCbuild\field3.py: * ! * For 2.2.3, * PY_MICRO_VERSION = 3 ! * PY_RELEASE_LEVEL = 'final' = 0xf ! * PY_RELEASE_SERIAL = 0 * ! * and 3*1000 + 15*10 + 0 = 3150 */ ! #define FIELD3 3150 /* e.g., 2.1a2 From bwarsaw@users.sourceforge.net Fri May 30 21:57:42 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 30 May 2003 13:57:42 -0700 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.337.2.4.2.86,1.337.2.4.2.87 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv20179 Modified Files: Tag: release22-maint NEWS Log Message: Last minute NEWS file updates Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.337.2.4.2.86 retrieving revision 1.337.2.4.2.87 diff -C2 -d -r1.337.2.4.2.86 -r1.337.2.4.2.87 *** NEWS 29 May 2003 19:31:15 -0000 1.337.2.4.2.86 --- NEWS 30 May 2003 20:57:36 -0000 1.337.2.4.2.87 *************** *** 28,34 **** in code relying (whether intentionally or accidentally) on old behavior. - RPM spec file update from Sean Reifschneider. ! - Mac OS X specific backports for distutils/unixccompiler.py. --- 28,37 ---- in code relying (whether intentionally or accidentally) on old behavior. + - Backport SF #745478: email package 2.5.3; fixes a buglet in + multipart boundary calculation. + - RPM spec file update from Sean Reifschneider. ! - Mac OS X specific backports for distutils/unixccompiler.py. SF #723495 From nascheme@users.sourceforge.net Sat May 31 00:59:46 2003 From: nascheme@users.sourceforge.net (nascheme@users.sourceforge.net) Date: Fri, 30 May 2003 16:59:46 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.362,2.363 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv7836/Python Modified Files: ceval.c Log Message: Don't use fast_next_opcode for JUMP_* opcodes. This fixes the problem reported by Kurt B. Kaiser. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.362 retrieving revision 2.363 diff -C2 -d -r2.362 -r2.363 *** ceval.c 29 Apr 2003 16:18:42 -0000 2.362 --- ceval.c 30 May 2003 23:59:44 -0000 2.363 *************** *** 2002,2006 **** case JUMP_FORWARD: JUMPBY(oparg); ! goto fast_next_opcode; PREDICTED_WITH_ARG(JUMP_IF_FALSE); --- 2002,2006 ---- case JUMP_FORWARD: JUMPBY(oparg); ! continue; PREDICTED_WITH_ARG(JUMP_IF_FALSE); *************** *** 2009,2017 **** if (w == Py_True) { PREDICT(POP_TOP); ! goto fast_next_opcode; } if (w == Py_False) { JUMPBY(oparg); ! goto fast_next_opcode; } err = PyObject_IsTrue(w); --- 2009,2017 ---- if (w == Py_True) { PREDICT(POP_TOP); ! continue; } if (w == Py_False) { JUMPBY(oparg); ! continue; } err = PyObject_IsTrue(w); *************** *** 2029,2037 **** if (w == Py_False) { PREDICT(POP_TOP); ! goto fast_next_opcode; } if (w == Py_True) { JUMPBY(oparg); ! goto fast_next_opcode; } err = PyObject_IsTrue(w); --- 2029,2037 ---- if (w == Py_False) { PREDICT(POP_TOP); ! continue; } if (w == Py_True) { JUMPBY(oparg); ! continue; } err = PyObject_IsTrue(w); *************** *** 2048,2052 **** case JUMP_ABSOLUTE: JUMPTO(oparg); ! goto fast_next_opcode; case GET_ITER: --- 2048,2052 ---- case JUMP_ABSOLUTE: JUMPTO(oparg); ! continue; case GET_ITER: From bwarsaw@users.sourceforge.net Sat May 31 04:19:30 2003 From: bwarsaw@users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Fri, 30 May 2003 20:19:30 -0700 Subject: [Python-checkins] python/dist/src/Include patchlevel.h,2.60.2.1.2.12,2.60.2.1.2.13 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv1575 Modified Files: Tag: release22-maint patchlevel.h Log Message: Bump the version number Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.60.2.1.2.12 retrieving revision 2.60.2.1.2.13 diff -C2 -d -r2.60.2.1.2.12 -r2.60.2.1.2.13 *** patchlevel.h 30 May 2003 13:41:07 -0000 2.60.2.1.2.12 --- patchlevel.h 31 May 2003 03:19:28 -0000 2.60.2.1.2.13 *************** *** 27,31 **** /* Version as a string */ ! #define PY_VERSION "2.2.3" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 27,31 ---- /* Version as a string */ ! #define PY_VERSION "2.2.3+" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From rhettinger@users.sourceforge.net Sat May 31 08:04:18 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 31 May 2003 00:04:18 -0700 Subject: [Python-checkins] python/dist/src/Python ceval.c,2.363,2.364 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv17103/Python Modified Files: ceval.c Log Message: SF bug #733667: kwargs handled incorrectly The fast_function() inlining optimization only applies when there are zero keyword arguments. Index: ceval.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v retrieving revision 2.363 retrieving revision 2.364 diff -C2 -d -r2.363 -r2.364 *** ceval.c 30 May 2003 23:59:44 -0000 2.363 --- ceval.c 31 May 2003 07:04:16 -0000 2.364 *************** *** 3469,3473 **** PCALL(PCALL_FUNCTION); PCALL(PCALL_FAST_FUNCTION); ! if (argdefs == NULL && co->co_argcount == n && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { PyFrameObject *f; --- 3469,3473 ---- PCALL(PCALL_FUNCTION); PCALL(PCALL_FAST_FUNCTION); ! if (argdefs == NULL && co->co_argcount == n && nk==0 && co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { PyFrameObject *f; From rhettinger@users.sourceforge.net Sat May 31 08:04:19 2003 From: rhettinger@users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat, 31 May 2003 00:04:19 -0700 Subject: [Python-checkins] python/dist/src/Lib/test test_extcall.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv17103/Lib/test Modified Files: test_extcall.py Log Message: SF bug #733667: kwargs handled incorrectly The fast_function() inlining optimization only applies when there are zero keyword arguments. Index: test_extcall.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_extcall.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_extcall.py 27 Feb 2003 20:14:49 -0000 1.19 --- test_extcall.py 31 May 2003 07:04:16 -0000 1.20 *************** *** 2,5 **** --- 2,8 ---- from UserList import UserList + def e(a, b): + print a, b + def f(*a, **k): print a, sortdict(k) *************** *** 22,25 **** --- 25,36 ---- f(1, 2, 3, *(4, 5), **{'a':6, 'b':7}) f(1, 2, 3, x=4, y=5, *(6, 7), **{'a':8, 'b':9}) + + # Verify clearing of SF bug #733667 + try: + e(c=3) + except TypeError: + pass + else: + print "should raise TypeError: e() got an unexpected keyword argument 'c'" try: From loewis@users.sourceforge.net Sat May 31 08:55:46 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 31 May 2003 00:55:46 -0700 Subject: [Python-checkins] python/dist/src/Lib BaseHTTPServer.py,1.25,1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv31634 Modified Files: BaseHTTPServer.py Log Message: Patch #744041: Use only first two elements of address to support IPv6. Index: BaseHTTPServer.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/BaseHTTPServer.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** BaseHTTPServer.py 27 Feb 2003 20:14:29 -0000 1.25 --- BaseHTTPServer.py 31 May 2003 07:55:43 -0000 1.26 *************** *** 99,103 **** """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self) ! host, port = self.socket.getsockname() self.server_name = socket.getfqdn(host) self.server_port = port --- 99,103 ---- """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self) ! host, port = self.socket.getsockname()[:2] self.server_name = socket.getfqdn(host) self.server_port = port *************** *** 476,480 **** """ ! host, port = self.client_address return socket.getfqdn(host) --- 476,480 ---- """ ! host, port = self.client_address[:2] return socket.getfqdn(host) From loewis@users.sourceforge.net Sat May 31 08:58:48 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 31 May 2003 00:58:48 -0700 Subject: [Python-checkins] python/dist/src configure,1.402,1.403 configure.in,1.413,1.414 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv32403 Modified Files: configure configure.in Log Message: Modified Patch #745620: build shared lib as ".so" for NetBSD. Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.402 retrieving revision 1.403 diff -C2 -d -r1.402 -r1.403 *** configure 26 May 2003 14:11:52 -0000 1.402 --- configure 31 May 2003 07:58:41 -0000 1.403 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.412 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.413 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for python 2.3. *************** *** 3269,3273 **** RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*|GNU*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' --- 3269,3273 ---- RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*|GNU*|NetBSD*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.413 retrieving revision 1.414 diff -C2 -d -r1.413 -r1.414 *** configure.in 26 May 2003 14:11:55 -0000 1.413 --- configure.in 31 May 2003 07:58:45 -0000 1.414 *************** *** 499,503 **** RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*|GNU*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' --- 499,503 ---- RUNSHARED=LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH ;; ! Linux*|GNU*|NetBSD*) LDLIBRARY='libpython$(VERSION).so' BLDLIBRARY='-L. -lpython$(VERSION)' From loewis@users.sourceforge.net Sat May 31 09:02:40 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 31 May 2003 01:02:40 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.132,1.133 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv850 Modified Files: libfuncs.tex Log Message: Patch #744877: Explain filter in terms of list comprehension. Remove explanation of int in terms of string.atoi. Explain sum in terms of reduce. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** libfuncs.tex 10 May 2003 19:46:39 -0000 1.132 --- libfuncs.tex 31 May 2003 08:02:38 -0000 1.133 *************** *** 440,443 **** --- 440,448 ---- function is assumed, that is, all elements of \var{list} that are false (zero or empty) are removed. + + Note that \code{filter(function, list)} equals + \code{[item for item in list if function(item)]} if function is not + \code{None} and \code{[item for item in list if item]} if function is + None. \end{funcdesc} *************** *** 538,544 **** Convert a string or number to a plain integer. If the argument is a string, it must contain a possibly signed decimal number ! representable as a Python integer, possibly embedded in whitespace; ! this behaves identical to \code{string.atoi(\var{x}\optional{, ! \var{radix}})}. The \var{radix} parameter gives the base for the conversion and may be any integer in the range [2, 36], or zero. If \var{radix} is zero, the proper radix is guessed based on the --- 543,548 ---- Convert a string or number to a plain integer. If the argument is a string, it must contain a possibly signed decimal number ! representable as a Python integer, possibly embedded in whitespace. ! The \var{radix} parameter gives the base for the conversion and may be any integer in the range [2, 36], or zero. If \var{radix} is zero, the proper radix is guessed based on the *************** *** 905,908 **** --- 909,913 ---- to be strings. The fast, correct way to concatenate sequence of strings is by calling \code{''.join(\var{sequence})}. + Note that \code{sum(range(n), m)} equals \code{reduce(operator.add, range(n), m)} \versionadded{2.3} \end{funcdesc} From loewis@users.sourceforge.net Sat May 31 09:05:52 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 31 May 2003 01:05:52 -0700 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex,1.125,1.126 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv1638 Modified Files: libstdtypes.tex Log Message: Patch #744238: Explain that different string types also may compare equal. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.125 retrieving revision 1.126 diff -C2 -d -r1.125 -r1.126 *** libstdtypes.tex 10 May 2003 07:40:56 -0000 1.125 --- libstdtypes.tex 31 May 2003 08:05:49 -0000 1.126 *************** *** 145,149 **** \end{description} ! Objects of different types, except different numeric types, never compare equal; such objects are ordered consistently but arbitrarily (so that sorting a heterogeneous array yields a consistent result). --- 145,149 ---- \end{description} ! Objects of different types, except different numeric types and different string types, never compare equal; such objects are ordered consistently but arbitrarily (so that sorting a heterogeneous array yields a consistent result). From loewis@users.sourceforge.net Sat May 31 09:09:23 2003 From: loewis@users.sourceforge.net (loewis@users.sourceforge.net) Date: Sat, 31 May 2003 01:09:23 -0700 Subject: [Python-checkins] python/dist/src/Lib/distutils unixccompiler.py,1.52,1.53 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv2039 Modified Files: unixccompiler.py Log Message: Patch #740301: Add +s when linking shared libraries on HP-UX, use -L for the library path. Index: unixccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/unixccompiler.py,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** unixccompiler.py 18 Apr 2003 17:27:47 -0000 1.52 --- unixccompiler.py 31 May 2003 08:09:21 -0000 1.53 *************** *** 204,209 **** # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir ! elif compiler[:3] == "gcc" or compiler[:3] == "g++": ! return "-Wl,-R" + dir else: return "-R" + dir --- 204,211 ---- # MacOSX's linker doesn't understand the -R flag at all return "-L" + dir ! elif sys.platform[:5] == "hp-ux": ! return "+s -L" + dir ! elif compiler[:3] == "gcc" or compiler[:3] == "g++": ! return "-Wl,-R" + dir else: return "-R" + dir From jackjansen@users.sourceforge.net Sat May 31 23:09:36 2003 From: jackjansen@users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sat, 31 May 2003 15:09:36 -0700 Subject: [Python-checkins] python/dist/src/Mac/Modules/cf _CFmodule.c,1.21,1.22 cfsupport.py,1.22,1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cf In directory sc8-pr-cvs1:/tmp/cvs-serv29582 Modified Files: _CFmodule.c cfsupport.py Log Message: Forgot the code to initialize the glue for the new CFObj_ routines. Index: _CFmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/_CFmodule.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** _CFmodule.c 27 May 2003 21:39:58 -0000 1.21 --- _CFmodule.c 31 May 2003 22:09:33 -0000 1.22 *************** *** 4348,4351 **** --- 4348,4353 ---- + PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFTypeRefObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFTypeRefObj_Convert); *************** *** 4354,4358 **** PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableStringRef, CFMutableStringRefObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableStringRef, CFMutableStringRefObj_Convert); - PyMac_INIT_TOOLBOX_OBJECT_NEW(CFArrayRef, CFArrayRefObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFArrayRef, CFArrayRefObj_Convert); --- 4356,4359 ---- *************** *** 4364,4368 **** PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableDictionaryRef, CFMutableDictionaryRefObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_NEW(CFURLRef, CFURLRefObj_New); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert); --- 4365,4368 ---- Index: cfsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cf/cfsupport.py,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** cfsupport.py 27 May 2003 21:39:58 -0000 1.22 --- cfsupport.py 31 May 2003 22:09:33 -0000 1.23 *************** *** 195,198 **** --- 195,200 ---- initstuff = initstuff + """ + PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFObj_New); + PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_NEW(CFTypeRef, CFTypeRefObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFTypeRef, CFTypeRefObj_Convert); *************** *** 201,205 **** PyMac_INIT_TOOLBOX_OBJECT_NEW(CFMutableStringRef, CFMutableStringRefObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableStringRef, CFMutableStringRefObj_Convert); - PyMac_INIT_TOOLBOX_OBJECT_NEW(CFArrayRef, CFArrayRefObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFArrayRef, CFArrayRefObj_Convert); --- 203,206 ---- *************** *** 211,215 **** PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFMutableDictionaryRef, CFMutableDictionaryRefObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_NEW(CFURLRef, CFURLRefObj_New); - PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(CFURLRef, CFURLRefObj_Convert); """ --- 212,215 ----