From rhettinger at users.sourceforge.net Mon Dec 1 05:41:04 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 05:41:09 2003 Subject: [Python-checkins] python/dist/src/Lib/encodings bz2_codec.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1:/tmp/cvs-serv4440 Modified Files: bz2_codec.py Log Message: Simplifed the code. Index: bz2_codec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/bz2_codec.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** bz2_codec.py 24 Sep 2003 03:57:36 -0000 1.2 --- bz2_codec.py 1 Dec 2003 10:41:02 -0000 1.3 *************** *** 9,64 **** """ import codecs ! import bz2 # this codec needs the optional bz2 module ! ! ! ### Codec APIs ! ! def bz2_encode(input,errors='strict'): ! ! """ Encodes the object input and returns a tuple (output ! object, length consumed). ! ! errors defines the error handling to apply. It defaults to ! 'strict' handling which is the only currently supported ! error handling for this codec. ! """ assert errors == 'strict' output = bz2.compress(input) return (output, len(input)) ! def bz2_decode(input,errors='strict'): ! ! """ Decodes the object input and returns a tuple (output ! object, length consumed). ! ! input must be an object which provides the bf_getreadbuf ! buffer slot. Python strings, buffer objects and memory ! mapped files are examples of objects providing this slot. ! ! errors defines the error handling to apply. It defaults to ! 'strict' handling which is the only currently supported ! error handling for this codec. ! ! """ assert errors == 'strict' output = bz2.decompress(input) return (output, len(input)) - class Codec(codecs.Codec): - - def encode(self, input, errors='strict'): - return bz2_encode(input, errors) - def decode(self, input, errors='strict'): - return bz2_decode(input, errors) - - class StreamWriter(Codec,codecs.StreamWriter): - pass - - class StreamReader(Codec,codecs.StreamReader): - pass - ### encodings module API def getregentry(): ! return (bz2_encode,bz2_decode,StreamReader,StreamWriter) --- 9,27 ---- """ import codecs ! import bz2 ! def encode(input, errors='strict'): assert errors == 'strict' output = bz2.compress(input) return (output, len(input)) ! def decode(input, errors='strict'): assert errors == 'strict' output = bz2.decompress(input) return (output, len(input)) ### encodings module API def getregentry(): ! return (encode, decode, codecs.StreamReader, codecs.StreamWriter) From rhettinger at users.sourceforge.net Mon Dec 1 08:18:41 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 08:18:44 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_operator.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv29352/Lib/test Modified Files: test_operator.py Log Message: As discussed on python-dev, added two extractor functions to the operator module. Index: test_operator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operator.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_operator.py 18 Jan 2003 23:22:20 -0000 1.11 --- test_operator.py 1 Dec 2003 13:18:39 -0000 1.12 *************** *** 228,231 **** --- 228,270 ---- self.failUnless(operator.is_not(a,c)) + def test_attrgetter(self): + class A: + pass + a = A() + a.name = 'arthur' + f = operator.attrgetter('name') + self.assertEqual(f(a), 'arthur') + f = operator.attrgetter('rank') + self.assertRaises(AttributeError, f, a) + f = operator.attrgetter(2) + self.assertRaises(TypeError, f, a) + self.assertRaises(TypeError, operator.attrgetter) + self.assertRaises(TypeError, operator.attrgetter, 1, 2) + + def test_itemgetter(self): + a = 'ABCDE' + f = operator.itemgetter(2) + self.assertEqual(f(a), 'C') + f = operator.itemgetter(10) + self.assertRaises(IndexError, f, a) + + f = operator.itemgetter('name') + self.assertRaises(TypeError, f, a) + self.assertRaises(TypeError, operator.itemgetter) + self.assertRaises(TypeError, operator.itemgetter, 1, 2) + + d = dict(key='val') + f = operator.itemgetter('key') + self.assertEqual(f(d), 'val') + f = operator.itemgetter('nonkey') + self.assertRaises(KeyError, f, d) + + # example used in the docs + inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)] + getcount = operator.itemgetter(1) + self.assertEqual(map(getcount, inventory), [3, 2, 5, 1]) + self.assertEqual(list.sorted(inventory, key=getcount), + [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]) + def test_main(): test_support.run_unittest(OperatorTestCase) From rhettinger at users.sourceforge.net Mon Dec 1 08:18:41 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 08:18:46 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.903,1.904 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv29352/Misc Modified Files: NEWS Log Message: As discussed on python-dev, added two extractor functions to the operator module. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.903 retrieving revision 1.904 diff -C2 -d -r1.903 -r1.904 *** NEWS 30 Nov 2003 22:10:15 -0000 1.903 --- NEWS 1 Dec 2003 13:18:38 -0000 1.904 *************** *** 105,108 **** --- 105,113 ---- ----------------- + - The operator module has two new functions, attrgetter() and + itemgetter() which are useful for creating fast data extractor + functions for map(), list.sort(), itertools.groupby(), and + other functions that expect a function argument. + - socket.SHUT_{RD,WR,RDWR} was added. From rhettinger at users.sourceforge.net Mon Dec 1 08:18:41 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 08:18:47 2003 Subject: [Python-checkins] python/dist/src/Modules operator.c,2.27,2.28 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv29352/Modules Modified Files: operator.c Log Message: As discussed on python-dev, added two extractor functions to the operator module. Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** operator.c 18 Jan 2003 23:22:20 -0000 2.27 --- operator.c 1 Dec 2003 13:18:39 -0000 2.28 *************** *** 253,257 **** --- 253,468 ---- }; + /* itemgetter object **********************************************************/ + + typedef struct { + PyObject_HEAD + PyObject *item; + } itemgetterobject; + + static PyTypeObject itemgetter_type; + + static PyObject * + itemgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + itemgetterobject *ig; + PyObject *item; + + if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item)) + return NULL; + + /* create itemgetterobject structure */ + ig = PyObject_GC_New(itemgetterobject, &itemgetter_type); + if (ig == NULL) + return NULL; + + Py_INCREF(item); + ig->item = item; + + PyObject_GC_Track(ig); + return (PyObject *)ig; + } + + static void + itemgetter_dealloc(itemgetterobject *ig) + { + PyObject_GC_UnTrack(ig); + Py_XDECREF(ig->item); + PyObject_GC_Del(ig); + } + + static int + itemgetter_traverse(itemgetterobject *ig, visitproc visit, void *arg) + { + if (ig->item) + return visit(ig->item, arg); + return 0; + } + + static PyObject * + itemgetter_call(itemgetterobject *ig, PyObject *args, PyObject *kw) + { + PyObject * obj; + + if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &obj)) + return NULL; + return PyObject_GetItem(obj, ig->item); + } + + PyDoc_STRVAR(itemgetter_doc, + "itemgetter(item) --> itemgetter object\n\ + \n\ + Return a callable object that fetches the given item from its operand.\n\ + After, f=itemgetter(2), the call f(b) returns b[2]."); + static PyTypeObject itemgetter_type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "itertools.itemgetter", /* tp_name */ + sizeof(itemgetterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)itemgetter_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 */ + (ternaryfunc)itemgetter_call, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + itemgetter_doc, /* tp_doc */ + (traverseproc)itemgetter_traverse, /* 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 */ + itemgetter_new, /* tp_new */ + 0, /* tp_free */ + }; + + + /* attrgetter object **********************************************************/ + + typedef struct { + PyObject_HEAD + PyObject *attr; + } attrgetterobject; + + static PyTypeObject attrgetter_type; + + static PyObject * + attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + attrgetterobject *ag; + PyObject *attr; + + if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr)) + return NULL; + + /* create attrgetterobject structure */ + ag = PyObject_GC_New(attrgetterobject, &attrgetter_type); + if (ag == NULL) + return NULL; + + Py_INCREF(attr); + ag->attr = attr; + + PyObject_GC_Track(ag); + return (PyObject *)ag; + } + + static void + attrgetter_dealloc(attrgetterobject *ag) + { + PyObject_GC_UnTrack(ag); + Py_XDECREF(ag->attr); + PyObject_GC_Del(ag); + } + + static int + attrgetter_traverse(attrgetterobject *ag, visitproc visit, void *arg) + { + if (ag->attr) + return visit(ag->attr, arg); + return 0; + } + + static PyObject * + attrgetter_call(attrgetterobject *ag, PyObject *args, PyObject *kw) + { + PyObject * obj; + + if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &obj)) + return NULL; + return PyObject_GetAttr(obj, ag->attr); + } + + PyDoc_STRVAR(attrgetter_doc, + "attrgetter(attr) --> attrgetter object\n\ + \n\ + Return a callable object that fetches the given attribute from its operand.\n\ + After, f=attrgetter('name'), the call f(b) returns b.name."); + + static PyTypeObject attrgetter_type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "itertools.attrgetter", /* tp_name */ + sizeof(attrgetterobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)attrgetter_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 */ + (ternaryfunc)attrgetter_call, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + attrgetter_doc, /* tp_doc */ + (traverseproc)attrgetter_traverse, /* 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 */ + attrgetter_new, /* tp_new */ + 0, /* tp_free */ + }; /* Initialization function for the module (*must* be called initoperator) */ *************** *** 259,264 **** initoperator(void) { ! /* Create the module and add the functions */ ! Py_InitModule4("operator", operator_methods, operator_doc, (PyObject*)NULL, PYTHON_API_VERSION); } --- 470,487 ---- initoperator(void) { ! PyObject *m; ! ! /* Create the module and add the functions */ ! m = Py_InitModule4("operator", operator_methods, operator_doc, (PyObject*)NULL, PYTHON_API_VERSION); + + if (PyType_Ready(&itemgetter_type) < 0) + return; + Py_INCREF(&itemgetter_type); + PyModule_AddObject(m, "itemgetter", (PyObject *)&itemgetter_type); + + if (PyType_Ready(&attrgetter_type) < 0) + return; + Py_INCREF(&attrgetter_type); + PyModule_AddObject(m, "attrgetter", (PyObject *)&attrgetter_type); } From rhettinger at users.sourceforge.net Mon Dec 1 08:18:41 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 08:18:49 2003 Subject: [Python-checkins] python/dist/src/Doc/lib liboperator.tex, 1.29, 1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29352/Doc/lib Modified Files: liboperator.tex Log Message: As discussed on python-dev, added two extractor functions to the operator module. Index: liboperator.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboperator.tex,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** liboperator.tex 27 Nov 2003 19:48:03 -0000 1.29 --- liboperator.tex 1 Dec 2003 13:18:39 -0000 1.30 *************** *** 301,304 **** --- 301,337 ---- + The \module{operator} module also defines tools for generalized attribute + and item lookups. These are useful for making fast field extractors + as arguments for \function{map()}, \method{list.sort()}, + \method{itertools.groupby()}, or other functions that expect a + function argument. + + \begin{funcdesc}{attrgetter}{attr} + Return a callable object that fetches \var{attr} from its operand. + After, \samp{f=attrgetter('name')}, the call \samp{f(b)} returns + \samp{b.name}. + \versionadded{2.4} + \end{funcdesc} + + \begin{funcdesc}{itemgetter}{item} + Return a callable object that fetches \var{item} from its operand. + After, \samp{f=itemgetter(2)}, the call \samp{f(b)} returns + \samp{b[2]}. + \versionadded{2.4} + \end{funcdesc} + + Examples: + + \begin{verbatim} + >>> from operator import * + >>> inventory = [('apple', 3), ('banana', 2), ('pear', 5), ('orange', 1)] + >>> getcount = itemgetter(1) + >>> map(getcount, inventory) + [3, 2, 5, 1] + >>> list.sorted(inventory, key=getcount) + [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] + \end{verbatim} + + \subsection{Mapping Operators to Functions \label{operator-map}} From rhettinger at users.sourceforge.net Mon Dec 1 08:26:48 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 08:26:52 2003 Subject: [Python-checkins] python/dist/src/Lib/encodings bz2_codec.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/encodings In directory sc8-pr-cvs1:/tmp/cvs-serv30883 Modified Files: bz2_codec.py Log Message: Revert previous change. MAL preferred the old version. Index: bz2_codec.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/encodings/bz2_codec.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** bz2_codec.py 1 Dec 2003 10:41:02 -0000 1.3 --- bz2_codec.py 1 Dec 2003 13:26:46 -0000 1.4 *************** *** 9,27 **** """ import codecs ! import bz2 ! def encode(input, errors='strict'): assert errors == 'strict' output = bz2.compress(input) return (output, len(input)) ! def decode(input, errors='strict'): assert errors == 'strict' output = bz2.decompress(input) return (output, len(input)) ### encodings module API def getregentry(): ! return (encode, decode, codecs.StreamReader, codecs.StreamWriter) --- 9,64 ---- """ import codecs ! import bz2 # this codec needs the optional bz2 module ! ! ### Codec APIs ! ! def bz2_encode(input,errors='strict'): ! ! """ Encodes the object input and returns a tuple (output ! object, length consumed). ! ! errors defines the error handling to apply. It defaults to ! 'strict' handling which is the only currently supported ! error handling for this codec. ! ! """ assert errors == 'strict' output = bz2.compress(input) return (output, len(input)) ! def bz2_decode(input,errors='strict'): ! ! """ Decodes the object input and returns a tuple (output ! object, length consumed). ! ! input must be an object which provides the bf_getreadbuf ! buffer slot. Python strings, buffer objects and memory ! mapped files are examples of objects providing this slot. ! ! errors defines the error handling to apply. It defaults to ! 'strict' handling which is the only currently supported ! error handling for this codec. ! ! """ assert errors == 'strict' output = bz2.decompress(input) return (output, len(input)) + class Codec(codecs.Codec): + + def encode(self, input, errors='strict'): + return bz2_encode(input, errors) + def decode(self, input, errors='strict'): + return bz2_decode(input, errors) + + class StreamWriter(Codec,codecs.StreamWriter): + pass + + class StreamReader(Codec,codecs.StreamReader): + pass + ### encodings module API def getregentry(): ! return (bz2_encode,bz2_decode,StreamReader,StreamWriter) From rhettinger at users.sourceforge.net Mon Dec 1 15:12:17 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 1 15:12:23 2003 Subject: [Python-checkins] python/dist/src/Lib pyclbr.py, 1.30, 1.31 inspect.py, 1.48, 1.49 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv15634 Modified Files: pyclbr.py inspect.py Log Message: Apply extract functions instead of lambda. Index: pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pyclbr.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** pyclbr.py 3 Dec 2002 08:14:35 -0000 1.30 --- pyclbr.py 1 Dec 2003 20:12:14 -0000 1.31 *************** *** 44,47 **** --- 44,48 ---- import tokenize # Python tokenizer from token import NAME, DEDENT, NEWLINE + from operator import itemgetter __all__ = ["readmodule", "readmodule_ex", "Class", "Function"] *************** *** 327,332 **** if isinstance(obj, Class): print "class", obj.name, obj.super, obj.lineno ! methods = obj.methods.items() ! methods.sort(lambda a, b: cmp(a[1], b[1])) for name, lineno in methods: if name != "__path__": --- 328,332 ---- if isinstance(obj, Class): print "class", obj.name, obj.super, obj.lineno ! methods = list.sorted(obj.methods.iteritems(), key=itemgetter(1)) for name, lineno in methods: if name != "__path__": Index: inspect.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** inspect.py 16 Oct 2003 05:53:16 -0000 1.48 --- inspect.py 1 Dec 2003 20:12:15 -0000 1.49 *************** *** 30,33 **** --- 30,34 ---- import sys, os, types, string, re, dis, imp, tokenize, linecache + from operator import attrgetter # ----------------------------------------------------------- type-checking *************** *** 554,558 **** """Recursive helper function for getclasstree().""" results = [] ! classes.sort(key=lambda c: c.__name__) for c in classes: results.append((c, c.__bases__)) --- 555,559 ---- """Recursive helper function for getclasstree().""" results = [] ! classes.sort(key=attrgetter('__name__')) for c in classes: results.append((c, c.__bases__)) From loewis at users.sourceforge.net Mon Dec 1 16:04:04 2003 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Dec 1 16:05:28 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.79,1.831.4.80 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv26885/Misc Modified Files: Tag: release23-maint NEWS Log Message: Convert path objects to strings in askdirectory. Fixes #852314. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.79 retrieving revision 1.831.4.80 diff -C2 -d -r1.831.4.79 -r1.831.4.80 *** NEWS 30 Nov 2003 22:10:54 -0000 1.831.4.79 --- NEWS 1 Dec 2003 21:04:02 -0000 1.831.4.80 *************** *** 40,43 **** --- 40,45 ---- ----------------- + - Bug #852314: Fix return type of tkFileDialog.askdirectory on Unix. + - Bug #834676: Fix crashes when normalizing Hangul syllables. From loewis at users.sourceforge.net Mon Dec 1 16:04:04 2003 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Dec 1 16:05:29 2003 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py, 1.11, 1.11.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv26885/Lib/lib-tk Modified Files: Tag: release23-maint tkFileDialog.py Log Message: Convert path objects to strings in askdirectory. Fixes #852314. Index: tkFileDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v retrieving revision 1.11 retrieving revision 1.11.8.1 diff -C2 -d -r1.11 -r1.11.8.1 *** tkFileDialog.py 15 Jun 2003 19:08:57 -0000 1.11 --- tkFileDialog.py 1 Dec 2003 21:04:01 -0000 1.11.8.1 *************** *** 106,109 **** --- 106,115 ---- def _fixresult(self, widget, result): if result: + # convert Tcl path objects to strings + try: + result = result.string + except AttributeError: + # it already is a string + pass # keep directory until next time self.options["initialdir"] = result From loewis at users.sourceforge.net Mon Dec 1 16:04:25 2003 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Mon Dec 1 16:05:42 2003 Subject: [Python-checkins] python/dist/src/Lib/lib-tk tkFileDialog.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/lib-tk In directory sc8-pr-cvs1:/tmp/cvs-serv27027/Lib/lib-tk Modified Files: tkFileDialog.py Log Message: Convert path objects to strings in askdirectory. Fixes #852314. Backported to 2.3. Index: tkFileDialog.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/lib-tk/tkFileDialog.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** tkFileDialog.py 15 Jun 2003 19:08:57 -0000 1.11 --- tkFileDialog.py 1 Dec 2003 21:04:22 -0000 1.12 *************** *** 106,109 **** --- 106,115 ---- def _fixresult(self, widget, result): if result: + # convert Tcl path objects to strings + try: + result = result.string + except AttributeError: + # it already is a string + pass # keep directory until next time self.options["initialdir"] = result From tim_one at users.sourceforge.net Mon Dec 1 16:35:29 2003 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Dec 1 16:35:38 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.904,1.905 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv32594/Misc Modified Files: NEWS Log Message: Py_Finalize(): disabled the second call of cyclic gc, and added extensive comments about why both calls to cyclic gc here can cause problems. I'll backport to 2.3 maint. Since the calls were introduced in 2.3, that will be the end of it. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.904 retrieving revision 1.905 diff -C2 -d -r1.904 -r1.905 *** NEWS 1 Dec 2003 13:18:38 -0000 1.904 --- NEWS 1 Dec 2003 21:35:25 -0000 1.905 *************** *** 13,16 **** --- 13,26 ---- ----------------- + - At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage + collection twice, both before and after tearing down modules. The + call after tearing down modules has been disabled, because too much + of Python has been torn down then for __del__ methods and weakref + callbacks to execute sanely. The most common symptom was a sequence + of uninformative messages on stderr when Python shut down, produced + by threads trying to raise exceptions, but unable to report the nature + of their problems because too much of the sys module had already been + destroyed. + - Removed FutureWarnings related to hex/oct literals and conversions and left shifts. (Thanks to Kalle Svensson for SF patch 849227.) From tim_one at users.sourceforge.net Mon Dec 1 16:35:30 2003 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Dec 1 16:36:52 2003 Subject: [Python-checkins] python/dist/src/Python pythonrun.c,2.201,2.202 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv32594/Python Modified Files: pythonrun.c Log Message: Py_Finalize(): disabled the second call of cyclic gc, and added extensive comments about why both calls to cyclic gc here can cause problems. I'll backport to 2.3 maint. Since the calls were introduced in 2.3, that will be the end of it. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.201 retrieving revision 2.202 diff -C2 -d -r2.201 -r2.202 *** pythonrun.c 20 Nov 2003 01:44:58 -0000 2.201 --- pythonrun.c 1 Dec 2003 21:35:27 -0000 2.202 *************** *** 330,334 **** /* Collect garbage. This may call finalizers; it's nice to call these ! before all modules are destroyed. */ PyGC_Collect(); --- 330,344 ---- /* Collect garbage. This may call finalizers; it's nice to call these ! * before all modules are destroyed. ! * XXX If a __del__ or weakref callback is triggered here, and tries to ! * XXX import a module, bad things can happen, because Python no ! * XXX longer believes it's initialized. ! * XXX Fatal Python error: Interpreter not initialized (version mismatch?) ! * XXX is easy to provoke that way. I've also seen, e.g., ! * XXX Exception exceptions.ImportError: 'No module named sha' ! * XXX in ignored ! * XXX but I'm unclear on exactly how that one happens. In any case, ! * XXX I haven't seen a real-life report of either of these. ! */ PyGC_Collect(); *************** *** 337,342 **** /* Collect final garbage. This disposes of cycles created by ! new-style class definitions, for example. */ PyGC_Collect(); /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ --- 347,367 ---- /* Collect final garbage. This disposes of cycles created by ! * new-style class definitions, for example. ! * XXX This is disabled because it caused too many problems. If ! * XXX a __del__ or weakref callback triggers here, Python code has ! * XXX a hard time running, because even the sys module has been ! * XXX cleared out (sys.stdout is gone, sys.excepthook is gone, etc). ! * XXX One symptom is a sequence of information-free messages ! * XXX coming from threads (if a __del__ or callback is invoked, ! * XXX other threads can execute too, and any exception they encounter ! * XXX triggers a comedy of errors as subsystem after subsystem ! * XXX fails to find what it *expects* to find in sys to help report ! * XXX the exception and consequent unexpected failures). I've also ! * XXX seen segfaults then, after adding print statements to the ! * XXX Python code getting called. ! */ ! #if 0 PyGC_Collect(); + #endif /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ From tim_one at users.sourceforge.net Mon Dec 1 17:13:14 2003 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Dec 1 17:13:17 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.80,1.831.4.81 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv8447/Misc Modified Files: Tag: release23-maint NEWS Log Message: Py_Finalize(): disabled the second call of cyclic gc, and added extensive comments about why both calls to cyclic gc here can cause problems. Already fixed on the trunk. Since the calls were introduced in 2.3, that's the end of it. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.80 retrieving revision 1.831.4.81 diff -C2 -d -r1.831.4.80 -r1.831.4.81 *** NEWS 1 Dec 2003 21:04:02 -0000 1.831.4.80 --- NEWS 1 Dec 2003 22:13:11 -0000 1.831.4.81 *************** *** 34,37 **** --- 34,47 ---- This has been repaired. + - At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage + collection twice, both before and after tearing down modules. The + call after tearing down modules has been disabled, because too much + of Python has been torn down then for __del__ methods and weakref + callbacks to execute sanely. The most common symptom was a sequence + of uninformative messages on stderr when Python shut down, produced + by threads trying to raise exceptions, but unable to report the nature + of their problems because too much of the sys module had already been + destroyed. + - Patch #820195: object.__contains__() now returns True or False instead of 1 or 0. From tim_one at users.sourceforge.net Mon Dec 1 17:13:14 2003 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Dec 1 17:13:19 2003 Subject: [Python-checkins] python/dist/src/Python pythonrun.c, 2.195.6.3, 2.195.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv8447/Python Modified Files: Tag: release23-maint pythonrun.c Log Message: Py_Finalize(): disabled the second call of cyclic gc, and added extensive comments about why both calls to cyclic gc here can cause problems. Already fixed on the trunk. Since the calls were introduced in 2.3, that's the end of it. Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.195.6.3 retrieving revision 2.195.6.4 diff -C2 -d -r2.195.6.3 -r2.195.6.4 *** pythonrun.c 13 Nov 2003 07:42:13 -0000 2.195.6.3 --- pythonrun.c 1 Dec 2003 22:13:12 -0000 2.195.6.4 *************** *** 333,337 **** /* Collect garbage. This may call finalizers; it's nice to call these ! before all modules are destroyed. */ PyGC_Collect(); --- 333,347 ---- /* Collect garbage. This may call finalizers; it's nice to call these ! * before all modules are destroyed. ! * XXX If a __del__ or weakref callback is triggered here, and tries to ! * XXX import a module, bad things can happen, because Python no ! * XXX longer believes it's initialized. ! * XXX Fatal Python error: Interpreter not initialized (version mismatch?) ! * XXX is easy to provoke that way. I've also seen, e.g., ! * XXX Exception exceptions.ImportError: 'No module named sha' ! * XXX in ignored ! * XXX but I'm unclear on exactly how that one happens. In any case, ! * XXX I haven't seen a real-life report of either of these. ! */ PyGC_Collect(); *************** *** 340,345 **** /* Collect final garbage. This disposes of cycles created by ! new-style class definitions, for example. */ PyGC_Collect(); /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ --- 350,370 ---- /* Collect final garbage. This disposes of cycles created by ! * new-style class definitions, for example. ! * XXX This is disabled because it caused too many problems. If ! * XXX a __del__ or weakref callback triggers here, Python code has ! * XXX a hard time running, because even the sys module has been ! * XXX cleared out (sys.stdout is gone, sys.excepthook is gone, etc). ! * XXX One symptom is a sequence of information-free messages ! * XXX coming from threads (if a __del__ or callback is invoked, ! * XXX other threads can execute too, and any exception they encounter ! * XXX triggers a comedy of errors as subsystem after subsystem ! * XXX fails to find what it *expects* to find in sys to help report ! * XXX the exception and consequent unexpected failures). I've also ! * XXX seen segfaults then, after adding print statements to the ! * XXX Python code getting called. ! */ ! #if 0 PyGC_Collect(); + #endif /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ From gvanrossum at users.sourceforge.net Mon Dec 1 20:22:52 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon Dec 1 20:22:56 2003 Subject: [Python-checkins] python/nondist/peps pep-0237.txt,1.16,1.17 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv13682 Modified Files: pep-0237.txt Log Message: Record recent changes of heart (see python-dev): - No warnings for operations that changed semantics between 2.3 and 2.4. - Trailing 'L' remains in repr() of long ints until Python 3.0. Index: pep-0237.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0237.txt,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** pep-0237.txt 7 Nov 2002 15:41:19 -0000 1.16 --- pep-0237.txt 2 Dec 2003 01:22:50 -0000 1.17 *************** *** 117,133 **** - Currently, repr() of a long int returns a string ending in 'L' ! while repr() of a short int doesn't. The 'L' will be dropped. - Currently, an operation with long operands will never return a short int. This *may* change, since it allows some ! optimization. - The expression type(x).__name__ depends on whether x is a short or a long int. Since implementation alternative 2 is chosen, ! this difference will remain. - Long and short ints are handled different by the marshal module, and by the pickle and cPickle modules. This difference will ! remain. - Short ints with small values (typically between -1 and 99 --- 117,138 ---- - Currently, repr() of a long int returns a string ending in 'L' ! while repr() of a short int doesn't. The 'L' will be dropped; ! but not before Python 3.0. - Currently, an operation with long operands will never return a short int. This *may* change, since it allows some ! optimization. (No changes have been made in this area yet, and ! none are planned.) - The expression type(x).__name__ depends on whether x is a short or a long int. Since implementation alternative 2 is chosen, ! this difference will remain. (In Python 3.0, we *may* be able ! to deploy a trick to hide the difference, because it *is* ! annoying to reveal the difference to user code, and more so as ! the difference between the two types is less visible.) - Long and short ints are handled different by the marshal module, and by the pickle and cPickle modules. This difference will ! remain (at least until Python 3.0). - Short ints with small values (typically between -1 and 99 *************** *** 147,150 **** --- 152,158 ---- any meaning, and will be eventually become illegal. The compiler will choose the appropriate type solely based on the value. + (Until Python 3.0, it will force the literal to be a long; but + literals without a trailing 'L' may also be long, if they are not + representable as short ints.) *************** *** 152,160 **** The function int() will return a short or a long int depending on ! the argument value. The function long() will call the function ! int(). The built-in name 'long' will remain in the language to ! represent the long implementation type, but using the int() ! function is still recommended, since it will automatically return ! a long when needed. --- 160,170 ---- The function int() will return a short or a long int depending on ! the argument value. In Python 3.0, the function long() will call ! the function int(); before then, it will continue to force the ! result to be a long int, but otherwise work the same way as int(). ! The built-in name 'long' will remain in the language to represent ! the long implementation type (unless it is completely eradicated ! in Python 3.0), but using the int() function is still recommended, ! since it will automatically return a long when needed. *************** *** 162,166 **** The C API remains unchanged; C code will still need to be aware of ! the difference between short and long ints. The PyArg_Parse*() APIs already accept long ints, as long as they --- 172,177 ---- The C API remains unchanged; C code will still need to be aware of ! the difference between short and long ints. (The Python 3.0 C API ! will probably be completely incompatible.) The PyArg_Parse*() APIs already accept long ints, as long as they *************** *** 172,176 **** Transition ! There are two major phases to the transition: A. Short int operations that currently raise OverflowError return --- 183,187 ---- Transition ! There are three major phases to the transition: A. Short int operations that currently raise OverflowError return *************** *** 187,203 **** issued at this point, but this is off by default. ! B. The remaining semantic differences are addressed. In most ! cases the long int semantics will prevail; however, the ! trailing 'L' from long int representations will be dropped. ! Eventually, support for integer literals with a trailing 'L' ! will be removed. Since this will introduce backwards ! incompatibilities which will break some old code, this phase ! may require a future statement and/or warnings, and a ! prolonged transition phase. Phase A will be implemented in Python 2.2. ! Phase B will be implemented starting with Python 2.3. Envisioned ! stages of phase B: B0. Warnings are enabled about operations that will change their --- 198,215 ---- issued at this point, but this is off by default. ! B. The remaining semantic differences are addressed. In all cases ! the long int semantics will prevail. Since this will introduce ! backwards incompatibilities which will break some old code, ! this phase may require a future statement and/or warnings, and ! a prolonged transition phase. The trailing 'L' will continue ! to be used for longs as input and by repr(). ! ! C. The trailing 'L' is dropped from repr(), and made illegal on ! input. (If possible, the 'long' type completely disappears.) Phase A will be implemented in Python 2.2. ! Phase B will be implemented gradually in Python 2.3 and Python ! 2.4. Envisioned stages of phase B: B0. Warnings are enabled about operations that will change their *************** *** 205,223 **** '%u', '%x', '%X' and '%o', hex and oct literals in the (inclusive) range [sys.maxint+1, sys.maxint*2+1], and left ! shifts losing bits; but not repr() of a long. ! ! B1. The remaining semantic differences are addressed. Operations ! that give different results than before will issue a warning ! that is on by default. A warning for the use of long literals ! (with a trailing 'L') may be enabled through a command line ! option, but it is off by default. ! ! B2. (This stage is deleted.) ! ! B3. The warnings about operations that give different results than ! before are turned off by default. ! B4. Long literals are no longer legal. All warnings related to ! this issue are gone. We propose the following timeline: --- 217,225 ---- '%u', '%x', '%X' and '%o', hex and oct literals in the (inclusive) range [sys.maxint+1, sys.maxint*2+1], and left ! shifts losing bits. ! B1. The new semantic for these operations are implemented. ! Operations that give different results than before will *not* ! issue a warning. We propose the following timeline: *************** *** 227,235 **** B1. Python 2.4. ! B2. (Not applicable.) ! ! B3. The rest of the Python 2.x line. ! ! B4. Python 3.0 (at least two years in the future). --- 229,234 ---- B1. Python 2.4. ! Phase C will be implemented in Python 3.0 (at least two years ! after Python 2.4 is released). *************** *** 323,329 **** Implementation ! A complete implementation of phase A is present in the current CVS ! tree and will be released with Python 2.2a3. (It didn't make it ! into 2.2a2.) Still missing are documentation and a test suite. --- 322,329 ---- Implementation ! The implementation work for the Python 2.x line is completed; ! phase A was released with Python 2.2, phase B0 with Python 2.3, ! and phase B1 will be released with Python 2.4 (and is already in ! CVS). From jhylton at users.sourceforge.net Tue Dec 2 00:53:45 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 00:53:49 2003 Subject: [Python-checkins] python/dist/src/Python ast.c, 1.1.2.34, 1.1.2.35 newcompile.c, 1.1.2.55, 1.1.2.56 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv22363/Python Modified Files: Tag: ast-branch ast.c newcompile.c Log Message: Add support for calls with *args and **kwargs. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.34 retrieving revision 1.1.2.35 diff -C2 -d -r1.1.2.34 -r1.1.2.35 *** ast.c 15 Oct 2003 06:19:31 -0000 1.1.2.34 --- ast.c 2 Dec 2003 05:53:43 -0000 1.1.2.35 *************** *** 1150,1153 **** --- 1150,1154 ---- asdl_seq *args = NULL; asdl_seq *keywords = NULL; + expr_ty vararg = NULL, kwarg = NULL; REQ(n, arglist); *************** *** 1201,1208 **** } } } /* XXX syntax error if more than 255 arguments */ ! return Call(func, args, keywords, NULL, NULL); error: --- 1202,1217 ---- } } + else if (TYPE(ch) == STAR) { + vararg = ast_for_expr(CHILD(n, i+1)); + i++; + } + else if (TYPE(ch) == DOUBLESTAR) { + kwarg = ast_for_expr(CHILD(n, i+1)); + i++; + } } /* XXX syntax error if more than 255 arguments */ ! return Call(func, args, keywords, vararg, kwarg); error: Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.55 retrieving revision 1.1.2.56 diff -C2 -d -r1.1.2.55 -r1.1.2.56 *** newcompile.c 24 Nov 2003 04:14:34 -0000 1.1.2.55 --- newcompile.c 2 Dec 2003 05:53:43 -0000 1.1.2.56 *************** *** 1622,1625 **** --- 1622,1658 ---- static int + compiler_call(struct compiler *c, expr_ty e) + { + int n, code = 0; + + VISIT(c, expr, e->v.Call.func); + n = asdl_seq_LEN(e->v.Call.args); + if (e->v.Call.starargs) { + VISIT(c, expr, e->v.Call.starargs); + code |= 1; + } + if (e->v.Call.kwargs) { + VISIT(c, expr, e->v.Call.kwargs); + code |= 2; + } + VISIT_SEQ(c, expr, e->v.Call.args); + switch (code) { + case 0: + ADDOP_I(c, CALL_FUNCTION, n); + break; + case 1: + ADDOP_I(c, CALL_FUNCTION_VAR, n); + break; + case 2: + ADDOP_I(c, CALL_FUNCTION_KW, n); + break; + case 3: + ADDOP_I(c, CALL_FUNCTION_VAR_KW, n); + break; + } + return 1; + } + + static int compiler_listcomp_generator(struct compiler *c, listcomp_ty l, expr_ty elt) { *************** *** 1739,1748 **** return compiler_compare(c, e); case Call_kind: ! VISIT(c, expr, e->v.Call.func); ! n = asdl_seq_LEN(e->v.Call.args); ! /* XXX other args */ ! VISIT_SEQ(c, expr, e->v.Call.args); ! ADDOP_I(c, CALL_FUNCTION, n); ! break; case Repr_kind: VISIT(c, expr, e->v.Repr.value); --- 1772,1776 ---- return compiler_compare(c, e); case Call_kind: ! return compiler_call(c, e); case Repr_kind: VISIT(c, expr, e->v.Repr.value); From jhylton at users.sourceforge.net Tue Dec 2 01:47:39 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 01:47:42 2003 Subject: [Python-checkins] python/dist/src/Lib site.py,1.53.6.1,1.53.6.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv30842 Modified Files: Tag: release23-maint site.py Log Message: A hack: Disable import of re, because sre doesn't compile right. DON'T MERGE THIS CHANGE TO THE TRUNK. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.53.6.1 retrieving revision 1.53.6.2 diff -C2 -d -r1.53.6.1 -r1.53.6.2 *** site.py 20 Oct 2003 14:34:46 -0000 1.53.6.1 --- site.py 2 Dec 2003 06:47:37 -0000 1.53.6.2 *************** *** 92,96 **** if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): ! from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s) --- 92,98 ---- if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): ! ## from distutils.util import get_platform ! def get_platform(): ! return "linux-i686" s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s) From jhylton at users.sourceforge.net Tue Dec 2 01:54:30 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 01:54:33 2003 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.35,1.1.2.36 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv31586 Modified Files: Tag: ast-branch ast.c Log Message: Probable fix for set_context(). It was complaining about types that don't have a context attribute, but I think it's expected to ignore these expression types. My memory is hazy. Change comparisons so -1 is second. No way. Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.35 retrieving revision 1.1.2.36 diff -C2 -d -r1.1.2.35 -r1.1.2.36 *** ast.c 2 Dec 2003 05:53:43 -0000 1.1.2.35 --- ast.c 2 Dec 2003 06:54:28 -0000 1.1.2.36 *************** *** 278,284 **** break; default: ! PyErr_Format(PyExc_SyntaxError, "can't set context for %d", ! e->kind); ! return -1; } if (s) { --- 278,286 ---- break; default: ! /* XXX It's not clear why were't getting into this code, ! although list comps seem like one possibility. ! */ ! fprintf(stderr, "can't set context for %d\n", e->kind); ! return 0; } if (s) { *************** *** 327,331 **** default: PyErr_Format(PyExc_Exception, "invalid augassign: %s", STR(n)); ! return NULL; } } --- 329,333 ---- default: PyErr_Format(PyExc_Exception, "invalid augassign: %s", STR(n)); ! return 0; } } *************** *** 362,366 **** PyErr_Format(PyExc_Exception, "invalid comp_op: %s", STR(n)); ! return NULL; } } --- 364,368 ---- PyErr_Format(PyExc_Exception, "invalid comp_op: %s", STR(n)); ! return 0; } } *************** *** 376,385 **** PyErr_Format(PyExc_Exception, "invalid comp_op: %s %s", STR(CHILD(n, 0)), STR(CHILD(n, 1))); ! return NULL; } } PyErr_Format(PyExc_Exception, "invalid comp_op: has %d children", NCH(n)); ! return NULL; } --- 378,387 ---- PyErr_Format(PyExc_Exception, "invalid comp_op: %s %s", STR(CHILD(n, 0)), STR(CHILD(n, 1))); ! return 0; } } PyErr_Format(PyExc_Exception, "invalid comp_op: has %d children", NCH(n)); ! return 0; } *************** *** 623,626 **** --- 625,630 ---- node *ch; + fprintf(stderr, "listcomp at %d\n", n->n_lineno); + REQ(n, listmaker); assert(NCH(n) > 1); *************** *** 630,638 **** return NULL; ! if (-1 == set_context(elt, Load)) return NULL; n_fors = count_list_fors(n); ! if (-1 == n_fors) return NULL; --- 634,644 ---- return NULL; ! if (set_context(elt, Load) == -1) { ! fprintf(stderr, "XXX 2\n"); return NULL; + } n_fors = count_list_fors(n); ! if (n_fors == -1) return NULL; *************** *** 678,682 **** ch = CHILD(ch, 4); n_ifs = count_list_ifs(ch); ! if (-1 == n_ifs) { asdl_seq_free(listcomps); return NULL; --- 684,688 ---- ch = CHILD(ch, 4); n_ifs = count_list_ifs(ch); ! if (n_ifs == -1) { asdl_seq_free(listcomps); return NULL; *************** *** 1295,1299 **** } tmp = set_context(e, Store); ! if (-1 == tmp) { asdl_seq_free(targets); return NULL; --- 1301,1305 ---- } tmp = set_context(e, Store); ! if (tmp == -1) { asdl_seq_free(targets); return NULL; *************** *** 1360,1364 **** if (context) { int context_result = set_context(e, context); ! if (-1 == context_result) return NULL; } --- 1366,1370 ---- if (context) { int context_result = set_context(e, context); ! if (context_result == -1) return NULL; } *************** *** 1971,1975 **** if (!e) return NULL; ! if (-1 == set_context(e, Store)) return NULL; expression = ast_for_expr(CHILD(exc, 1)); --- 1977,1981 ---- if (!e) return NULL; ! if (set_context(e, Store) == -1) return NULL; expression = ast_for_expr(CHILD(exc, 1)); From jhylton at users.sourceforge.net Tue Dec 2 01:58:39 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 01:58:42 2003 Subject: [Python-checkins] python/dist/src/Include symtable.h, 2.9.18.8, 2.9.18.9 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv32005 Modified Files: Tag: ast-branch symtable.h Log Message: Add flags for CO_VARARGS and CO_VARKEYWORDS. Index: symtable.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/symtable.h,v retrieving revision 2.9.18.8 retrieving revision 2.9.18.9 diff -C2 -d -r2.9.18.8 -r2.9.18.9 *** symtable.h 28 Apr 2003 17:32:47 -0000 2.9.18.8 --- symtable.h 2 Dec 2003 06:58:37 -0000 2.9.18.9 *************** *** 36,39 **** --- 36,41 ---- including free refs to globals */ int ste_generator : 1; /* true if namespace is a generator */ + int ste_varargs : 1; /* true if block has varargs */ + int ste_varkeywords : 1; /* true if block has varkeywords */ int ste_lineno; /* first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ From jhylton at users.sourceforge.net Tue Dec 2 02:01:24 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 02:01:27 2003 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.56, 1.1.2.57 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv32465 Modified Files: Tag: ast-branch newcompile.c Log Message: Off-by-one in assertion. Thread CO_ flags through from symbol table. Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.56 retrieving revision 1.1.2.57 diff -C2 -d -r1.1.2.56 -r1.1.2.57 *** newcompile.c 2 Dec 2003 05:53:43 -0000 1.1.2.56 --- newcompile.c 2 Dec 2003 07:01:20 -0000 1.1.2.57 *************** *** 2207,2211 **** a->a_lnotab_off += ncodes * 2; } ! assert(d_bytecode < 255); if (d_lineno > 255) { int i, nbytes, ncodes = d_lineno / 255; --- 2207,2211 ---- a->a_lnotab_off += ncodes * 2; } ! assert(d_bytecode <= 255); if (d_lineno > 255) { int i, nbytes, ncodes = d_lineno / 255; *************** *** 2368,2371 **** --- 2368,2375 ---- flags |= CO_GENERATOR; } + if (ste->ste_varargs) + flags |= CO_VARARGS; + if (ste->ste_varkeywords) + flags |= CO_VARKEYWORDS; return flags; } From jhylton at users.sourceforge.net Tue Dec 2 02:04:54 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 02:04:57 2003 Subject: [Python-checkins] python/dist/src/Python symtable.c, 2.10.8.15, 2.10.8.16 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv472 Modified Files: Tag: ast-branch symtable.c Log Message: Set flags for CO_VARARGS and CO_VARKEYWORDS. Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.15 retrieving revision 2.10.8.16 diff -C2 -d -r2.10.8.15 -r2.10.8.16 *** symtable.c 1 Apr 2003 22:13:31 -0000 2.10.8.15 --- symtable.c 2 Dec 2003 07:04:51 -0000 2.10.8.16 *************** *** 888,895 **** if (a->args && !symtable_visit_params(st, a->args, 1)) return 0; ! if (a->vararg && !symtable_add_def(st, a->vararg, DEF_PARAM)) return 0; ! if (a->kwarg && !symtable_add_def(st, a->kwarg, DEF_PARAM)) return 0; return 1; } --- 888,901 ---- if (a->args && !symtable_visit_params(st, a->args, 1)) return 0; ! if (a->vararg) { ! if (!symtable_add_def(st, a->vararg, DEF_PARAM)) return 0; ! st->st_cur->ste_varargs = 1; ! } ! if (a->kwarg) { ! if (!symtable_add_def(st, a->kwarg, DEF_PARAM)) return 0; + st->st_cur->ste_varkeywords = 1; + } return 1; } From rhettinger at users.sourceforge.net Tue Dec 2 02:38:35 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 2 02:38:39 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.212,1.213 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv5077 Modified Files: tut.tex Log Message: Convert a 0/1 to False/True. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.212 retrieving revision 1.213 diff -C2 -d -r1.212 -r1.213 *** tut.tex 26 Nov 2003 17:52:45 -0000 1.212 --- tut.tex 2 Dec 2003 07:38:30 -0000 1.213 *************** *** 1421,1426 **** while True: ok = raw_input(prompt) ! if ok in ('y', 'ye', 'yes'): return 1 ! if ok in ('n', 'no', 'nop', 'nope'): return 0 retries = retries - 1 if retries < 0: raise IOError, 'refusenik user' --- 1421,1426 ---- while True: ok = raw_input(prompt) ! if ok in ('y', 'ye', 'yes'): return True ! if ok in ('n', 'no', 'nop', 'nope'): return False retries = retries - 1 if retries < 0: raise IOError, 'refusenik user' From rhettinger at users.sourceforge.net Tue Dec 2 02:48:18 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 2 02:48:23 2003 Subject: [Python-checkins] python/dist/src/Lib keyword.py,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6662 Modified Files: keyword.py Log Message: SF patch #852140: keyword.py - use __contains__ and bool Use a set instead of dict with values equal to one. Index: keyword.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/keyword.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** keyword.py 30 Oct 2002 05:17:22 -0000 1.12 --- keyword.py 2 Dec 2003 07:48:15 -0000 1.13 *************** *** 47,55 **** ] ! kwdict = {} ! for keyword in kwlist: ! kwdict[keyword] = 1 ! ! iskeyword = kwdict.has_key def main(): --- 47,51 ---- ] ! iskeyword = frozenset(kwlist).__contains__ def main(): From aimacintyre at users.sourceforge.net Tue Dec 2 07:18:02 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:18:07 2003 Subject: [Python-checkins] python/dist/src/Lib/distutils emxccompiler.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv2895 Modified Files: emxccompiler.py Log Message: use same compiler switches as core for extensions Index: emxccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/emxccompiler.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** emxccompiler.py 14 Nov 2002 02:25:41 -0000 1.10 --- emxccompiler.py 2 Dec 2003 12:17:59 -0000 1.11 *************** *** 64,69 **** # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. ! self.set_executables(compiler='gcc -Zomf -Zmt -O2 -Wall', ! compiler_so='gcc -Zomf -Zmt -O2 -Wall', linker_exe='gcc -Zomf -Zmt -Zcrtdll', linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') --- 64,69 ---- # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. ! self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ! compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', linker_exe='gcc -Zomf -Zmt -Zcrtdll', linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') From aimacintyre at users.sourceforge.net Tue Dec 2 07:21:22 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:21:25 2003 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.14,1.15 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv3201 Modified Files: Makefile Log Message: - add build support for curses extension to be a normal DLL as well as a Python extension, so that the curses_panel extension works. - minor compiler switch tweak. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Makefile 16 Jul 2003 13:31:11 -0000 1.14 --- Makefile 2 Dec 2003 12:21:20 -0000 1.15 *************** *** 92,96 **** LDFLAGS+= -g else ! CFLAGS+= -s -O3 -fomit-frame-pointer LDFLAGS+= -s endif --- 92,96 ---- LDFLAGS+= -g else ! CFLAGS+= -s -O3 -fomit-frame-pointer -mprobe LDFLAGS+= -s endif *************** *** 114,117 **** --- 114,118 ---- # File extensions MODULE.EXT= .pyd + MODLIB.EXT= .dll ifeq ($(OMF),yes) O= .obj *************** *** 254,258 **** DESCRIPTION.readline$(MODULE.EXT)= Python Extension DLL for access to GNU ReadLine library DESCRIPTION.bsddb185$(MODULE.EXT)= Python Extension DLL for access to BSD DB (v1.85) library ! DESCRIPTION._curses$(MODULE.EXT)= Python Extension DLL for access to ncurses library DESCRIPTION.pyexpat$(MODULE.EXT)= Python Extension DLL for access to expat library DESCRIPTION.bz2$(MODULE.EXT)= Python Extension DLL for accessing the bz2 compression library --- 255,259 ---- DESCRIPTION.readline$(MODULE.EXT)= Python Extension DLL for access to GNU ReadLine library DESCRIPTION.bsddb185$(MODULE.EXT)= Python Extension DLL for access to BSD DB (v1.85) library ! DESCRIPTION._curses$(MODLIB.EXT)= Python Extension DLL for access to ncurses library DESCRIPTION.pyexpat$(MODULE.EXT)= Python Extension DLL for access to expat library DESCRIPTION.bz2$(MODULE.EXT)= Python Extension DLL for accessing the bz2 compression library *************** *** 430,433 **** --- 431,438 ---- unicoded + # Python modules that are used as libraries and therefore must use + # a .DLL extension + LIBEXTMODULES= + # Python external ($(MODULE.EXT)) modules - can be EASY or HARD ifeq ($(HAVE_ZLIB),yes) *************** *** 452,456 **** endif ifeq ($(HAVE_NCURSES),yes) ! HARDEXTMODULES+= _curses _curses_ endif ifeq ($(HAVE_GDBM),yes) --- 457,462 ---- endif ifeq ($(HAVE_NCURSES),yes) ! LIBEXTMODULES+= _curses ! HARDEXTMODULES+= _curses_ endif ifeq ($(HAVE_GDBM),yes) *************** *** 474,477 **** --- 480,484 ---- EXTERNDLLS= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(EASYEXTMODULES))) EXTERNDLLS+= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(HARDEXTMODULES))) + EXTERNDLLS+= $(addsuffix $(MODLIB.EXT),$(patsubst %module,%,$(LIBEXTMODULES))) # Targets *************** *** 584,588 **** @echo Creating .DEF file: $@ @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@ ! @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODULE.EXT))$(DQUOTE) >>$@ @echo DATA MULTIPLE NONSHARED >>$@ @echo EXPORTS >>$@ --- 591,595 ---- @echo Creating .DEF file: $@ @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@ ! @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODLIB.EXT))$(DQUOTE) >>$@ @echo DATA MULTIPLE NONSHARED >>$@ @echo EXPORTS >>$@ *************** *** 610,614 **** @echo init_curses_panel >>$@ ! _curses$(MODULE.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses --- 617,621 ---- @echo init_curses_panel >>$@ ! _curses$(MODLIB.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses From aimacintyre at users.sourceforge.net Tue Dec 2 07:23:09 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:23:12 2003 Subject: [Python-checkins] python/dist/src/PC/os2emx README.os2emx,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv3677 Modified Files: README.os2emx Log Message: - add notes about os.link() emulation; - various minor cleanups and updates. Index: README.os2emx =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/README.os2emx,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** README.os2emx 16 Jul 2003 13:31:11 -0000 1.7 --- README.os2emx 2 Dec 2003 12:23:07 -0000 1.8 *************** *** 1,3 **** ! This is a port of Python 2.3 to OS/2 using the EMX development tools ========================================================================= --- 1,3 ---- ! This is a port of Python 2.4 to OS/2 using the EMX development tools ========================================================================= *************** *** 5,24 **** ------------------------------------- ! This release of the port incorporates the following changes from the ! October 24, 2002 release of the Python 2.2.2 port: ! ! - based on the Python v2.3 final release source. ! - now setting higher number of file handles (250). ! - defaults to building with PyMalloc enabled (Python 2.3 default). ! - the port is now maintained in the Python CVS repository. ! - most standard modules are now built into the core Python DLL. ! ! Python 2.3 incorporates several changes which have resolved the ! longstanding problems the EMX port has had with test_longexp. ! ! Python 2.3 introduces changes to the Berkeley DB support, as a result of ! the PyBSDDB3 module (for the Sleepycat DB 3.3.x/4.0.x/4.1.x library) ! being imported into Python's standard library - see "YOU HAVE BEEN WARNED" ! items 4 & 5 for more information. --- 5,9 ---- ------------------------------------- ! Another day, another version... *************** *** 26,34 **** -------------------------------------- ! Please read the file README.Python-2.3 included in this package for ! information about Python 2.3. This file is the README file from the ! Python 2.3 source distribution available via http://www.python.org/ ! and its mirrors. The file LICENCE.Python-2.3 is the text of the Licence ! from the Python 2.3 source distribution. Note that the EMX package that this package depends on is released under --- 11,19 ---- -------------------------------------- ! Please read the file README.Python-2.4 included in this package for ! information about Python 2.4. This file is the README file from the ! Python 2.4 source distribution available via http://www.python.org/ ! and its mirrors. The file LICENCE.Python-2.4 is the text of the Licence ! from the Python 2.4 source distribution. Note that the EMX package that this package depends on is released under *************** *** 62,66 **** The best known would be that by Jeff Rush, most recently of version 1.5.2. Jeff used IBM's Visual Age C++ (v3) for his ports, and his ! patches have been included in the Python 2.3 source distribution. Andy Zabolotny implemented a port of Python v1.5.2 using the EMX --- 47,51 ---- The best known would be that by Jeff Rush, most recently of version 1.5.2. Jeff used IBM's Visual Age C++ (v3) for his ports, and his ! patches have been included in the Python 2.4 source distribution. Andy Zabolotny implemented a port of Python v1.5.2 using the EMX *************** *** 72,94 **** of the "YOU HAVE BEEN WARNED" section below). - Previous Python port releases by me:- - - v2.0 on March 31, 2001; - - v2.0 on April 25, 2001 (cleanup release + Stackless variant); - - v2.1 on June 17, 2001; - - v2.0 (Stackless re-release) on June 18, 2001. - - v2.1.1 on August 5, 2001; - - v2.1.1 on August 12, 2001 (cleanup release); - - v2.1.1 (updated DLL) on August 14, 2001; - - v2.2b2 on December 8, 2001 (not uploaded to archive sites); - - v2.2c1 on December 16, 2001 (not uploaded to archive sites); - - v2.2 on December 24, 2001; - - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); - - v2.2.1 on April 14, 2002; - - v2.2.2 on October 24, 2002; - - v2.3a2 on March 2, 2003 (not uploaded to archive sites); - - v2.3b1 on April 27, 2003 (not uploaded to archive sites); - - v2.2.3c1 on May 28, 2003 (not uploaded to archive sites); - - v2.2.3 on June 1, 2003. - It is possible to have these earlier ports still usable after installing this port - see the README.os2emx.multiple_versions file, contributed by --- 57,60 ---- *************** *** 128,132 **** "YOU HAVE BEEN WARNED" item 1). ! Python23.dll is created as a normal OMF DLL, with an OMF import library and module definition file. There is also an a.out (.a) import library to support linking the DLL to a.out executables. The DLL --- 94,98 ---- "YOU HAVE BEEN WARNED" item 1). ! Python24.dll is created as a normal OMF DLL, with an OMF import library and module definition file. There is also an a.out (.a) import library to support linking the DLL to a.out executables. The DLL *************** *** 149,153 **** "YOU HAVE BEEN WARNED" item 10 for notes about the pwd and grp modules. ! Support for case sensitive module import semantics has been added to match the Windows release. This can be deactivated by setting the PYTHONCASEOK environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED" --- 115,119 ---- "YOU HAVE BEEN WARNED" item 10 for notes about the pwd and grp modules. ! This port supports case sensitive module import semantics, matching the Windows release. This can be deactivated by setting the PYTHONCASEOK environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED" *************** *** 163,168 **** and GNU UFC (crypt). ! Expat is now included in the Python release sourceball, and is always ! built. I have built these modules statically linked against the 3rd party --- 129,134 ---- and GNU UFC (crypt). ! Expat is now included in the Python release sourceball, and the pyexpat ! module is always built. I have built these modules statically linked against the 3rd party *************** *** 184,188 **** Upstream source patches: ! No updates to the Python 2.3 release have become available. Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes --- 150,154 ---- Upstream source patches: ! No updates to the Python 2.4 release have become available. Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes *************** *** 193,203 **** The Python standard library lives in the Lib directory. All the standard ! library code included with the Python 2.3 source distribution is included in the binary archive, with the exception of the dos-8x3 and tkinter subdirectories which have been omitted to reduce the size of the binary archive - the dos-8x3 components are unnecessary duplicates and Tkinter is not supported by this port (yet). All the plat-* subdirectories in the ! source distribution have also been omitted, and a plat-os2emx directory ! included. The Tools and Demo directories contain a collection of Python scripts. --- 159,169 ---- The Python standard library lives in the Lib directory. All the standard ! library code included with the Python 2.4 source distribution is included in the binary archive, with the exception of the dos-8x3 and tkinter subdirectories which have been omitted to reduce the size of the binary archive - the dos-8x3 components are unnecessary duplicates and Tkinter is not supported by this port (yet). All the plat-* subdirectories in the ! source distribution have also been omitted, except for the plat-os2emx ! subdirectory. The Tools and Demo directories contain a collection of Python scripts. *************** *** 208,212 **** All subdirectories omitted from the binary archive can be reconstituted ! from the Python 2.3 source distribution, if desired. Support for building Python extensions: --- 174,178 ---- All subdirectories omitted from the binary archive can be reconstituted ! from the Python 2.4 source distribution, if desired. Support for building Python extensions: *************** *** 226,231 **** This port is packaged as follows: ! - python-2.3-os2emx-bin-03????.zip (binaries, library modules) ! - python-2.3-os2emx-src-03???? (patches+makefiles for non-Python code) As all the Python specific patches for the port are now part of the --- 192,197 ---- This port is packaged as follows: ! - python-2.4-os2emx-bin-03????.zip (binaries, library modules) ! - python-2.4-os2emx-src-03???? (patches+makefiles for non-Python code) As all the Python specific patches for the port are now part of the *************** *** 234,238 **** the source archive. ! Documentation for the Python language, as well as the Python 2.3 source distibution, can be obtained from the Python website (http://www.python.org/) or the Python project pages at Sourceforge --- 200,204 ---- the source archive. ! Documentation for the Python language, as well as the Python 2.4 source distibution, can be obtained from the Python website (http://www.python.org/) or the Python project pages at Sourceforge *************** *** 249,253 **** of the drive where you want Python to live. ! Add the Python directory (eg C:\Python23) to the PATH and LIBPATH variables in CONFIG.SYS. --- 215,219 ---- of the drive where you want Python to live. ! Add the Python directory (eg C:\Python24) to the PATH and LIBPATH variables in CONFIG.SYS. *************** *** 259,265 **** directories. I use: ! SET PYTHONHOME=F:/Python23 ! SET PYTHONPATH=F:/Python23/Lib;F:/Python23/Lib/plat-os2emx; ! F:/Python23/Lib/lib-dynload;F:/Python23/Lib/site-packages NOTE!: the PYTHONPATH setting above is linewrapped for this document - it --- 225,231 ---- directories. I use: ! SET PYTHONHOME=F:/Python24 ! SET PYTHONPATH=F:/Python24/Lib;F:/Python24/Lib/plat-os2emx; ! F:/Python24/Lib/lib-dynload;F:/Python24/Lib/site-packages NOTE!: the PYTHONPATH setting above is linewrapped for this document - it *************** *** 274,278 **** to the path of the Terminfo subdirectory below the Python home directory. On my system this looks like: ! SET TERMINFO=F:/Python23/Terminfo For the TERM environment variable, I would try one of the following: --- 240,244 ---- to the path of the Terminfo subdirectory below the Python home directory. On my system this looks like: ! SET TERMINFO=F:/Python24/Terminfo For the TERM environment variable, I would try one of the following: *************** *** 288,302 **** batch file. ! You can execute the regression tests included with the Python 2.3 source ! distribution by changing to the Python 2.3 home directory and executing the REGRTEST.CMD batch file. The following tests are known to fail at this time: - test_mhlib (I don't know of any port of MH to OS/2); - - test_pwd (see "YOU HAVE BEEN WARNED" item 10); - - test_grp (as per test_pwd); - - test_strftime (see "YOU HAVE BEEN WARNED" item 15); - test_strptime (see "YOU HAVE BEEN WARNED" item 22); ! - test_whichdb (see "YOU HAVE BEEN WARNED" item 5). ! - test_socketserver (fork() related, see "YOU HAVE BEEN WARNED" item 1). Note that some of the network related tests expect the loopback interface --- 254,265 ---- batch file. ! You can execute the regression tests included with the Python 2.4 source ! distribution by changing to the Python 2.4 home directory and executing the REGRTEST.CMD batch file. The following tests are known to fail at this time: - test_mhlib (I don't know of any port of MH to OS/2); - test_strptime (see "YOU HAVE BEEN WARNED" item 22); ! - test_time (see "YOU HAVE BEEN WARNED" item 22); ! - test_posixpath (see "YOU HAVE BEEN WARNED" item 23). Note that some of the network related tests expect the loopback interface *************** *** 327,330 **** --- 290,294 ---- - rm, cp, mkdir from the GNU file utilities package - GNU find + - GNU sed Procedure *************** *** 337,341 **** If you wish to do this, set the value of the Makefile variable LIB_DIR to the directory you wish to use for PYTHONHOME ! (eg /usr/local/lib/python2.3). If you want Python to find its library without the PYTHONHOME --- 301,305 ---- If you wish to do this, set the value of the Makefile variable LIB_DIR to the directory you wish to use for PYTHONHOME ! (eg /usr/local/lib/python2.4). If you want Python to find its library without the PYTHONHOME *************** *** 347,351 **** the value of the Makefile variable EXE_DIR to the appropriate directory. ! 3. If you wish the Python core DLL (python23.dll) to be installed in a directory other than the directory in which the Python executables are installed (by default, the PYTHONHOME directory), set the value of the --- 311,315 ---- the value of the Makefile variable EXE_DIR to the appropriate directory. ! 3. If you wish the Python core DLL (python24.dll) to be installed in a directory other than the directory in which the Python executables are installed (by default, the PYTHONHOME directory), set the value of the *************** *** 446,451 **** you may be better off deleting it and relying on GDBM. ! Any code you have which uses the bsddb module can be modified to use the ! renamed module by changing import bsddb --- 410,415 ---- you may be better off deleting it and relying on GDBM. ! Any code you have which uses the v1.85 bsddb module can be modified to ! use the renamed module by changing import bsddb *************** *** 455,461 **** import bsddb185 as bsddb - A side effect of these changes is that the test_whichdb regression test - fails. - 6. The readline module has been linked against ncurses rather than the termcap library supplied with EMX. --- 419,422 ---- *************** *** 522,535 **** have been incorporated into this port, and are active by default. Setting the PYTHONCASEOK environment variable (to any value) reverts to the ! previous (case insensitive) semantics. 13. Because I am statically linking ncurses, the _curses_panel module has potential problems arising from separate library data areas. To avoid this, I have configured the _curses_.pyd (imported as ! "_curses_panel") to import the ncurses symbols it needs from _curses.pyd. ! As a result the _curses module must be imported before the _curses_panel ! module. As far as I can tell, the modules in the curses package do this. ! If you have problems attempting to use the _curses_panel support please ! let me know, and I'll look into an alternative solution. 14. sys.platform reports "os2emx" instead of "os2". os.name still --- 483,502 ---- have been incorporated into this port, and are active by default. Setting the PYTHONCASEOK environment variable (to any value) reverts to the ! previous (case insensitive) semantics. This can be an issue with some ! file management utilities that do not preserve the case of file and ! directory names. 13. Because I am statically linking ncurses, the _curses_panel module has potential problems arising from separate library data areas. To avoid this, I have configured the _curses_.pyd (imported as ! "_curses_panel") to import the ncurses symbols it needs from _curses.dll ! (which is the curses module, but with a .dll extension rather than .pyd ! so that the dynamic loader can actually import the symbols from it as a ! DLL). ! ! The site module (Lib/site.py) has code added to tweak BEGINLIBPATH so ! that _curses.dll is found when _curses_panel is imported. If you have ! problems attempting to use the _curses_panel support please let me know, ! and I'll have another look at this. 14. sys.platform reports "os2emx" instead of "os2". os.name still *************** *** 556,561 **** This release sees the default optimisation change to ! "-O3 -fomit-frame-pointer". This works fine too for pgcc 2.95 but not ! for gcc 3.2.1. With gcc 3.2.1, -O3 causes 2 unexpected test failures: test_format and --- 523,528 ---- This release sees the default optimisation change to ! "-O3 -fomit-frame-pointer -mprobe". This works fine too for pgcc 2.95 ! but not for gcc 3.2.1. With gcc 3.2.1, -O3 causes 2 unexpected test failures: test_format and *************** *** 637,640 **** --- 604,645 ---- due to the EMX strftime bug in item 20 above. + 23. test_posixpath attempts to exercise various Posix path related + functionality. Most of the sub-tests pass, but the "ismount" and + "samestat" subtests fail: + - EMX provides not satisfactory mount point emulation, so "ismount" + cannot succeed; + - EMX documents that successive stat() calls will produce different + results, so "samestat" cannot succeed. + + test_posixpath should skip these tests on EMX. + + 24. I have had a report that attempting to use the Bittorrent package + (http://bitconjurer.org/BitTorrent/) with this port causes traps not + long after starting the download; this using the "headless" download + script on eCS v1.1. I have not been able to duplicate this myself, + but the indications I have suggest a failure in the 32 bit TCP/IP + stack (v4.3.2? on eCS v1.1) - on my v4.0 FP12 system with MPTS fixpack + WR8425 applied (16 bit TCP/IP stack v4.02), BitTorrent appears to work + normally in testing on a 100Mbit LAN. With the curses.panel fix (see + item 13 above), the BitTorrent curses downloader works too. I'd + appreciate any success or failure reports with BitTorrent, though + I've regretfully recommended that the person who reported the failure + take this up with eCS support. Since this report, I have received a + followup which suggests that the problem may have been a buggy network + card driver. I think it suffices to say that BitTorrent is a fair stress + test of a system's networking capability. + + 25. In the absence of an EMX implementation of the link() function, I've + implemented a crude Python emulation, in the file + Lib/plat-os2emx/_emx_link.py. This is imported into the os module, and + becomes available as os.link() in the normal way. + + The emulation copies the source file in binary mode, and will fail if + disk space is exhausted. The call fails if the target already exists. + There are no guarantees to thread safety with this emulation - beware! + + The emulation was written to support a link() based file locking system + used in GNU Mailman. + ... probably other issues that I've not encountered, or don't remember :-( *************** *** 676,678 **** Web: http://www.andymac.org/ ! 18 April, 2003. --- 681,683 ---- Web: http://www.andymac.org/ ! 2 December, 2003. From aimacintyre at users.sourceforge.net Tue Dec 2 07:27:27 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:27:31 2003 Subject: [Python-checkins] python/dist/src/Lib site.py,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv4115 Modified Files: site.py Log Message: To find the curses extension as a DLL (on OS/2), we need to adjust the library search path to include the extension directory. Without this, the curses_panel extension can't find the curses extension/DLL, which exports some curses symbols to it. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** site.py 20 Oct 2003 14:01:50 -0000 1.54 --- site.py 2 Dec 2003 12:27:25 -0000 1.55 *************** *** 195,198 **** --- 195,213 ---- + # the OS/2 EMX port has optional extension modules that do double duty + # as DLLs (and must use the .DLL file extension) for other extensions. + # The library search path needs to be amended so these will be found + # during module import. Use BEGINLIBPATH so that these are at the start + # of the library search path. + if sys.platform == 'os2emx': + dllpath = os.path.join(sys.prefix, "Lib", "lib-dynload") + libpath = os.environ['BEGINLIBPATH'].split(';') + if libpath[-1]: + libpath.append(dllpath) + else: + libpath[-1] = dllpath + os.environ['BEGINLIBPATH'] = ';'.join(libpath) + + # Define new built-ins 'quit' and 'exit'. # These are simply strings that display a hint on how to exit. From aimacintyre at users.sourceforge.net Tue Dec 2 07:31:11 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:31:14 2003 Subject: [Python-checkins] python/dist/src/Lib/plat-os2emx _emx_link.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv5006 Added Files: _emx_link.py Log Message: EMX lacks an implementation of link(). As Mailman wants os.link() to implement its locking scheme, this module implements a crude link() by way of copying the source to the destination provided the destination doesn't already exist. --- NEW FILE: _emx_link.py --- # _emx_link.py # Written by Andrew I MacIntyre, December 2002. """_emx_link.py is a simplistic emulation of the Unix link(2) library routine for creating so-called hard links. It is intended to be imported into the os module in place of the unimplemented (on OS/2) Posix link() function (os.link()). We do this on OS/2 by implementing a file copy, with link(2) semantics:- - the target cannot already exist; - we hope that the actual file open (if successful) is actually atomic... Limitations of this approach/implementation include:- - no support for correct link counts (EMX stat(target).st_nlink is always 1); - thread safety undefined; - default file permissions (r+w) used, can't be over-ridden; - implemented in Python so comparatively slow, especially for large source files; - need sufficient free disk space to store the copy. Behaviour:- - any exception should propagate to the caller; - want target to be an exact copy of the source, so use binary mode; - returns None, same as os.link() which is implemented in posixmodule.c; - target removed in the event of a failure where possible; - given the motivation to write this emulation came from trying to support a Unix resource lock implementation, where minimal overhead during creation of the target is desirable and the files are small, we read a source block before attempting to create the target so that we're ready to immediately write some data into it. """ import os import errno __all__ = ['link'] def link(source, target): """link(source, target) -> None Attempt to hard link the source file to the target file name. On OS/2, this creates a complete copy of the source file. """ s = os.open(source, os.O_RDONLY | os.O_BINARY) if os.isatty(s): raise OSError, (errno.EXDEV, 'Cross-device link') data = os.read(s, 1024) try: t = os.open(target, os.O_WRONLY | os.O_BINARY | os.O_CREAT | os.O_EXCL) except OSError: os.close(s) raise try: while data: os.write(t, data) data = os.read(s, 1024) except OSError: os.close(s) os.close(t) os.unlink(target) raise os.close(s) os.close(t) if __name__ == '__main__': import sys try: link(sys.argv[1], sys.argv[2]) except IndexError: print 'Usage: emx_link ' except OSError: print 'emx_link: %s' % str(sys.exc_info()[1]) From aimacintyre at users.sourceforge.net Tue Dec 2 07:33:03 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:33:07 2003 Subject: [Python-checkins] python/dist/src/Lib os.py,1.72,1.73 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv5660 Modified Files: os.py Log Message: OS/2+EMX: make the link() emulation available as os.link() Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.72 retrieving revision 1.73 diff -C2 -d -r1.72 -r1.73 *** os.py 2 Jul 2003 02:49:33 -0000 1.72 --- os.py 2 Dec 2003 12:33:01 -0000 1.73 *************** *** 77,80 **** --- 77,81 ---- else: import os2emxpath as path + from _emx_link import link import os2 From aimacintyre at users.sourceforge.net Tue Dec 2 07:35:21 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:35:25 2003 Subject: [Python-checkins] python/dist/src/Lib/distutils emxccompiler.py, 1.10, 1.10.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv6251 Modified Files: Tag: release23-maint emxccompiler.py Log Message: use same compiler switches as core for extensions Index: emxccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/emxccompiler.py,v retrieving revision 1.10 retrieving revision 1.10.14.1 diff -C2 -d -r1.10 -r1.10.14.1 *** emxccompiler.py 14 Nov 2002 02:25:41 -0000 1.10 --- emxccompiler.py 2 Dec 2003 12:35:18 -0000 1.10.14.1 *************** *** 64,69 **** # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. ! self.set_executables(compiler='gcc -Zomf -Zmt -O2 -Wall', ! compiler_so='gcc -Zomf -Zmt -O2 -Wall', linker_exe='gcc -Zomf -Zmt -Zcrtdll', linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') --- 64,69 ---- # Hard-code GCC because that's what this is all about. # XXX optimization, warnings etc. should be customizable. ! self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', ! compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall', linker_exe='gcc -Zomf -Zmt -Zcrtdll', linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll') From aimacintyre at users.sourceforge.net Tue Dec 2 07:38:14 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:38:17 2003 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.14,1.14.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv6481 Modified Files: Tag: release23-maint Makefile Log Message: - add build support for curses to be both extension and DLL, so that curses_panel works; - tweak compiler switches. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.14 retrieving revision 1.14.6.1 diff -C2 -d -r1.14 -r1.14.6.1 *** Makefile 16 Jul 2003 13:31:11 -0000 1.14 --- Makefile 2 Dec 2003 12:38:11 -0000 1.14.6.1 *************** *** 92,96 **** LDFLAGS+= -g else ! CFLAGS+= -s -O3 -fomit-frame-pointer LDFLAGS+= -s endif --- 92,96 ---- LDFLAGS+= -g else ! CFLAGS+= -s -O3 -fomit-frame-pointer -mprobe LDFLAGS+= -s endif *************** *** 114,117 **** --- 114,118 ---- # File extensions MODULE.EXT= .pyd + MODLIB.EXT= .dll ifeq ($(OMF),yes) O= .obj *************** *** 254,258 **** DESCRIPTION.readline$(MODULE.EXT)= Python Extension DLL for access to GNU ReadLine library DESCRIPTION.bsddb185$(MODULE.EXT)= Python Extension DLL for access to BSD DB (v1.85) library ! DESCRIPTION._curses$(MODULE.EXT)= Python Extension DLL for access to ncurses library DESCRIPTION.pyexpat$(MODULE.EXT)= Python Extension DLL for access to expat library DESCRIPTION.bz2$(MODULE.EXT)= Python Extension DLL for accessing the bz2 compression library --- 255,259 ---- DESCRIPTION.readline$(MODULE.EXT)= Python Extension DLL for access to GNU ReadLine library DESCRIPTION.bsddb185$(MODULE.EXT)= Python Extension DLL for access to BSD DB (v1.85) library ! DESCRIPTION._curses$(MODLIB.EXT)= Python Extension DLL for access to ncurses library DESCRIPTION.pyexpat$(MODULE.EXT)= Python Extension DLL for access to expat library DESCRIPTION.bz2$(MODULE.EXT)= Python Extension DLL for accessing the bz2 compression library *************** *** 430,433 **** --- 431,438 ---- unicoded + # Python modules that are used as libraries and therefore must use + # a .DLL extension + LIBEXTMODULES= + # Python external ($(MODULE.EXT)) modules - can be EASY or HARD ifeq ($(HAVE_ZLIB),yes) *************** *** 452,456 **** endif ifeq ($(HAVE_NCURSES),yes) ! HARDEXTMODULES+= _curses _curses_ endif ifeq ($(HAVE_GDBM),yes) --- 457,462 ---- endif ifeq ($(HAVE_NCURSES),yes) ! LIBEXTMODULES+= _curses ! HARDEXTMODULES+= _curses_ endif ifeq ($(HAVE_GDBM),yes) *************** *** 474,477 **** --- 480,484 ---- EXTERNDLLS= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(EASYEXTMODULES))) EXTERNDLLS+= $(addsuffix $(MODULE.EXT),$(patsubst %module,%,$(HARDEXTMODULES))) + EXTERNDLLS+= $(addsuffix $(MODLIB.EXT),$(patsubst %module,%,$(LIBEXTMODULES))) # Targets *************** *** 584,588 **** @echo Creating .DEF file: $@ @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@ ! @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODULE.EXT))$(DQUOTE) >>$@ @echo DATA MULTIPLE NONSHARED >>$@ @echo EXPORTS >>$@ --- 591,595 ---- @echo Creating .DEF file: $@ @echo LIBRARY $(notdir $*) INITINSTANCE TERMINSTANCE >$@ ! @echo DESCRIPTION $(DQUOTE)$(DESCRIPTION.$(notdir $*)$(MODLIB.EXT))$(DQUOTE) >>$@ @echo DATA MULTIPLE NONSHARED >>$@ @echo EXPORTS >>$@ *************** *** 610,614 **** @echo init_curses_panel >>$@ ! _curses$(MODULE.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses --- 617,621 ---- @echo init_curses_panel >>$@ ! _curses$(MODLIB.EXT): $(OUT)_cursesmodule$O $(OUT)_curses_m.def $(PYTHON.IMPLIB) $(LD) $(LDFLAGS.DLL) -o $@ $(^^) $(L^) $(LIBS) -lncurses From aimacintyre at users.sourceforge.net Tue Dec 2 07:40:01 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:40:12 2003 Subject: [Python-checkins] python/dist/src/PC/os2emx README.os2emx, 1.7, 1.7.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv6883 Modified Files: Tag: release23-maint README.os2emx Log Message: - add notes about curses extension/DLL arrangements; - various cleanups and updates. Index: README.os2emx =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/README.os2emx,v retrieving revision 1.7 retrieving revision 1.7.6.1 diff -C2 -d -r1.7 -r1.7.6.1 *** README.os2emx 16 Jul 2003 13:31:11 -0000 1.7 --- README.os2emx 2 Dec 2003 12:39:59 -0000 1.7.6.1 *************** *** 1,3 **** ! This is a port of Python 2.3 to OS/2 using the EMX development tools ========================================================================= --- 1,3 ---- ! This is a port of Python 2.3.3 to OS/2 using the EMX development tools ========================================================================= *************** *** 5,24 **** ------------------------------------- ! This release of the port incorporates the following changes from the ! October 24, 2002 release of the Python 2.2.2 port: ! ! - based on the Python v2.3 final release source. ! - now setting higher number of file handles (250). ! - defaults to building with PyMalloc enabled (Python 2.3 default). ! - the port is now maintained in the Python CVS repository. ! - most standard modules are now built into the core Python DLL. ! ! Python 2.3 incorporates several changes which have resolved the ! longstanding problems the EMX port has had with test_longexp. ! ! Python 2.3 introduces changes to the Berkeley DB support, as a result of ! the PyBSDDB3 module (for the Sleepycat DB 3.3.x/4.0.x/4.1.x library) ! being imported into Python's standard library - see "YOU HAVE BEEN WARNED" ! items 4 & 5 for more information. --- 5,9 ---- ------------------------------------- ! Another day, another version... *************** *** 26,34 **** -------------------------------------- ! Please read the file README.Python-2.3 included in this package for ! information about Python 2.3. This file is the README file from the ! Python 2.3 source distribution available via http://www.python.org/ ! and its mirrors. The file LICENCE.Python-2.3 is the text of the Licence ! from the Python 2.3 source distribution. Note that the EMX package that this package depends on is released under --- 11,19 ---- -------------------------------------- ! Please read the file README.Python-2.3.3 included in this package for ! information about Python 2.3.3. This file is the README file from the ! Python 2.3.3 source distribution available via http://www.python.org/ ! and its mirrors. The file LICENCE.Python-2.3.3 is the text of the Licence ! from the Python 2.3.3 source distribution. Note that the EMX package that this package depends on is released under *************** *** 62,66 **** The best known would be that by Jeff Rush, most recently of version 1.5.2. Jeff used IBM's Visual Age C++ (v3) for his ports, and his ! patches have been included in the Python 2.3 source distribution. Andy Zabolotny implemented a port of Python v1.5.2 using the EMX --- 47,51 ---- The best known would be that by Jeff Rush, most recently of version 1.5.2. Jeff used IBM's Visual Age C++ (v3) for his ports, and his ! patches have been included in the Python 2.3.3 source distribution. Andy Zabolotny implemented a port of Python v1.5.2 using the EMX *************** *** 72,94 **** of the "YOU HAVE BEEN WARNED" section below). - Previous Python port releases by me:- - - v2.0 on March 31, 2001; - - v2.0 on April 25, 2001 (cleanup release + Stackless variant); - - v2.1 on June 17, 2001; - - v2.0 (Stackless re-release) on June 18, 2001. - - v2.1.1 on August 5, 2001; - - v2.1.1 on August 12, 2001 (cleanup release); - - v2.1.1 (updated DLL) on August 14, 2001; - - v2.2b2 on December 8, 2001 (not uploaded to archive sites); - - v2.2c1 on December 16, 2001 (not uploaded to archive sites); - - v2.2 on December 24, 2001; - - v2.2.1c2 on March 31, 2002 (not uploaded to archive sites); - - v2.2.1 on April 14, 2002; - - v2.2.2 on October 24, 2002; - - v2.3a2 on March 2, 2003 (not uploaded to archive sites); - - v2.3b1 on April 27, 2003 (not uploaded to archive sites); - - v2.2.3c1 on May 28, 2003 (not uploaded to archive sites); - - v2.2.3 on June 1, 2003. - It is possible to have these earlier ports still usable after installing this port - see the README.os2emx.multiple_versions file, contributed by --- 57,60 ---- *************** *** 149,153 **** "YOU HAVE BEEN WARNED" item 10 for notes about the pwd and grp modules. ! Support for case sensitive module import semantics has been added to match the Windows release. This can be deactivated by setting the PYTHONCASEOK environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED" --- 115,119 ---- "YOU HAVE BEEN WARNED" item 10 for notes about the pwd and grp modules. ! This port supports case sensitive module import semantics, matching the Windows release. This can be deactivated by setting the PYTHONCASEOK environment variable (the value doesn't matter) - see "YOU HAVE BEEN WARNED" *************** *** 163,168 **** and GNU UFC (crypt). ! Expat is now included in the Python release sourceball, and is always ! built. I have built these modules statically linked against the 3rd party --- 129,134 ---- and GNU UFC (crypt). ! Expat is now included in the Python release sourceball, and the pyexpat ! module is always built. I have built these modules statically linked against the 3rd party *************** *** 184,188 **** Upstream source patches: ! No updates to the Python 2.3 release have become available. Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes --- 150,154 ---- Upstream source patches: ! No updates to the Python 2.3.3 release have become available. Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes *************** *** 193,203 **** The Python standard library lives in the Lib directory. All the standard ! library code included with the Python 2.3 source distribution is included in the binary archive, with the exception of the dos-8x3 and tkinter subdirectories which have been omitted to reduce the size of the binary archive - the dos-8x3 components are unnecessary duplicates and Tkinter is not supported by this port (yet). All the plat-* subdirectories in the ! source distribution have also been omitted, and a plat-os2emx directory ! included. The Tools and Demo directories contain a collection of Python scripts. --- 159,169 ---- The Python standard library lives in the Lib directory. All the standard ! library code included with the Python 2.3.3 source distribution is included in the binary archive, with the exception of the dos-8x3 and tkinter subdirectories which have been omitted to reduce the size of the binary archive - the dos-8x3 components are unnecessary duplicates and Tkinter is not supported by this port (yet). All the plat-* subdirectories in the ! source distribution have also been omitted, except for the plat-os2emx ! subdirectory. The Tools and Demo directories contain a collection of Python scripts. *************** *** 208,212 **** All subdirectories omitted from the binary archive can be reconstituted ! from the Python 2.3 source distribution, if desired. Support for building Python extensions: --- 174,178 ---- All subdirectories omitted from the binary archive can be reconstituted ! from the Python 2.3.3 source distribution, if desired. Support for building Python extensions: *************** *** 226,231 **** This port is packaged as follows: ! - python-2.3-os2emx-bin-03????.zip (binaries, library modules) ! - python-2.3-os2emx-src-03???? (patches+makefiles for non-Python code) As all the Python specific patches for the port are now part of the --- 192,197 ---- This port is packaged as follows: ! - python-2.3.3-os2emx-bin-03????.zip (binaries, library modules) ! - python-2.3.3-os2emx-src-03???? (patches+makefiles for non-Python code) As all the Python specific patches for the port are now part of the *************** *** 234,238 **** the source archive. ! Documentation for the Python language, as well as the Python 2.3 source distibution, can be obtained from the Python website (http://www.python.org/) or the Python project pages at Sourceforge --- 200,204 ---- the source archive. ! Documentation for the Python language, as well as the Python 2.3.3 source distibution, can be obtained from the Python website (http://www.python.org/) or the Python project pages at Sourceforge *************** *** 288,302 **** batch file. ! You can execute the regression tests included with the Python 2.3 source ! distribution by changing to the Python 2.3 home directory and executing the REGRTEST.CMD batch file. The following tests are known to fail at this time: - test_mhlib (I don't know of any port of MH to OS/2); - - test_pwd (see "YOU HAVE BEEN WARNED" item 10); - - test_grp (as per test_pwd); - - test_strftime (see "YOU HAVE BEEN WARNED" item 15); - test_strptime (see "YOU HAVE BEEN WARNED" item 22); ! - test_whichdb (see "YOU HAVE BEEN WARNED" item 5). ! - test_socketserver (fork() related, see "YOU HAVE BEEN WARNED" item 1). Note that some of the network related tests expect the loopback interface --- 254,265 ---- batch file. ! You can execute the regression tests included with the Python 2.3.3 source ! distribution by changing to the Python 2.3.3 home directory and executing the REGRTEST.CMD batch file. The following tests are known to fail at this time: - test_mhlib (I don't know of any port of MH to OS/2); - test_strptime (see "YOU HAVE BEEN WARNED" item 22); ! - test_time (see "YOU HAVE BEEN WARNED" item 22); ! - test_posixpath (see "YOU HAVE BEEN WARNED" item 23). Note that some of the network related tests expect the loopback interface *************** *** 327,330 **** --- 290,294 ---- - rm, cp, mkdir from the GNU file utilities package - GNU find + - GNU sed Procedure *************** *** 337,341 **** If you wish to do this, set the value of the Makefile variable LIB_DIR to the directory you wish to use for PYTHONHOME ! (eg /usr/local/lib/python2.3). If you want Python to find its library without the PYTHONHOME --- 301,305 ---- If you wish to do this, set the value of the Makefile variable LIB_DIR to the directory you wish to use for PYTHONHOME ! (eg /usr/local/lib/python2.3.3). If you want Python to find its library without the PYTHONHOME *************** *** 446,451 **** you may be better off deleting it and relying on GDBM. ! Any code you have which uses the bsddb module can be modified to use the ! renamed module by changing import bsddb --- 410,415 ---- you may be better off deleting it and relying on GDBM. ! Any code you have which uses the v1.85 bsddb module can be modified to ! use the renamed module by changing import bsddb *************** *** 455,461 **** import bsddb185 as bsddb - A side effect of these changes is that the test_whichdb regression test - fails. - 6. The readline module has been linked against ncurses rather than the termcap library supplied with EMX. --- 419,422 ---- *************** *** 522,535 **** have been incorporated into this port, and are active by default. Setting the PYTHONCASEOK environment variable (to any value) reverts to the ! previous (case insensitive) semantics. 13. Because I am statically linking ncurses, the _curses_panel module has potential problems arising from separate library data areas. To avoid this, I have configured the _curses_.pyd (imported as ! "_curses_panel") to import the ncurses symbols it needs from _curses.pyd. ! As a result the _curses module must be imported before the _curses_panel ! module. As far as I can tell, the modules in the curses package do this. ! If you have problems attempting to use the _curses_panel support please ! let me know, and I'll look into an alternative solution. 14. sys.platform reports "os2emx" instead of "os2". os.name still --- 483,502 ---- have been incorporated into this port, and are active by default. Setting the PYTHONCASEOK environment variable (to any value) reverts to the ! previous (case insensitive) semantics. This can be an issue with some ! file management utilities that do not preserve the case of file and ! directory names. 13. Because I am statically linking ncurses, the _curses_panel module has potential problems arising from separate library data areas. To avoid this, I have configured the _curses_.pyd (imported as ! "_curses_panel") to import the ncurses symbols it needs from _curses.dll ! (which is the curses module, but with a .dll extension rather than .pyd ! so that the dynamic loader can actually import the symbols from it as a ! DLL). ! ! The site module (Lib/site.py) has code added to tweak BEGINLIBPATH so ! that _curses.dll is found when _curses_panel is imported. If you have ! problems attempting to use the _curses_panel support please let me know, ! and I'll have another look at this. 14. sys.platform reports "os2emx" instead of "os2". os.name still *************** *** 556,561 **** This release sees the default optimisation change to ! "-O3 -fomit-frame-pointer". This works fine too for pgcc 2.95 but not ! for gcc 3.2.1. With gcc 3.2.1, -O3 causes 2 unexpected test failures: test_format and --- 523,528 ---- This release sees the default optimisation change to ! "-O3 -fomit-frame-pointer -mprobe". This works fine too for pgcc 2.95 ! but not for gcc 3.2.1. With gcc 3.2.1, -O3 causes 2 unexpected test failures: test_format and *************** *** 637,640 **** --- 604,633 ---- due to the EMX strftime bug in item 20 above. + 23. test_posixpath attempts to exercise various Posix path related + functionality. Most of the sub-tests pass, but the "ismount" and + "samestat" subtests fail: + - EMX provides not satisfactory mount point emulation, so "ismount" + cannot succeed; + - EMX documents that successive stat() calls will produce different + results, so "samestat" cannot succeed. + + test_posixpath should skip these tests on EMX. + + 24. I have had a report that attempting to use the Bittorrent package + (http://bitconjurer.org/BitTorrent/) with this port causes traps not + long after starting the download; this using the "headless" download + script on eCS v1.1. I have not been able to duplicate this myself, + but the indications I have suggest a failure in the 32 bit TCP/IP + stack (v4.3.2? on eCS v1.1) - on my v4.0 FP12 system with MPTS fixpack + WR8425 applied (16 bit TCP/IP stack v4.02), BitTorrent appears to work + normally in testing on a 100Mbit LAN. With the curses.panel fix (see + item 13 above), the BitTorrent curses downloader works too. I'd + appreciate any success or failure reports with BitTorrent, though + I've regretfully recommended that the person who reported the failure + take this up with eCS support. Since this report, I have received a + followup which suggests that the problem may have been a buggy network + card driver. I think it suffices to say that BitTorrent is a fair stress + test of a system's networking capability. + ... probably other issues that I've not encountered, or don't remember :-( *************** *** 676,678 **** Web: http://www.andymac.org/ ! 18 April, 2003. --- 669,671 ---- Web: http://www.andymac.org/ ! 2 December, 2003. From aimacintyre at users.sourceforge.net Tue Dec 2 07:43:55 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Tue Dec 2 07:43:59 2003 Subject: [Python-checkins] python/dist/src/Lib site.py,1.53.6.2,1.53.6.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7560 Modified Files: Tag: release23-maint site.py Log Message: To find the curses extension as a DLL (on OS/2), we need to adjust the library search path to include the extension directory. Without this, the curses_panel extension can't find the curses extension/DLL, which exports some curses symbols to it. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.53.6.2 retrieving revision 1.53.6.3 diff -C2 -d -r1.53.6.2 -r1.53.6.3 *** site.py 2 Dec 2003 06:47:37 -0000 1.53.6.2 --- site.py 2 Dec 2003 12:43:52 -0000 1.53.6.3 *************** *** 197,200 **** --- 197,215 ---- + # the OS/2 EMX port has optional extension modules that do double duty + # as DLLs (and must use the .DLL file extension) for other extensions. + # The library search path needs to be amended so these will be found + # during module import. Use BEGINLIBPATH so that these are at the start + # of the library search path. + if sys.platform == 'os2emx': + dllpath = os.path.join(sys.prefix, "Lib", "lib-dynload") + libpath = os.environ['BEGINLIBPATH'].split(';') + if libpath[-1]: + libpath.append(dllpath) + else: + libpath[-1] = dllpath + os.environ['BEGINLIBPATH'] = ';'.join(libpath) + + # Define new built-ins 'quit' and 'exit'. # These are simply strings that display a hint on how to exit. From jhylton at users.sourceforge.net Tue Dec 2 10:00:57 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Tue Dec 2 10:01:06 2003 Subject: [Python-checkins] python/dist/src/Lib site.py,1.53.6.3,1.53.6.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv1690 Modified Files: Tag: release23-maint site.py Log Message: Revert previous checkin. It was meant for another branch. Index: site.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v retrieving revision 1.53.6.3 retrieving revision 1.53.6.4 diff -C2 -d -r1.53.6.3 -r1.53.6.4 *** site.py 2 Dec 2003 12:43:52 -0000 1.53.6.3 --- site.py 2 Dec 2003 15:00:54 -0000 1.53.6.4 *************** *** 92,98 **** if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): ! ## from distutils.util import get_platform ! def get_platform(): ! return "linux-i686" s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s) --- 92,96 ---- if (os.name == "posix" and sys.path and os.path.basename(sys.path[-1]) == "Modules"): ! from distutils.util import get_platform s = "build/lib.%s-%.3s" % (get_platform(), sys.version) s = os.path.join(os.path.dirname(sys.path[-1]), s) From montanaro at users.sourceforge.net Tue Dec 2 13:57:50 2003 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue Dec 2 13:57:55 2003 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.12,1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv16485 Modified Files: _csv.c Log Message: doc nit Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** _csv.c 9 Jun 2003 05:59:23 -0000 1.12 --- _csv.c 2 Dec 2003 18:57:47 -0000 1.13 *************** *** 1435,1439 **** " csv.QUOTE_ALL means that quotes are always placed around fields.\n" " csv.QUOTE_NONNUMERIC means that quotes are always placed around\n" ! " fields which contain characters other than [+-0-9.].\n" " csv.QUOTE_NONE means that quotes are never placed around fields.\n" " * escapechar - specifies a one-character string used to escape \n" --- 1435,1440 ---- " csv.QUOTE_ALL means that quotes are always placed around fields.\n" " csv.QUOTE_NONNUMERIC means that quotes are always placed around\n" ! " fields which do not parse as integers or floating point\n" ! " numbers.\n" " csv.QUOTE_NONE means that quotes are never placed around fields.\n" " * escapechar - specifies a one-character string used to escape \n" From montanaro at users.sourceforge.net Tue Dec 2 14:00:52 2003 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Tue Dec 2 14:00:55 2003 Subject: [Python-checkins] python/dist/src/Modules _csv.c,1.12,1.12.8.1 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv17082 Modified Files: Tag: release23-maint _csv.c Log Message: doc nit Index: _csv.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v retrieving revision 1.12 retrieving revision 1.12.8.1 diff -C2 -d -r1.12 -r1.12.8.1 *** _csv.c 9 Jun 2003 05:59:23 -0000 1.12 --- _csv.c 2 Dec 2003 19:00:44 -0000 1.12.8.1 *************** *** 1435,1439 **** " csv.QUOTE_ALL means that quotes are always placed around fields.\n" " csv.QUOTE_NONNUMERIC means that quotes are always placed around\n" ! " fields which contain characters other than [+-0-9.].\n" " csv.QUOTE_NONE means that quotes are never placed around fields.\n" " * escapechar - specifies a one-character string used to escape \n" --- 1435,1440 ---- " csv.QUOTE_ALL means that quotes are always placed around fields.\n" " csv.QUOTE_NONNUMERIC means that quotes are always placed around\n" ! " fields which do not parse as integers or floating point\n" ! " numbers.\n" " csv.QUOTE_NONE means that quotes are never placed around fields.\n" " * escapechar - specifies a one-character string used to escape \n" From jackjansen at users.sourceforge.net Tue Dec 2 17:58:09 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 2 17:58:12 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/launch - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/launch In directory sc8-pr-cvs1:/tmp/cvs-serv17302/launch Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/launch added to the repository From jackjansen at users.sourceforge.net Tue Dec 2 18:01:44 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 2 18:01:48 2003 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon LaunchServices.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv18090/Lib/plat-mac/Carbon Added Files: LaunchServices.py Log Message: An interface to the LaunchServices API. --- NEW FILE: LaunchServices.py --- # Generated from 'LaunchServices.h' def FOUR_CHAR_CODE(x): return x kLSRequestAllInfo = -1 kLSRolesAll = -1 kLSUnknownErr = -10810 kLSNotAnApplicationErr = -10811 kLSNotInitializedErr = -10812 kLSDataUnavailableErr = -10813 kLSApplicationNotFoundErr = -10814 kLSUnknownTypeErr = -10815 kLSDataTooOldErr = -10816 kLSDataErr = -10817 kLSLaunchInProgressErr = -10818 kLSNotRegisteredErr = -10819 kLSAppDoesNotClaimTypeErr = -10820 kLSAppDoesNotSupportSchemeWarning = -10821 kLSServerCommunicationErr = -10822 kLSInitializeDefaults = 0x00000001 kLSRequestExtension = 0x00000001 kLSRequestTypeCreator = 0x00000002 kLSRequestBasicFlagsOnly = 0x00000004 kLSRequestAppTypeFlags = 0x00000008 kLSRequestAllFlags = 0x00000010 kLSRequestIconAndKind = 0x00000020 # kLSRequestAllInfo = (unsigned long)0xFFFFFFFF kLSItemInfoIsPlainFile = 0x00000001 kLSItemInfoIsPackage = 0x00000002 kLSItemInfoIsApplication = 0x00000004 kLSItemInfoIsContainer = 0x00000008 kLSItemInfoIsAliasFile = 0x00000010 kLSItemInfoIsSymlink = 0x00000020 kLSItemInfoIsInvisible = 0x00000040 kLSItemInfoIsNativeApp = 0x00000080 kLSItemInfoIsClassicApp = 0x00000100 kLSItemInfoAppPrefersNative = 0x00000200 kLSItemInfoAppPrefersClassic = 0x00000400 kLSItemInfoAppIsScriptable = 0x00000800 kLSItemInfoIsVolume = 0x00001000 kLSRolesNone = 0x00000001 kLSRolesViewer = 0x00000002 kLSRolesEditor = 0x00000004 # kLSRolesAll = (unsigned long)0xFFFFFFFF kLSUnknownKindID = 0 kLSUnknownType = 0 kLSUnknownCreator = 0 kLSAcceptDefault = 0x00000001 kLSAcceptAllowLoginUI = 0x00000002 kLSLaunchDefaults = 0x00000001 kLSLaunchAndPrint = 0x00000002 kLSLaunchReserved2 = 0x00000004 kLSLaunchReserved3 = 0x00000008 kLSLaunchReserved4 = 0x00000010 kLSLaunchReserved5 = 0x00000020 kLSLaunchReserved6 = 0x00000040 kLSLaunchInhibitBGOnly = 0x00000080 kLSLaunchDontAddToRecents = 0x00000100 kLSLaunchDontSwitch = 0x00000200 kLSLaunchNoParams = 0x00000800 kLSLaunchAsync = 0x00010000 kLSLaunchStartClassic = 0x00020000 kLSLaunchInClassic = 0x00040000 kLSLaunchNewInstance = 0x00080000 kLSLaunchAndHide = 0x00100000 kLSLaunchAndHideOthers = 0x00200000 From jackjansen at users.sourceforge.net Tue Dec 2 18:01:45 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 2 18:01:51 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/launch _Launchmodule.c, NONE, 1.1 launchscan.py, NONE, 1.1 launchsupport.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/launch In directory sc8-pr-cvs1:/tmp/cvs-serv18090/Mac/Modules/launch Added Files: _Launchmodule.c launchscan.py launchsupport.py Log Message: An interface to the LaunchServices API. --- NEW FILE: _Launchmodule.c --- /* ========================= Module _Launch ========================= */ #include "Python.h" #include "pymactoolbox.h" /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ "Not available in this shared library/OS version"); \ return NULL; \ }} while(0) #include /* ** Optional CFStringRef. None will pass NULL */ static int OptCFStringRefObj_Convert(PyObject *v, CFStringRef *spec) { if (v == Py_None) { *spec = NULL; return 1; } return CFStringRefObj_Convert(v, spec); } PyObject * OptCFStringRefObj_New(CFStringRef it) { if (it == NULL) { Py_INCREF(Py_None); return Py_None; } return CFStringRefObj_New(it); } /* ** Convert LSItemInfoRecord to Python. */ PyObject * LSItemInfoRecord_New(LSItemInfoRecord *it) { return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}", "flags", it->flags, "filetype", PyMac_BuildOSType, it->filetype, "creator", PyMac_BuildOSType, it->creator, "extension", OptCFStringRefObj_New, it->extension, "iconFileName", OptCFStringRefObj_New, it->iconFileName, "kindID", it->kindID); } static PyObject *Launch_Error; static PyObject *Launch_LSInit(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; LSInitializeFlags inFlags; if (!PyArg_ParseTuple(_args, "l", &inFlags)) return NULL; _err = LSInit(inFlags); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Launch_LSTerm(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; if (!PyArg_ParseTuple(_args, "")) return NULL; _err = LSTerm(); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); _res = Py_None; return _res; } static PyObject *Launch_LSCopyItemInfoForRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; FSRef inItemRef; LSRequestedInfo inWhichInfo; LSItemInfoRecord outItemInfo; if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetFSRef, &inItemRef, &inWhichInfo)) return NULL; _err = LSCopyItemInfoForRef(&inItemRef, inWhichInfo, &outItemInfo); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", LSItemInfoRecord_New, &outItemInfo); return _res; } static PyObject *Launch_LSCopyItemInfoForURL(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFURLRef inURL; LSRequestedInfo inWhichInfo; LSItemInfoRecord outItemInfo; if (!PyArg_ParseTuple(_args, "O&l", CFURLRefObj_Convert, &inURL, &inWhichInfo)) return NULL; _err = LSCopyItemInfoForURL(inURL, inWhichInfo, &outItemInfo); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", LSItemInfoRecord_New, &outItemInfo); return _res; } static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; FSRef inFSRef; CFStringRef outKindString; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSRef, &inFSRef)) return NULL; _err = LSCopyKindStringForRef(&inFSRef, &outKindString); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", CFStringRefObj_New, outKindString); return _res; } static PyObject *Launch_LSCopyKindStringForURL(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFURLRef inURL; CFStringRef outKindString; if (!PyArg_ParseTuple(_args, "O&", CFURLRefObj_Convert, &inURL)) return NULL; _err = LSCopyKindStringForURL(inURL, &outKindString); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", CFStringRefObj_New, outKindString); return _res; } static PyObject *Launch_LSGetApplicationForItem(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; FSRef inItemRef; LSRolesMask inRoleMask; FSRef outAppRef; CFURLRef outAppURL; if (!PyArg_ParseTuple(_args, "O&l", PyMac_GetFSRef, &inItemRef, &inRoleMask)) return NULL; _err = LSGetApplicationForItem(&inItemRef, inRoleMask, &outAppRef, &outAppURL); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&O&", PyMac_BuildFSRef, &outAppRef, CFURLRefObj_New, outAppURL); return _res; } static PyObject *Launch_LSGetApplicationForInfo(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; OSType inType; OSType inCreator; CFStringRef inExtension; LSRolesMask inRoleMask; FSRef outAppRef; CFURLRef outAppURL; if (!PyArg_ParseTuple(_args, "O&O&O&l", PyMac_GetOSType, &inType, PyMac_GetOSType, &inCreator, OptCFStringRefObj_Convert, &inExtension, &inRoleMask)) return NULL; _err = LSGetApplicationForInfo(inType, inCreator, inExtension, inRoleMask, &outAppRef, &outAppURL); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&O&", PyMac_BuildFSRef, &outAppRef, CFURLRefObj_New, outAppURL); return _res; } static PyObject *Launch_LSGetApplicationForURL(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFURLRef inURL; LSRolesMask inRoleMask; FSRef outAppRef; CFURLRef outAppURL; if (!PyArg_ParseTuple(_args, "O&l", CFURLRefObj_Convert, &inURL, &inRoleMask)) return NULL; _err = LSGetApplicationForURL(inURL, inRoleMask, &outAppRef, &outAppURL); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&O&", PyMac_BuildFSRef, &outAppRef, CFURLRefObj_New, outAppURL); return _res; } static PyObject *Launch_LSFindApplicationForInfo(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; OSType inCreator; CFStringRef inBundleID; CFStringRef inName; FSRef outAppRef; CFURLRef outAppURL; if (!PyArg_ParseTuple(_args, "O&O&O&", PyMac_GetOSType, &inCreator, OptCFStringRefObj_Convert, &inBundleID, OptCFStringRefObj_Convert, &inName)) return NULL; _err = LSFindApplicationForInfo(inCreator, inBundleID, inName, &outAppRef, &outAppURL); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&O&", PyMac_BuildFSRef, &outAppRef, CFURLRefObj_New, outAppURL); return _res; } static PyObject *Launch_LSCanRefAcceptItem(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; FSRef inItemFSRef; FSRef inTargetRef; LSRolesMask inRoleMask; LSAcceptanceFlags inFlags; Boolean outAcceptsItem; if (!PyArg_ParseTuple(_args, "O&O&ll", PyMac_GetFSRef, &inItemFSRef, PyMac_GetFSRef, &inTargetRef, &inRoleMask, &inFlags)) return NULL; _err = LSCanRefAcceptItem(&inItemFSRef, &inTargetRef, inRoleMask, inFlags, &outAcceptsItem); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", outAcceptsItem); return _res; } static PyObject *Launch_LSCanURLAcceptURL(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFURLRef inItemURL; CFURLRef inTargetURL; LSRolesMask inRoleMask; LSAcceptanceFlags inFlags; Boolean outAcceptsItem; if (!PyArg_ParseTuple(_args, "O&O&ll", CFURLRefObj_Convert, &inItemURL, CFURLRefObj_Convert, &inTargetURL, &inRoleMask, &inFlags)) return NULL; _err = LSCanURLAcceptURL(inItemURL, inTargetURL, inRoleMask, inFlags, &outAcceptsItem); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", outAcceptsItem); return _res; } static PyObject *Launch_LSOpenFSRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; FSRef inRef; FSRef outLaunchedRef; if (!PyArg_ParseTuple(_args, "O&", PyMac_GetFSRef, &inRef)) return NULL; _err = LSOpenFSRef(&inRef, &outLaunchedRef); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", PyMac_BuildFSRef, &outLaunchedRef); return _res; } static PyObject *Launch_LSOpenCFURLRef(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; OSStatus _err; CFURLRef inURL; CFURLRef outLaunchedURL; if (!PyArg_ParseTuple(_args, "O&", CFURLRefObj_Convert, &inURL)) return NULL; _err = LSOpenCFURLRef(inURL, &outLaunchedURL); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", CFURLRefObj_New, outLaunchedURL); return _res; } static PyMethodDef Launch_methods[] = { {"LSInit", (PyCFunction)Launch_LSInit, 1, PyDoc_STR("(LSInitializeFlags inFlags) -> None")}, {"LSTerm", (PyCFunction)Launch_LSTerm, 1, PyDoc_STR("() -> None")}, {"LSCopyItemInfoForRef", (PyCFunction)Launch_LSCopyItemInfoForRef, 1, PyDoc_STR("(FSRef inItemRef, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")}, {"LSCopyItemInfoForURL", (PyCFunction)Launch_LSCopyItemInfoForURL, 1, PyDoc_STR("(CFURLRef inURL, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")}, {"LSCopyKindStringForRef", (PyCFunction)Launch_LSCopyKindStringForRef, 1, PyDoc_STR("(FSRef inFSRef) -> (CFStringRef outKindString)")}, {"LSCopyKindStringForURL", (PyCFunction)Launch_LSCopyKindStringForURL, 1, PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outKindString)")}, {"LSGetApplicationForItem", (PyCFunction)Launch_LSGetApplicationForItem, 1, PyDoc_STR("(FSRef inItemRef, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")}, {"LSGetApplicationForInfo", (PyCFunction)Launch_LSGetApplicationForInfo, 1, PyDoc_STR("(OSType inType, OSType inCreator, CFStringRef inExtension, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")}, {"LSGetApplicationForURL", (PyCFunction)Launch_LSGetApplicationForURL, 1, PyDoc_STR("(CFURLRef inURL, LSRolesMask inRoleMask) -> (FSRef outAppRef, CFURLRef outAppURL)")}, {"LSFindApplicationForInfo", (PyCFunction)Launch_LSFindApplicationForInfo, 1, PyDoc_STR("(OSType inCreator, CFStringRef inBundleID, CFStringRef inName) -> (FSRef outAppRef, CFURLRef outAppURL)")}, {"LSCanRefAcceptItem", (PyCFunction)Launch_LSCanRefAcceptItem, 1, PyDoc_STR("(FSRef inItemFSRef, FSRef inTargetRef, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")}, {"LSCanURLAcceptURL", (PyCFunction)Launch_LSCanURLAcceptURL, 1, PyDoc_STR("(CFURLRef inItemURL, CFURLRef inTargetURL, LSRolesMask inRoleMask, LSAcceptanceFlags inFlags) -> (Boolean outAcceptsItem)")}, {"LSOpenFSRef", (PyCFunction)Launch_LSOpenFSRef, 1, PyDoc_STR("(FSRef inRef) -> (FSRef outLaunchedRef)")}, {"LSOpenCFURLRef", (PyCFunction)Launch_LSOpenCFURLRef, 1, PyDoc_STR("(CFURLRef inURL) -> (CFURLRef outLaunchedURL)")}, {NULL, NULL, 0} }; void init_Launch(void) { PyObject *m; PyObject *d; m = Py_InitModule("_Launch", Launch_methods); d = PyModule_GetDict(m); Launch_Error = PyMac_GetOSErrException(); if (Launch_Error == NULL || PyDict_SetItemString(d, "Error", Launch_Error) != 0) return; } /* ======================= End module _Launch ======================= */ --- NEW FILE: launchscan.py --- # Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "LaunchServices" SHORT = "launch" OBJECT = "NOTUSED" def main(): input = LONG + ".h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() scanner.gentypetest(SHORT+"typetest.py") print "=== Testing definitions output code ===" execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner): def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] # This is non-functional today if t == OBJECT and m == "InMode": classname = "Method" listname = "methods" return classname, listname def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") self.defsfile.write("kLSRequestAllInfo = -1\n") self.defsfile.write("kLSRolesAll = -1\n") def makeblacklistnames(self): return [ "kLSRequestAllInfo", "kLSRolesAll", ] def makeblacklisttypes(self): return [ "LSLaunchFSRefSpec_ptr", "LSLaunchURLSpec_ptr", ] def makerepairinstructions(self): return [ # LSGetApplicationForInfo ([('CFStringRef', 'inExtension', 'InMode')], [('OptCFStringRef', 'inExtension', 'InMode')]), # LSFindApplicationForInfo ([('CFStringRef', 'inBundleID', 'InMode')], [('OptCFStringRef', 'inBundleID', 'InMode')]), ([('CFStringRef', 'inName', 'InMode')], [('OptCFStringRef', 'inName', 'InMode')]), ] if __name__ == "__main__": main() --- NEW FILE: launchsupport.py --- # This script generates a Python interface for an Apple Macintosh Manager. # It uses the "bgen" package to generate C code. # The function specifications are generated by scanning the mamager's header file, # using the "scantools" package (customized for this particular manager). import string # Declarations that change for each manager MODNAME = '_Launch' # The name of the module OBJECTNAME = 'UNUSED' # The basic name of the objects used here KIND = 'Record' # Usually 'Ptr' or 'Handle' # The following is *usually* unchanged but may still require tuning MODPREFIX = 'Launch' # The prefix for module-wide routines OBJECTTYPE = OBJECTNAME + KIND # The C type used to represent them OBJECTPREFIX = MODPREFIX + 'Obj' # The prefix for object methods INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects LSAcceptanceFlags = Type("LSAcceptanceFlags", "l") LSInitializeFlags = Type("LSInitializeFlags", "l") LSRequestedInfo = Type("LSRequestedInfo", "l") LSRolesMask = Type("LSRolesMask", "l") OptCFStringRef = OpaqueByValueType("CFStringRef", "OptCFStringRefObj") LSItemInfoRecord = OpaqueType("LSItemInfoRecord", "LSItemInfoRecord") #MenuRef = OpaqueByValueType("MenuRef", "MenuObj") #MenuItemIndex = Type("MenuItemIndex", "H") #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) #RgnHandle = FakeType("(RgnHandle)0") # XXXX Should be next, but this will break a lot of code... # RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj") #KeyMap = ArrayOutputBufferType("KeyMap") ##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style ##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style #EventMask = Type("EventMask", "H") #EventKind = Type("EventKind", "H") includestuff = includestuff + """ #include /* ** Optional CFStringRef. None will pass NULL */ static int OptCFStringRefObj_Convert(PyObject *v, CFStringRef *spec) { if (v == Py_None) { *spec = NULL; return 1; } return CFStringRefObj_Convert(v, spec); } PyObject * OptCFStringRefObj_New(CFStringRef it) { if (it == NULL) { Py_INCREF(Py_None); return Py_None; } return CFStringRefObj_New(it); } /* ** Convert LSItemInfoRecord to Python. */ PyObject * LSItemInfoRecord_New(LSItemInfoRecord *it) { return Py_BuildValue("{s:is:O&s:O&s:O&s:O&s:i}", "flags", it->flags, "filetype", PyMac_BuildOSType, it->filetype, "creator", PyMac_BuildOSType, it->creator, "extension", OptCFStringRefObj_New, it->extension, "iconFileName", OptCFStringRefObj_New, it->iconFileName, "kindID", it->kindID); } """ # From here on it's basically all boiler plate... execfile(string.lower(MODPREFIX) + 'typetest.py') # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) ##object = MyObjectDefinition(OBJECTNAME, OBJECTPREFIX, OBJECTTYPE) ##module.addobject(object) # Create the generator classes used to populate the lists Function = OSErrFunctionGenerator ##Method = OSErrMethodGenerator # Create and populate the lists functions = [] ##methods = [] execfile(INPUTFILE) # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) for f in functions: module.add(f) ##for f in methods: object.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() From jackjansen at users.sourceforge.net Tue Dec 2 18:02:14 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 2 18:02:17 2003 Subject: [Python-checkins] python/dist/src setup.py,1.177,1.178 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv18090 Modified Files: setup.py Log Message: An interface to the LaunchServices API. Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** setup.py 13 Nov 2003 08:30:02 -0000 1.177 --- setup.py 2 Dec 2003 23:01:39 -0000 1.178 *************** *** 829,832 **** --- 829,834 ---- exts.append( Extension('_IBCarbon', ['ibcarbon/_IBCarbon.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_Launch', ['launch/_Launchmodule.c'], + extra_link_args=['-framework', 'ApplicationServices']) ) exts.append( Extension('_List', ['list/_Listmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From mhammond at users.sourceforge.net Tue Dec 2 20:21:04 2003 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue Dec 2 20:21:08 2003 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.300.8.4, 2.300.8.5 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv12845 Modified Files: Tag: release23-maint posixmodule.c Log Message: Fix [ 846133 ] os.chmod/os.utime/shutil do not work with unicode filenames Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.300.8.4 retrieving revision 2.300.8.5 diff -C2 -d -r2.300.8.4 -r2.300.8.5 *** posixmodule.c 31 Oct 2003 10:01:37 -0000 2.300.8.4 --- posixmodule.c 3 Dec 2003 01:21:01 -0000 2.300.8.5 *************** *** 1145,1149 **** int i; int res; ! if (!PyArg_ParseTuple(args, "eti", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; --- 1145,1167 ---- int i; int res; ! #ifdef Py_WIN_WIDE_FILENAMES ! if (unicode_file_names()) { ! PyUnicodeObject *po; ! if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { ! Py_BEGIN_ALLOW_THREADS ! res = _wchmod(PyUnicode_AS_UNICODE(po), i); ! Py_END_ALLOW_THREADS ! if (res < 0) ! return posix_error_with_unicode_filename( ! PyUnicode_AS_UNICODE(po)); ! Py_INCREF(Py_None); ! return Py_None; ! } ! /* Drop the argument parsing error as narrow strings ! are also valid. */ ! PyErr_Clear(); ! } ! #endif /* Py_WIN_WIDE_FILENAMES */ ! if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; *************** *** 1917,1925 **** #endif /* HAVE_UTIMES */ ! if (!PyArg_ParseTuple(args, "sO:utime", &path, &arg)) return NULL; if (arg == Py_None) { /* optional time values not given */ Py_BEGIN_ALLOW_THREADS res = utime(path, NULL); Py_END_ALLOW_THREADS --- 1935,1964 ---- #endif /* HAVE_UTIMES */ ! int have_unicode_filename = 0; ! #ifdef Py_WIN_WIDE_FILENAMES ! PyUnicodeObject *obwpath; ! wchar_t *wpath; ! if (unicode_file_names()) { ! if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { ! wpath = PyUnicode_AS_UNICODE(obwpath); ! have_unicode_filename = 1; ! } else ! /* Drop the argument parsing error as narrow strings ! are also valid. */ ! PyErr_Clear(); ! } ! #endif /* Py_WIN_WIDE_FILENAMES */ ! ! if (!have_unicode_filename && \ ! !PyArg_ParseTuple(args, "sO:utime", &path, &arg)) return NULL; if (arg == Py_None) { /* optional time values not given */ Py_BEGIN_ALLOW_THREADS + #ifdef Py_WIN_WIDE_FILENAMES + if (have_unicode_filename) + res = _wutime(wpath, NULL); + else + #endif /* Py_WIN_WIDE_FILENAMES */ res = utime(path, NULL); Py_END_ALLOW_THREADS *************** *** 1947,1953 **** #else Py_BEGIN_ALLOW_THREADS res = utime(path, UTIME_ARG); Py_END_ALLOW_THREADS ! #endif } if (res < 0) --- 1986,2000 ---- #else Py_BEGIN_ALLOW_THREADS + #ifdef Py_WIN_WIDE_FILENAMES + if (have_unicode_filename) + /* utime is OK with utimbuf, but _wutime insists + on _utimbuf (the msvc headers assert the + underscore version is ansi) */ + res = _wutime(wpath, (struct _utimbuf *)UTIME_ARG); + else + #endif /* Py_WIN_WIDE_FILENAMES */ res = utime(path, UTIME_ARG); Py_END_ALLOW_THREADS ! #endif /* HAVE_UTIMES */ } if (res < 0) From mhammond at users.sourceforge.net Tue Dec 2 20:22:40 2003 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue Dec 2 20:22:43 2003 Subject: [Python-checkins] python/dist/src/Modules posixmodule.c, 2.308, 2.309 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv13267 Modified Files: posixmodule.c Log Message: Fix [ 846133 ] os.chmod/os.utime/shutil do not work with unicode filenames Index: posixmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v retrieving revision 2.308 retrieving revision 2.309 diff -C2 -d -r2.308 -r2.309 *** posixmodule.c 10 Nov 2003 06:35:36 -0000 2.308 --- posixmodule.c 3 Dec 2003 01:22:38 -0000 2.309 *************** *** 1163,1167 **** int i; int res; ! if (!PyArg_ParseTuple(args, "eti", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; --- 1163,1185 ---- int i; int res; ! #ifdef Py_WIN_WIDE_FILENAMES ! if (unicode_file_names()) { ! PyUnicodeObject *po; ! if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { ! Py_BEGIN_ALLOW_THREADS ! res = _wchmod(PyUnicode_AS_UNICODE(po), i); ! Py_END_ALLOW_THREADS ! if (res < 0) ! return posix_error_with_unicode_filename( ! PyUnicode_AS_UNICODE(po)); ! Py_INCREF(Py_None); ! return Py_None; ! } ! /* Drop the argument parsing error as narrow strings ! are also valid. */ ! PyErr_Clear(); ! } ! #endif /* Py_WIN_WIDE_FILENAMES */ ! if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; *************** *** 1935,1943 **** #endif /* HAVE_UTIMES */ ! if (!PyArg_ParseTuple(args, "sO:utime", &path, &arg)) return NULL; if (arg == Py_None) { /* optional time values not given */ Py_BEGIN_ALLOW_THREADS res = utime(path, NULL); Py_END_ALLOW_THREADS --- 1953,1982 ---- #endif /* HAVE_UTIMES */ ! int have_unicode_filename = 0; ! #ifdef Py_WIN_WIDE_FILENAMES ! PyUnicodeObject *obwpath; ! wchar_t *wpath; ! if (unicode_file_names()) { ! if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { ! wpath = PyUnicode_AS_UNICODE(obwpath); ! have_unicode_filename = 1; ! } else ! /* Drop the argument parsing error as narrow strings ! are also valid. */ ! PyErr_Clear(); ! } ! #endif /* Py_WIN_WIDE_FILENAMES */ ! ! if (!have_unicode_filename && \ ! !PyArg_ParseTuple(args, "sO:utime", &path, &arg)) return NULL; if (arg == Py_None) { /* optional time values not given */ Py_BEGIN_ALLOW_THREADS + #ifdef Py_WIN_WIDE_FILENAMES + if (have_unicode_filename) + res = _wutime(wpath, NULL); + else + #endif /* Py_WIN_WIDE_FILENAMES */ res = utime(path, NULL); Py_END_ALLOW_THREADS *************** *** 1965,1971 **** #else Py_BEGIN_ALLOW_THREADS res = utime(path, UTIME_ARG); Py_END_ALLOW_THREADS ! #endif } if (res < 0) --- 2004,2018 ---- #else Py_BEGIN_ALLOW_THREADS + #ifdef Py_WIN_WIDE_FILENAMES + if (have_unicode_filename) + /* utime is OK with utimbuf, but _wutime insists + on _utimbuf (the msvc headers assert the + underscore version is ansi) */ + res = _wutime(wpath, (struct _utimbuf *)UTIME_ARG); + else + #endif /* Py_WIN_WIDE_FILENAMES */ res = utime(path, UTIME_ARG); Py_END_ALLOW_THREADS ! #endif /* HAVE_UTIMES */ } if (res < 0) From mhammond at users.sourceforge.net Tue Dec 2 20:27:25 2003 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue Dec 2 20:27:29 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py, 1.58, 1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14031 Modified Files: test_support.py Log Message: Add TESTFN_UNICODE_UNENCODEABLE, a unicode filename that can not be encoded using the default file system encoding. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** test_support.py 16 Jul 2003 04:29:42 -0000 1.58 --- test_support.py 3 Dec 2003 01:27:23 -0000 1.59 *************** *** 125,128 **** --- 125,131 ---- # Unicode name only used if TEST_FN_ENCODING exists for the platform. if have_unicode: + # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() + # TESTFN_UNICODE is a filename that can be encoded using the + # file system encoding, but *not* with the default (ascii) encoding if isinstance('', unicode): # python -U *************** *** 132,135 **** --- 135,156 ---- TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. TESTFN_ENCODING=sys.getfilesystemencoding() + # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be + # able to be encoded by *either* the default or filesystem encoding. + # Japanese characters (I think - from bug 846133) + TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b" + try: + # XXX - Note - should be using TESTFN_ENCODING here - but for + # Windows, "mbcs" currently always operates as if in + # errors=ignore' mode - hence we get '?' characters rather than + # the exception. 'Latin1' operates as we expect - ie, fails. + # See [ 850997 ] mbcs encoding ignores errors + TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") + except UnicodeEncodeError: + pass + else: + print \ + 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ + 'Unicode filename tests may not be effective' \ + % TESTFN_UNICODE_UNENCODEABLE # Make sure we can write to TESTFN, try in /tmp if we can't From mhammond at users.sourceforge.net Tue Dec 2 20:29:58 2003 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue Dec 2 20:30:02 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_unicode_file.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14438 Modified Files: test_unicode_file.py Log Message: Add test for bug "[ 846133 ] os.chmod/os.utime/shutil do not work with unicode filenames" Reorganize tests into functions so more combinations of unicode/encoded/ascii can be tested, and while I was at it, upgrade to unittest based test. Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_unicode_file.py 6 Aug 2003 02:46:58 -0000 1.10 --- test_unicode_file.py 3 Dec 2003 01:29:55 -0000 1.11 *************** *** 2,9 **** # We dont test many operations on files other than # that their names can be used with Unicode characters. ! import os, glob ! from test.test_support import verify, TestSkipped, TESTFN_UNICODE ! from test.test_support import TESTFN_ENCODING try: TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) --- 2,10 ---- # We dont test many operations on files other than # that their names can be used with Unicode characters. ! import os, glob, time, shutil ! import unittest ! from test.test_support import run_suite, TestSkipped, TESTFN_UNICODE ! from test.test_support import TESTFN_ENCODING, TESTFN_UNICODE_UNENCODEABLE try: TESTFN_ENCODED = TESTFN_UNICODE.encode(TESTFN_ENCODING) *************** *** 13,97 **** raise TestSkipped("No Unicode filesystem semantics on this platform.") ! # Check with creation as Unicode string. ! f = open(TESTFN_UNICODE, 'wb') ! if not os.path.isfile(TESTFN_UNICODE): ! print "File doesn't exist after creating it" ! ! if not os.path.isfile(TESTFN_ENCODED): ! print "File doesn't exist (encoded string) after creating it" ! f.close() ! # Test stat and chmod ! if os.stat(TESTFN_ENCODED) != os.stat(TESTFN_UNICODE): ! print "os.stat() did not agree on the 2 filenames" ! if os.lstat(TESTFN_ENCODED) != os.lstat(TESTFN_UNICODE): ! print "os.lstat() did not agree on the 2 filenames" ! os.chmod(TESTFN_ENCODED, 0777) ! os.chmod(TESTFN_UNICODE, 0777) ! # Test rename ! try: ! os.unlink(TESTFN_ENCODED + ".new") ! except os.error: ! pass ! os.rename(TESTFN_ENCODED, TESTFN_ENCODED + ".new") ! os.rename(TESTFN_UNICODE+".new", TESTFN_ENCODED) ! os.unlink(TESTFN_ENCODED) ! if os.path.isfile(TESTFN_ENCODED) or \ ! os.path.isfile(TESTFN_UNICODE): ! print "File exists after deleting it" ! # Check with creation as encoded string. ! f = open(TESTFN_ENCODED, 'wb') ! if not os.path.isfile(TESTFN_UNICODE) or \ ! not os.path.isfile(TESTFN_ENCODED): ! print "File doesn't exist after creating it" ! path, base = os.path.split(os.path.abspath(TESTFN_ENCODED)) ! # Until PEP 277 is adopted, this test is not portable ! # if base not in os.listdir(path): ! # print "Filename did not appear in os.listdir()" ! # path, base = os.path.split(os.path.abspath(TESTFN_UNICODE)) ! # if base not in os.listdir(path): ! # print "Unicode filename did not appear in os.listdir()" ! if os.path.abspath(TESTFN_ENCODED) != os.path.abspath(glob.glob(TESTFN_ENCODED)[0]): ! print "Filename did not appear in glob.glob()" ! if os.path.abspath(TESTFN_UNICODE) != os.path.abspath(glob.glob(TESTFN_UNICODE)[0]): ! print "Unicode filename did not appear in glob.glob()" ! f.close() ! os.unlink(TESTFN_UNICODE) ! if os.path.isfile(TESTFN_ENCODED) or \ ! os.path.isfile(TESTFN_UNICODE): ! print "File exists after deleting it" ! # test os.open ! f = os.open(TESTFN_ENCODED, os.O_CREAT) ! if not os.path.isfile(TESTFN_UNICODE) or \ ! not os.path.isfile(TESTFN_ENCODED): ! print "File doesn't exist after creating it" ! os.close(f) ! os.unlink(TESTFN_UNICODE) ! # Test directories etc ! cwd = os.getcwd() ! abs_encoded = os.path.abspath(TESTFN_ENCODED) + ".dir" ! abs_unicode = os.path.abspath(TESTFN_UNICODE) + ".dir" ! os.mkdir(abs_encoded) ! try: ! os.chdir(abs_encoded) ! os.chdir(abs_unicode) ! finally: ! os.chdir(cwd) ! os.rmdir(abs_unicode) ! os.mkdir(abs_unicode) ! try: ! os.chdir(abs_encoded) ! os.chdir(abs_unicode) ! finally: ! os.chdir(cwd) ! os.rmdir(abs_encoded) ! print "All the Unicode tests appeared to work" --- 14,169 ---- raise TestSkipped("No Unicode filesystem semantics on this platform.") ! def remove_if_exists(filename): ! if os.path.exists(filename): ! os.unlink(filename) ! class TestUnicodeFiles(unittest.TestCase): ! # The 'do_' functions are the actual tests. They generally assume the ! # file already exists etc. ! ! # Do all the tests we can given only a single filename. The file should ! # exist. ! def _do_single(self, filename): ! self.failUnless(os.path.exists(filename)) ! self.failUnless(os.path.isfile(filename)) ! self.failUnless(os.path.exists(os.path.abspath(filename))) ! self.failUnless(os.path.isfile(os.path.abspath(filename))) ! os.chmod(filename, 0777) ! os.utime(filename, None) ! os.utime(filename, (time.time(), time.time())) ! # Copy/rename etc tests using the same filename ! self._do_copyish(filename, filename) ! # Filename should appear in glob output ! self.failUnless( ! os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0])) ! # basename should appear in listdir. ! path, base = os.path.split(os.path.abspath(filename)) ! self.failUnless(base in os.listdir(path)) ! ! # Do as many "equivalancy' tests as we can - ie, check that although we ! # have different types for the filename, they refer to the same file. ! def _do_equivilent(self, filename1, filename2): ! # Note we only check "filename1 against filename2" - we don't bother ! # checking "filename2 against 1", as we assume we are called again with ! # the args reversed. ! self.failUnless(type(filename1)!=type(filename2), ! "No point checking equivalent filenames of the same type") ! # stat and lstat should return the same results. ! self.failUnlessEqual(os.stat(filename1), ! os.stat(filename2)) ! self.failUnlessEqual(os.lstat(filename1), ! os.lstat(filename2)) ! # Copy/rename etc tests using equivalent filename ! self._do_copyish(filename1, filename2) ! # Tests that copy, move, etc one file to another. ! def _do_copyish(self, filename1, filename2): ! # Should be able to rename the file using either name. ! self.failUnless(os.path.isfile(filename1)) # must exist. ! os.rename(filename1, filename2 + ".new") ! self.failUnless(os.path.isfile(filename1+".new")) ! os.rename(filename1 + ".new", filename2) ! self.failUnless(os.path.isfile(filename2)) ! # Try using shutil on the filenames. ! try: ! filename1==filename2 ! except UnicodeDecodeError: ! # these filenames can't be compared - shutil.copy tries to do ! # just that. This is really a bug in 'shutil' - if one of shutil's ! # 2 params are Unicode and the other isn't, it should coerce the ! # string to Unicode with the filesystem encoding before comparison. ! pass ! else: ! # filenames can be compared. ! shutil.copy(filename1, filename2 + ".new") ! os.unlink(filename1 + ".new") # remove using equiv name. ! # And a couple of moves, one using each name. ! shutil.move(filename1, filename2 + ".new") ! self.failUnless(not os.path.exists(filename2)) ! shutil.move(filename1 + ".new", filename2) ! self.failUnless(os.path.exists(filename1)) ! # Note - due to the implementation of shutil.move, ! # it tries a rename first. This only fails on Windows when on ! # different file systems - and this test can't ensure that. ! # So we test the shutil.copy2 function, which is the thing most ! # likely to fail. ! shutil.copy2(filename1, filename2 + ".new") ! os.unlink(filename1 + ".new") ! def _do_directory(self, make_name, chdir_name, getcwd_func): ! cwd = os.getcwd() ! if os.path.isdir(make_name): ! os.rmdir(make_name) ! os.mkdir(make_name) ! try: ! os.chdir(chdir_name) ! try: ! self.failUnlessEqual(os.path.basename(getcwd_func()), ! make_name) ! finally: ! os.chdir(cwd) ! finally: ! os.rmdir(make_name) ! # The '_test' functions 'entry points with params' - ie, what the ! # top-level 'test' functions would be if they could take params ! def _test_single(self, filename): ! remove_if_exists(filename) ! f = file(filename, "w") ! f.close() ! try: ! self._do_single(filename) ! finally: ! os.unlink(filename) ! self.failUnless(not os.path.exists(filename)) ! # and again with os.open. ! f = os.open(filename, os.O_CREAT) ! os.close(f) ! try: ! self._do_single(filename) ! finally: ! os.unlink(filename) ! ! def _test_equivalent(self, filename1, filename2): ! remove_if_exists(filename1) ! self.failUnless(not os.path.exists(filename2)) ! f = file(filename1, "w") ! f.close() ! try: ! self._do_equivilent(filename1, filename2) ! finally: ! os.unlink(filename1) ! # The 'test' functions are unittest entry points, and simply call our ! # _test functions with each of the filename combinations we wish to test ! def test_single_files(self): ! self._test_single(TESTFN_ENCODED) ! self._test_single(TESTFN_UNICODE) ! self._test_single(TESTFN_UNICODE_UNENCODEABLE) ! def test_equivalent_files(self): ! self._test_equivalent(TESTFN_ENCODED, TESTFN_UNICODE) ! self._test_equivalent(TESTFN_UNICODE, TESTFN_ENCODED) ! def test_directories(self): ! # For all 'equivilent' combinations: ! # Make dir with encoded, chdir with unicode, checkdir with encoded ! # (or unicode/encoded/unicode, etc ! ext = ".dir" ! self._do_directory(TESTFN_ENCODED+ext, TESTFN_ENCODED+ext, os.getcwd) ! self._do_directory(TESTFN_ENCODED+ext, TESTFN_UNICODE+ext, os.getcwd) ! self._do_directory(TESTFN_UNICODE+ext, TESTFN_ENCODED+ext, os.getcwdu) ! self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, os.getcwdu) ! # Our directory name that can't use a non-unicode name. ! self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, ! TESTFN_UNICODE_UNENCODEABLE+ext, ! os.getcwdu) ! def test_main(): ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestUnicodeFiles)) ! run_suite(suite) ! if __name__ == "__main__": ! test_main() From mhammond at users.sourceforge.net Tue Dec 2 20:29:59 2003 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Tue Dec 2 20:30:07 2003 Subject: [Python-checkins] python/dist/src/Lib/test/output test_unicode_file, 1.1, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv14438/output Removed Files: test_unicode_file Log Message: Add test for bug "[ 846133 ] os.chmod/os.utime/shutil do not work with unicode filenames" Reorganize tests into functions so more combinations of unicode/encoded/ascii can be tested, and while I was at it, upgrade to unittest based test. --- test_unicode_file DELETED --- From doerwalter at users.sourceforge.net Wed Dec 3 05:34:59 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 05:35:03 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.213,1.214 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv31082/Doc/tut Modified Files: tut.tex Log Message: Fix typo. (From SF bug #853064) Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.213 retrieving revision 1.214 diff -C2 -d -r1.213 -r1.214 *** tut.tex 2 Dec 2003 07:38:30 -0000 1.213 --- tut.tex 3 Dec 2003 10:34:57 -0000 1.214 *************** *** 2147,2151 **** \end{verbatim} ! The \function{dict()} contructor builds dictionaries directly from lists of key-value pairs stored as tuples. When the pairs form a pattern, list comprehensions can compactly specify the key-value list. --- 2147,2151 ---- \end{verbatim} ! The \function{dict()} constructor builds dictionaries directly from lists of key-value pairs stored as tuples. When the pairs form a pattern, list comprehensions can compactly specify the key-value list. From doerwalter at users.sourceforge.net Wed Dec 3 05:36:17 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 05:36:21 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.8, 1.196.8.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv31308/Doc/tut Modified Files: Tag: release23-maint tut.tex Log Message: Backport checkin: Fix typo. (From SF bug #853064) Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.8 retrieving revision 1.196.8.9 diff -C2 -d -r1.196.8.8 -r1.196.8.9 *** tut.tex 25 Oct 2003 14:17:15 -0000 1.196.8.8 --- tut.tex 3 Dec 2003 10:36:15 -0000 1.196.8.9 *************** *** 2097,2101 **** \end{verbatim} ! The \function{dict()} contructor builds dictionaries directly from lists of key-value pairs stored as tuples. When the pairs form a pattern, list comprehensions can compactly specify the key-value list. --- 2097,2101 ---- \end{verbatim} ! The \function{dict()} constructor builds dictionaries directly from lists of key-value pairs stored as tuples. When the pairs form a pattern, list comprehensions can compactly specify the key-value list. From gvanrossum at users.sourceforge.net Wed Dec 3 10:24:05 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 3 10:24:08 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_winreg.py, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18146 Modified Files: test_winreg.py Log Message: Reduce the size of Big String and Big Binary tests to 2**14 (minus one for Big String). This should make the tests pass on Win98SE. Note that the docs only promise lengths up to 2048. Unfortunately this no longer tests for the segfault I was seeing earlier, but I'm confident I've nailed that one. :-) Fixes SF 852281. Will backport to 2.3. Index: test_winreg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winreg.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_winreg.py 30 Nov 2003 22:46:18 -0000 1.12 --- test_winreg.py 3 Dec 2003 15:24:02 -0000 1.13 *************** *** 15,20 **** ("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ), ("Raw Data", ("binary"+chr(0)+"data"), REG_BINARY), ! ("Big String", "x"*(512*1024-4), REG_SZ), ! ("Big Binary", "x"*(1024*1024-4), REG_BINARY), ] if have_unicode: --- 15,20 ---- ("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ), ("Raw Data", ("binary"+chr(0)+"data"), REG_BINARY), ! ("Big String", "x"*(2**14-1), REG_SZ), ! ("Big Binary", "x"*(2**14), REG_BINARY), ] if have_unicode: From gvanrossum at users.sourceforge.net Wed Dec 3 10:25:12 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 3 10:25:17 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_winreg.py, 1.11.16.1, 1.11.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv18423 Modified Files: Tag: release23-maint test_winreg.py Log Message: backport: Reduce the size of Big String and Big Binary tests to 2**14 (minus one for Big String). This should make the tests pass on Win98SE. Note that the docs only promise lengths up to 2048. Unfortunately this no longer tests for the segfault I was seeing earlier, but I'm confident I've nailed that one. :-) Fixes SF 852281. Index: test_winreg.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_winreg.py,v retrieving revision 1.11.16.1 retrieving revision 1.11.16.2 diff -C2 -d -r1.11.16.1 -r1.11.16.2 *** test_winreg.py 30 Nov 2003 22:45:03 -0000 1.11.16.1 --- test_winreg.py 3 Dec 2003 15:25:10 -0000 1.11.16.2 *************** *** 15,20 **** ("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ), ("Raw Data", ("binary"+chr(0)+"data"), REG_BINARY), ! ("Big String", "x"*(512*1024-4), REG_SZ), ! ("Big Binary", "x"*(1024*1024-4), REG_BINARY), ] if have_unicode: --- 15,20 ---- ("Multi-string", ["Lots", "of", "string", "values"], REG_MULTI_SZ), ("Raw Data", ("binary"+chr(0)+"data"), REG_BINARY), ! ("Big String", "x"*(2**14-1), REG_SZ), ! ("Big Binary", "x"*(2**14), REG_BINARY), ] if have_unicode: From doerwalter at users.sourceforge.net Wed Dec 3 15:15:30 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:15:36 2003 Subject: [Python-checkins] python/dist/src/Lib pprint.py,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv12889/Lib Modified Files: pprint.py Log Message: Patch #750542: pprint now will pretty print subclasses of list, tuple and dict too, as long as they don't overwrite __repr__(). Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** pprint.py 7 Jun 2003 20:47:37 -0000 1.26 --- pprint.py 3 Dec 2003 20:15:28 -0000 1.27 *************** *** 91,97 **** indent = int(indent) width = int(width) ! assert indent >= 0 assert depth is None or depth > 0, "depth must be > 0" ! assert width self._depth = depth self._indent_per_level = indent --- 91,97 ---- indent = int(indent) width = int(width) ! assert indent >= 0, "indent must be >= 0" assert depth is None or depth > 0, "depth must be > 0" ! assert width, "width must be != 0" self._depth = depth self._indent_per_level = indent *************** *** 131,135 **** if sepLines: ! if typ is dict: write('{') if self._indent_per_level > 1: --- 131,136 ---- if sepLines: ! r = typ.__repr__ ! if issubclass(typ, dict) and r is dict.__repr__: write('{') if self._indent_per_level > 1: *************** *** 158,163 **** return ! if typ is list or typ is tuple: ! if typ is list: write('[') endchar = ']' --- 159,165 ---- return ! if (issubclass(typ, list) and r is list.__repr__) or \ ! (issubclass(typ, tuple) and r is tuple.__repr__): ! if issubclass(typ, list): write('[') endchar = ']' *************** *** 180,184 **** indent = indent - self._indent_per_level del context[objid] ! if typ is tuple and length == 1: write(',') write(endchar) --- 182,186 ---- indent = indent - self._indent_per_level del context[objid] ! if issubclass(typ, tuple) and length == 1: write(',') write(endchar) *************** *** 227,231 **** return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False ! if typ is dict: if not object: return "{}", True, False --- 229,234 ---- return ("%s%s%s" % (closure, sio.getvalue(), closure)), True, False ! r = typ.__repr__ ! if issubclass(typ, dict) and r is dict.__repr__: if not object: return "{}", True, False *************** *** 252,257 **** return "{%s}" % _commajoin(components), readable, recursive ! if typ is list or typ is tuple: ! if typ is list: if not object: return "[]", True, False --- 255,261 ---- return "{%s}" % _commajoin(components), readable, recursive ! if (issubclass(typ, list) and r is list.__repr__) or \ ! (issubclass(typ, tuple) and r is tuple.__repr__): ! if issubclass(typ, list): if not object: return "[]", True, False From doerwalter at users.sourceforge.net Wed Dec 3 15:15:31 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:15:39 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_pprint.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv12889/Lib/test Modified Files: test_pprint.py Log Message: Patch #750542: pprint now will pretty print subclasses of list, tuple and dict too, as long as they don't overwrite __repr__(). Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_pprint.py 31 Dec 2002 07:16:16 -0000 1.11 --- test_pprint.py 3 Dec 2003 20:15:28 -0000 1.12 *************** *** 9,12 **** --- 9,28 ---- return x + # list, tuple and dict subclasses that do or don't overwrite __repr__ + class list2(list): + pass + class list3(list): + def __repr__(self): + return list.__repr__(self) + class tuple2(tuple): + pass + class tuple3(tuple): + def __repr__(self): + return tuple.__repr__(self) + class dict2(dict): + pass + class dict3(dict): + def __repr__(self): + return dict.__repr__(self) class QueryTestCase(unittest.TestCase): *************** *** 85,93 **** def test_same_as_repr(self): ! # Simple objects and small containers that should be same as repr() verify = self.assert_ ! for simple in (0, 0L, 0+0j, 0.0, "", uni(""), (), [], {}, verify, pprint, -6, -6L, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6}, (1,2), [3,4], {5: 6, 7: 8}, {"xy\tab\n": (3,), 5: [[]], (): {}}, range(10, -11, -1) --- 101,118 ---- def test_same_as_repr(self): ! # Simple objects, small containers and classes that overwrite __repr__ ! # For those the result should be the same as repr() verify = self.assert_ ! for simple in (0, 0L, 0+0j, 0.0, "", uni(""), ! (), tuple2(), tuple3(), ! [], list2(), list3(), ! {}, dict2(), dict3(), ! verify, pprint, -6, -6L, -6-6j, -1.5, "x", uni("x"), (3,), [3], {3: 6}, (1,2), [3,4], {5: 6, 7: 8}, + tuple2((1,2)), tuple3((1,2)), tuple3(range(100)), + [3,4], list2([3,4]), list3([3,4]), list3(range(100)), + {5: 6, 7: 8}, dict2({5: 6, 7: 8}), dict3({5: 6, 7: 8}), + dict3([(x,x) for x in range(100)]), {"xy\tab\n": (3,), 5: [[]], (): {}}, range(10, -11, -1) *************** *** 100,104 **** (native, got, function)) - def test_basic_line_wrap(self): # verify basic line-wrapping operation --- 125,128 ---- *************** *** 118,122 **** 'read_io_runtime_us': 0, 'write_io_runtime_us': 43690}""" ! self.assertEqual(pprint.pformat(o), exp) def test_subclassing(self): --- 142,157 ---- 'read_io_runtime_us': 0, 'write_io_runtime_us': 43690}""" ! for type in [dict, dict2]: ! self.assertEqual(pprint.pformat(type(o)), exp) ! ! o = range(100) ! exp = '[%s]' % ',\n '.join(map(str, o)) ! for type in [list, list2]: ! self.assertEqual(pprint.pformat(type(o)), exp) ! ! o = tuple(range(100)) ! exp = '(%s)' % ',\n '.join(map(str, o)) ! for type in [tuple, tuple2]: ! self.assertEqual(pprint.pformat(type(o)), exp) def test_subclassing(self): From doerwalter at users.sourceforge.net Wed Dec 3 15:14:15 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:22:03 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.905,1.906 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv11223/Misc Modified Files: NEWS Log Message: Patch #750542: pprint now will pretty print subclasses of list, tuple and dict too, as long as they don't overwrite __repr__(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.905 retrieving revision 1.906 diff -C2 -d -r1.905 -r1.906 *** NEWS 1 Dec 2003 21:35:25 -0000 1.905 --- NEWS 3 Dec 2003 20:14:12 -0000 1.906 *************** *** 171,174 **** --- 171,177 ---- ------- + - Patch #750542: pprint now will pretty print subclasses of list, tuple + and dict too, as long as they don't overwrite __repr__(). + - Bug #848614: distutils' msvccompiler fails to find the MSVC6 compiler because of incomplete registry entries. From doerwalter at users.sourceforge.net Wed Dec 3 15:26:07 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:26:12 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.906,1.907 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv14858/Misc Modified Files: NEWS Log Message: Add parameters indent, width and depth to pprint.pprint() and pprint.pformat() and pass them along to the PrettyPrinter constructor. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.906 retrieving revision 1.907 diff -C2 -d -r1.906 -r1.907 *** NEWS 3 Dec 2003 20:14:12 -0000 1.906 --- NEWS 3 Dec 2003 20:26:04 -0000 1.907 *************** *** 171,174 **** --- 171,177 ---- ------- + - pprint.pprint() and pprint.pformat() now have additional parameters + indent, width and depth. + - Patch #750542: pprint now will pretty print subclasses of list, tuple and dict too, as long as they don't overwrite __repr__(). From doerwalter at users.sourceforge.net Wed Dec 3 15:26:07 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:26:14 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libpprint.tex,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14858/Doc/lib Modified Files: libpprint.tex Log Message: Add parameters indent, width and depth to pprint.pprint() and pprint.pformat() and pass them along to the PrettyPrinter constructor. Index: libpprint.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpprint.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libpprint.tex 27 Nov 2003 19:48:03 -0000 1.16 --- libpprint.tex 3 Dec 2003 20:26:05 -0000 1.17 *************** *** 78,92 **** The \class{PrettyPrinter} class supports several derivative functions: ! \begin{funcdesc}{pformat}{object} ! Return the formatted representation of \var{object} as a string. The ! default parameters for formatting are used. \end{funcdesc} ! \begin{funcdesc}{pprint}{object\optional{, stream}} Prints the formatted representation of \var{object} on \var{stream}, followed by a newline. If \var{stream} is omitted, \code{sys.stdout} is used. This may be used in the interactive interpreter instead of a ! \keyword{print} statement for inspecting values. The default ! parameters for formatting are used. \begin{verbatim} --- 78,98 ---- The \class{PrettyPrinter} class supports several derivative functions: ! \begin{funcdesc}{pformat}{object\optional{, indent\optional{, ! width\optional{, depth}}}} ! Return the formatted representation of \var{object} as a string. \var{indent}, ! \var{width} and \var{depth} will be passed to the \class{PrettyPrinter} ! constructor as formatting parameters. ! \versionchanged[The parameters \var{indent}, \var{width} and \var{depth} ! were added]{2.4} \end{funcdesc} ! \begin{funcdesc}{pprint}{object\optional{, stream\optional{, ! indent\optional{, width\optional{, depth}}}}} Prints the formatted representation of \var{object} on \var{stream}, followed by a newline. If \var{stream} is omitted, \code{sys.stdout} is used. This may be used in the interactive interpreter instead of a ! \keyword{print} statement for inspecting values. \var{indent}, ! \var{width} and \var{depth} will be passed to the \class{PrettyPrinter} ! constructor as formatting parameters. \begin{verbatim} *************** *** 102,105 **** --- 108,113 ---- '/usr/local/lib/python1.5/tkinter'] \end{verbatim} + \versionchanged[The parameters \var{indent}, \var{width} and \var{depth} + were added]{2.4} \end{funcdesc} From doerwalter at users.sourceforge.net Wed Dec 3 15:26:07 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:26:16 2003 Subject: [Python-checkins] python/dist/src/Lib pprint.py,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv14858/Lib Modified Files: pprint.py Log Message: Add parameters indent, width and depth to pprint.pprint() and pprint.pformat() and pass them along to the PrettyPrinter constructor. Index: pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pprint.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** pprint.py 3 Dec 2003 20:15:28 -0000 1.27 --- pprint.py 3 Dec 2003 20:26:05 -0000 1.28 *************** *** 49,60 **** ! def pprint(object, stream=None): """Pretty-print a Python object to a stream [default is sys.sydout].""" ! printer = PrettyPrinter(stream=stream) printer.pprint(object) ! def pformat(object): """Format a Python object into a pretty-printed representation.""" ! return PrettyPrinter().pformat(object) def saferepr(object): --- 49,61 ---- ! def pprint(object, stream=None, indent=1, width=80, depth=None): """Pretty-print a Python object to a stream [default is sys.sydout].""" ! printer = PrettyPrinter( ! stream=stream, indent=indent, width=width, depth=depth) printer.pprint(object) ! def pformat(object, indent=1, width=80, depth=None): """Format a Python object into a pretty-printed representation.""" ! return PrettyPrinter(indent=indent, width=width, depth=depth).pformat(object) def saferepr(object): From doerwalter at users.sourceforge.net Wed Dec 3 15:26:07 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Wed Dec 3 15:26:18 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_pprint.py, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv14858/Lib/test Modified Files: test_pprint.py Log Message: Add parameters indent, width and depth to pprint.pprint() and pprint.pformat() and pass them along to the PrettyPrinter constructor. Index: test_pprint.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_pprint.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_pprint.py 3 Dec 2003 20:15:28 -0000 1.12 --- test_pprint.py 3 Dec 2003 20:26:05 -0000 1.13 *************** *** 155,158 **** --- 155,164 ---- self.assertEqual(pprint.pformat(type(o)), exp) + # indent parameter + o = range(100) + exp = '[ %s]' % ',\n '.join(map(str, o)) + for type in [list, list2]: + self.assertEqual(pprint.pformat(type(o), indent=4), exp) + def test_subclassing(self): o = {'names with spaces': 'should be presented using repr()', From jackjansen at users.sourceforge.net Wed Dec 3 15:52:09 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 15:52:13 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/launch _Launchmodule.c, 1.1, 1.2 launchscan.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/launch In directory sc8-pr-cvs1:/tmp/cvs-serv21374 Modified Files: _Launchmodule.c launchscan.py Log Message: Blacklisting LSInit and LSTerm, which are deprecated. Partial fix for 853558. Index: _Launchmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/_Launchmodule.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _Launchmodule.c 2 Dec 2003 23:01:43 -0000 1.1 --- _Launchmodule.c 3 Dec 2003 20:52:07 -0000 1.2 *************** *** 58,89 **** static PyObject *Launch_Error; - static PyObject *Launch_LSInit(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OSStatus _err; - LSInitializeFlags inFlags; - if (!PyArg_ParseTuple(_args, "l", - &inFlags)) - return NULL; - _err = LSInit(inFlags); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; - } - - static PyObject *Launch_LSTerm(PyObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OSStatus _err; - if (!PyArg_ParseTuple(_args, "")) - return NULL; - _err = LSTerm(); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; - } - static PyObject *Launch_LSCopyItemInfoForRef(PyObject *_self, PyObject *_args) { --- 58,61 ---- *************** *** 348,355 **** static PyMethodDef Launch_methods[] = { - {"LSInit", (PyCFunction)Launch_LSInit, 1, - PyDoc_STR("(LSInitializeFlags inFlags) -> None")}, - {"LSTerm", (PyCFunction)Launch_LSTerm, 1, - PyDoc_STR("() -> None")}, {"LSCopyItemInfoForRef", (PyCFunction)Launch_LSCopyItemInfoForRef, 1, PyDoc_STR("(FSRef inItemRef, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")}, --- 320,323 ---- Index: launchscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/launchscan.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** launchscan.py 2 Dec 2003 23:01:43 -0000 1.1 --- launchscan.py 3 Dec 2003 20:52:07 -0000 1.2 *************** *** 45,48 **** --- 45,50 ---- def makeblacklistnames(self): return [ + "LSInit", + "LSTerm", "kLSRequestAllInfo", "kLSRolesAll", From mhammond at users.sourceforge.net Wed Dec 3 17:16:49 2003 From: mhammond at users.sourceforge.net (mhammond@users.sourceforge.net) Date: Wed Dec 3 17:16:53 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py, 1.59, 1.60 test_unicode_file.py, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv8208 Modified Files: test_support.py test_unicode_file.py Log Message: Fix test_unicode_file errors on platforms without Unicode file support, by setting TESTFN_UNICODE_UNENCODEABLE on these platforms. test_unicode_file only attempts to use the name for testing if not None. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** test_support.py 3 Dec 2003 01:27:23 -0000 1.59 --- test_support.py 3 Dec 2003 22:16:46 -0000 1.60 *************** *** 137,156 **** # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # able to be encoded by *either* the default or filesystem encoding. ! # Japanese characters (I think - from bug 846133) ! TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b" ! try: ! # XXX - Note - should be using TESTFN_ENCODING here - but for ! # Windows, "mbcs" currently always operates as if in ! # errors=ignore' mode - hence we get '?' characters rather than ! # the exception. 'Latin1' operates as we expect - ie, fails. ! # See [ 850997 ] mbcs encoding ignores errors ! TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") ! except UnicodeEncodeError: ! pass else: ! print \ ! 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ ! 'Unicode filename tests may not be effective' \ ! % TESTFN_UNICODE_UNENCODEABLE # Make sure we can write to TESTFN, try in /tmp if we can't --- 137,162 ---- # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # able to be encoded by *either* the default or filesystem encoding. ! # This test really only makes sense on Windows NT platforms ! # which have special Unicode support in posixmodule. ! if not hasattr(sys, "getwindowsversion") or \ ! sys.getwindowsversion()[3]<2: ! TESTFN_UNICODE_UNENCODABLE = None else: ! # Japanese characters (I think - from bug 846133) ! TESTFN_UNICODE_UNENCODEABLE = u"@test-\u5171\u6709\u3055\u308c\u308b" ! try: ! # XXX - Note - should be using TESTFN_ENCODING here - but for ! # Windows, "mbcs" currently always operates as if in ! # errors=ignore' mode - hence we get '?' characters rather than ! # the exception. 'Latin1' operates as we expect - ie, fails. ! # See [ 850997 ] mbcs encoding ignores errors ! TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") ! except UnicodeEncodeError: ! pass ! else: ! print \ ! 'WARNING: The filename %r CAN be encoded by the filesystem. ' \ ! 'Unicode filename tests may not be effective' \ ! % TESTFN_UNICODE_UNENCODEABLE # Make sure we can write to TESTFN, try in /tmp if we can't Index: test_unicode_file.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_unicode_file.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** test_unicode_file.py 3 Dec 2003 01:29:55 -0000 1.11 --- test_unicode_file.py 3 Dec 2003 22:16:47 -0000 1.12 *************** *** 141,145 **** self._test_single(TESTFN_ENCODED) self._test_single(TESTFN_UNICODE) ! self._test_single(TESTFN_UNICODE_UNENCODEABLE) def test_equivalent_files(self): --- 141,146 ---- self._test_single(TESTFN_ENCODED) self._test_single(TESTFN_UNICODE) ! if TESTFN_UNICODE_UNENCODEABLE is not None: ! self._test_single(TESTFN_UNICODE_UNENCODEABLE) def test_equivalent_files(self): *************** *** 157,163 **** self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, os.getcwdu) # Our directory name that can't use a non-unicode name. ! self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, ! TESTFN_UNICODE_UNENCODEABLE+ext, ! os.getcwdu) def test_main(): --- 158,165 ---- self._do_directory(TESTFN_UNICODE+ext, TESTFN_UNICODE+ext, os.getcwdu) # Our directory name that can't use a non-unicode name. ! if TESTFN_UNICODE_UNENCODEABLE is not None: ! self._do_directory(TESTFN_UNICODE_UNENCODEABLE+ext, ! TESTFN_UNICODE_UNENCODEABLE+ext, ! os.getcwdu) def test_main(): From rhettinger at users.sourceforge.net Wed Dec 3 17:23:49 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 3 17:23:55 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.214,1.215 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv10157 Modified Files: tut.tex Log Message: Add a standard library tour Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.214 retrieving revision 1.215 diff -C2 -d -r1.214 -r1.215 *** tut.tex 3 Dec 2003 10:34:57 -0000 1.214 --- tut.tex 3 Dec 2003 22:23:46 -0000 1.215 *************** *** 4386,4389 **** --- 4386,4707 ---- + + \chapter{Brief Tour of the Standard Library \label{briefTour}} + + + \section{Operating System Interface\label{os-interface}} + + The \ulink{\module{os}}{../lib/module-os.html} + module provides dozens of functions for interacting with the + operating system: + + \begin{verbatim} + >>> import os + >>> os.system('copy /data/mydata.fil /backup/mydata.fil') + 0 + >>> os.getcwd() # Return the current working directory + 'C:\\Python24' + >>> os.chdir('/server/accesslogs') + \end{verbatim} + + Be sure to use the \samp{import os} style instead of + \samp{from os import *}. This will keep \function{os.open()} from + shadowing the builtin \function{open()} function which operates much + differently. + + The builtin \function{dir()} and \function{help()} functions are useful + as interactive aids for working with large modules like \module{os}: + + \begin{verbatim} + >>> import os + >>> dir(os) + + >>> help(os) + + \end{verbatim} + + For daily file and directory management tasks, the + \ulink{\module{shutil}}{../lib/module-shutil.html} + module provides a higher level interface that is easier to use: + + \begin{verbatim} + >>> import shutil + >>> shutil.copyfile('data.db', 'archive.db') + >>> shutil.move('/build/excecutables', 'installdir') + \end{verbatim} + + + \section{File Wildcards\label{file-wildcards}} + + The \ulink{\module{glob}}{../lib/module-glob.html} + module provides a function for making file lists from directory + wildcard searches: + + \begin{verbatim} + >>> import glob + >>> glob.glob('*.py') + ['primes.py', 'random.py', 'quote.py'] + \end{verbatim} + + + \section{Command Line Arguments\label{command-line-arguments}} + + Common utility scripts often invoke processing command line arguments. + These arguments are stored in the + \ulink{\module{sys}}{../lib/module-sys.html}\ module's \var{argv} + attribute as a list. For instance the following output results from + running \samp{python demo.py one two three} at the command line: + + \begin{verbatim} + >>> import sys + >>> print sys.argv[] + ['demo.py', 'one', 'two', 'three'] + \end{verbatim} + + The \ulink{\module{getopt}}{../lib/module-getopt.html} + module processes \var{sys.argv} using the conventions of the \UNIX{} + \function{getopt()} function. More powerful and flexible command line + processing is provided by the + \ulink{\module{optparse}}{../lib/module-optparse.html} module. + + + \section{Error Output Redirection and Program Termination\label{stderr}} + + The \ulink{\module{sys}}{../lib/module-sys.html} + module also has attributes for \var{stdin}, \var{stdout}, and + \var{stderr}. The latter is useful for emitting warnings and error + messages to make them visible even when \var{stdout} has been redirected: + + \begin{verbatim} + >>> sys.stderr.write('Warning, log file not found starting a new one') + Warning, log file not found starting a new one + \end{verbatim} + + The most direct way to terminate a script is to use \samp{sys.exit()}. + + + \section{String Pattern Matching\label{string-pattern-matching}} + + The \ulink{\module{re}}{../lib/module-re.html} + module provides regular expression tools for advanced string processing. + When only simple capabilities are needed, string methods are preferred + because they are easier to read and debug. However, for more + sophisticated applications, regular expressions can provide succinct, + optimized solutions: + + \begin{verbatim} + >>> import re + >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') + ['foot', 'fell', 'fastest'] + >>> re.sub(r'(\b[a-z]+) \1', r'\1', 'cat in the the hat') + 'cat in the hat' + \end{verbatim} + + + \section{Mathematics\label{mathematics}} + + The \ulink{\module{math}}{../lib/module-math.html} math module gives + access to the underlying C library functions for floating point math: + + \begin{verbatim} + >>> import math + >>> math.cos(math.pi / 4.0) + 0.70710678118654757 + >>> math.log(1024, 2) + 10.0 + \end{verbatim} + + The \ulink{\module{random}}{../lib/module-random.html} + module provides tools for making random selections: + + \begin{verbatim} + >>> import random + >>> random.choice(['apple', 'pear', 'banana']) + 'apple' + >>> random.sample(xrange(100), 10) # sampling without replacement + [30, 83, 16, 4, 8, 81, 41, 50, 18, 33] + >>> random.random() # random float + 0.17970987693706186 + >>> random.randrange(6) # random integer chosen from range(6) + 4 + \end{verbatim} + + + \section{Internet Access\label{internet-access}} + + There are a number of modules for accessing the internet and processing + internet protocols. Two of the simplest are + \ulink{\module{urllib2}}{../lib/module-urllib2.html} + for retrieving data from urls and + \ulink{\module{smtplib}}{../lib/module-smtplib.html} + for sending mail: + + \begin{verbatim} + >>> import urllib2 + >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): + ... if 'EST' in line: # look for Eastern Standard Time + ... print line + +
Nov. 25, 09:43:32 PM EST + + >>> import smtplib + >>> server = smtplib.SMTP('localhost') + >>> server.sendmail('soothsayer@tmp.org', 'jceasar@tmp.org', + """To: jceasar@tmp.org + From: soothsayer@tmp.org + + Beware the Ides of March. + """) + >>> server.quit() + \end{verbatim} + + + \section{Dates and Times\label{dates-and-times}} + + The \ulink{\module{datetime}}{../lib/module-datetime.html} module + supplies classes for manipulating dates and times in both simple + and complex ways. While date and time arithmetic is supported, the + focus of the implementation is on efficient member extraction for + output formatting and manipulation. The module also supports objects + that are time zone aware. + + \begin{verbatim} + # dates are easily constructed and formatted + >>> from datetime import date + >>> now = date.today() + >>> now + datetime.date(2003, 12, 2) + >>> now.strftime("%m-%d-%y or %d%b %Y is a %A on the %d day of %B") + '12-02-03 or 02Dec 2003 is a Tuesday on the 02 day of December' + + # dates support calendar arithmetic + >>> birthday = date(1964, 7, 31) + >>> age = now - birthday + >>> age.days + 14368 + \end{verbatim} + + + \section{Data Compression\label{data-compression}} + + Common data archiving and compression formats are directly supported + by modules including: \module{zlib}, \module{gzip}, \module{bz2}, + \module{zipfile}, and \module{tar}. + + \begin{verbatim} + >>> import zlib + >>> s = 'witch which has which witches wrist watch' + >>> len(s) + 41 + >>> t = zlib.compress(s) + >>> len(t) + 37 + >>> zlib.decompress(t) + 'witch which has which witches wrist watch' + >>> zlib.crc32(t) + -1438085031 + \end{verbatim} + + + \section{Performance Measurement\label{performance-measurement}} + + Some Python users develop a deep interest in knowing the relative + performance between different approaches to the same problem. + Python provides a measurement tool that answers those questions + immediately. + + For example, it may be tempting to use the tuple packing and unpacking + feature instead of the traditional approach to swapping arguments. + The \ulink{\module{timeit}}{../lib/module-timeit.html} module + quickly demonstrates that the traditional approach is faster: + + \begin{verbatim} + >>> from timeit import Timer + >>> dir(Timer) + >>> Timer('t=a; a=b; b=t', 'a=1; b=1').timeit() + 0.60864915603680925 + >>> Timer('a,b = b,a', 'a=1; b=1').timeit() + 0.8625194857439773 + \end{verbatim} + + In contrast to \module{timeit}'s fine level of granularity, the + \ulink{\module{profile}}{../lib/module-profile.html} and + \ulink{\module{pstats}}{../lib/module-pstats.html} modules + provide tools for identifying time critical sections in larger + blocks of code. + + + \section{Quality Control\label{quality-control}} + + One approach for developing high quality software is to write tests for + each function as it is developed and to run those tests frequently during + the development process. + + The \ulink{\module{doctest}}{../lib/module-doctest.html} module provides + a tool for scanning a module and validating tests embedded in a program's + docstrings. Test construction is as simple as cutting-and-pasting a + typical call along with its results into the docstring. This improves + the documentation by providing the user with an example and it allows the + doctest module to make sure the code remains true to the documentation: + + \begin{verbatim} + def average(values): + """Computes the arithmetic mean of a list of numbers. + + >>> print average([20, 30, 70]) + 40.0 + """ + return sum(values, 0.0) / len(values) + + import doctest + doctest.testmod() # automatically validate the embedded tests + \end{verbatim} + + The \ulink{\module{unittest}}{../lib/module-unittest.html} module is not + as effortless as the \module{doctest} module, but it allows a more + comprehensive set of tests to be maintained in a separate file: + + \begin{verbatim} + import unittest + + class TestStatisticalFunctions(unittest.TestCase): + + def test_average(self): + self.assertEqual(average([20, 30, 70]), 40.0) + self.assertEqual(round(average([1, 5, 7]), 1), 4.3) + self.assertRaises(ZeroDivisionError, average, []) + self.assertRaises(TypeError, average, 20, 30, 70) + + unittest.main() # Calling from the command line invokes all tests + \end{verbatim} + + \section{Batteries Included\label{batteries-included}} + + Python has a ``batteries included'' philosophy. The is best seen + through the sophisticated and robust capabilites of its larger + packages. For example: + + * The \module{xmlrpclib} and \module{SimpleXMLRPCServer} modules make + implementing remote procedure calls into an almost trivial task. + Despite the names, no direct knowledge or handling of XML is needed. + + * The \module{email} package is a library for managing email messages, + including MIME and other RFC 2822-based message documents. Unlike + \module{smtplib} and \module{poplib} which actually send and receive + messages, the email package has a complete toolset for building or + decoding complex message structures (including attachments) + and for implementing internet encoding and header protocols. + + * The \module{xml.dom} and \module{xml.sax} packages provide robust + support for parsing this popular data interchange format. Likewise, + the \module{csv} module supports direct reads and writes in a common + database format. Together, these modules and packages greatly simplify + data interchange between python applications and other tools. + + * Internationalization is supported by a number of modules including + \module{gettext}, \module{locale}, and the \module{codecs} package. + + + \chapter{What Now? \label{whatNow}} From jackjansen at users.sourceforge.net Wed Dec 3 17:30:56 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 17:31:00 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/osa - New directory Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/osa In directory sc8-pr-cvs1:/tmp/cvs-serv11538/osa Log Message: Directory /cvsroot/python/python/dist/src/Mac/Modules/osa added to the repository From rhettinger at users.sourceforge.net Wed Dec 3 17:33:17 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 3 17:33:22 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.215,1.216 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv11995 Modified Files: tut.tex Log Message: Fix link Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.215 retrieving revision 1.216 diff -C2 -d -r1.215 -r1.216 *** tut.tex 3 Dec 2003 22:23:46 -0000 1.215 --- tut.tex 3 Dec 2003 22:33:13 -0000 1.216 *************** *** 4626,4632 **** In contrast to \module{timeit}'s fine level of granularity, the ! \ulink{\module{profile}}{../lib/module-profile.html} and ! \ulink{\module{pstats}}{../lib/module-pstats.html} modules ! provide tools for identifying time critical sections in larger blocks of code. --- 4626,4631 ---- In contrast to \module{timeit}'s fine level of granularity, the ! \ulink{\module{profile}}{../lib/module-profile.html} and \module{pstats} ! modules provide tools for identifying time critical sections in larger blocks of code. From jackjansen at users.sourceforge.net Wed Dec 3 17:34:21 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 17:34:24 2003 Subject: [Python-checkins] python/dist/src setup.py,1.178,1.179 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv11782 Modified Files: setup.py Log Message: Adding an interface to the high-level Open Scripting Architecture, by request of Donovan Preston. In return, he promised to use this to create a Python OSA component, which would turn Python into a first-class OSA scripting language (like AppleScript itself). Index: setup.py =================================================================== RCS file: /cvsroot/python/python/dist/src/setup.py,v retrieving revision 1.178 retrieving revision 1.179 diff -C2 -d -r1.178 -r1.179 *** setup.py 2 Dec 2003 23:01:39 -0000 1.178 --- setup.py 3 Dec 2003 22:34:19 -0000 1.179 *************** *** 837,840 **** --- 837,842 ---- exts.append( Extension('_Mlte', ['mlte/_Mltemodule.c'], extra_link_args=['-framework', 'Carbon']) ) + exts.append( Extension('_OSA', ['osa/_OSAmodule.c'], + extra_link_args=['-framework', 'Carbon']) ) exts.append( Extension('_Qd', ['qd/_Qdmodule.c'], extra_link_args=['-framework', 'Carbon']) ) From jackjansen at users.sourceforge.net Wed Dec 3 17:34:21 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 17:34:29 2003 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon OSAconst.py, NONE, 1.1 WASTEconst.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv11782/Lib/plat-mac/Carbon Modified Files: WASTEconst.py Added Files: OSAconst.py Log Message: Adding an interface to the high-level Open Scripting Architecture, by request of Donovan Preston. In return, he promised to use this to create a Python OSA component, which would turn Python into a first-class OSA scripting language (like AppleScript itself). --- NEW FILE: OSAconst.py --- # Generated from 'OSA.h' def FOUR_CHAR_CODE(x): return x from Carbon.AppleEvents import * kAEUseStandardDispatch = -1 kOSAComponentType = FOUR_CHAR_CODE('osa ') kOSAGenericScriptingComponentSubtype = FOUR_CHAR_CODE('scpt') kOSAFileType = FOUR_CHAR_CODE('osas') kOSASuite = FOUR_CHAR_CODE('ascr') kOSARecordedText = FOUR_CHAR_CODE('recd') kOSAScriptIsModified = FOUR_CHAR_CODE('modi') kOSAScriptIsTypeCompiledScript = FOUR_CHAR_CODE('cscr') kOSAScriptIsTypeScriptValue = FOUR_CHAR_CODE('valu') kOSAScriptIsTypeScriptContext = FOUR_CHAR_CODE('cntx') kOSAScriptBestType = FOUR_CHAR_CODE('best') kOSACanGetSource = FOUR_CHAR_CODE('gsrc') typeOSADialectInfo = FOUR_CHAR_CODE('difo') keyOSADialectName = FOUR_CHAR_CODE('dnam') keyOSADialectCode = FOUR_CHAR_CODE('dcod') keyOSADialectLangCode = FOUR_CHAR_CODE('dlcd') keyOSADialectScriptCode = FOUR_CHAR_CODE('dscd') kOSANullScript = 0L kOSANullMode = 0 kOSAModeNull = 0 kOSASupportsCompiling = 0x0002 kOSASupportsGetSource = 0x0004 kOSASupportsAECoercion = 0x0008 kOSASupportsAESending = 0x0010 kOSASupportsRecording = 0x0020 kOSASupportsConvenience = 0x0040 kOSASupportsDialects = 0x0080 kOSASupportsEventHandling = 0x0100 kOSASelectLoad = 0x0001 kOSASelectStore = 0x0002 kOSASelectExecute = 0x0003 kOSASelectDisplay = 0x0004 kOSASelectScriptError = 0x0005 kOSASelectDispose = 0x0006 kOSASelectSetScriptInfo = 0x0007 kOSASelectGetScriptInfo = 0x0008 kOSASelectSetActiveProc = 0x0009 kOSASelectGetActiveProc = 0x000A kOSASelectScriptingComponentName = 0x0102 kOSASelectCompile = 0x0103 kOSASelectCopyID = 0x0104 kOSASelectCopyScript = 0x0105 kOSASelectGetSource = 0x0201 kOSASelectCoerceFromDesc = 0x0301 kOSASelectCoerceToDesc = 0x0302 kOSASelectSetSendProc = 0x0401 kOSASelectGetSendProc = 0x0402 kOSASelectSetCreateProc = 0x0403 kOSASelectGetCreateProc = 0x0404 kOSASelectSetDefaultTarget = 0x0405 kOSASelectStartRecording = 0x0501 kOSASelectStopRecording = 0x0502 kOSASelectLoadExecute = 0x0601 kOSASelectCompileExecute = 0x0602 kOSASelectDoScript = 0x0603 kOSASelectSetCurrentDialect = 0x0701 kOSASelectGetCurrentDialect = 0x0702 kOSASelectAvailableDialects = 0x0703 kOSASelectGetDialectInfo = 0x0704 kOSASelectAvailableDialectCodeList = 0x0705 kOSASelectSetResumeDispatchProc = 0x0801 kOSASelectGetResumeDispatchProc = 0x0802 kOSASelectExecuteEvent = 0x0803 kOSASelectDoEvent = 0x0804 kOSASelectMakeContext = 0x0805 kOSADebuggerCreateSession = 0x0901 kOSADebuggerGetSessionState = 0x0902 kOSADebuggerSessionStep = 0x0903 kOSADebuggerDisposeSession = 0x0904 kOSADebuggerGetStatementRanges = 0x0905 kOSADebuggerGetBreakpoint = 0x0910 kOSADebuggerSetBreakpoint = 0x0911 kOSADebuggerGetDefaultBreakpoint = 0x0912 kOSADebuggerGetCurrentCallFrame = 0x0906 kOSADebuggerGetCallFrameState = 0x0907 kOSADebuggerGetVariable = 0x0908 kOSADebuggerSetVariable = 0x0909 kOSADebuggerGetPreviousCallFrame = 0x090A kOSADebuggerDisposeCallFrame = 0x090B kOSASelectComponentSpecificStart = 0x1001 kOSAModePreventGetSource = 0x00000001 kOSAModeNeverInteract = kAENeverInteract kOSAModeCanInteract = kAECanInteract kOSAModeAlwaysInteract = kAEAlwaysInteract kOSAModeDontReconnect = kAEDontReconnect kOSAModeCantSwitchLayer = 0x00000040 kOSAModeDoRecord = 0x00001000 kOSAModeCompileIntoContext = 0x00000002 kOSAModeAugmentContext = 0x00000004 kOSAModeDisplayForHumans = 0x00000008 kOSAModeDontStoreParent = 0x00010000 kOSAModeDispatchToDirectObject = 0x00020000 kOSAModeDontGetDataForArguments = 0x00040000 kOSAScriptResourceType = kOSAGenericScriptingComponentSubtype typeOSAGenericStorage = kOSAScriptResourceType kOSAErrorNumber = keyErrorNumber kOSAErrorMessage = keyErrorString kOSAErrorBriefMessage = FOUR_CHAR_CODE('errb') kOSAErrorApp = FOUR_CHAR_CODE('erap') kOSAErrorPartialResult = FOUR_CHAR_CODE('ptlr') kOSAErrorOffendingObject = FOUR_CHAR_CODE('erob') kOSAErrorExpectedType = FOUR_CHAR_CODE('errt') kOSAErrorRange = FOUR_CHAR_CODE('erng') typeOSAErrorRange = FOUR_CHAR_CODE('erng') keyOSASourceStart = FOUR_CHAR_CODE('srcs') keyOSASourceEnd = FOUR_CHAR_CODE('srce') kOSAUseStandardDispatch = kAEUseStandardDispatch kOSANoDispatch = kAENoDispatch kOSADontUsePhac = 0x0001 eNotStarted = 0 eRunnable = 1 eRunning = 2 eStopped = 3 eTerminated = 4 eStepOver = 0 eStepIn = 1 eStepOut = 2 eRun = 3 keyProgramState = FOUR_CHAR_CODE('dsps') typeStatementRange = FOUR_CHAR_CODE('srng') keyProcedureName = FOUR_CHAR_CODE('dfnm') keyStatementRange = FOUR_CHAR_CODE('dfsr') keyLocalsNames = FOUR_CHAR_CODE('dfln') keyGlobalsNames = FOUR_CHAR_CODE('dfgn') keyParamsNames = FOUR_CHAR_CODE('dfpn') Index: WASTEconst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/WASTEconst.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** WASTEconst.py 30 Dec 2002 22:04:21 -0000 1.1 --- WASTEconst.py 3 Dec 2003 22:34:19 -0000 1.2 *************** *** 52,55 **** --- 52,56 ---- kObjectEdge = 2 weFAutoScroll = 0 + weFAutoIdle = 1 weFOutlineHilite = 2 weFReadOnly = 5 *************** *** 63,70 **** --- 64,74 ---- weFMonoStyled = 13 weFMultipleUndo = 14 + weFLeftMarginClick = 16 + weFNoAutoTabForHangingIndent = 28 weFNoKeyboardSync = 29 weFInhibitICSupport = 30 weFInhibitColor = 31 # weDoAutoScroll = 1UL << weFAutoScroll + weDoAutoIdle = 1UL << weFAutoIdle # weDoOutlineHilite = 1UL << weFOutlineHilite # weDoReadOnly = 1UL << weFReadOnly *************** *** 78,81 **** --- 82,87 ---- # weDoMonoStyled = 1UL << weFMonoStyled # weDoMultipleUndo = 1UL << weFMultipleUndo + weDoLeftMarginClick = 1UL << weFLeftMarginClick + weDoNoAutoTabForHangingIndent = 1UL << weFNoAutoTabForHangingIndent # weDoNoKeyboardSync = 1UL << weFNoKeyboardSync # weDoInhibitICSupport = 1UL << weFInhibitICSupport *************** *** 87,90 **** --- 93,99 ---- weLowerCase = 0 weUpperCase = 1 + weRedWigglyUnderline = 29303 + weGreenWigglyUnderline = 26487 + weOrangeWigglyUnderline = 28535 weFindWholeWords = 0x00000001 weFindCaseInsensitive = 0x00000002 *************** *** 95,100 **** --- 104,114 ---- weStreamDestinationKindMask = 0x000000FF weStreamIncludeObjects = 0x00000100 + weCopyPromiseFlavors = 0x00000001 weGetAddUnicodeBOM = 0x00000200 weGetLittleEndian = 0x00000400 + weSaveAddResources = 0x00000001 + weSaveCompatibilityResources = 0x00000002 + weSaveLittleEndian = 0x00000004 + kWASTECreator = FOUR_CHAR_CODE('OEDE') weTagFontFamily = FOUR_CHAR_CODE('font') weTagFontSize = FOUR_CHAR_CODE('ptsz') *************** *** 108,115 **** --- 122,138 ---- weTagExtended = FOUR_CHAR_CODE('pexp') weTagStrikethrough = FOUR_CHAR_CODE('strk') + weTagHidden = FOUR_CHAR_CODE('hidn') + weTagAllCaps = FOUR_CHAR_CODE('alcp') + weTagAllLowercase = FOUR_CHAR_CODE('lowc') weTagTextColor = FOUR_CHAR_CODE('colr') weTagBackgroundColor = FOUR_CHAR_CODE('pbcl') weTagTransferMode = FOUR_CHAR_CODE('pptm') weTagVerticalShift = FOUR_CHAR_CODE('xshf') + weTagLanguage = FOUR_CHAR_CODE('lang') + weTagUnderlineStyle = FOUR_CHAR_CODE('unds') + weTagSmallCaps = FOUR_CHAR_CODE('smcp') + weTagDoubleStrikethrough = FOUR_CHAR_CODE('dstr') + weTagEmbossed = FOUR_CHAR_CODE('embo') + weTagEngraved = FOUR_CHAR_CODE('engr') weTagAlignment = FOUR_CHAR_CODE('pjst') weTagDirection = FOUR_CHAR_CODE('LDIR') *************** *** 120,130 **** --- 143,178 ---- weTagSpaceBefore = FOUR_CHAR_CODE('spbe') weTagSpaceAfter = FOUR_CHAR_CODE('spaf') + weTagTabList = FOUR_CHAR_CODE('tabs') weTagBottomBorderStyle = FOUR_CHAR_CODE('BBRD') + weTagKeepTogether = FOUR_CHAR_CODE('keep') + weTagKeepWithNext = FOUR_CHAR_CODE('kepn') + weTagPageBreakBefore = FOUR_CHAR_CODE('pbrb') + weTagWidowOrphanOverride = FOUR_CHAR_CODE('wdov') + weTagWidowOrphanControl = FOUR_CHAR_CODE('wido') + weTagNoLineNumbering = FOUR_CHAR_CODE('!ln#') + weTagNoHyphenation = FOUR_CHAR_CODE('!hyp') + weTagParagraphUserData = FOUR_CHAR_CODE('pusr') weTagForceFontFamily = FOUR_CHAR_CODE('ffnt') weTagAddFontSize = FOUR_CHAR_CODE('+siz') weTagAddVerticalShift = FOUR_CHAR_CODE('+shf') + weTagAddLeftIndent = FOUR_CHAR_CODE('+lei') + weTagAddRightIndent = FOUR_CHAR_CODE('+rii') + weTagAddFirstLineIndent = FOUR_CHAR_CODE('+fid') + weTagAddSpaceBefore = FOUR_CHAR_CODE('+spb') + weTagAddSpaceAfter = FOUR_CHAR_CODE('+spa') + weTagAddLineSpacing = FOUR_CHAR_CODE('+led') weTagTextEncoding = FOUR_CHAR_CODE('ptxe') weTagQDStyles = FOUR_CHAR_CODE('qdst') weTagTETextStyle = FOUR_CHAR_CODE('tets') + weTagRunDirection = FOUR_CHAR_CODE('rdir') + weTagUnderlineDefault = FOUR_CHAR_CODE('deft') + weTagUnderlineWord = FOUR_CHAR_CODE('word') + weTagUnderlineDouble = FOUR_CHAR_CODE('dubl') + weTagUnderlineThick = FOUR_CHAR_CODE('thck') + weTagUnderlineDash = FOUR_CHAR_CODE('- ') + weTagUnderlineDot = FOUR_CHAR_CODE('. ') + weTagUnderlineDotDash = FOUR_CHAR_CODE('.- ') + weTagUnderlineDotDotDash = FOUR_CHAR_CODE('..- ') + weTagUnderlineWave = FOUR_CHAR_CODE('wave') weTagAlignmentDefault = FOUR_CHAR_CODE('deft') weTagAlignmentLeft = FOUR_CHAR_CODE('left') *************** *** 132,145 **** --- 180,206 ---- weTagAlignmentRight = FOUR_CHAR_CODE('rght') weTagAlignmentFull = FOUR_CHAR_CODE('full') + weTagAlignmentDecimal = FOUR_CHAR_CODE('decm') weTagDirectionDefault = FOUR_CHAR_CODE('deft') weTagDirectionLeftToRight = FOUR_CHAR_CODE('L->R') weTagDirectionRightToLeft = FOUR_CHAR_CODE('R->L') + weTagLeaderNone = FOUR_CHAR_CODE('NONE') + weTagLeaderDots = FOUR_CHAR_CODE('DOTS') + weTagLeaderHyphens = FOUR_CHAR_CODE('HYPH') + weTagLeaderUnderline = FOUR_CHAR_CODE('UNDL') + weTagLeaderThickLine = FOUR_CHAR_CODE('THKL') + weTagLeaderEqualSigns = FOUR_CHAR_CODE('= ') weTagBorderStyleNone = FOUR_CHAR_CODE('NONE') weTagBorderStyleThin = FOUR_CHAR_CODE('SLDL') weTagBorderStyleDotted = FOUR_CHAR_CODE('DTDL') weTagBorderStyleThick = FOUR_CHAR_CODE('THKL') + weTagLineSpacingAbsolute = FOUR_CHAR_CODE('abso') + weTagLineSpacingAtLeast = FOUR_CHAR_CODE('atle') + weTagLineSpacingRelative = FOUR_CHAR_CODE('rele') weLineSpacingSingle = 0x00000000 weLineSpacingOneAndHalf = 0x00008000 weLineSpacingDouble = 0x00010000 + weAutoScrollDelay = FOUR_CHAR_CODE('ausd') + weBusyProc = FOUR_CHAR_CODE('busy') + weBusyInterval = FOUR_CHAR_CODE('bzin') weCharByteHook = FOUR_CHAR_CODE('cbyt') weCharToPixelHook = FOUR_CHAR_CODE('c2p ') *************** *** 166,169 **** --- 227,231 ---- weTSMPreUpdate = FOUR_CHAR_CODE('pre ') weTSMPostUpdate = FOUR_CHAR_CODE('post') + weUndoProc = FOUR_CHAR_CODE('undo') weURLHint = FOUR_CHAR_CODE('urlh') weWordBreakHook = FOUR_CHAR_CODE('wbrk') *************** *** 185,188 **** --- 247,252 ---- kTypeUTF8Text = FOUR_CHAR_CODE('UTF8') kTypeStyledText = FOUR_CHAR_CODE('STXT') + kTypeRTF = FOUR_CHAR_CODE('RTF ') + kTypeRTFD = FOUR_CHAR_CODE('RTFD') weAKNone = 0 weAKUnspecified = 1 *************** *** 198,201 **** --- 262,268 ---- weAKCaseChange = 11 weAKObjectChange = 12 + weUndoNewAction = 0 + weUndoNewSubAction = 1 + weUndoBeginSequence = 2 weToScrap = 0 weToDrag = 1 *************** *** 204,207 **** --- 271,290 ---- weMouseWithin = 1 weMouseLeave = 2 + weBusyRecalBreaks = 0 + weCreatorDocumentInfo = FOUR_CHAR_CODE('Info') + weTagDocumentTitle = FOUR_CHAR_CODE('Titl') + weTagDocumentSubject = FOUR_CHAR_CODE('Subj') + weTagDocumentAuthor = FOUR_CHAR_CODE('Auth') + weTagDocumentManager = FOUR_CHAR_CODE('Mngr') + weTagDocumentCompany = FOUR_CHAR_CODE('Cmpy') + weTagDocumentCategory = FOUR_CHAR_CODE('Ctgy') + weTagDocumentKeywords = FOUR_CHAR_CODE('Keyw') + weTagDocumentComments = FOUR_CHAR_CODE('Cmnt') + weTagDocumentOperator = FOUR_CHAR_CODE('Oper') + weTagDocumentBaseAddress = FOUR_CHAR_CODE('Hlnk') + weTagPageInfo = FOUR_CHAR_CODE('Page') + weTagMacPrintRecord = FOUR_CHAR_CODE('PRec') kCurrentSelection = -1 kNullStyle = -2 + kMaxTabCount = 20 + kMaxLanguageTagSize = 32 From jackjansen at users.sourceforge.net Wed Dec 3 17:34:21 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 17:34:31 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/osa _OSAmodule.c, NONE, 1.1 osascan.py, NONE, 1.1 osasupport.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/osa In directory sc8-pr-cvs1:/tmp/cvs-serv11782/Mac/Modules/osa Added Files: _OSAmodule.c osascan.py osasupport.py Log Message: Adding an interface to the high-level Open Scripting Architecture, by request of Donovan Preston. In return, he promised to use this to create a Python OSA component, which would turn Python into a first-class OSA scripting language (like AppleScript itself). --- NEW FILE: _OSAmodule.c --- /* ========================== Module _OSA =========================== */ #include "Python.h" #include "pymactoolbox.h" /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ PyErr_SetString(PyExc_NotImplementedError, \ "Not available in this shared library/OS version"); \ return NULL; \ }} while(0) #include [...1187 lines suppressed...] */ m = Py_InitModule("_OSA", OSA_methods); d = PyModule_GetDict(m); OSA_Error = PyMac_GetOSErrException(); if (OSA_Error == NULL || PyDict_SetItemString(d, "Error", OSA_Error) != 0) return; ComponentInstance_Type.ob_type = &PyType_Type; if (PyType_Ready(&ComponentInstance_Type) < 0) return; Py_INCREF(&ComponentInstance_Type); PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type); /* Backward-compatible name */ Py_INCREF(&ComponentInstance_Type); PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type); } /* ======================== End module _OSA ========================= */ --- NEW FILE: osascan.py --- # Scan an Apple header file, generating a Python file of generator calls. import sys import os from bgenlocations import TOOLBOXDIR, BGENDIR sys.path.append(BGENDIR) from scantools import Scanner LONG = "OSAconst" SHORT = "osa" def main(): input = "OSA.h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.close() scanner.gentypetest(SHORT+"typetest.py") print "=== Testing definitions output code ===" execfile(defsoutput, {}, {}) print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ===" class MyScanner(Scanner): def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] if t == "ComponentInstance" and m == "InMode": classname = "Method" listname = "methods" return classname, listname def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") self.defsfile.write("from Carbon.AppleEvents import *\n") self.defsfile.write("kAEUseStandardDispatch = -1\n") def makeblacklistnames(self): return [ "OSACopyScript", ] def makeblacklisttypes(self): return [ "OSACreateAppleEventUPP", "OSAActiveUPP", "AEEventHandlerUPP", "OSASendUPP", ] def makerepairinstructions(self): return [ ] if __name__ == "__main__": main() --- NEW FILE: osasupport.py --- # This script generates a Python interface for an Apple Macintosh Manager. # It uses the "bgen" package to generate C code. # The function specifications are generated by scanning the mamager's header file, # using the "scantools" package (customized for this particular manager). import string # Declarations that change for each manager MACHEADERFILE = 'OSA.h' # The Apple header file MODNAME = '_OSA' # The name of the module # The following is *usually* unchanged but may still require tuning MODPREFIX = 'OSA' # The prefix for module-wide routines OBJECTPREFIX = 'OSAObj' # The prefix for object methods INPUTFILE = string.lower(MODPREFIX) + 'gen.py' # The file generated by the scanner OUTPUTFILE = MODNAME + "module.c" # The file generated by this program from macsupport import * # Create the type objects includestuff = includestuff + """ #include #ifdef USE_TOOLBOX_OBJECT_GLUE extern PyObject *_OSAObj_New(ComponentInstance); extern int _OSAObj_Convert(PyObject *, ComponentInstance *); #define OSAObj_New _OSAObj_New #define OSAObj_Convert _OSAObj_Convert #endif """ initstuff = initstuff + """ /* PyMac_INIT_TOOLBOX_OBJECT_NEW(ComponentInstance, OSAObj_New); PyMac_INIT_TOOLBOX_OBJECT_CONVERT(ComponentInstance, OSAObj_Convert); */ """ ComponentInstance = OpaqueByValueType('ComponentInstance', OBJECTPREFIX) OSAError = OSErrType("OSAError", "l") OSAID = Type("OSAID", "l") OSADebugCallFrameRef = Type("OSADebugCallFrameRef", "l") OSADebugSessionRef = Type("OSADebugSessionRef", "l") OSADebugStepKind = Type("OSADebugStepKind", "l") DescType = OSTypeType("DescType") AEDesc = OpaqueType('AEDesc') AEDesc_ptr = OpaqueType('AEDesc') AEAddressDesc = OpaqueType('AEAddressDesc', 'AEDesc') AEAddressDesc_ptr = OpaqueType('AEAddressDesc', 'AEDesc') AEDescList = OpaqueType('AEDescList', 'AEDesc') AEDescList_ptr = OpaqueType('AEDescList', 'AEDesc') AERecord = OpaqueType('AERecord', 'AEDesc') AERecord_ptr = OpaqueType('AERecord', 'AEDesc') AppleEvent = OpaqueType('AppleEvent', 'AEDesc') AppleEvent_ptr = OpaqueType('AppleEvent', 'AEDesc') # NOTE: at the moment OSA.ComponentInstance is not a subclass # of Cm.ComponentInstance. If this is a problem it can be fixed. class MyObjectDefinition(PEP253Mixin, GlobalObjectDefinition): def outputCheckNewArg(self): Output("""if (itself == NULL) { PyErr_SetString(OSA_Error,"NULL ComponentInstance"); return NULL; }""") # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) object = MyObjectDefinition('ComponentInstance', OBJECTPREFIX, 'ComponentInstance') module.addobject(object) # Create the generator classes used to populate the lists Function = OSErrWeakLinkFunctionGenerator Method = OSErrWeakLinkMethodGenerator # Test which types we are still missing. execfile(string.lower(MODPREFIX) + 'typetest.py') # Create and populate the lists functions = [] methods = [] execfile(INPUTFILE) # add the populated lists to the generator groups # (in a different wordl the scan program would generate this) for f in functions: module.add(f) for f in methods: object.add(f) # generate output (open the output file as late as possible) SetOutputFileName(OUTPUTFILE) module.generate() From jackjansen at users.sourceforge.net Wed Dec 3 18:20:14 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:18 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/drag dragscan.py, 1.6, 1.7 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/drag In directory sc8-pr-cvs1:/tmp/cvs-serv22913/drag Modified Files: dragscan.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: dragscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/drag/dragscan.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** dragscan.py 15 Aug 2002 22:05:58 -0000 1.6 --- dragscan.py 3 Dec 2003 23:20:11 -0000 1.7 *************** *** 48,51 **** --- 48,52 ---- self.defsfile.write("from Carbon.TextEdit import *\n") self.defsfile.write("from Carbon.QuickDraw import *\n") + self.defsfile.write("fkDragActionAll = -1\n") self.defsfile.write("\n") # Defines unparseable in Drag.h *************** *** 54,57 **** --- 55,59 ---- def makeblacklistnames(self): return [ + "kDragActionAll", ] From jackjansen at users.sourceforge.net Wed Dec 3 18:20:14 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:20 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/file filescan.py, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/file In directory sc8-pr-cvs1:/tmp/cvs-serv22913/file Modified Files: filescan.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: filescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filescan.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** filescan.py 19 Nov 2003 16:34:04 -0000 1.9 --- filescan.py 3 Dec 2003 23:20:12 -0000 1.10 *************** *** 137,141 **** --- 137,143 ---- "AliasFilterProcPtr", "AliasFilterUPP", + "FNSubscriptionUPP", + "FNSubscriptionRef", # Lazy, for now. ] From jackjansen at users.sourceforge.net Wed Dec 3 18:20:14 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:22 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/launch _Launchmodule.c, 1.2, 1.3 launchscan.py, 1.2, 1.3 launchsupport.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/launch In directory sc8-pr-cvs1:/tmp/cvs-serv22913/launch Modified Files: _Launchmodule.c launchscan.py launchsupport.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: _Launchmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/_Launchmodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _Launchmodule.c 3 Dec 2003 20:52:07 -0000 1.2 --- _Launchmodule.c 3 Dec 2003 23:20:12 -0000 1.3 *************** *** 98,101 **** --- 98,191 ---- } + static PyObject *Launch_LSGetExtensionInfo(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + UniChar *inNameLen__in__; + UniCharCount inNameLen__len__; + int inNameLen__in_len__; + UniCharCount outExtStartIndex; + if (!PyArg_ParseTuple(_args, "u#", + &inNameLen__in__, &inNameLen__in_len__)) + return NULL; + inNameLen__len__ = inNameLen__in_len__; + _err = LSGetExtensionInfo(inNameLen__len__, inNameLen__in__, + &outExtStartIndex); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("l", + outExtStartIndex); + return _res; + } + + static PyObject *Launch_LSCopyDisplayNameForRef(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + FSRef inRef; + CFStringRef outDisplayName; + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetFSRef, &inRef)) + return NULL; + _err = LSCopyDisplayNameForRef(&inRef, + &outDisplayName); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + CFStringRefObj_New, outDisplayName); + return _res; + } + + static PyObject *Launch_LSCopyDisplayNameForURL(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + CFURLRef inURL; + CFStringRef outDisplayName; + if (!PyArg_ParseTuple(_args, "O&", + CFURLRefObj_Convert, &inURL)) + return NULL; + _err = LSCopyDisplayNameForURL(inURL, + &outDisplayName); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + CFStringRefObj_New, outDisplayName); + return _res; + } + + static PyObject *Launch_LSSetExtensionHiddenForRef(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + FSRef inRef; + Boolean inHide; + if (!PyArg_ParseTuple(_args, "O&b", + PyMac_GetFSRef, &inRef, + &inHide)) + return NULL; + _err = LSSetExtensionHiddenForRef(&inRef, + inHide); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + + static PyObject *Launch_LSSetExtensionHiddenForURL(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + CFURLRef inURL; + Boolean inHide; + if (!PyArg_ParseTuple(_args, "O&b", + CFURLRefObj_Convert, &inURL, + &inHide)) + return NULL; + _err = LSSetExtensionHiddenForURL(inURL, + inHide); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args) { *************** *** 324,327 **** --- 414,427 ---- {"LSCopyItemInfoForURL", (PyCFunction)Launch_LSCopyItemInfoForURL, 1, PyDoc_STR("(CFURLRef inURL, LSRequestedInfo inWhichInfo) -> (LSItemInfoRecord outItemInfo)")}, + {"LSGetExtensionInfo", (PyCFunction)Launch_LSGetExtensionInfo, 1, + PyDoc_STR("(Buffer inNameLen) -> (UniCharCount outExtStartIndex)")}, + {"LSCopyDisplayNameForRef", (PyCFunction)Launch_LSCopyDisplayNameForRef, 1, + PyDoc_STR("(FSRef inRef) -> (CFStringRef outDisplayName)")}, + {"LSCopyDisplayNameForURL", (PyCFunction)Launch_LSCopyDisplayNameForURL, 1, + PyDoc_STR("(CFURLRef inURL) -> (CFStringRef outDisplayName)")}, + {"LSSetExtensionHiddenForRef", (PyCFunction)Launch_LSSetExtensionHiddenForRef, 1, + PyDoc_STR("(FSRef inRef, Boolean inHide) -> None")}, + {"LSSetExtensionHiddenForURL", (PyCFunction)Launch_LSSetExtensionHiddenForURL, 1, + PyDoc_STR("(CFURLRef inURL, Boolean inHide) -> None")}, {"LSCopyKindStringForRef", (PyCFunction)Launch_LSCopyKindStringForRef, 1, PyDoc_STR("(FSRef inFSRef) -> (CFStringRef outKindString)")}, Index: launchscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/launchscan.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** launchscan.py 3 Dec 2003 20:52:07 -0000 1.2 --- launchscan.py 3 Dec 2003 23:20:12 -0000 1.3 *************** *** 40,45 **** --- 40,47 ---- def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") + self.defsfile.write("from Carbon.Files import *\n") self.defsfile.write("kLSRequestAllInfo = -1\n") self.defsfile.write("kLSRolesAll = -1\n") + self.defsfile.write("kLSInvalidExtensionIndex = -1\n") def makeblacklistnames(self): *************** *** 49,52 **** --- 51,55 ---- "kLSRequestAllInfo", "kLSRolesAll", + "kLSInvalidExtensionIndex", ] *************** *** 68,71 **** --- 71,80 ---- ([('CFStringRef', 'inName', 'InMode')], [('OptCFStringRef', 'inName', 'InMode')]), + + # Unicode filenames passed as length, buffer. LSGetExtensionInfo + ([('UniCharCount', '*', 'InMode'), + ('UniChar_ptr', '*', 'InMode')], + [('UnicodeReverseInBuffer', '*', 'InMode')] + ), ] Index: launchsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/launchsupport.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** launchsupport.py 2 Dec 2003 23:01:43 -0000 1.1 --- launchsupport.py 3 Dec 2003 23:20:12 -0000 1.2 *************** *** 25,44 **** LSRequestedInfo = Type("LSRequestedInfo", "l") LSRolesMask = Type("LSRolesMask", "l") OptCFStringRef = OpaqueByValueType("CFStringRef", "OptCFStringRefObj") LSItemInfoRecord = OpaqueType("LSItemInfoRecord", "LSItemInfoRecord") - #MenuRef = OpaqueByValueType("MenuRef", "MenuObj") - #MenuItemIndex = Type("MenuItemIndex", "H") - - #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) - - #RgnHandle = FakeType("(RgnHandle)0") - # XXXX Should be next, but this will break a lot of code... - # RgnHandle = OpaqueByValueType("RgnHandle", "OptResObj") - - #KeyMap = ArrayOutputBufferType("KeyMap") - ##MacOSEventKind = Type("MacOSEventKind", "h") # Old-style - ##MacOSEventMask = Type("MacOSEventMask", "h") # Old-style - #EventMask = Type("EventMask", "H") - #EventKind = Type("EventKind", "H") includestuff = includestuff + """ --- 25,31 ---- LSRequestedInfo = Type("LSRequestedInfo", "l") LSRolesMask = Type("LSRolesMask", "l") + UniCharCount = Type("UniCharCount", "l") OptCFStringRef = OpaqueByValueType("CFStringRef", "OptCFStringRefObj") LSItemInfoRecord = OpaqueType("LSItemInfoRecord", "LSItemInfoRecord") includestuff = includestuff + """ From jackjansen at users.sourceforge.net Wed Dec 3 18:20:14 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:24 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/icn _Icnmodule.c, 1.9, 1.10 icnscan.py, 1.10, 1.11 icnsupport.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/icn In directory sc8-pr-cvs1:/tmp/cvs-serv22913/icn Modified Files: _Icnmodule.c icnscan.py icnsupport.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: _Icnmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/_Icnmodule.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** _Icnmodule.c 20 Nov 2003 13:30:57 -0000 1.9 --- _Icnmodule.c 3 Dec 2003 23:20:12 -0000 1.10 *************** *** 907,910 **** --- 907,936 ---- } + static PyObject *Icn_RegisterIconRefFromFSRef(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + OSType creator; + OSType iconType; + FSRef iconFile; + IconRef theIconRef; + #ifndef RegisterIconRefFromFSRef + PyMac_PRECHECK(RegisterIconRefFromFSRef); + #endif + if (!PyArg_ParseTuple(_args, "O&O&O&", + PyMac_GetOSType, &creator, + PyMac_GetOSType, &iconType, + PyMac_GetFSRef, &iconFile)) + return NULL; + _err = RegisterIconRefFromFSRef(creator, + iconType, + &iconFile, + &theIconRef); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, theIconRef); + return _res; + } + static PyObject *Icn_UnregisterIconRef(PyObject *_self, PyObject *_args) { *************** *** 1382,1385 **** --- 1408,1431 ---- } + static PyObject *Icn_ReadIconFromFSRef(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + FSRef ref; + IconFamilyHandle iconFamily; + #ifndef ReadIconFromFSRef + PyMac_PRECHECK(ReadIconFromFSRef); + #endif + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetFSRef, &ref)) + return NULL; + _err = ReadIconFromFSRef(&ref, + &iconFamily); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("O&", + ResObj_New, iconFamily); + return _res; + } + static PyObject *Icn_WriteIconFile(PyObject *_self, PyObject *_args) { *************** *** 1480,1483 **** --- 1526,1531 ---- {"RegisterIconRefFromResource", (PyCFunction)Icn_RegisterIconRefFromResource, 1, PyDoc_STR("(OSType creator, OSType iconType, FSSpec resourceFile, SInt16 resourceID) -> (IconRef theIconRef)")}, + {"RegisterIconRefFromFSRef", (PyCFunction)Icn_RegisterIconRefFromFSRef, 1, + PyDoc_STR("(OSType creator, OSType iconType, FSRef iconFile) -> (IconRef theIconRef)")}, {"UnregisterIconRef", (PyCFunction)Icn_UnregisterIconRef, 1, PyDoc_STR("(OSType creator, OSType iconType) -> None")}, *************** *** 1522,1525 **** --- 1570,1575 ---- {"ReadIconFile", (PyCFunction)Icn_ReadIconFile, 1, PyDoc_STR("(FSSpec iconFile) -> (IconFamilyHandle iconFamily)")}, + {"ReadIconFromFSRef", (PyCFunction)Icn_ReadIconFromFSRef, 1, + PyDoc_STR("(FSRef ref) -> (IconFamilyHandle iconFamily)")}, {"WriteIconFile", (PyCFunction)Icn_WriteIconFile, 1, PyDoc_STR("(IconFamilyHandle iconFamily, FSSpec iconFile) -> None")}, Index: icnscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnscan.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** icnscan.py 12 Dec 2002 10:31:51 -0000 1.10 --- icnscan.py 3 Dec 2003 23:20:12 -0000 1.11 *************** *** 49,52 **** --- 49,54 ---- # OS8 only 'IconServicesTerminate', + # Lazy, right now. + "GetIconRefFromFileInfo" ] *************** *** 56,59 **** --- 58,62 ---- "IconGetterUPP", "CFragInitBlockPtr", + "CGRect_ptr", ] *************** *** 64,67 **** --- 67,71 ---- def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n") + self.defsfile.write("from Carbon.Files import *\n") if __name__ == "__main__": Index: icnsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icn/icnsupport.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** icnsupport.py 19 Nov 2003 16:13:29 -0000 1.10 --- icnsupport.py 3 Dec 2003 23:20:12 -0000 1.11 *************** *** 33,36 **** --- 33,37 ---- IconServicesUsageFlags = Type("IconServicesUsageFlags", "l") RGBColor = OpaqueType("RGBColor", "QdRGB") + CGContextRef = OpaqueByValueType("CGContextRef", "CGContextRefObj") #WindowPeek = OpaqueByValueType("WindowPeek", OBJECTPREFIX) From jackjansen at users.sourceforge.net Wed Dec 3 18:20:15 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:26 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/mlte _Mltemodule.c, 1.19, 1.20 mltescan.py, 1.12, 1.13 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/mlte In directory sc8-pr-cvs1:/tmp/cvs-serv22913/mlte Modified Files: _Mltemodule.c mltescan.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: _Mltemodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/_Mltemodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _Mltemodule.c 20 Nov 2003 13:30:58 -0000 1.19 --- _Mltemodule.c 3 Dec 2003 23:20:12 -0000 1.20 *************** *** 362,366 **** { PyObject *_res = NULL; ! short iPart; #ifndef TXNZoomWindow PyMac_PRECHECK(TXNZoomWindow); --- 362,366 ---- { PyObject *_res = NULL; ! SInt16 iPart; #ifndef TXNZoomWindow PyMac_PRECHECK(TXNZoomWindow); *************** *** 698,732 **** } - static PyObject *TXNObj_TXNSetData(TXNObjectObject *_self, PyObject *_args) - { - PyObject *_res = NULL; - OSStatus _err; - TXNDataType iDataType; - void * *iDataPtr__in__; - ByteCount iDataPtr__len__; - int iDataPtr__in_len__; - TXNOffset iStartOffset; - TXNOffset iEndOffset; - #ifndef TXNSetData - PyMac_PRECHECK(TXNSetData); - #endif - if (!PyArg_ParseTuple(_args, "O&s#ll", - PyMac_GetOSType, &iDataType, - &iDataPtr__in__, &iDataPtr__in_len__, - &iStartOffset, - &iEndOffset)) - return NULL; - iDataPtr__len__ = iDataPtr__in_len__; - _err = TXNSetData(_self->ob_itself, - iDataType, - iDataPtr__in__, iDataPtr__len__, - iStartOffset, - iEndOffset); - if (_err != noErr) return PyMac_Error(_err); - Py_INCREF(Py_None); - _res = Py_None; - return _res; - } - static PyObject *TXNObj_TXNGetChangeCount(TXNObjectObject *_self, PyObject *_args) { --- 698,701 ---- *************** *** 1151,1154 **** --- 1120,1137 ---- } + static PyObject *TXNObj_TXNRecalcTextLayout(TXNObjectObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + #ifndef TXNRecalcTextLayout + PyMac_PRECHECK(TXNRecalcTextLayout); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + TXNRecalcTextLayout(_self->ob_itself); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyMethodDef TXNObj_methods[] = { {"TXNDeleteObject", (PyCFunction)TXNObj_TXNDeleteObject, 1, *************** *** 1181,1185 **** PyDoc_STR("(EventRecord iEvent) -> None")}, {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1, ! PyDoc_STR("(short iPart) -> None")}, {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1, PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")}, --- 1164,1168 ---- PyDoc_STR("(EventRecord iEvent) -> None")}, {"TXNZoomWindow", (PyCFunction)TXNObj_TXNZoomWindow, 1, ! PyDoc_STR("(SInt16 iPart) -> None")}, {"TXNCanUndo", (PyCFunction)TXNObj_TXNCanUndo, 1, PyDoc_STR("() -> (Boolean _rv, TXNActionKey oTXNActionKey)")}, *************** *** 1216,1221 **** {"TXNSetDataFromFile", (PyCFunction)TXNObj_TXNSetDataFromFile, 1, PyDoc_STR("(SInt16 iFileRefNum, OSType iFileType, ByteCount iFileLength, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, - {"TXNSetData", (PyCFunction)TXNObj_TXNSetData, 1, - PyDoc_STR("(TXNDataType iDataType, Buffer iDataPtr, TXNOffset iStartOffset, TXNOffset iEndOffset) -> None")}, {"TXNGetChangeCount", (PyCFunction)TXNObj_TXNGetChangeCount, 1, PyDoc_STR("() -> (ItemCount _rv)")}, --- 1199,1202 ---- *************** *** 1258,1261 **** --- 1239,1244 ---- {"TXNIsObjectAttachedToSpecificWindow", (PyCFunction)TXNObj_TXNIsObjectAttachedToSpecificWindow, 1, PyDoc_STR("(WindowPtr iWindow) -> (Boolean oAttached)")}, + {"TXNRecalcTextLayout", (PyCFunction)TXNObj_TXNRecalcTextLayout, 1, + PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; *************** *** 1494,1498 **** FSSpec * iFileSpec; WindowPtr iWindow; ! Rect * iFrame; TXNFrameOptions iFrameOptions; TXNFrameType iFrameType; --- 1477,1481 ---- FSSpec * iFileSpec; WindowPtr iWindow; ! Rect iFrame; TXNFrameOptions iFrameOptions; TXNFrameType iFrameType; *************** *** 1507,1511 **** OptFSSpecPtr_Convert, &iFileSpec, WinObj_Convert, &iWindow, ! OptRectPtr_Convert, &iFrame, &iFrameOptions, &iFrameType, --- 1490,1494 ---- OptFSSpecPtr_Convert, &iFileSpec, WinObj_Convert, &iWindow, ! PyMac_GetRect, &iFrame, &iFrameOptions, &iFrameType, *************** *** 1515,1519 **** _err = TXNNewObject(iFileSpec, iWindow, ! iFrame, iFrameOptions, iFrameType, --- 1498,1502 ---- _err = TXNNewObject(iFileSpec, iWindow, ! &iFrame, iFrameOptions, iFrameType, *************** *** 1657,1661 **** static PyMethodDef Mlte_methods[] = { {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, ! PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect * iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")}, {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, PyDoc_STR("() -> None")}, --- 1640,1644 ---- static PyMethodDef Mlte_methods[] = { {"TXNNewObject", (PyCFunction)Mlte_TXNNewObject, 1, ! PyDoc_STR("(FSSpec * iFileSpec, WindowPtr iWindow, Rect iFrame, TXNFrameOptions iFrameOptions, TXNFrameType iFrameType, TXNFileType iFileType, TXNPermanentTextEncodingType iPermanentEncoding) -> (TXNObject oTXNObject, TXNFrameID oTXNFrameID)")}, {"TXNTerminateTextension", (PyCFunction)Mlte_TXNTerminateTextension, 1, PyDoc_STR("() -> None")}, Index: mltescan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/mlte/mltescan.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** mltescan.py 19 Nov 2003 16:34:04 -0000 1.12 --- mltescan.py 3 Dec 2003 23:20:13 -0000 1.13 *************** *** 53,56 **** --- 53,57 ---- kTXNUseEncodingWordRulesMask = 0x80000000 kTXNFontSizeAttributeSize = 4 + normal = 0 """) *************** *** 95,102 **** --- 96,111 ---- "TXNFindUPP", "ATSUStyle", #TBD + "TXNBackground_ptr", #TBD + "TXNControlData_ptr", #TBD + "TXNControlTag_ptr", #TBD + "TXNLongRect", #TBD + "TXNLongRect_ptr", #TBD + "TXNTypeAttributes_ptr", #TBD + "TXNActionKeyMapperProcPtr", "TXNActionKeyMapperUPP", "TXNTextBoxOptionsData", "TXNCountOptions", + "void_ptr", ] From jackjansen at users.sourceforge.net Wed Dec 3 18:20:15 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:27 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/osa osascan.py, 1.1, 1.2 osasupport.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/osa In directory sc8-pr-cvs1:/tmp/cvs-serv22913/osa Modified Files: osascan.py osasupport.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: osascan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/osa/osascan.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** osascan.py 3 Dec 2003 22:34:19 -0000 1.1 --- osascan.py 3 Dec 2003 23:20:13 -0000 1.2 *************** *** 48,51 **** --- 48,52 ---- def makeblacklisttypes(self): return [ + "OSALocalOrGlobal", "OSACreateAppleEventUPP", "OSAActiveUPP", Index: osasupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/osa/osasupport.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** osasupport.py 3 Dec 2003 22:34:19 -0000 1.1 --- osasupport.py 3 Dec 2003 23:20:13 -0000 1.2 *************** *** 41,44 **** --- 41,45 ---- ComponentInstance = OpaqueByValueType('ComponentInstance', OBJECTPREFIX) OSAError = OSErrType("OSAError", "l") + # OSALocalOrGlobal = Type("OSALocalOrGlobal", "l") OSAID = Type("OSAID", "l") OSADebugCallFrameRef = Type("OSADebugCallFrameRef", "l") From jackjansen at users.sourceforge.net Wed Dec 3 18:20:16 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:31 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/win _Winmodule.c, 1.21, 1.22 winscan.py, 1.25, 1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/win In directory sc8-pr-cvs1:/tmp/cvs-serv22913/win Modified Files: _Winmodule.c winscan.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: _Winmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/_Winmodule.c,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** _Winmodule.c 20 Nov 2003 13:30:59 -0000 1.21 --- _Winmodule.c 3 Dec 2003 23:20:13 -0000 1.22 *************** *** 1042,1054 **** PyObject *_res = NULL; OSStatus _err; ! AliasHandle alias; #ifndef SetWindowProxyAlias PyMac_PRECHECK(SetWindowProxyAlias); #endif if (!PyArg_ParseTuple(_args, "O&", ! ResObj_Convert, &alias)) return NULL; _err = SetWindowProxyAlias(_self->ob_itself, ! alias); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 1042,1054 ---- PyObject *_res = NULL; OSStatus _err; ! AliasHandle inAlias; #ifndef SetWindowProxyAlias PyMac_PRECHECK(SetWindowProxyAlias); #endif if (!PyArg_ParseTuple(_args, "O&", ! ResObj_Convert, &inAlias)) return NULL; _err = SetWindowProxyAlias(_self->ob_itself, ! inAlias); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 1333,1351 **** PyObject *_res = NULL; OSStatus _err; ! WindowTransitionEffect effect; ! WindowTransitionAction action; ! Rect rect; #ifndef TransitionWindow PyMac_PRECHECK(TransitionWindow); #endif if (!PyArg_ParseTuple(_args, "llO&", ! &effect, ! &action, ! PyMac_GetRect, &rect)) return NULL; _err = TransitionWindow(_self->ob_itself, ! effect, ! action, ! &rect); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 1333,1351 ---- PyObject *_res = NULL; OSStatus _err; ! WindowTransitionEffect inEffect; ! WindowTransitionAction inAction; ! Rect inRect; #ifndef TransitionWindow PyMac_PRECHECK(TransitionWindow); #endif if (!PyArg_ParseTuple(_args, "llO&", ! &inEffect, ! &inAction, ! PyMac_GetRect, &inRect)) return NULL; _err = TransitionWindow(_self->ob_itself, ! inEffect, ! inAction, ! &inRect); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 1358,1379 **** PyObject *_res = NULL; OSStatus _err; ! WindowPtr parentWindow; ! WindowTransitionEffect effect; ! WindowTransitionAction action; ! Rect rect; #ifndef TransitionWindowAndParent PyMac_PRECHECK(TransitionWindowAndParent); #endif if (!PyArg_ParseTuple(_args, "O&llO&", ! WinObj_Convert, &parentWindow, ! &effect, ! &action, ! PyMac_GetRect, &rect)) return NULL; _err = TransitionWindowAndParent(_self->ob_itself, ! parentWindow, ! effect, ! action, ! &rect); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 1358,1379 ---- PyObject *_res = NULL; OSStatus _err; ! WindowPtr inParentWindow; ! WindowTransitionEffect inEffect; ! WindowTransitionAction inAction; ! Rect inRect; #ifndef TransitionWindowAndParent PyMac_PRECHECK(TransitionWindowAndParent); #endif if (!PyArg_ParseTuple(_args, "O&llO&", ! WinObj_Convert, &inParentWindow, ! &inEffect, ! &inAction, ! PyMac_GetRect, &inRect)) return NULL; _err = TransitionWindowAndParent(_self->ob_itself, ! inParentWindow, ! inEffect, ! inAction, ! &inRect); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 1563,1583 **** PyObject *_res = NULL; Boolean _rv; ! Point startPoint; ! Rect sizeConstraints; ! Rect newContentRect; #ifndef ResizeWindow PyMac_PRECHECK(ResizeWindow); #endif if (!PyArg_ParseTuple(_args, "O&O&", ! PyMac_GetPoint, &startPoint, ! PyMac_GetRect, &sizeConstraints)) return NULL; _rv = ResizeWindow(_self->ob_itself, ! startPoint, ! &sizeConstraints, ! &newContentRect); _res = Py_BuildValue("bO&", _rv, ! PyMac_BuildRect, &newContentRect); return _res; } --- 1563,1583 ---- PyObject *_res = NULL; Boolean _rv; ! Point inStartPoint; ! Rect inSizeConstraints; ! Rect outNewContentRect; #ifndef ResizeWindow PyMac_PRECHECK(ResizeWindow); #endif if (!PyArg_ParseTuple(_args, "O&O&", ! PyMac_GetPoint, &inStartPoint, ! PyMac_GetRect, &inSizeConstraints)) return NULL; _rv = ResizeWindow(_self->ob_itself, ! inStartPoint, ! &inSizeConstraints, ! &outNewContentRect); _res = Py_BuildValue("bO&", _rv, ! PyMac_BuildRect, &outNewContentRect); return _res; } *************** *** 1653,1670 **** PyObject *_res = NULL; Boolean _rv; ! Point idealSize; ! Rect idealStandardState; #ifndef IsWindowInStandardState PyMac_PRECHECK(IsWindowInStandardState); #endif ! if (!PyArg_ParseTuple(_args, "")) return NULL; _rv = IsWindowInStandardState(_self->ob_itself, ! &idealSize, ! &idealStandardState); ! _res = Py_BuildValue("bO&O&", _rv, ! PyMac_BuildPoint, idealSize, ! PyMac_BuildRect, &idealStandardState); return _res; } --- 1653,1670 ---- PyObject *_res = NULL; Boolean _rv; ! Point inIdealSize; ! Rect outIdealStandardState; #ifndef IsWindowInStandardState PyMac_PRECHECK(IsWindowInStandardState); #endif ! if (!PyArg_ParseTuple(_args, "O&", ! PyMac_GetPoint, &inIdealSize)) return NULL; _rv = IsWindowInStandardState(_self->ob_itself, ! &inIdealSize, ! &outIdealStandardState); ! _res = Py_BuildValue("bO&", _rv, ! PyMac_BuildRect, &outIdealStandardState); return _res; } *************** *** 1674,1678 **** PyObject *_res = NULL; OSStatus _err; ! WindowPartCode partCode; Point ioIdealSize; #ifndef ZoomWindowIdeal --- 1674,1678 ---- PyObject *_res = NULL; OSStatus _err; ! WindowPartCode inPartCode; Point ioIdealSize; #ifndef ZoomWindowIdeal *************** *** 1680,1687 **** #endif if (!PyArg_ParseTuple(_args, "h", ! &partCode)) return NULL; _err = ZoomWindowIdeal(_self->ob_itself, ! partCode, &ioIdealSize); if (_err != noErr) return PyMac_Error(_err); --- 1680,1687 ---- #endif if (!PyArg_ParseTuple(_args, "h", ! &inPartCode)) return NULL; _err = ZoomWindowIdeal(_self->ob_itself, ! inPartCode, &ioIdealSize); if (_err != noErr) return PyMac_Error(_err); *************** *** 1695,1699 **** PyObject *_res = NULL; OSStatus _err; ! Rect userState; #ifndef GetWindowIdealUserState PyMac_PRECHECK(GetWindowIdealUserState); --- 1695,1699 ---- PyObject *_res = NULL; OSStatus _err; ! Rect outUserState; #ifndef GetWindowIdealUserState PyMac_PRECHECK(GetWindowIdealUserState); *************** *** 1702,1709 **** return NULL; _err = GetWindowIdealUserState(_self->ob_itself, ! &userState); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", ! PyMac_BuildRect, &userState); return _res; } --- 1702,1709 ---- return NULL; _err = GetWindowIdealUserState(_self->ob_itself, ! &outUserState); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", ! PyMac_BuildRect, &outUserState); return _res; } *************** *** 1713,1725 **** PyObject *_res = NULL; OSStatus _err; ! Rect userState; #ifndef SetWindowIdealUserState PyMac_PRECHECK(SetWindowIdealUserState); #endif if (!PyArg_ParseTuple(_args, "O&", ! PyMac_GetRect, &userState)) return NULL; _err = SetWindowIdealUserState(_self->ob_itself, ! &userState); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 1713,1725 ---- PyObject *_res = NULL; OSStatus _err; ! Rect inUserState; #ifndef SetWindowIdealUserState PyMac_PRECHECK(SetWindowIdealUserState); #endif if (!PyArg_ParseTuple(_args, "O&", ! PyMac_GetRect, &inUserState)) return NULL; _err = SetWindowIdealUserState(_self->ob_itself, ! &inUserState); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 1998,2001 **** --- 1998,2016 ---- } + static PyObject *WinObj_GetWindowStructurePort(WindowObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + CGrafPtr _rv; + #ifndef GetWindowStructurePort + PyMac_PRECHECK(GetWindowStructurePort); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = GetWindowStructurePort(_self->ob_itself); + _res = Py_BuildValue("O&", + GrafObj_New, _rv); + return _res; + } + static PyObject *WinObj_GetWindowKind(WindowObject *_self, PyObject *_args) { *************** *** 2413,2417 **** PyDoc_STR("() -> (FSSpec outFile)")}, {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1, ! PyDoc_STR("(AliasHandle alias) -> None")}, {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1, PyDoc_STR("() -> (AliasHandle alias)")}, --- 2428,2432 ---- PyDoc_STR("() -> (FSSpec outFile)")}, {"SetWindowProxyAlias", (PyCFunction)WinObj_SetWindowProxyAlias, 1, ! PyDoc_STR("(AliasHandle inAlias) -> None")}, {"GetWindowProxyAlias", (PyCFunction)WinObj_GetWindowProxyAlias, 1, PyDoc_STR("() -> (AliasHandle alias)")}, *************** *** 2443,2449 **** PyDoc_STR("(Boolean hilited) -> None")}, {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, ! PyDoc_STR("(WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None")}, {"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1, ! PyDoc_STR("(WindowPtr parentWindow, WindowTransitionEffect effect, WindowTransitionAction action, Rect rect) -> None")}, {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")}, --- 2458,2464 ---- PyDoc_STR("(Boolean hilited) -> None")}, {"TransitionWindow", (PyCFunction)WinObj_TransitionWindow, 1, ! PyDoc_STR("(WindowTransitionEffect inEffect, WindowTransitionAction inAction, Rect inRect) -> None")}, {"TransitionWindowAndParent", (PyCFunction)WinObj_TransitionWindowAndParent, 1, ! PyDoc_STR("(WindowPtr inParentWindow, WindowTransitionEffect inEffect, WindowTransitionAction inAction, Rect inRect) -> None")}, {"MacMoveWindow", (PyCFunction)WinObj_MacMoveWindow, 1, PyDoc_STR("(short hGlobal, short vGlobal, Boolean front) -> None")}, *************** *** 2465,2469 **** PyDoc_STR("(WindowRegionCode regionCode) -> (Rect globalBounds)")}, {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1, ! PyDoc_STR("(Point startPoint, Rect sizeConstraints) -> (Boolean _rv, Rect newContentRect)")}, {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, PyDoc_STR("(WindowRegionCode regionCode, Rect globalBounds) -> None")}, --- 2480,2484 ---- PyDoc_STR("(WindowRegionCode regionCode) -> (Rect globalBounds)")}, {"ResizeWindow", (PyCFunction)WinObj_ResizeWindow, 1, ! PyDoc_STR("(Point inStartPoint, Rect inSizeConstraints) -> (Boolean _rv, Rect outNewContentRect)")}, {"SetWindowBounds", (PyCFunction)WinObj_SetWindowBounds, 1, PyDoc_STR("(WindowRegionCode regionCode, Rect globalBounds) -> None")}, *************** *** 2473,2483 **** PyDoc_STR("(short hGlobal, short vGlobal) -> None")}, {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, ! PyDoc_STR("() -> (Boolean _rv, Point idealSize, Rect idealStandardState)")}, {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, ! PyDoc_STR("(WindowPartCode partCode) -> (Point ioIdealSize)")}, {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, ! PyDoc_STR("() -> (Rect userState)")}, {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, ! PyDoc_STR("(Rect userState) -> None")}, {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1, PyDoc_STR("(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)")}, --- 2488,2498 ---- PyDoc_STR("(short hGlobal, short vGlobal) -> None")}, {"IsWindowInStandardState", (PyCFunction)WinObj_IsWindowInStandardState, 1, ! PyDoc_STR("(Point inIdealSize) -> (Boolean _rv, Rect outIdealStandardState)")}, {"ZoomWindowIdeal", (PyCFunction)WinObj_ZoomWindowIdeal, 1, ! PyDoc_STR("(WindowPartCode inPartCode) -> (Point ioIdealSize)")}, {"GetWindowIdealUserState", (PyCFunction)WinObj_GetWindowIdealUserState, 1, ! PyDoc_STR("() -> (Rect outUserState)")}, {"SetWindowIdealUserState", (PyCFunction)WinObj_SetWindowIdealUserState, 1, ! PyDoc_STR("(Rect inUserState) -> None")}, {"GetWindowGreatestAreaDevice", (PyCFunction)WinObj_GetWindowGreatestAreaDevice, 1, PyDoc_STR("(WindowRegionCode inRegion) -> (GDHandle outGreatestDevice, Rect outGreatestDeviceRect)")}, *************** *** 2508,2511 **** --- 2523,2528 ---- {"GetWindowPort", (PyCFunction)WinObj_GetWindowPort, 1, PyDoc_STR("() -> (CGrafPtr _rv)")}, + {"GetWindowStructurePort", (PyCFunction)WinObj_GetWindowStructurePort, 1, + PyDoc_STR("() -> (CGrafPtr _rv)")}, {"GetWindowKind", (PyCFunction)WinObj_GetWindowKind, 1, PyDoc_STR("() -> (short _rv)")}, *************** *** 2999,3003 **** OSStatus _err; GDHandle inDevice; ! Rect availableRect; #ifndef GetAvailableWindowPositioningBounds PyMac_PRECHECK(GetAvailableWindowPositioningBounds); --- 3016,3020 ---- OSStatus _err; GDHandle inDevice; ! Rect outAvailableRect; #ifndef GetAvailableWindowPositioningBounds PyMac_PRECHECK(GetAvailableWindowPositioningBounds); *************** *** 3007,3014 **** return NULL; _err = GetAvailableWindowPositioningBounds(inDevice, ! &availableRect); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", ! PyMac_BuildRect, &availableRect); return _res; } --- 3024,3031 ---- return NULL; _err = GetAvailableWindowPositioningBounds(inDevice, ! &outAvailableRect); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("O&", ! PyMac_BuildRect, &outAvailableRect); return _res; } *************** *** 3167,3171 **** PyDoc_STR("(Boolean collapse) -> None")}, {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1, ! PyDoc_STR("(GDHandle inDevice) -> (Rect availableRect)")}, {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1, PyDoc_STR("() -> None")}, --- 3184,3188 ---- PyDoc_STR("(Boolean collapse) -> None")}, {"GetAvailableWindowPositioningBounds", (PyCFunction)Win_GetAvailableWindowPositioningBounds, 1, ! PyDoc_STR("(GDHandle inDevice) -> (Rect outAvailableRect)")}, {"DisableScreenUpdates", (PyCFunction)Win_DisableScreenUpdates, 1, PyDoc_STR("() -> None")}, Index: winscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/win/winscan.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** winscan.py 19 Nov 2003 16:34:04 -0000 1.25 --- winscan.py 3 Dec 2003 23:20:13 -0000 1.26 *************** *** 36,39 **** --- 36,40 ---- self.defsfile.write("false = 0\n") self.defsfile.write("true = 1\n") + self.defsfile.write("kWindowNoConstrainAttribute = 0x80000000\n") def makeblacklistnames(self): *************** *** 50,53 **** --- 51,55 ---- 'kMouseUpOutOfSlop', 'kAllWindowClasses', + 'kWindowNoConstrainAttribute', # OS8 only: 'GetAuxWin', From jackjansen at users.sourceforge.net Wed Dec 3 18:20:43 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:46 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/cg _CGmodule.c, 1.14, 1.15 cgsupport.py, 1.8, 1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/cg In directory sc8-pr-cvs1:/tmp/cvs-serv22913/cg Modified Files: _CGmodule.c cgsupport.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: _CGmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/_CGmodule.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** _CGmodule.c 20 Nov 2003 13:30:56 -0000 1.14 --- _CGmodule.c 3 Dec 2003 23:20:10 -0000 1.15 *************** *** 700,717 **** { PyObject *_res = NULL; ! float r; ! float g; ! float b; float alpha; if (!PyArg_ParseTuple(_args, "ffff", ! &r, ! &g, ! &b, &alpha)) return NULL; CGContextSetRGBFillColor(_self->ob_itself, ! r, ! g, ! b, alpha); Py_INCREF(Py_None); --- 700,717 ---- { PyObject *_res = NULL; ! float red; ! float green; ! float blue; float alpha; if (!PyArg_ParseTuple(_args, "ffff", ! &red, ! &green, ! &blue, &alpha)) return NULL; CGContextSetRGBFillColor(_self->ob_itself, ! red, ! green, ! blue, alpha); Py_INCREF(Py_None); *************** *** 723,740 **** { PyObject *_res = NULL; ! float r; ! float g; ! float b; float alpha; if (!PyArg_ParseTuple(_args, "ffff", ! &r, ! &g, ! &b, &alpha)) return NULL; CGContextSetRGBStrokeColor(_self->ob_itself, ! r, ! g, ! b, alpha); Py_INCREF(Py_None); --- 723,740 ---- { PyObject *_res = NULL; ! float red; ! float green; ! float blue; float alpha; if (!PyArg_ParseTuple(_args, "ffff", ! &red, ! &green, ! &blue, &alpha)) return NULL; CGContextSetRGBStrokeColor(_self->ob_itself, ! red, ! green, ! blue, alpha); Py_INCREF(Py_None); *************** *** 746,766 **** { PyObject *_res = NULL; ! float c; ! float m; ! float y; ! float k; float alpha; if (!PyArg_ParseTuple(_args, "fffff", ! &c, ! &m, ! &y, ! &k, &alpha)) return NULL; CGContextSetCMYKFillColor(_self->ob_itself, ! c, ! m, ! y, ! k, alpha); Py_INCREF(Py_None); --- 746,766 ---- { PyObject *_res = NULL; ! float cyan; ! float magenta; ! float yellow; ! float black; float alpha; if (!PyArg_ParseTuple(_args, "fffff", ! &cyan, ! &magenta, ! &yellow, ! &black, &alpha)) return NULL; CGContextSetCMYKFillColor(_self->ob_itself, ! cyan, ! magenta, ! yellow, ! black, alpha); Py_INCREF(Py_None); *************** *** 772,792 **** { PyObject *_res = NULL; ! float c; ! float m; ! float y; ! float k; float alpha; if (!PyArg_ParseTuple(_args, "fffff", ! &c, ! &m, ! &y, ! &k, &alpha)) return NULL; CGContextSetCMYKStrokeColor(_self->ob_itself, ! c, ! m, ! y, ! k, alpha); Py_INCREF(Py_None); --- 772,792 ---- { PyObject *_res = NULL; ! float cyan; ! float magenta; ! float yellow; ! float black; float alpha; if (!PyArg_ParseTuple(_args, "fffff", ! &cyan, ! &magenta, ! &yellow, ! &black, &alpha)) return NULL; CGContextSetCMYKStrokeColor(_self->ob_itself, ! cyan, ! magenta, ! yellow, ! black, alpha); Py_INCREF(Py_None); *************** *** 795,798 **** --- 795,824 ---- } + static PyObject *CGContextRefObj_CGContextGetInterpolationQuality(CGContextRefObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + int _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = CGContextGetInterpolationQuality(_self->ob_itself); + _res = Py_BuildValue("i", + _rv); + return _res; + } + + static PyObject *CGContextRefObj_CGContextSetInterpolationQuality(CGContextRefObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + int quality; + if (!PyArg_ParseTuple(_args, "i", + &quality)) + return NULL; + CGContextSetInterpolationQuality(_self->ob_itself, + quality); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyObject *CGContextRefObj_CGContextSetCharacterSpacing(CGContextRefObject *_self, PyObject *_args) { *************** *** 1108,1118 **** PyDoc_STR("(float gray, float alpha) -> None")}, {"CGContextSetRGBFillColor", (PyCFunction)CGContextRefObj_CGContextSetRGBFillColor, 1, ! PyDoc_STR("(float r, float g, float b, float alpha) -> None")}, {"CGContextSetRGBStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetRGBStrokeColor, 1, ! PyDoc_STR("(float r, float g, float b, float alpha) -> None")}, {"CGContextSetCMYKFillColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKFillColor, 1, ! PyDoc_STR("(float c, float m, float y, float k, float alpha) -> None")}, {"CGContextSetCMYKStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKStrokeColor, 1, ! PyDoc_STR("(float c, float m, float y, float k, float alpha) -> None")}, {"CGContextSetCharacterSpacing", (PyCFunction)CGContextRefObj_CGContextSetCharacterSpacing, 1, PyDoc_STR("(float spacing) -> None")}, --- 1134,1148 ---- PyDoc_STR("(float gray, float alpha) -> None")}, {"CGContextSetRGBFillColor", (PyCFunction)CGContextRefObj_CGContextSetRGBFillColor, 1, ! PyDoc_STR("(float red, float green, float blue, float alpha) -> None")}, {"CGContextSetRGBStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetRGBStrokeColor, 1, ! PyDoc_STR("(float red, float green, float blue, float alpha) -> None")}, {"CGContextSetCMYKFillColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKFillColor, 1, ! PyDoc_STR("(float cyan, float magenta, float yellow, float black, float alpha) -> None")}, {"CGContextSetCMYKStrokeColor", (PyCFunction)CGContextRefObj_CGContextSetCMYKStrokeColor, 1, ! PyDoc_STR("(float cyan, float magenta, float yellow, float black, float alpha) -> None")}, ! {"CGContextGetInterpolationQuality", (PyCFunction)CGContextRefObj_CGContextGetInterpolationQuality, 1, ! PyDoc_STR("() -> (int _rv)")}, ! {"CGContextSetInterpolationQuality", (PyCFunction)CGContextRefObj_CGContextSetInterpolationQuality, 1, ! PyDoc_STR("(int quality) -> None")}, {"CGContextSetCharacterSpacing", (PyCFunction)CGContextRefObj_CGContextSetCharacterSpacing, 1, PyDoc_STR("(float spacing) -> None")}, Index: cgsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/cg/cgsupport.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** cgsupport.py 19 Nov 2003 16:34:03 -0000 1.8 --- cgsupport.py 3 Dec 2003 23:20:10 -0000 1.9 *************** *** 115,118 **** --- 115,119 ---- CGTextDrawingMode = int CGPathDrawingMode = int + CGInterpolationQuality = int # The real objects From jackjansen at users.sourceforge.net Wed Dec 3 18:20:44 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 3 18:20:50 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/ctl _Ctlmodule.c, 1.27, 1.28 ctlscan.py, 1.32, 1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/ctl In directory sc8-pr-cvs1:/tmp/cvs-serv22913/ctl Modified Files: _Ctlmodule.c ctlscan.py Log Message: Ported to Universal Headers 3.4.2. Qd and Qt remain to be done. Completely untested. Index: _Ctlmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/_Ctlmodule.c,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** _Ctlmodule.c 20 Nov 2003 13:30:56 -0000 1.27 --- _Ctlmodule.c 3 Dec 2003 23:20:11 -0000 1.28 *************** *** 1386,1398 **** PyObject *_res = NULL; OSStatus _err; ! Boolean tracks; #ifndef SetControlDragTrackingEnabled PyMac_PRECHECK(SetControlDragTrackingEnabled); #endif if (!PyArg_ParseTuple(_args, "b", ! &tracks)) return NULL; _err = SetControlDragTrackingEnabled(_self->ob_itself, ! tracks); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 1386,1398 ---- PyObject *_res = NULL; OSStatus _err; ! Boolean inTracks; #ifndef SetControlDragTrackingEnabled PyMac_PRECHECK(SetControlDragTrackingEnabled); #endif if (!PyArg_ParseTuple(_args, "b", ! &inTracks)) return NULL; _err = SetControlDragTrackingEnabled(_self->ob_itself, ! inTracks); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 1405,1409 **** PyObject *_res = NULL; OSStatus _err; ! Boolean tracks; #ifndef IsControlDragTrackingEnabled PyMac_PRECHECK(IsControlDragTrackingEnabled); --- 1405,1409 ---- PyObject *_res = NULL; OSStatus _err; ! Boolean outTracks; #ifndef IsControlDragTrackingEnabled PyMac_PRECHECK(IsControlDragTrackingEnabled); *************** *** 1412,1419 **** return NULL; _err = IsControlDragTrackingEnabled(_self->ob_itself, ! &tracks); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", ! tracks); return _res; } --- 1412,1419 ---- return NULL; _err = IsControlDragTrackingEnabled(_self->ob_itself, ! &outTracks); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", ! outTracks); return _res; } *************** *** 3609,3615 **** PyDoc_STR("(DragReference inDrag) -> None")}, {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1, ! PyDoc_STR("(Boolean tracks) -> None")}, {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1, ! PyDoc_STR("() -> (Boolean tracks)")}, {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1, PyDoc_STR("() -> (Rect bounds)")}, --- 3609,3615 ---- PyDoc_STR("(DragReference inDrag) -> None")}, {"SetControlDragTrackingEnabled", (PyCFunction)CtlObj_SetControlDragTrackingEnabled, 1, ! PyDoc_STR("(Boolean inTracks) -> None")}, {"IsControlDragTrackingEnabled", (PyCFunction)CtlObj_IsControlDragTrackingEnabled, 1, ! PyDoc_STR("() -> (Boolean outTracks)")}, {"GetControlBounds", (PyCFunction)CtlObj_GetControlBounds, 1, PyDoc_STR("() -> (Rect bounds)")}, *************** *** 3991,4005 **** { PyObject *_res = NULL; ! WindowPtr theWindow; ! RgnHandle updateRegion; #ifndef UpdateControls PyMac_PRECHECK(UpdateControls); #endif if (!PyArg_ParseTuple(_args, "O&O&", ! WinObj_Convert, &theWindow, ! ResObj_Convert, &updateRegion)) return NULL; ! UpdateControls(theWindow, ! updateRegion); Py_INCREF(Py_None); _res = Py_None; --- 3991,4005 ---- { PyObject *_res = NULL; ! WindowPtr inWindow; ! RgnHandle inUpdateRegion; #ifndef UpdateControls PyMac_PRECHECK(UpdateControls); #endif if (!PyArg_ParseTuple(_args, "O&O&", ! WinObj_Convert, &inWindow, ! ResObj_Convert, &inUpdateRegion)) return NULL; ! UpdateControls(inWindow, ! inUpdateRegion); Py_INCREF(Py_None); _res = Py_None; *************** *** 4232,4246 **** PyObject *_res = NULL; OSStatus _err; ! WindowPtr theWindow; ! Boolean tracks; #ifndef SetAutomaticControlDragTrackingEnabledForWindow PyMac_PRECHECK(SetAutomaticControlDragTrackingEnabledForWindow); #endif if (!PyArg_ParseTuple(_args, "O&b", ! WinObj_Convert, &theWindow, ! &tracks)) return NULL; ! _err = SetAutomaticControlDragTrackingEnabledForWindow(theWindow, ! tracks); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 4232,4246 ---- PyObject *_res = NULL; OSStatus _err; ! WindowPtr inWindow; ! Boolean inTracks; #ifndef SetAutomaticControlDragTrackingEnabledForWindow PyMac_PRECHECK(SetAutomaticControlDragTrackingEnabledForWindow); #endif if (!PyArg_ParseTuple(_args, "O&b", ! WinObj_Convert, &inWindow, ! &inTracks)) return NULL; ! _err = SetAutomaticControlDragTrackingEnabledForWindow(inWindow, ! inTracks); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 4253,4269 **** PyObject *_res = NULL; OSStatus _err; ! WindowPtr theWindow; ! Boolean tracks; #ifndef IsAutomaticControlDragTrackingEnabledForWindow PyMac_PRECHECK(IsAutomaticControlDragTrackingEnabledForWindow); #endif if (!PyArg_ParseTuple(_args, "O&", ! WinObj_Convert, &theWindow)) return NULL; ! _err = IsAutomaticControlDragTrackingEnabledForWindow(theWindow, ! &tracks); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", ! tracks); return _res; } --- 4253,4269 ---- PyObject *_res = NULL; OSStatus _err; ! WindowPtr inWindow; ! Boolean outTracks; #ifndef IsAutomaticControlDragTrackingEnabledForWindow PyMac_PRECHECK(IsAutomaticControlDragTrackingEnabledForWindow); #endif if (!PyArg_ParseTuple(_args, "O&", ! WinObj_Convert, &inWindow)) return NULL; ! _err = IsAutomaticControlDragTrackingEnabledForWindow(inWindow, ! &outTracks); if (_err != noErr) return PyMac_Error(_err); _res = Py_BuildValue("b", ! outTracks); return _res; } *************** *** 4363,4373 **** PyObject *_res = NULL; OSStatus _err; ! WindowPtr window; ! Rect boundsRect; ! UInt16 orientation; ! CFStringRef title; ! SInt32 initialValue; ! Boolean drawTitle; ! Boolean autoToggles; ControlHandle outControl; #ifndef CreateDisclosureTriangleControl --- 4363,4373 ---- PyObject *_res = NULL; OSStatus _err; ! WindowPtr inWindow; ! Rect inBoundsRect; ! UInt16 inOrientation; ! CFStringRef inTitle; ! SInt32 inInitialValue; ! Boolean inDrawTitle; ! Boolean inAutoToggles; ControlHandle outControl; #ifndef CreateDisclosureTriangleControl *************** *** 4375,4393 **** #endif if (!PyArg_ParseTuple(_args, "O&O&HO&lbb", ! WinObj_Convert, &window, ! PyMac_GetRect, &boundsRect, ! &orientation, ! CFStringRefObj_Convert, &title, ! &initialValue, ! &drawTitle, ! &autoToggles)) return NULL; ! _err = CreateDisclosureTriangleControl(window, ! &boundsRect, ! orientation, ! title, ! initialValue, ! drawTitle, ! autoToggles, &outControl); if (_err != noErr) return PyMac_Error(_err); --- 4375,4393 ---- #endif if (!PyArg_ParseTuple(_args, "O&O&HO&lbb", ! WinObj_Convert, &inWindow, ! PyMac_GetRect, &inBoundsRect, ! &inOrientation, ! CFStringRefObj_Convert, &inTitle, ! &inInitialValue, ! &inDrawTitle, ! &inAutoToggles)) return NULL; ! _err = CreateDisclosureTriangleControl(inWindow, ! &inBoundsRect, ! inOrientation, ! inTitle, ! inInitialValue, ! inDrawTitle, ! inAutoToggles, &outControl); if (_err != noErr) return PyMac_Error(_err); *************** *** 4883,4890 **** PyObject *_res = NULL; OSStatus _err; ! WindowPtr window; ! Rect boundsRect; ! ControlButtonContentInfo icon; ! Boolean dontTrack; ControlHandle outControl; #ifndef CreateIconControl --- 4883,4890 ---- PyObject *_res = NULL; OSStatus _err; ! WindowPtr inWindow; ! Rect inBoundsRect; ! ControlButtonContentInfo inIconContent; ! Boolean inDontTrack; ControlHandle outControl; #ifndef CreateIconControl *************** *** 4892,4904 **** #endif if (!PyArg_ParseTuple(_args, "O&O&O&b", ! WinObj_Convert, &window, ! PyMac_GetRect, &boundsRect, ! ControlButtonContentInfo_Convert, &icon, ! &dontTrack)) return NULL; ! _err = CreateIconControl(window, ! &boundsRect, ! &icon, ! dontTrack, &outControl); if (_err != noErr) return PyMac_Error(_err); --- 4892,4904 ---- #endif if (!PyArg_ParseTuple(_args, "O&O&O&b", ! WinObj_Convert, &inWindow, ! PyMac_GetRect, &inBoundsRect, ! ControlButtonContentInfo_Convert, &inIconContent, ! &inDontTrack)) return NULL; ! _err = CreateIconControl(inWindow, ! &inBoundsRect, ! &inIconContent, ! inDontTrack, &outControl); if (_err != noErr) return PyMac_Error(_err); *************** *** 5423,5427 **** PyDoc_STR("(WindowPtr theWindow) -> None")}, {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1, ! PyDoc_STR("(WindowPtr theWindow, RgnHandle updateRegion) -> None")}, {"FindControl", (PyCFunction)Ctl_FindControl, 1, PyDoc_STR("(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)")}, --- 5423,5427 ---- PyDoc_STR("(WindowPtr theWindow) -> None")}, {"UpdateControls", (PyCFunction)Ctl_UpdateControls, 1, ! PyDoc_STR("(WindowPtr inWindow, RgnHandle inUpdateRegion) -> None")}, {"FindControl", (PyCFunction)Ctl_FindControl, 1, PyDoc_STR("(Point testPoint, WindowPtr theWindow) -> (ControlPartCode _rv, ControlHandle theControl)")}, *************** *** 5447,5453 **** PyDoc_STR("(WindowPtr inWindow) -> None")}, {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1, ! PyDoc_STR("(WindowPtr theWindow, Boolean tracks) -> None")}, {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1, ! PyDoc_STR("(WindowPtr theWindow) -> (Boolean tracks)")}, {"CreateBevelButtonControl", (PyCFunction)Ctl_CreateBevelButtonControl, 1, PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, UInt16 thickness, UInt16 behavior, ControlButtonContentInfo info, SInt16 menuID, UInt16 menuBehavior, UInt16 menuPlacement) -> (ControlHandle outControl)")}, --- 5447,5453 ---- PyDoc_STR("(WindowPtr inWindow) -> None")}, {"SetAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_SetAutomaticControlDragTrackingEnabledForWindow, 1, ! PyDoc_STR("(WindowPtr inWindow, Boolean inTracks) -> None")}, {"IsAutomaticControlDragTrackingEnabledForWindow", (PyCFunction)Ctl_IsAutomaticControlDragTrackingEnabledForWindow, 1, ! PyDoc_STR("(WindowPtr inWindow) -> (Boolean outTracks)")}, {"CreateBevelButtonControl", (PyCFunction)Ctl_CreateBevelButtonControl, 1, PyDoc_STR("(WindowPtr window, Rect boundsRect, CFStringRef title, UInt16 thickness, UInt16 behavior, ControlButtonContentInfo info, SInt16 menuID, UInt16 menuBehavior, UInt16 menuPlacement) -> (ControlHandle outControl)")}, *************** *** 5455,5459 **** PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, UInt16 orientation, UInt16 numTickMarks, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")}, {"CreateDisclosureTriangleControl", (PyCFunction)Ctl_CreateDisclosureTriangleControl, 1, ! PyDoc_STR("(WindowPtr window, Rect boundsRect, UInt16 orientation, CFStringRef title, SInt32 initialValue, Boolean drawTitle, Boolean autoToggles) -> (ControlHandle outControl)")}, {"CreateProgressBarControl", (PyCFunction)Ctl_CreateProgressBarControl, 1, PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)")}, --- 5455,5459 ---- PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, UInt16 orientation, UInt16 numTickMarks, Boolean liveTracking, PyObject* liveTrackingProc) -> (ControlHandle outControl)")}, {"CreateDisclosureTriangleControl", (PyCFunction)Ctl_CreateDisclosureTriangleControl, 1, ! PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, UInt16 inOrientation, CFStringRef inTitle, SInt32 inInitialValue, Boolean inDrawTitle, Boolean inAutoToggles) -> (ControlHandle outControl)")}, {"CreateProgressBarControl", (PyCFunction)Ctl_CreateProgressBarControl, 1, PyDoc_STR("(WindowPtr window, Rect boundsRect, SInt32 value, SInt32 minimum, SInt32 maximum, Boolean indeterminate) -> (ControlHandle outControl)")}, *************** *** 5489,5493 **** PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo content, Boolean dontTrack) -> (ControlHandle outControl)")}, {"CreateIconControl", (PyCFunction)Ctl_CreateIconControl, 1, ! PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo icon, Boolean dontTrack) -> (ControlHandle outControl)")}, {"CreateWindowHeaderControl", (PyCFunction)Ctl_CreateWindowHeaderControl, 1, PyDoc_STR("(WindowPtr window, Rect boundsRect, Boolean isListHeader) -> (ControlHandle outControl)")}, --- 5489,5493 ---- PyDoc_STR("(WindowPtr window, Rect boundsRect, ControlButtonContentInfo content, Boolean dontTrack) -> (ControlHandle outControl)")}, {"CreateIconControl", (PyCFunction)Ctl_CreateIconControl, 1, ! PyDoc_STR("(WindowPtr inWindow, Rect inBoundsRect, ControlButtonContentInfo inIconContent, Boolean inDontTrack) -> (ControlHandle outControl)")}, {"CreateWindowHeaderControl", (PyCFunction)Ctl_CreateWindowHeaderControl, 1, PyDoc_STR("(WindowPtr window, Rect boundsRect, Boolean isListHeader) -> (ControlHandle outControl)")}, Index: ctlscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/ctl/ctlscan.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** ctlscan.py 19 Nov 2003 16:34:03 -0000 1.32 --- ctlscan.py 3 Dec 2003 23:20:11 -0000 1.33 *************** *** 126,129 **** --- 126,130 ---- ## 'DataBrowserListViewColumnDesc', 'CFDataRef', + 'DataBrowserListViewHeaderDesc', # difficult struct ] From tim_one at users.sourceforge.net Thu Dec 4 00:39:46 2003 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Thu Dec 4 00:39:52 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py, 1.60, 1.61 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv27598/Lib/test Modified Files: test_support.py Log Message: Typo repair; added some comments and horizontal whitespace. Index: test_support.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_support.py,v retrieving revision 1.60 retrieving revision 1.61 diff -C2 -d -r1.60 -r1.61 *** test_support.py 3 Dec 2003 22:16:46 -0000 1.60 --- test_support.py 4 Dec 2003 05:39:43 -0000 1.61 *************** *** 131,145 **** # python -U # XXX perhaps unicode() should accept Unicode strings? ! TESTFN_UNICODE="@test-\xe0\xf2" else: ! TESTFN_UNICODE=unicode("@test-\xe0\xf2", "latin-1") # 2 latin characters. ! TESTFN_ENCODING=sys.getfilesystemencoding() ! # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # able to be encoded by *either* the default or filesystem encoding. ! # This test really only makes sense on Windows NT platforms # which have special Unicode support in posixmodule. ! if not hasattr(sys, "getwindowsversion") or \ ! sys.getwindowsversion()[3]<2: ! TESTFN_UNICODE_UNENCODABLE = None else: # Japanese characters (I think - from bug 846133) --- 131,146 ---- # python -U # XXX perhaps unicode() should accept Unicode strings? ! TESTFN_UNICODE = "@test-\xe0\xf2" else: ! # 2 latin characters. ! TESTFN_UNICODE = unicode("@test-\xe0\xf2", "latin-1") ! TESTFN_ENCODING = sys.getfilesystemencoding() ! # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be # able to be encoded by *either* the default or filesystem encoding. ! # This test really only makes sense on Windows NT platforms # which have special Unicode support in posixmodule. ! if (not hasattr(sys, "getwindowsversion") or ! sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME ! TESTFN_UNICODE_UNENCODEABLE = None else: # Japanese characters (I think - from bug 846133) *************** *** 147,151 **** try: # XXX - Note - should be using TESTFN_ENCODING here - but for ! # Windows, "mbcs" currently always operates as if in # errors=ignore' mode - hence we get '?' characters rather than # the exception. 'Latin1' operates as we expect - ie, fails. --- 148,152 ---- try: # XXX - Note - should be using TESTFN_ENCODING here - but for ! # Windows, "mbcs" currently always operates as if in # errors=ignore' mode - hence we get '?' characters rather than # the exception. 'Latin1' operates as we expect - ie, fails. From mwh at users.sourceforge.net Thu Dec 4 06:25:48 2003 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu Dec 4 06:25:52 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.166,2.167 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv21077/Objects Modified Files: listobject.c Log Message: Fixes and tests for various "holding pointers when arbitrary Python code can run" bugs as discussed in [ 848856 ] couple of new list.sort bugs Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.166 retrieving revision 2.167 diff -C2 -d -r2.166 -r2.167 *** listobject.c 28 Nov 2003 21:43:02 -0000 2.166 --- listobject.c 4 Dec 2003 11:25:46 -0000 2.167 *************** *** 1849,1853 **** int reverse = 0; PyObject *keyfunc = NULL; ! int i, len = 0; PyObject *key, *value, *kvpair; static char *kwlist[] = {"cmp", "key", "reverse", 0}; --- 1849,1853 ---- int reverse = 0; PyObject *keyfunc = NULL; ! int i; PyObject *key, *value, *kvpair; static char *kwlist[] = {"cmp", "key", "reverse", 0}; *************** *** 1871,1887 **** Py_XINCREF(compare); if (keyfunc != NULL) { ! len = PyList_GET_SIZE(self); ! for (i=0 ; i < len ; i++) { ! value = PyList_GET_ITEM(self, i); key = PyObject_CallFunctionObjArgs(keyfunc, value, NULL); if (key == NULL) { for (i=i-1 ; i>=0 ; i--) { ! kvpair = PyList_GET_ITEM(self, i); value = sortwrapper_getvalue(kvpair); ! PyList_SET_ITEM(self, i, value); Py_DECREF(kvpair); } goto dsu_fail; } --- 1871,1908 ---- Py_XINCREF(compare); + /* The list is temporarily made empty, so that mutations performed + * by comparison functions can't affect the slice of memory we're + * sorting (allowing mutations during sorting is a core-dump + * factory, since ob_item may change). + */ + saved_ob_size = self->ob_size; + saved_ob_item = self->ob_item; + self->ob_size = 0; + self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0); + if (keyfunc != NULL) { ! for (i=0 ; i < saved_ob_size ; i++) { ! value = saved_ob_item[i]; key = PyObject_CallFunctionObjArgs(keyfunc, value, NULL); if (key == NULL) { for (i=i-1 ; i>=0 ; i--) { ! kvpair = saved_ob_item[i]; value = sortwrapper_getvalue(kvpair); ! saved_ob_item[i] = value; Py_DECREF(kvpair); } + if (self->ob_item != empty_ob_item + || self->ob_size) { + /* If the list changed *as well* we + have two errors. We let the first + one "win", but we shouldn't let + what's in the list currently + leak. */ + (void)list_ass_slice( + self, 0, self->ob_size, + (PyObject *)NULL); + } + goto dsu_fail; } *************** *** 1889,1893 **** if (kvpair == NULL) goto dsu_fail; ! PyList_SET_ITEM(self, i, kvpair); } } --- 1910,1914 ---- if (kvpair == NULL) goto dsu_fail; ! saved_ob_item[i] = kvpair; } } *************** *** 1895,1913 **** /* Reverse sort stability achieved by initially reversing the list, applying a stable forward sort, then reversing the final result. */ ! if (reverse && self->ob_size > 1) ! reverse_slice(self->ob_item, self->ob_item + self->ob_size); merge_init(&ms, compare); - /* The list is temporarily made empty, so that mutations performed - * by comparison functions can't affect the slice of memory we're - * sorting (allowing mutations during sorting is a core-dump - * factory, since ob_item may change). - */ - saved_ob_size = self->ob_size; - saved_ob_item = self->ob_item; - self->ob_size = 0; - self->ob_item = empty_ob_item = PyMem_NEW(PyObject *, 0); - nremaining = saved_ob_size; if (nremaining < 2) --- 1916,1924 ---- /* Reverse sort stability achieved by initially reversing the list, applying a stable forward sort, then reversing the final result. */ ! if (reverse && saved_ob_size > 1) ! reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size); merge_init(&ms, compare); nremaining = saved_ob_size; if (nremaining < 2) *************** *** 1960,1963 **** --- 1971,1983 ---- result = Py_None; fail: + if (keyfunc != NULL) { + for (i=0 ; i < saved_ob_size ; i++) { + kvpair = saved_ob_item[i]; + value = sortwrapper_getvalue(kvpair); + saved_ob_item[i] = value; + Py_DECREF(kvpair); + } + } + if (self->ob_item != empty_ob_item || self->ob_size) { /* The user mucked with the list during the sort. */ *************** *** 1969,1992 **** } } - if (self->ob_item == empty_ob_item) - PyMem_FREE(empty_ob_item); - self->ob_size = saved_ob_size; - self->ob_item = saved_ob_item; - merge_freemem(&ms); ! if (keyfunc != NULL) { ! len = PyList_GET_SIZE(self); ! for (i=0 ; i < len ; i++) { ! kvpair = PyList_GET_ITEM(self, i); ! value = sortwrapper_getvalue(kvpair); ! PyList_SET_ITEM(self, i, value); ! Py_DECREF(kvpair); ! } ! } ! if (reverse && self->ob_size > 1) ! reverse_slice(self->ob_item, self->ob_item + self->ob_size); dsu_fail: Py_XDECREF(compare); Py_XINCREF(result); --- 1989,2003 ---- } } ! if (reverse && saved_ob_size > 1) ! reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size); ! merge_freemem(&ms); dsu_fail: + if (self->ob_item == empty_ob_item) + PyMem_FREE(empty_ob_item); + self->ob_size = saved_ob_size; + self->ob_item = saved_ob_item; Py_XDECREF(compare); Py_XINCREF(result); From mwh at users.sourceforge.net Thu Dec 4 06:25:48 2003 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu Dec 4 06:25:55 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21077/Lib/test Modified Files: test_sort.py Log Message: Fixes and tests for various "holding pointers when arbitrary Python code can run" bugs as discussed in [ 848856 ] couple of new list.sort bugs Index: test_sort.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_sort.py 28 Nov 2003 21:43:02 -0000 1.8 --- test_sort.py 4 Dec 2003 11:25:45 -0000 1.9 *************** *** 194,197 **** --- 194,242 ---- self.assertEqual(data, dup) + def test_key_with_mutation(self): + data = range(10) + def k(x): + del data[:] + data[:] = range(20) + return x + self.assertRaises(ValueError, data.sort, key=k) + + def test_key_with_mutating_del(self): + data = range(10) + class SortKiller(object): + def __init__(self, x): + pass + def __del__(self): + del data[:] + data[:] = range(20) + self.assertRaises(ValueError, data.sort, key=SortKiller) + + def test_key_with_mutating_del_and_exception(self): + data = range(10) + ## dup = data[:] + class SortKiller(object): + def __init__(self, x): + if x > 2: + raise RuntimeError + def __del__(self): + del data[:] + data[:] = range(20) + self.assertRaises(RuntimeError, data.sort, key=SortKiller) + ## major honking subtlety: we *can't* do: + ## + ## self.assertEqual(data, dup) + ## + ## because there is a reference to a SortKiller in the + ## traceback and by the time it dies we're outside the call to + ## .sort() and so the list protection gimmicks are out of + ## date (this cost some brain cells to figure out...). + + def test_key_with_exception(self): + # Verify that the wrapper has been removed + data = range(-2,2) + dup = data[:] + self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1/x) + self.assertEqual(data, dup) + def test_reverse(self): data = range(100) From mwh at users.sourceforge.net Thu Dec 4 06:41:26 2003 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Thu Dec 4 06:41:30 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_sort.py,1.9,1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv23509/Lib/test Modified Files: test_sort.py Log Message: Remove extra copy of test_key_with_exception that somehow appeared during a CVS merge. Index: test_sort.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_sort.py 4 Dec 2003 11:25:45 -0000 1.9 --- test_sort.py 4 Dec 2003 11:41:24 -0000 1.10 *************** *** 232,242 **** ## date (this cost some brain cells to figure out...). - def test_key_with_exception(self): - # Verify that the wrapper has been removed - data = range(-2,2) - dup = data[:] - self.assertRaises(ZeroDivisionError, data.sort, None, lambda x: 1/x) - self.assertEqual(data, dup) - def test_reverse(self): data = range(100) --- 232,235 ---- From bwarsaw at users.sourceforge.net Thu Dec 4 10:12:58 2003 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu Dec 4 10:13:03 2003 Subject: [Python-checkins] python/nondist/peps pep-0291.txt,1.6,1.7 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv29839 Modified Files: pep-0291.txt Log Message: Elaborate that some packages may have different compatibility requirements based on the branch of Python they're developed on. Index: pep-0291.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0291.txt,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pep-0291.txt 18 Jul 2003 15:32:46 -0000 1.6 --- pep-0291.txt 4 Dec 2003 15:12:55 -0000 1.7 *************** *** 15,19 **** This PEP describes the packages and modules in the standard library which should remain backward compatible with previous ! versions of Python. --- 15,21 ---- This PEP describes the packages and modules in the standard library which should remain backward compatible with previous ! versions of Python. If a package is not listed here, then it need ! only remain compatible with the version of Python it is ! distributed with. *************** *** 35,38 **** --- 37,47 ---- the compatibility requirement. + When a major version of Python is released, a CVS branch is + created for continued maintenance and bug fix releases. A package + version on a branch may have a different compatibility requirement + than the same package on the trunk (i.e. current bleeding-edge + development). Where appropriate, these branch compatibilities are + listed below. + Features to Avoid *************** *** 67,82 **** Backward Compatible Packages, Modules, and Tools ! Package/Module Maintainer(s) Python Version ! -------------- ------------- -------------- bsddb Barry Warsaw 2.1 compiler Jeremy Hylton 2.1 distutils Andrew Kuchling 1.5.2 ! email Barry Warsaw 2.1 logging Vinay Sajip 1.5.2 sre Fredrik Lundh 2.1 xml (PyXML) Martin v. Loewis 2.0 xmlrpclib Fredrik Lundh 1.5.2 ! modulefinder Thomas Heller, Just van Rossum ! 2.2 --- 76,91 ---- Backward Compatible Packages, Modules, and Tools ! Package/Module Maintainer(s) Python Version Notes ! -------------- ------------- -------------- ----- bsddb Barry Warsaw 2.1 compiler Jeremy Hylton 2.1 distutils Andrew Kuchling 1.5.2 ! email Barry Warsaw 2.1 / 2.3 [1] logging Vinay Sajip 1.5.2 sre Fredrik Lundh 2.1 xml (PyXML) Martin v. Loewis 2.0 xmlrpclib Fredrik Lundh 1.5.2 ! modulefinder Thomas Heller ! Just van Rossum 2.2 *************** *** 84,87 **** --- 93,105 ---- ---- ------------- -------------- None + + + Notes + ----- + + [1] The email package version 2 was distributed with Python up to + Python 2.3, and this must remain Python 2.1 compatible. email + package version 3 will be distributed with Python 2.4 and will + need to remain compatible only with Python 2.3. From bwarsaw at users.sourceforge.net Thu Dec 4 10:16:02 2003 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Thu Dec 4 10:16:13 2003 Subject: [Python-checkins] python/nondist/peps pep-0291.txt,1.7,1.8 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv30420 Modified Files: pep-0291.txt Log Message: Greg's really the maintainer of bsddb, I just back him up. Index: pep-0291.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0291.txt,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pep-0291.txt 4 Dec 2003 15:12:55 -0000 1.7 --- pep-0291.txt 4 Dec 2003 15:16:00 -0000 1.8 *************** *** 78,82 **** Package/Module Maintainer(s) Python Version Notes -------------- ------------- -------------- ----- ! bsddb Barry Warsaw 2.1 compiler Jeremy Hylton 2.1 distutils Andrew Kuchling 1.5.2 --- 78,83 ---- Package/Module Maintainer(s) Python Version Notes -------------- ------------- -------------- ----- ! bsddb Greg Smith 2.1 ! Barry Warsaw compiler Jeremy Hylton 2.1 distutils Andrew Kuchling 1.5.2 *************** *** 86,91 **** xml (PyXML) Martin v. Loewis 2.0 xmlrpclib Fredrik Lundh 1.5.2 ! modulefinder Thomas Heller ! Just van Rossum 2.2 --- 87,92 ---- xml (PyXML) Martin v. Loewis 2.0 xmlrpclib Fredrik Lundh 1.5.2 ! modulefinder Thomas Heller 2.2 ! Just van Rossum From fdrake at users.sourceforge.net Thu Dec 4 13:27:26 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 4 13:27:34 2003 Subject: [Python-checkins] python/dist/src/Doc Makefile, 1.261.4.9, 1.261.4.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv4358 Modified Files: Tag: release23-maint Makefile Log Message: Bump some version numbers. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.261.4.9 retrieving revision 1.261.4.10 diff -C2 -d -r1.261.4.9 -r1.261.4.10 *** Makefile 30 Sep 2003 16:22:28 -0000 1.261.4.9 --- Makefile 4 Dec 2003 18:27:24 -0000 1.261.4.10 *************** *** 67,71 **** # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.3.2 PYTHON= python --- 67,71 ---- # This is the *documentation* release, and is used to construct the file # names of the downloadable tarballs. ! RELEASE=2.3.3c1 PYTHON= python From fdrake at users.sourceforge.net Thu Dec 4 13:27:27 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 4 13:27:36 2003 Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.1.2.2, 1.1.2.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1:/tmp/cvs-serv4358/commontex Modified Files: Tag: release23-maint boilerplate.tex Log Message: Bump some version numbers. Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** boilerplate.tex 30 Sep 2003 16:22:28 -0000 1.1.2.2 --- boilerplate.tex 4 Dec 2003 18:27:24 -0000 1.1.2.3 *************** *** 6,11 **** } ! \date{October 3, 2003} % XXX update before final release! ! \release{2.3.2} % software release, not documentation ! \setreleaseinfo{} % empty for final release \setshortversion{2.3} % major.minor only for software --- 6,11 ---- } ! \date{\today} % XXX update before final release! ! \release{2.3.3} % software release, not documentation ! \setreleaseinfo{c1} % empty for final release \setshortversion{2.3} % major.minor only for software From bcannon at users.sourceforge.net Thu Dec 4 14:28:08 2003 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Thu Dec 4 14:28:17 2003 Subject: [Python-checkins] python/dist/src/Lib gzip.py,1.38,1.39 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv18388/Lib Modified Files: gzip.py Log Message: Fix error in exception message. Index: gzip.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/gzip.py,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** gzip.py 5 Feb 2003 21:35:07 -0000 1.38 --- gzip.py 4 Dec 2003 19:28:06 -0000 1.39 *************** *** 206,210 **** if self.mode != READ: import errno ! raise IOError(errno.EBADF, "write() on read-only GzipFile object") if self.extrasize <= 0 and self.fileobj is None: --- 206,210 ---- if self.mode != READ: import errno ! raise IOError(errno.EBADF, "read() on write-only GzipFile object") if self.extrasize <= 0 and self.fileobj is None: From rhettinger at users.sourceforge.net Thu Dec 4 15:04:12 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 4 15:04:16 2003 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.24,1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv26926 Modified Files: UserDict.py Log Message: SF bug #849662. Dramatically, improve comparison speed for "if shl == None". Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** UserDict.py 6 Mar 2003 23:54:27 -0000 1.24 --- UserDict.py 4 Dec 2003 20:04:09 -0000 1.25 *************** *** 156,159 **** --- 156,161 ---- return repr(dict(self.iteritems())) def __cmp__(self, other): + if other is None: + return 1 if isinstance(other, DictMixin): other = dict(other.iteritems()) From theller at users.sourceforge.net Thu Dec 4 15:25:13 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:25:16 2003 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.6, 2.74.4.7 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv32626 Modified Files: Tag: release23-maint patchlevel.h Log Message: Version numbers for Python 2.3.3c1. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.6 retrieving revision 2.74.4.7 diff -C2 -d -r2.74.4.6 -r2.74.4.7 *** patchlevel.h 14 Nov 2003 18:33:13 -0000 2.74.4.6 --- patchlevel.h 4 Dec 2003 20:25:10 -0000 2.74.4.7 *************** *** 23,31 **** #define PY_MINOR_VERSION 3 #define PY_MICRO_VERSION 3 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA ! #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.3.3a0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,31 ---- #define PY_MINOR_VERSION 3 #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.3.3c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From theller at users.sourceforge.net Thu Dec 4 15:34:03 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:34:08 2003 Subject: [Python-checkins] python/dist/src README,1.177.4.6,1.177.4.7 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv1786 Modified Files: Tag: release23-maint README Log Message: Version numbers for Python 2.3.3c1. PEP 101 is unclear about the exact version number in the README file ;-( Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/README,v retrieving revision 1.177.4.6 retrieving revision 1.177.4.7 diff -C2 -d -r1.177.4.6 -r1.177.4.7 *** README 1 Oct 2003 07:25:31 -0000 1.177.4.6 --- README 4 Dec 2003 20:33:58 -0000 1.177.4.7 *************** *** 1,3 **** ! This is Python version 2.3.2 ============================ --- 1,3 ---- ! This is Python version 2.3.3 ============================ From theller at users.sourceforge.net Thu Dec 4 15:35:06 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:35:09 2003 Subject: [Python-checkins] python/dist/src LICENSE,1.26.8.2,1.26.8.3 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv1990 Modified Files: Tag: release23-maint LICENSE Log Message: Version numbers for Python 2.3.3. Index: LICENSE =================================================================== RCS file: /cvsroot/python/python/dist/src/LICENSE,v retrieving revision 1.26.8.2 retrieving revision 1.26.8.3 diff -C2 -d -r1.26.8.2 -r1.26.8.3 *** LICENSE 30 Sep 2003 07:10:25 -0000 1.26.8.2 --- LICENSE 4 Dec 2003 20:35:03 -0000 1.26.8.3 *************** *** 46,49 **** --- 46,50 ---- 2.3.1 2.3 2002-2003 PSF yes 2.3.2 2.3.1 2002-2003 PSF yes + 2.3.3 2.3.2 2002-2003 PSF yes Footnotes: From theller at users.sourceforge.net Thu Dec 4 15:36:01 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:36:04 2003 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt, 1.51.4.3, 1.51.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv2213 Modified Files: Tag: release23-maint BUILDno.txt Log Message: The Windows build number for 2.3.3c1 is 50. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.51.4.3 retrieving revision 1.51.4.4 diff -C2 -d -r1.51.4.3 -r1.51.4.4 *** BUILDno.txt 1 Oct 2003 17:35:07 -0000 1.51.4.3 --- BUILDno.txt 4 Dec 2003 20:35:58 -0000 1.51.4.4 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 50 2.3.3c1 + 5-Dec-2003 49 2.3.2 (final) 3-Oct-2003 From theller at users.sourceforge.net Thu Dec 4 15:36:55 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:36:59 2003 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.54,1.55 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv2554 Modified Files: BUILDno.txt Log Message: The Windows build number for 2.3.3c1 is 50. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** BUILDno.txt 1 Oct 2003 17:36:45 -0000 1.54 --- BUILDno.txt 4 Dec 2003 20:36:53 -0000 1.55 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 50 2.3.3c1 + 5-Dec-2003 49 2.3.2 (final) 3-Oct-2003 From theller at users.sourceforge.net Thu Dec 4 15:42:01 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:42:04 2003 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp, 1.48.4.3, 1.48.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv3790 Modified Files: Tag: release23-maint pythoncore.dsp Log Message: The Windows build number for 2.3.3c1 is 50. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.48.4.3 retrieving revision 1.48.4.4 diff -C2 -d -r1.48.4.3 -r1.48.4.4 *** pythoncore.dsp 1 Oct 2003 17:35:07 -0000 1.48.4.3 --- pythoncore.dsp 4 Dec 2003 20:41:59 -0000 1.48.4.4 *************** *** 259,263 **** SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=49 # End Source File # Begin Source File --- 259,263 ---- SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=50 # End Source File # Begin Source File From theller at users.sourceforge.net Thu Dec 4 15:43:20 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:43:22 2003 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse, 1.133.4.5, 1.133.4.6 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv4103 Modified Files: Tag: release23-maint python20.wse Log Message: Version number and filename changes for the wise installer. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.133.4.5 retrieving revision 1.133.4.6 diff -C2 -d -r1.133.4.5 -r1.133.4.6 *** python20.wse 14 Nov 2003 19:07:21 -0000 1.133.4.5 --- python20.wse 4 Dec 2003 20:43:18 -0000 1.133.4.6 *************** *** 2,6 **** item: Global Version=9.0 ! Title=Python 2.3.3a0 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=9.0 ! Title=Python 2.3.3c1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 21,27 **** MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.3a0.exe Dialogs Version=8 ! Version File=2.3.3a0 Version Description=Python Programming Language Version Copyright=©2001-2003 Python Software Foundation --- 21,27 ---- MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.3c1.exe Dialogs Version=8 ! Version File=2.3.3c1 Version Description=Python Programming Language Version Copyright=©2001-2003 Python Software Foundation *************** *** 77,81 **** item: Set Variable Variable=PYVER_STRING ! Value=2.3.3a0 end item: Remark --- 77,81 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.3.3c1 end item: Remark From theller at users.sourceforge.net Thu Dec 4 15:44:30 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:44:33 2003 Subject: [Python-checkins] python/dist/src/Lib/idlelib idlever.py, 1.15.4.1, 1.15.4.2 NEWS.txt, 1.23.4.3, 1.23.4.4 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/idlelib In directory sc8-pr-cvs1:/tmp/cvs-serv4394 Modified Files: Tag: release23-maint idlever.py NEWS.txt Log Message: Version number and release date for IDLE, the version now is 1.0.2. Index: idlever.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/idlever.py,v retrieving revision 1.15.4.1 retrieving revision 1.15.4.2 diff -C2 -d -r1.15.4.1 -r1.15.4.2 *** idlever.py 24 Nov 2003 02:34:01 -0000 1.15.4.1 --- idlever.py 4 Dec 2003 20:44:28 -0000 1.15.4.2 *************** *** 1 **** ! IDLE_VERSION = "1.0.1+" --- 1 ---- ! IDLE_VERSION = "1.0.2" Index: NEWS.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v retrieving revision 1.23.4.3 retrieving revision 1.23.4.4 diff -C2 -d -r1.23.4.3 -r1.23.4.4 *** NEWS.txt 24 Nov 2003 02:34:01 -0000 1.23.4.3 --- NEWS.txt 4 Dec 2003 20:44:28 -0000 1.23.4.4 *************** *** 2,6 **** =================================== ! *Release date: XX-Dec-2003* - After an exception, run.py was not setting the exception vector. Noam --- 2,6 ---- =================================== ! *Release date: 05-Dec-2003* - After an exception, run.py was not setting the exception vector. Noam From theller at users.sourceforge.net Thu Dec 4 15:45:54 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 15:46:02 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.81,1.831.4.82 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv4672 Modified Files: Tag: release23-maint NEWS Log Message: Release date for 2.3.3c1. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.81 retrieving revision 1.831.4.82 diff -C2 -d -r1.831.4.81 -r1.831.4.82 *** NEWS 1 Dec 2003 22:13:11 -0000 1.831.4.81 --- NEWS 4 Dec 2003 20:45:50 -0000 1.831.4.82 *************** *** 8,12 **** =================================== ! *Release date: XXX * Core and builtins --- 8,12 ---- =================================== ! *Release date: 05-Dec-2003* Core and builtins From theller at users.sourceforge.net Thu Dec 4 16:07:59 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 4 16:08:02 2003 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.24,1.24.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv10333 Modified Files: Tag: release23-maint UserDict.py Log Message: Backported from the trunk, on Raymond's request: SF bug #849662. Dramatically, improve comparison speed for "if shl == None". Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.24 retrieving revision 1.24.10.1 diff -C2 -d -r1.24 -r1.24.10.1 *** UserDict.py 6 Mar 2003 23:54:27 -0000 1.24 --- UserDict.py 4 Dec 2003 21:07:57 -0000 1.24.10.1 *************** *** 156,159 **** --- 156,161 ---- return repr(dict(self.iteritems())) def __cmp__(self, other): + if other is None: + return 1 if isinstance(other, DictMixin): other = dict(other.iteritems()) From rhettinger at users.sourceforge.net Thu Dec 4 16:30:07 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 4 16:30:16 2003 Subject: [Python-checkins] python/dist/src/Doc/tut glossary.tex, NONE, 1.5.2.1 tut.tex, 1.196.8.9, 1.196.8.10 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv14962 Modified Files: Tag: release23-maint tut.tex Added Files: Tag: release23-maint glossary.tex Log Message: Backport library tour, glossary, and small fixups to the tutorial. --- NEW FILE: glossary.tex --- \chapter{Glossary\label{glossary}} %%% keep the entries sorted and include at least one \index{} item for each %%% cross-references are marked with \emph{entry} \begin{description} \index{>>>} \item[\code{>\code{>}>}] The typical Python prompt of the interactive shell. Often seen for code examples that can be tried right away in the interpreter. \index{...} \item[\code{.\code{.}.}] The typical Python prompt of the interactive shell when entering code for an indented code block. \index{BDFL} \item[BDFL] Benevolent Dictator For Life, a.k.a. \ulink{Guido van Rossum}{http://www.python.org/\textasciitilde{}guido/}, Python's creator. \index{byte code} \item[byte code] The internal representation of a Python program in the interpreter. The byte code is also cached in the \code{.pyc} and \code{.pyo} files so that executing the same file is faster the second time (compilation from source to byte code can be saved). This ``intermediate language'' is said to run on a ``virtual machine'' that calls the subroutines corresponding to each bytecode. \index{classic class} \item[classic class] Any class which does not inherit from \class{object}. See \emph{new-style class}. \index{coercion} \item[coercion] Converting data from one type to another. For example, {}\code{int(3.15)} coerces the floating point number to the integer, {}\code{3}. Most mathematical operations have rules for coercing their arguments to a common type. For instance, adding \code{3+4.5}, causes the integer \code{3} to be coerced to be a float {}\code{3.0} before adding to \code{4.5} resulting in the float {}\code{7.5}. \index{descriptor} \item[descriptor] Any \emph{new-style} object that defines the methods {}\method{__get__()}, \method{__set__()}, or \method{__delete__()}. When a class attribute is a descriptor, its special binding behavior is triggered upon attribute lookup. Normally, writing \var{a.b} looks up the object \var{b} in the class dictionary for \var{a}, but if {}\var{b} is a descriptor, the defined method gets called. Understanding descriptors is a key to a deep understanding of Python because they are the basis for many features including functions, methods, properties, class methods, static methods, and reference to super classes. \index{dictionary} \item[dictionary] An associative array, where arbitrary keys are mapped to values. The use of \class{dict} much resembles that for \class{list}, but the keys can be any object with a \method{__hash__()} function, not just integers starting from zero. Called a hash in Perl. \index{EAFP} \item[EAFP] Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many \keyword{try} and {}\keyword{except} statements. The technique contrasts with the {}\emph{LBYL} style that is common in many other languages such as C. \index{__future__} \item[__future__] A pseudo module which programmers can use to enable new language features which are not compatible with the current interpreter. For example, the expression \code{11/4} currently evaluates to \code{2}. If the module in which it is executed had enabled \emph{true division} by executing: \begin{verbatim} from __future__ import division \end{verbatim} the expression \code{11/4} would evaluate to \code{2.75}. By actually importing the \ulink{\module{__future__}}{../lib/module-future.html} module and evaluating its variables, you can see when a new feature was first added to the language and when it will become the default: \begin{verbatim} >>> import __future__ >>> __future__.division _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) \end{verbatim} \index{generator} \item[generator] A function that returns an iterator. It looks like a normal function except that the \keyword{yield} keyword is used instead of {}\keyword{return}. Generator functions often contain one or more {}\keyword{for} or \keyword{while} loops that \keyword{yield} elements back to the caller. The function execution is stopped at the {}\keyword{yield} keyword (returning the result) and is resumed there when the next element is requested by calling the \method{next()} method of the returned iterator. \index{GIL} \item[GIL] See \emph{global interpreter lock}. \index{global interpreter lock} \item[global interpreter lock] The lock used by Python threads to assure that only one thread can be run at a time. This simplifies Python by assuring that no two processes can access the same memory at the same time. Locking the entire interpreter makes it easier for the interpreter to be multi-threaded, at the expense of some parallelism on multi-processor machines. Efforts have been made in the past to create a ``free-threaded'' interpreter (one which locks shared data at a much finer granularity), but performance suffered in the common single-processor case. \index{IDLE} \item[IDLE] An Integrated Development Environment for Python. IDLE is a basic editor and interpreter environment that ships with the standard distribution of Python. Good for beginners, it also serves as clear example code for those wanting to implement a moderately sophisticated, multi-platform GUI application. \index{immutable} \item[immutable] A object with fixed value. Immutable objects are numbers, strings or tuples (and more). Such an object cannot be altered. A new object has to be created if a different value has to be stored. They play an important role in places where a constant hash value is needed. For example as a key in a dictionary. \index{integer division} \item[integer division] Mathematical division discarding any remainder. For example, the expression \code{11/4} currently evaluates to \code{2} in contrast to the \code{2.75} returned by float division. Also called {}\emph{floor division}. When dividing two integers the outcome will always be another integer (having the floor function applied to it). However, if one of the operands is another numeric type (such as a {}\class{float}), the result will be coerced (see \emph{coercion}) to a common type. For example, a integer divided by a float will result in a float value, possibly with a decimal fraction. Integer division can be forced by using the \code{//} operator instead of the \code{/} operator. See also \emph{__future__}. \index{interactive} \item[interactive] Python has an interactive interpreter which means that you can try out things and directly see its result. Just launch \code{python} with no arguments (possibly by selecting it from your computer's main menu). It is a very powerful way to test out new ideas or inspect modules and packages (remember \code{help(x)}). \index{interpreted} \item[interpreted] Python is an interpreted language, opposed to a compiled one. This means that the source files can be run right away without first making an executable which is then run. Interpreted languages typically have a shorter development/debug cycle than compiled ones. See also {}\emph{interactive}. \index{iterable} \item[iterable] A container object capable of returning its members one at a time. Examples of iterables include all sequence types (such as \class{list}, {}\class{str}, and \class{tuple}) and some non-sequence types like {}\class{dict} and \class{file} and objects of any classes you define with an \method{__iter__()} or \method{__getitem__()} method. Iterables can be used in a \keyword{for} loop and in many other places where a sequence is needed (\function{zip()}, \function{map()}, ...). When an iterable object is passed as an argument to the builtin function {}\function{iter()}, it returns an iterator for the object. This iterator is good for one pass over the set of values. When using iterables, it is usually not necessary to call \function{iter()} or deal with iterator objects yourself. The \code{for} statement does that automatically for you, creating a temporary unnamed variable to hold the iterator for the duration of the loop. See also {}\emph{iterator}, \emph{sequence}, and \emph{generator}. \index{iterator} \item[iterator] An object representing a stream of data. Repeated calls to the iterator's \method{next()} method return successive items in the stream. When no more data is available a \exception{StopIteration} exception is raised instead. At this point, the iterator object is exhausted and any further calls to its \method{next()} method just raise \exception{StopIteration} again. Iterators are required to have an \method{__iter__()} method that returns the iterator object itself so every iterator is also iterable and may be used in most places where other iterables are accepted. One notable exception is code that attempts multiple iteration passes. A container object (such as a \class{list}) produces a fresh new iterator each time you pass it to the \function{iter()} function or use it in a {}\keyword{for} loop. Attempting this with an iterator will just return the same exhausted iterator object from the second iteration pass, making it appear like an empty container. \index{list comprehension} \item[list comprehension] A compact way to process all or a subset of elements in a sequence and return a list with the results. \code{result = ["0x\%02x" \% x for x in range(256) if x \% 2 == 0]} generates a list of strings containing hex numbers (0x..) that are even and in the range from 0 to 255. The \keyword{if} clause is optional. If omitted, all elements in {}\code{range(256)} are processed in that case. \index{mapping} \item[mapping] A container object (such as \class{dict}) that supports arbitrary key lookups using the special method \method{__getitem__()}. \index{metaclass} \item[metaclass] The class of a class. Class definitions create a class name, a class dictionary, and a list of base classes. The metaclass is responsible for taking those three arguments and creating the class. Most object oriented programming languages provide a default implementation. What makes Python special is that it is possible to create custom metaclasses. Most users never need this tool, but when the need arises, metaclasses can provide powerful, elegant solutions. They have been used for logging attribute access, adding thread-safety, tracking object creation, implementing singletons, and many other tasks. \index{LBYL} \item[LBYL] Look before you leap. This coding style explicitly tests for pre-conditions before making calls or lookups. This style contrasts with the \emph{EAFP} approach and is characterized the presence of many \keyword{if} statements. \index{mutable} \item[mutable] Mutable objects can change their value but keep their \function{id()}. See also \emph{immutable}. \index{namespace} \item[namespace] The place where a variable is stored. Namespaces are implemented as dictionary. There is the local, global and builtins namespace and the nested namespaces in objects (in methods). Namespaces support modularity by preventing naming conflicts. For instance, the functions \function{__builtin__.open()} and \function{os.open()} are distinguished by their namespaces. Namespaces also aid readability and maintainability by making it clear which modules implement a function. For instance, writing \function{random.seed()} or {}\function{itertools.izip()} makes it clear that those functions are implemented by the \ulink{\module{random}}{../lib/module-random.html} and \ulink{\module{itertools}}{../lib/module-itertools.html} modules respectively. \index{nested scope} \item[nested scope] The ability to refer to a variable in an enclosing definition. For instance, a function defined inside another function can refer to variables in the outer function. Note that nested scopes work only for reference and not for assignment which will always write to the innermost scope. In contrast, local variables both read and write in the innermost scope. Likewise, global variables read and write to the global namespace. \index{new-style class} \item[new-style class] Any class that inherits from \class{object}. This includes all built-in types like \class{list} and \class{dict}. Only new-style classes can use Python's newer, versatile features like {}\method{__slots__}, descriptors, properties, \method{__getattribute__()}, class methods, and static methods. \index{Python3000} \item[Python3000] A mythical python release, allowed not to be backward compatible, with telepathic interface. \index{__slots__} \item[__slots__] A declaration inside a \emph{new-style class} that saves memory by pre-declaring space for instance attributes and eliminating instance dictionaries. Though popular, the technique is somewhat tricky to get right and is best reserved for rare cases where there are large numbers of instances in a memory critical application. \index{sequence} \item[sequence] An \emph{iterable} which supports efficient element access using integer indices via the \method{__getitem__()} and {}\method{__len__()} special methods. Some built-in sequence types are \class{list}, \class{str}, \class{tuple}, and \class{unicode}. Note that \class{dict} also supports \method{__getitem__()} and {}\method{__len__()}, but is considered a mapping rather than a sequence because the lookups use arbitrary \emph{immutable} keys rather than integers. \index{Zen of Python} \item[Zen of Python] Listing of Python design principles and philosophies that are helpful in understanding and using the language. The listing can be found by typing ``\code{import this}'' at the interactive prompt. \end{description} Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.9 retrieving revision 1.196.8.10 diff -C2 -d -r1.196.8.9 -r1.196.8.10 *** tut.tex 3 Dec 2003 10:36:15 -0000 1.196.8.9 --- tut.tex 4 Dec 2003 21:30:04 -0000 1.196.8.10 *************** *** 12,15 **** --- 12,17 ---- \input{boilerplate} + \makeindex + \begin{document} *************** *** 1405,1410 **** while True: ok = raw_input(prompt) ! if ok in ('y', 'ye', 'yes'): return 1 ! if ok in ('n', 'no', 'nop', 'nope'): return 0 retries = retries - 1 if retries < 0: raise IOError, 'refusenik user' --- 1407,1412 ---- while True: ok = raw_input(prompt) ! if ok in ('y', 'ye', 'yes'): return True ! if ok in ('n', 'no', 'nop', 'nope'): return False retries = retries - 1 if retries < 0: raise IOError, 'refusenik user' *************** *** 2112,2120 **** When looping through dictionaries, the key and corresponding value can ! be retrieved at the same time using the \method{items()} method. \begin{verbatim} >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} ! >>> for k, v in knights.items(): ... print k, v ... --- 2114,2122 ---- When looping through dictionaries, the key and corresponding value can ! be retrieved at the same time using the \method{iteritems()} method. \begin{verbatim} >>> knights = {'gallahad': 'the pure', 'robin': 'the brave'} ! >>> for k, v in knights.iteritems(): ... print k, v ... *************** *** 3897,3901 **** \section{Random Remarks \label{remarks}} ! [These should perhaps be placed more carefully...] --- 3899,3903 ---- \section{Random Remarks \label{remarks}} ! % [These should perhaps be placed more carefully...] *************** *** 4297,4305 **** \begin{verbatim} >>> def reverse(data): ! for index in range(len(data)-1, -1, -1): ! yield data[index] >>> for char in reverse('golf'): ! print char f --- 4299,4307 ---- \begin{verbatim} >>> def reverse(data): ! for index in range(len(data)-1, -1, -1): ! yield data[index] >>> for char in reverse('golf'): ! print char f *************** *** 4325,4328 **** --- 4327,4647 ---- + + \chapter{Brief Tour of the Standard Library \label{briefTour}} + + + \section{Operating System Interface\label{os-interface}} + + The \ulink{\module{os}}{../lib/module-os.html} + module provides dozens of functions for interacting with the + operating system: + + \begin{verbatim} + >>> import os + >>> os.system('copy /data/mydata.fil /backup/mydata.fil') + 0 + >>> os.getcwd() # Return the current working directory + 'C:\\Python24' + >>> os.chdir('/server/accesslogs') + \end{verbatim} + + Be sure to use the \samp{import os} style instead of + \samp{from os import *}. This will keep \function{os.open()} from + shadowing the builtin \function{open()} function which operates much + differently. + + The builtin \function{dir()} and \function{help()} functions are useful + as interactive aids for working with large modules like \module{os}: + + \begin{verbatim} + >>> import os + >>> dir(os) + + >>> help(os) + + \end{verbatim} + + For daily file and directory management tasks, the + \ulink{\module{shutil}}{../lib/module-shutil.html} + module provides a higher level interface that is easier to use: + + \begin{verbatim} + >>> import shutil + >>> shutil.copyfile('data.db', 'archive.db') + >>> shutil.move('/build/excecutables', 'installdir') + \end{verbatim} + + + \section{File Wildcards\label{file-wildcards}} + + The \ulink{\module{glob}}{../lib/module-glob.html} + module provides a function for making file lists from directory + wildcard searches: + + \begin{verbatim} + >>> import glob + >>> glob.glob('*.py') + ['primes.py', 'random.py', 'quote.py'] + \end{verbatim} + + + \section{Command Line Arguments\label{command-line-arguments}} + + Common utility scripts often invoke processing command line arguments. + These arguments are stored in the + \ulink{\module{sys}}{../lib/module-sys.html}\ module's \var{argv} + attribute as a list. For instance the following output results from + running \samp{python demo.py one two three} at the command line: + + \begin{verbatim} + >>> import sys + >>> print sys.argv[] + ['demo.py', 'one', 'two', 'three'] + \end{verbatim} + + The \ulink{\module{getopt}}{../lib/module-getopt.html} + module processes \var{sys.argv} using the conventions of the \UNIX{} + \function{getopt()} function. More powerful and flexible command line + processing is provided by the + \ulink{\module{optparse}}{../lib/module-optparse.html} module. + + + \section{Error Output Redirection and Program Termination\label{stderr}} + + The \ulink{\module{sys}}{../lib/module-sys.html} + module also has attributes for \var{stdin}, \var{stdout}, and + \var{stderr}. The latter is useful for emitting warnings and error + messages to make them visible even when \var{stdout} has been redirected: + + \begin{verbatim} + >>> sys.stderr.write('Warning, log file not found starting a new one') + Warning, log file not found starting a new one + \end{verbatim} + + The most direct way to terminate a script is to use \samp{sys.exit()}. + + + \section{String Pattern Matching\label{string-pattern-matching}} + + The \ulink{\module{re}}{../lib/module-re.html} + module provides regular expression tools for advanced string processing. + When only simple capabilities are needed, string methods are preferred + because they are easier to read and debug. However, for more + sophisticated applications, regular expressions can provide succinct, + optimized solutions: + + \begin{verbatim} + >>> import re + >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') + ['foot', 'fell', 'fastest'] + >>> re.sub(r'(\b[a-z]+) \1', r'\1', 'cat in the the hat') + 'cat in the hat' + \end{verbatim} + + + \section{Mathematics\label{mathematics}} + + The \ulink{\module{math}}{../lib/module-math.html} math module gives + access to the underlying C library functions for floating point math: + + \begin{verbatim} + >>> import math + >>> math.cos(math.pi / 4.0) + 0.70710678118654757 + >>> math.log(1024, 2) + 10.0 + \end{verbatim} + + The \ulink{\module{random}}{../lib/module-random.html} + module provides tools for making random selections: + + \begin{verbatim} + >>> import random + >>> random.choice(['apple', 'pear', 'banana']) + 'apple' + >>> random.sample(xrange(100), 10) # sampling without replacement + [30, 83, 16, 4, 8, 81, 41, 50, 18, 33] + >>> random.random() # random float + 0.17970987693706186 + >>> random.randrange(6) # random integer chosen from range(6) + 4 + \end{verbatim} + + + \section{Internet Access\label{internet-access}} + + There are a number of modules for accessing the internet and processing + internet protocols. Two of the simplest are + \ulink{\module{urllib2}}{../lib/module-urllib2.html} + for retrieving data from urls and + \ulink{\module{smtplib}}{../lib/module-smtplib.html} + for sending mail: + + \begin{verbatim} + >>> import urllib2 + >>> for line in urllib2.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl'): + ... if 'EST' in line: # look for Eastern Standard Time + ... print line + +
Nov. 25, 09:43:32 PM EST + + >>> import smtplib + >>> server = smtplib.SMTP('localhost') + >>> server.sendmail('soothsayer@tmp.org', 'jceasar@tmp.org', + """To: jceasar@tmp.org + From: soothsayer@tmp.org + + Beware the Ides of March. + """) + >>> server.quit() + \end{verbatim} + + + \section{Dates and Times\label{dates-and-times}} + + The \ulink{\module{datetime}}{../lib/module-datetime.html} module + supplies classes for manipulating dates and times in both simple + and complex ways. While date and time arithmetic is supported, the + focus of the implementation is on efficient member extraction for + output formatting and manipulation. The module also supports objects + that are time zone aware. + + \begin{verbatim} + # dates are easily constructed and formatted + >>> from datetime import date + >>> now = date.today() + >>> now + datetime.date(2003, 12, 2) + >>> now.strftime("%m-%d-%y or %d%b %Y is a %A on the %d day of %B") + '12-02-03 or 02Dec 2003 is a Tuesday on the 02 day of December' + + # dates support calendar arithmetic + >>> birthday = date(1964, 7, 31) + >>> age = now - birthday + >>> age.days + 14368 + \end{verbatim} + + + \section{Data Compression\label{data-compression}} + + Common data archiving and compression formats are directly supported + by modules including: \module{zlib}, \module{gzip}, \module{bz2}, + \module{zipfile}, and \module{tar}. + + \begin{verbatim} + >>> import zlib + >>> s = 'witch which has which witches wrist watch' + >>> len(s) + 41 + >>> t = zlib.compress(s) + >>> len(t) + 37 + >>> zlib.decompress(t) + 'witch which has which witches wrist watch' + >>> zlib.crc32(t) + -1438085031 + \end{verbatim} + + + \section{Performance Measurement\label{performance-measurement}} + + Some Python users develop a deep interest in knowing the relative + performance between different approaches to the same problem. + Python provides a measurement tool that answers those questions + immediately. + + For example, it may be tempting to use the tuple packing and unpacking + feature instead of the traditional approach to swapping arguments. + The \ulink{\module{timeit}}{../lib/module-timeit.html} module + quickly demonstrates that the traditional approach is faster: + + \begin{verbatim} + >>> from timeit import Timer + >>> dir(Timer) + >>> Timer('t=a; a=b; b=t', 'a=1; b=1').timeit() + 0.60864915603680925 + >>> Timer('a,b = b,a', 'a=1; b=1').timeit() + 0.8625194857439773 + \end{verbatim} + + In contrast to \module{timeit}'s fine level of granularity, the + \ulink{\module{profile}}{../lib/module-profile.html} and \module{pstats} + modules provide tools for identifying time critical sections in larger + blocks of code. + + + \section{Quality Control\label{quality-control}} + + One approach for developing high quality software is to write tests for + each function as it is developed and to run those tests frequently during + the development process. + + The \ulink{\module{doctest}}{../lib/module-doctest.html} module provides + a tool for scanning a module and validating tests embedded in a program's + docstrings. Test construction is as simple as cutting-and-pasting a + typical call along with its results into the docstring. This improves + the documentation by providing the user with an example and it allows the + doctest module to make sure the code remains true to the documentation: + + \begin{verbatim} + def average(values): + """Computes the arithmetic mean of a list of numbers. + + >>> print average([20, 30, 70]) + 40.0 + """ + return sum(values, 0.0) / len(values) + + import doctest + doctest.testmod() # automatically validate the embedded tests + \end{verbatim} + + The \ulink{\module{unittest}}{../lib/module-unittest.html} module is not + as effortless as the \module{doctest} module, but it allows a more + comprehensive set of tests to be maintained in a separate file: + + \begin{verbatim} + import unittest + + class TestStatisticalFunctions(unittest.TestCase): + + def test_average(self): + self.assertEqual(average([20, 30, 70]), 40.0) + self.assertEqual(round(average([1, 5, 7]), 1), 4.3) + self.assertRaises(ZeroDivisionError, average, []) + self.assertRaises(TypeError, average, 20, 30, 70) + + unittest.main() # Calling from the command line invokes all tests + \end{verbatim} + + \section{Batteries Included\label{batteries-included}} + + Python has a ``batteries included'' philosophy. The is best seen + through the sophisticated and robust capabilites of its larger + packages. For example: + + * The \module{xmlrpclib} and \module{SimpleXMLRPCServer} modules make + implementing remote procedure calls into an almost trivial task. + Despite the names, no direct knowledge or handling of XML is needed. + + * The \module{email} package is a library for managing email messages, + including MIME and other RFC 2822-based message documents. Unlike + \module{smtplib} and \module{poplib} which actually send and receive + messages, the email package has a complete toolset for building or + decoding complex message structures (including attachments) + and for implementing internet encoding and header protocols. + + * The \module{xml.dom} and \module{xml.sax} packages provide robust + support for parsing this popular data interchange format. Likewise, + the \module{csv} module supports direct reads and writes in a common + database format. Together, these modules and packages greatly simplify + data interchange between python applications and other tools. + + * Internationalization is supported by a number of modules including + \module{gettext}, \module{locale}, and the \module{codecs} package. + + + \chapter{What Now? \label{whatNow}} *************** *** 4804,4807 **** --- 5123,5130 ---- \chapter{History and License} \input{license} + + \input{glossary} + + \input{tut.ind} \end{document} From rhettinger at users.sourceforge.net Thu Dec 4 16:42:37 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 4 16:42:41 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.82,1.831.4.83 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv17625 Modified Files: Tag: release23-maint NEWS Log Message: Add newsitem for a bugfix backport. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.82 retrieving revision 1.831.4.83 diff -C2 -d -r1.831.4.82 -r1.831.4.83 *** NEWS 4 Dec 2003 20:45:50 -0000 1.831.4.82 --- NEWS 4 Dec 2003 21:42:31 -0000 1.831.4.83 *************** *** 76,79 **** --- 76,82 ---- ------- + - Bug #849662: UserDict.DictMixin had performance issues when + an instance was tested for equality with None. + - Bug #848614: distutils' msvccompiler fails to find the MSVC6 compiler because of incomplete registry entries. From rhettinger at users.sourceforge.net Thu Dec 4 17:17:51 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Thu Dec 4 17:17:55 2003 Subject: [Python-checkins] python/dist/src/Modules operator.c,2.28,2.29 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv26663 Modified Files: operator.c Log Message: Fix typos. Index: operator.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/operator.c,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** operator.c 1 Dec 2003 13:18:39 -0000 2.28 --- operator.c 4 Dec 2003 22:17:49 -0000 2.29 *************** *** 318,322 **** PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "itertools.itemgetter", /* tp_name */ sizeof(itemgetterobject), /* tp_basicsize */ 0, /* tp_itemsize */ --- 318,322 ---- PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "operator.itemgetter", /* tp_name */ sizeof(itemgetterobject), /* tp_basicsize */ 0, /* tp_itemsize */ *************** *** 425,429 **** PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "itertools.attrgetter", /* tp_name */ sizeof(attrgetterobject), /* tp_basicsize */ 0, /* tp_itemsize */ --- 425,429 ---- PyObject_HEAD_INIT(NULL) 0, /* ob_size */ ! "operator.attrgetter", /* tp_name */ sizeof(attrgetterobject), /* tp_basicsize */ 0, /* tp_itemsize */ From kbk at users.sourceforge.net Thu Dec 4 19:45:16 2003 From: kbk at users.sourceforge.net (kbk@users.sourceforge.net) Date: Thu Dec 4 19:45:20 2003 Subject: [Python-checkins] python/nondist/peps pep-0101.txt, 1.47, 1.48 pep-0102.txt, 1.18, 1.19 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27312 Modified Files: pep-0101.txt pep-0102.txt Log Message: Add IDLE tasks. Modified Files: pep-0101.txt pep-0102.txt Index: pep-0101.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0101.txt,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** pep-0101.txt 6 Oct 2003 15:24:25 -0000 1.47 --- pep-0101.txt 5 Dec 2003 00:45:13 -0000 1.48 *************** *** 96,99 **** --- 96,102 ---- new" entries from Misc/NEWS to Misc/HISTORY. + ___ Check with the IDLE maintainer to be sure that + Lib/idlelib/NEWS.txt has been similarly updated. + ___ Tag and/or branch the tree for release X.YaZ *************** *** 139,142 **** --- 142,151 ---- to change the PY_VERSION macro, and one or several of the version subpart macros just above PY_VERSION, as appropriate. + + ___ IDLE maintains its own versioning and NEWS file (Lib/idlelib/NEWS.txt). + There should be a number of entries reflecting new development, under a + temporary header. Update that header to reflect IDLE's new version and + release date. Then update Lib/idlelib/idlever.py to show a matching + version. ___ Change the "%define version" line of Misc/RPM/python-2.3.spec to Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** pep-0102.txt 16 Oct 2003 19:13:48 -0000 1.18 --- pep-0102.txt 5 Dec 2003 00:45:14 -0000 1.19 *************** *** 138,141 **** --- 138,145 ---- to forget to update the release date in this file! + ___ Check in any changes to IDLE's NEWS.txt. Update the header in + Lib/idlelib/NEWS.txt to reflect its release version and date. + Update the IDLE version in Lib/idlelib/idlever.py to match. + ___ Once the release process has started, the documentation needs to be built and posted on python.org according to the instructions From anthonybaxter at users.sourceforge.net Thu Dec 4 23:30:12 2003 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu Dec 4 23:30:17 2003 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.4, 1.2.12.5 Message-ID: Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1:/tmp/cvs-serv30263 Modified Files: Tag: release23-maint python-2.3.spec Log Message: 2.3.3c1 Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.4 retrieving revision 1.2.12.5 diff -C2 -d -r1.2.12.4 -r1.2.12.5 *** python-2.3.spec 19 Oct 2003 18:34:35 -0000 1.2.12.4 --- python-2.3.spec 5 Dec 2003 04:30:10 -0000 1.2.12.5 *************** *** 31,35 **** %define name python ! %define version 2.3.2 %define libvers 2.3 %define release 1pydotorg --- 31,35 ---- %define name python ! %define version 2.3.3c1 %define libvers 2.3 %define release 1pydotorg From anthonybaxter at users.sourceforge.net Thu Dec 4 23:34:07 2003 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu Dec 4 23:34:09 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.83,1.831.4.84 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30708/Misc Modified Files: Tag: release23-maint NEWS Log Message: this wasn't on the branch. mea culpa Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.83 retrieving revision 1.831.4.84 diff -C2 -d -r1.831.4.83 -r1.831.4.84 *** NEWS 4 Dec 2003 21:42:31 -0000 1.831.4.83 --- NEWS 5 Dec 2003 04:34:04 -0000 1.831.4.84 *************** *** 6,10 **** What's New in Python 2.3.3c1? ! =================================== *Release date: 05-Dec-2003* --- 6,10 ---- What's New in Python 2.3.3c1? ! ============================= *Release date: 05-Dec-2003* *************** *** 68,75 **** - Bug #814613: INET_ADDRSTRLEN fix needed for all compilers on SGI - - - The sre module (which underlies the re module) now uses a non-recursive - algorithm for matching. A bunch of ugly REs that used to fail with a - RuntimeError will now work. See Bug #757624 Library --- 68,71 ---- From rhettinger at users.sourceforge.net Fri Dec 5 01:38:09 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 5 01:38:12 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.10, 1.196.8.11 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv15621 Modified Files: Tag: release23-maint tut.tex Log Message: Fix typo Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.10 retrieving revision 1.196.8.11 diff -C2 -d -r1.196.8.10 -r1.196.8.11 *** tut.tex 4 Dec 2003 21:30:04 -0000 1.196.8.10 --- tut.tex 5 Dec 2003 06:38:06 -0000 1.196.8.11 *************** *** 4396,4400 **** \begin{verbatim} >>> import sys ! >>> print sys.argv[] ['demo.py', 'one', 'two', 'three'] \end{verbatim} --- 4396,4400 ---- \begin{verbatim} >>> import sys ! >>> print sys.argv ['demo.py', 'one', 'two', 'three'] \end{verbatim} *************** *** 4442,4446 **** \section{Mathematics\label{mathematics}} ! The \ulink{\module{math}}{../lib/module-math.html} math module gives access to the underlying C library functions for floating point math: --- 4442,4446 ---- \section{Mathematics\label{mathematics}} ! The \ulink{\module{math}}{../lib/module-math.html} module gives access to the underlying C library functions for floating point math: *************** *** 4560,4566 **** >>> from timeit import Timer >>> dir(Timer) ! >>> Timer('t=a; a=b; b=t', 'a=1; b=1').timeit() 0.60864915603680925 ! >>> Timer('a,b = b,a', 'a=1; b=1').timeit() 0.8625194857439773 \end{verbatim} --- 4560,4566 ---- >>> from timeit import Timer >>> dir(Timer) ! >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.60864915603680925 ! >>> Timer('a,b = b,a', 'a=1; b=2').timeit() 0.8625194857439773 \end{verbatim} From rhettinger at users.sourceforge.net Fri Dec 5 01:39:56 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 5 01:39:59 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.216,1.217 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv15797 Modified Files: tut.tex Log Message: Fix typo Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.216 retrieving revision 1.217 diff -C2 -d -r1.216 -r1.217 *** tut.tex 3 Dec 2003 22:33:13 -0000 1.216 --- tut.tex 5 Dec 2003 06:39:54 -0000 1.217 *************** *** 4455,4459 **** \begin{verbatim} >>> import sys ! >>> print sys.argv[] ['demo.py', 'one', 'two', 'three'] \end{verbatim} --- 4455,4459 ---- \begin{verbatim} >>> import sys ! >>> print sys.argv ['demo.py', 'one', 'two', 'three'] \end{verbatim} *************** *** 4501,4505 **** \section{Mathematics\label{mathematics}} ! The \ulink{\module{math}}{../lib/module-math.html} math module gives access to the underlying C library functions for floating point math: --- 4501,4505 ---- \section{Mathematics\label{mathematics}} ! The \ulink{\module{math}}{../lib/module-math.html} module gives access to the underlying C library functions for floating point math: *************** *** 4619,4625 **** >>> from timeit import Timer >>> dir(Timer) ! >>> Timer('t=a; a=b; b=t', 'a=1; b=1').timeit() 0.60864915603680925 ! >>> Timer('a,b = b,a', 'a=1; b=1').timeit() 0.8625194857439773 \end{verbatim} --- 4619,4625 ---- >>> from timeit import Timer >>> dir(Timer) ! >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.60864915603680925 ! >>> Timer('a,b = b,a', 'a=1; b=2').timeit() 0.8625194857439773 \end{verbatim} From rhettinger at users.sourceforge.net Fri Dec 5 02:21:16 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 5 02:21:21 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.11, 1.196.8.12 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv21088 Modified Files: Tag: release23-maint tut.tex Log Message: Fix nits Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.11 retrieving revision 1.196.8.12 diff -C2 -d -r1.196.8.11 -r1.196.8.12 *** tut.tex 5 Dec 2003 06:38:06 -0000 1.196.8.11 --- tut.tex 5 Dec 2003 07:21:13 -0000 1.196.8.12 *************** *** 4357,4361 **** >>> import os >>> dir(os) ! >>> help(os) --- 4357,4361 ---- >>> import os >>> dir(os) ! >>> help(os) *************** *** 4559,4563 **** \begin{verbatim} >>> from timeit import Timer - >>> dir(Timer) >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.60864915603680925 --- 4559,4562 ---- From rhettinger at users.sourceforge.net Fri Dec 5 02:53:52 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 5 02:53:57 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.217,1.218 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv26124 Modified Files: tut.tex Log Message: Fix links and typos. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.217 retrieving revision 1.218 diff -C2 -d -r1.217 -r1.218 *** tut.tex 5 Dec 2003 06:39:54 -0000 1.217 --- tut.tex 5 Dec 2003 07:53:50 -0000 1.218 *************** *** 4416,4420 **** >>> import os >>> dir(os) ! >>> help(os) --- 4416,4420 ---- >>> import os >>> dir(os) ! >>> help(os) *************** *** 4428,4432 **** >>> import shutil >>> shutil.copyfile('data.db', 'archive.db') ! >>> shutil.move('/build/excecutables', 'installdir') \end{verbatim} --- 4428,4432 ---- >>> import shutil >>> shutil.copyfile('data.db', 'archive.db') ! >>> shutil.move('/build/executables', 'installdir') \end{verbatim} *************** *** 4586,4591 **** Common data archiving and compression formats are directly supported ! by modules including: \module{zlib}, \module{gzip}, \module{bz2}, ! \module{zipfile}, and \module{tar}. \begin{verbatim} --- 4586,4595 ---- Common data archiving and compression formats are directly supported ! by modules including: ! \ulink{\module{zlib}}{../lib/module-zlib.html}, ! \ulink{\module{gzip}}{../lib/module-gzip.html}, ! \ulink{\module{bz2}}{../lib/module-bz2.html}, ! \ulink{\module{zipfile}}{../lib/module-zipfile.html}, and ! \ulink{\module{tarfile}}{../lib/module-tarfile.html}. \begin{verbatim} *************** *** 4618,4622 **** \begin{verbatim} >>> from timeit import Timer - >>> dir(Timer) >>> Timer('t=a; a=b; b=t', 'a=1; b=2').timeit() 0.60864915603680925 --- 4622,4625 ---- *************** *** 4677,4689 **** \section{Batteries Included\label{batteries-included}} ! Python has a ``batteries included'' philosophy. The is best seen ! through the sophisticated and robust capabilites of its larger packages. For example: ! * The \module{xmlrpclib} and \module{SimpleXMLRPCServer} modules make ! implementing remote procedure calls into an almost trivial task. ! Despite the names, no direct knowledge or handling of XML is needed. ! * The \module{email} package is a library for managing email messages, including MIME and other RFC 2822-based message documents. Unlike \module{smtplib} and \module{poplib} which actually send and receive --- 4680,4694 ---- \section{Batteries Included\label{batteries-included}} ! Python has a ``batteries included'' philosophy. This is best seen ! through the sophisticated and robust capabilities of its larger packages. For example: ! * The \ulink{\module{xmlrpclib}}{../lib/module-xmlrpclib.html} and ! \ulink{\module{SimpleXMLRPCServer}}{../lib/module-SimpleXMLRPCServer.html} ! modules make implementing remote procedure calls into an almost trivial ! task. Despite the names, no direct knowledge or handling of XML is needed. ! * The \ulink{\module{email}}{../lib/module-email.html} ! package is a library for managing email messages, including MIME and other RFC 2822-based message documents. Unlike \module{smtplib} and \module{poplib} which actually send and receive *************** *** 4692,4697 **** and for implementing internet encoding and header protocols. ! * The \module{xml.dom} and \module{xml.sax} packages provide robust ! support for parsing this popular data interchange format. Likewise, the \module{csv} module supports direct reads and writes in a common database format. Together, these modules and packages greatly simplify --- 4697,4703 ---- and for implementing internet encoding and header protocols. ! * The \ulink{\module{xml.dom}}{../lib/module-xml.dom.html} and ! \ulink{\module{xml.sax}}{../lib/module-xml.sax.html} packages provide ! robust support for parsing this popular data interchange format. Likewise, the \module{csv} module supports direct reads and writes in a common database format. Together, these modules and packages greatly simplify *************** *** 4699,4703 **** * Internationalization is supported by a number of modules including ! \module{gettext}, \module{locale}, and the \module{codecs} package. --- 4705,4711 ---- * Internationalization is supported by a number of modules including ! \ulink{\module{gettext}}{../lib/module-gettext.html}, ! \ulink{\module{locale}}{../lib/module-locale.html}, and the ! \ulink{\module{codecs}}{../lib/module-codecs.html} package. From rhettinger at users.sourceforge.net Fri Dec 5 03:03:14 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 5 03:03:15 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.12, 1.196.8.13 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv27664 Modified Files: Tag: release23-maint tut.tex Log Message: Fix links and typos. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.12 retrieving revision 1.196.8.13 diff -C2 -d -r1.196.8.12 -r1.196.8.13 *** tut.tex 5 Dec 2003 07:21:13 -0000 1.196.8.12 --- tut.tex 5 Dec 2003 08:03:09 -0000 1.196.8.13 *************** *** 4369,4373 **** >>> import shutil >>> shutil.copyfile('data.db', 'archive.db') ! >>> shutil.move('/build/excecutables', 'installdir') \end{verbatim} --- 4369,4373 ---- >>> import shutil >>> shutil.copyfile('data.db', 'archive.db') ! >>> shutil.move('/build/executables', 'installdir') \end{verbatim} *************** *** 4527,4532 **** Common data archiving and compression formats are directly supported ! by modules including: \module{zlib}, \module{gzip}, \module{bz2}, ! \module{zipfile}, and \module{tar}. \begin{verbatim} --- 4527,4536 ---- Common data archiving and compression formats are directly supported ! by modules including: ! \ulink{\module{zlib}}{../lib/module-zlib.html}, ! \ulink{\module{gzip}}{../lib/module-gzip.html}, ! \ulink{\module{bz2}}{../lib/module-bz2.html}, ! \ulink{\module{zipfile}}{../lib/module-zipfile.html}, and ! \ulink{\module{tarfile}}{../lib/module-tarfile.html}. \begin{verbatim} *************** *** 4617,4629 **** \section{Batteries Included\label{batteries-included}} ! Python has a ``batteries included'' philosophy. The is best seen ! through the sophisticated and robust capabilites of its larger packages. For example: ! * The \module{xmlrpclib} and \module{SimpleXMLRPCServer} modules make ! implementing remote procedure calls into an almost trivial task. ! Despite the names, no direct knowledge or handling of XML is needed. ! * The \module{email} package is a library for managing email messages, including MIME and other RFC 2822-based message documents. Unlike \module{smtplib} and \module{poplib} which actually send and receive --- 4621,4635 ---- \section{Batteries Included\label{batteries-included}} ! Python has a ``batteries included'' philosophy. This is best seen ! through the sophisticated and robust capabilities of its larger packages. For example: ! * The \ulink{\module{xmlrpclib}}{../lib/module-xmlrpclib.html} and ! \ulink{\module{SimpleXMLRPCServer}}{../lib/module-SimpleXMLRPCServer.html} ! modules make implementing remote procedure calls into an almost trivial ! task. Despite the names, no direct knowledge or handling of XML is needed. ! * The \ulink{\module{email}}{../lib/module-email.html} ! package is a library for managing email messages, including MIME and other RFC 2822-based message documents. Unlike \module{smtplib} and \module{poplib} which actually send and receive *************** *** 4632,4637 **** and for implementing internet encoding and header protocols. ! * The \module{xml.dom} and \module{xml.sax} packages provide robust ! support for parsing this popular data interchange format. Likewise, the \module{csv} module supports direct reads and writes in a common database format. Together, these modules and packages greatly simplify --- 4638,4644 ---- and for implementing internet encoding and header protocols. ! * The \ulink{\module{xml.dom}}{../lib/module-xml.dom.html} and ! \ulink{\module{xml.sax}}{../lib/module-xml.sax.html} packages provide ! robust support for parsing this popular data interchange format. Likewise, the \module{csv} module supports direct reads and writes in a common database format. Together, these modules and packages greatly simplify *************** *** 4639,4643 **** * Internationalization is supported by a number of modules including ! \module{gettext}, \module{locale}, and the \module{codecs} package. --- 4646,4652 ---- * Internationalization is supported by a number of modules including ! \ulink{\module{gettext}}{../lib/module-gettext.html}, ! \ulink{\module{locale}}{../lib/module-locale.html}, and the ! \ulink{\module{codecs}}{../lib/module-codecs.html} package. From theller at users.sourceforge.net Fri Dec 5 03:37:43 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Fri Dec 5 03:37:46 2003 Subject: [Python-checkins] python/nondist/peps pep-0102.txt,1.19,1.20 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv688 Modified Files: pep-0102.txt Log Message: Note that it isn't required any more to manually edit PC/python_nt.rc, this file is updated automatically now. I'll leave the section in in case a release of 2.2.x is done. Index: pep-0102.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0102.txt,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** pep-0102.txt 5 Dec 2003 00:45:14 -0000 1.19 --- pep-0102.txt 5 Dec 2003 08:37:41 -0000 1.20 *************** *** 94,101 **** ___ For the Windows build, additional files have to be updated. - PC/python_nt.rc sets up the DLL version resource for Windows - (displayed when you right-click on the DLL and select - Properties). - PCBuild/BUILDno.txt contains the Windows build number, see the instructions in this file how to change it. Saving the project --- 94,97 ---- *************** *** 107,110 **** --- 103,110 ---- and select Properties), and also contains the Python version number. + + (Before version 2.3.2, it was required to manually edit + PC/python_nt.rc, this step is now automated by the build + process.) ___ After starting the process, the most important thing to do next From anthonybaxter at users.sourceforge.net Fri Dec 5 07:56:24 2003 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Fri Dec 5 07:56:29 2003 Subject: [Python-checkins] python/dist/src/Doc/tools getversioninfo, NONE, 1.1.2.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv9708 Added Files: Tag: release23-maint getversioninfo Log Message: copied from the trunk. --- NEW FILE: getversioninfo --- #! /usr/bin/env python import os import re import sys try: __file__ except NameError: __file__ = sys.argv[0] tools = os.path.dirname(os.path.abspath(__file__)) Doc = os.path.dirname(tools) src = os.path.dirname(Doc) patchlevel_h = os.path.join(src, "Include", "patchlevel.h") # This won't pick out all #defines, but it will pick up the ones we # care about. rx = re.compile(r"\s*#define\s+([a-zA-Z][a-zA-Z_0-9]*)\s+([a-zA-Z_0-9]+)") d = {} f = open(patchlevel_h) for line in f: m = rx.match(line) if m is not None: name, value = m.group(1, 2) d[name] = value f.close() release = "%s.%s" % (d["PY_MAJOR_VERSION"], d["PY_MINOR_VERSION"]) micro = int(d["PY_MICRO_VERSION"]) shortversion = release if micro != 0: release += "." + str(micro) level = d["PY_RELEASE_LEVEL"] suffixes = { "PY_RELEASE_LEVEL_ALPHA": "a", "PY_RELEASE_LEVEL_BETA": "b", "PY_RELEASE_LEVEL_GAMMA": "c", } releaseinfo = "" if level != "PY_RELEASE_LEVEL_FINAL": releaseinfo = suffixes[level] + str(int(d["PY_RELEASE_SERIAL"])) def write_file(name, text): """Write text to a file if the file doesn't exist or if text differs from any existing content.""" if os.path.exists(name): f = open(name, "r") s = f.read() f.close() if s == text: return f = open(name, "w") f.write(text) f.close() patchlevel_tex = os.path.join(Doc, "commontex", "patchlevel.tex") Makefile_version = os.path.join(Doc, "Makefile.version") write_file(patchlevel_tex, "%% This file is generated by ../tools/getversioninfo;\n" "%% do not edit manually.\n" "\n" "\\release{%s}\n" "\\setreleaseinfo{%s}\n" "\\setshortversion{%s}\n" % (release, releaseinfo, shortversion)) print release + releaseinfo From fdrake at users.sourceforge.net Fri Dec 5 11:44:03 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 11:44:06 2003 Subject: [Python-checkins] python/dist/src/Doc/commontex .cvsignore, NONE, 1.1.2.1 boilerplate.tex, 1.1.2.3, 1.1.2.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1:/tmp/cvs-serv15258/commontex Modified Files: Tag: release23-maint boilerplate.tex Added Files: Tag: release23-maint .cvsignore Log Message: Anthony started backporting the changes needed to remove version numbers from the Doc/ tree; this finishes the job. Version information is now extracted from Python's Include/patchlevel.h. --- NEW FILE: .cvsignore --- patchlevel.tex Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** boilerplate.tex 4 Dec 2003 18:27:24 -0000 1.1.2.3 --- boilerplate.tex 5 Dec 2003 16:44:01 -0000 1.1.2.4 *************** *** 7,11 **** \date{\today} % XXX update before final release! ! \release{2.3.3} % software release, not documentation ! \setreleaseinfo{c1} % empty for final release ! \setshortversion{2.3} % major.minor only for software --- 7,9 ---- \date{\today} % XXX update before final release! ! \input{patchlevel} % include Python version information From fdrake at users.sourceforge.net Fri Dec 5 11:44:03 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 11:44:08 2003 Subject: [Python-checkins] python/dist/src/Doc/tools mksourcepkg, 1.6.16.1, 1.6.16.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv15258/tools Modified Files: Tag: release23-maint mksourcepkg Log Message: Anthony started backporting the changes needed to remove version numbers from the Doc/ tree; this finishes the job. Version information is now extracted from Python's Include/patchlevel.h. Index: mksourcepkg =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/mksourcepkg,v retrieving revision 1.6.16.1 retrieving revision 1.6.16.2 diff -C2 -d -r1.6.16.1 -r1.6.16.2 *** mksourcepkg 3 Oct 2003 15:20:30 -0000 1.6.16.1 --- mksourcepkg 5 Dec 2003 16:44:01 -0000 1.6.16.2 *************** *** 27,30 **** --- 27,38 ---- import cvsinfo + try: + __file__ + except NameError: + __file__ = sys.argv[0] + + tools = os.path.dirname(os.path.abspath(__file__)) + Doc = os.path.dirname(tools) + patchlevel_tex = os.path.join(Doc, "commontex", "patchlevel.tex") quiet = 0 *************** *** 106,111 **** for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'): map(shutil.rmtree, glob.glob(p)) ! for f in ('.cvsignore', '*/.cvsignore'): ! map(os.unlink, glob.glob(f)) LICENSE = os.path.normpath( os.path.join(mydir, os.pardir, os.pardir, "LICENSE")) --- 114,130 ---- for p in ('*/CVS', '*/*/CVS', '*/*/*/CVS'): map(shutil.rmtree, glob.glob(p)) ! for f in ('.cvsignore', '*/.cvsignore'): ! map(os.unlink, glob.glob(f)) ! ! # Copy in the version informtation, if we're not just going to ! # rip it back out: ! if not tools: ! if not os.path.exists(patchlevel_tex): ! run(os.path.join(here, "getversioninfo")) ! dest = os.path.join("Python-Docs-" + release, "commontex", ! "patchlevel.tex") ! shutil.copyfile(patchlevel_tex, dest) ! ! # Copy in the license file: LICENSE = os.path.normpath( os.path.join(mydir, os.pardir, os.pardir, "LICENSE")) *************** *** 115,119 **** # we don't want the actual documents in this case: for d in ("api", "dist", "doc", "ext", "inst", ! "lib", "mac", "ref", "tut"): shutil.rmtree(os.path.join(pkgdir, d)) else: --- 134,138 ---- # we don't want the actual documents in this case: for d in ("api", "dist", "doc", "ext", "inst", ! "lib", "mac", "ref", "tut", "commontex"): shutil.rmtree(os.path.join(pkgdir, d)) else: From fdrake at users.sourceforge.net Fri Dec 5 11:44:03 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 11:44:10 2003 Subject: [Python-checkins] python/dist/src/Doc Makefile, 1.261.4.10, 1.261.4.11 Makefile.deps, 1.110.8.2, 1.110.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv15258 Modified Files: Tag: release23-maint Makefile Makefile.deps Log Message: Anthony started backporting the changes needed to remove version numbers from the Doc/ tree; this finishes the job. Version information is now extracted from Python's Include/patchlevel.h. Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile,v retrieving revision 1.261.4.10 retrieving revision 1.261.4.11 diff -C2 -d -r1.261.4.10 -r1.261.4.11 *** Makefile 4 Dec 2003 18:27:24 -0000 1.261.4.10 --- Makefile 5 Dec 2003 16:44:01 -0000 1.261.4.11 *************** *** 65,71 **** TOOLSDIR= tools ! # This is the *documentation* release, and is used to construct the file ! # names of the downloadable tarballs. ! RELEASE=2.3.3c1 PYTHON= python --- 65,76 ---- TOOLSDIR= tools ! # This is the *documentation* release, and is used to construct the ! # file names of the downloadable tarballs. It is initialized by the ! # getversioninfo script to ensure that the right version number is ! # used; the script will also write commontex/patchlevel.tex if that ! # doesn't exist or needs to be changed. Documents which depend on the ! # version number should use \input{patchlevel} and include ! # commontex/patchlevel.tex in their dependencies. ! RELEASE=$(shell $(PYTHON) tools/getversioninfo) PYTHON= python Index: Makefile.deps =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/Makefile.deps,v retrieving revision 1.110.8.2 retrieving revision 1.110.8.3 diff -C2 -d -r1.110.8.2 -r1.110.8.3 *** Makefile.deps 27 Sep 2003 07:14:31 -0000 1.110.8.2 --- Makefile.deps 5 Dec 2003 16:44:01 -0000 1.110.8.3 *************** *** 8,11 **** --- 8,12 ---- COMMONTEX=commontex/copyright.tex \ commontex/license.tex \ + commontex/patchlevel.tex \ commontex/boilerplate.tex *************** *** 69,73 **** commontex/reportingbugs.tex ! TUTFILES= tut/tut.tex $(MANSTYLES) $(COMMONTEX) # LaTeX source files for the Python Reference Manual --- 70,74 ---- commontex/reportingbugs.tex ! TUTFILES= tut/tut.tex tut/glossary.tex $(MANSTYLES) $(COMMONTEX) # LaTeX source files for the Python Reference Manual From fdrake at users.sourceforge.net Fri Dec 5 12:33:58 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 12:34:04 2003 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c, 2.292.10.3, 2.292.10.4 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24200 Modified Files: Tag: release23-maint bltinmodule.c Log Message: Remove the PendingDeprecationWarning from apply(). apply() will remain deprecated in the documentation. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.292.10.3 retrieving revision 2.292.10.4 diff -C2 -d -r2.292.10.3 -r2.292.10.4 *** bltinmodule.c 25 Oct 2003 23:22:55 -0000 2.292.10.3 --- bltinmodule.c 5 Dec 2003 17:33:55 -0000 2.292.10.4 *************** *** 76,83 **** PyObject *t = NULL, *retval = NULL; - if (PyErr_Warn(PyExc_PendingDeprecationWarning, - "use func(*args, **kwargs) instead of " - "apply(func, args, kwargs)") < 0) - return NULL; if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) return NULL; --- 76,79 ---- From fdrake at users.sourceforge.net Fri Dec 5 12:34:30 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 12:34:32 2003 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.303,2.304 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24273 Modified Files: bltinmodule.c Log Message: Remove the PendingDeprecationWarning from apply(). apply() will remain deprecated in the documentation. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.303 retrieving revision 2.304 diff -C2 -d -r2.303 -r2.304 *** bltinmodule.c 16 Nov 2003 16:17:49 -0000 2.303 --- bltinmodule.c 5 Dec 2003 17:34:27 -0000 2.304 *************** *** 76,83 **** PyObject *t = NULL, *retval = NULL; - if (PyErr_Warn(PyExc_PendingDeprecationWarning, - "use func(*args, **kwargs) instead of " - "apply(func, args, kwargs)") < 0) - return NULL; if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) return NULL; --- 76,79 ---- From fdrake at users.sourceforge.net Fri Dec 5 12:42:08 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 12:42:11 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.84,1.831.4.85 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25462 Modified Files: Tag: release23-maint NEWS Log Message: Add news about removal of the PendingDeprecationWarning from apply(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.84 retrieving revision 1.831.4.85 diff -C2 -d -r1.831.4.84 -r1.831.4.85 *** NEWS 5 Dec 2003 04:34:04 -0000 1.831.4.84 --- NEWS 5 Dec 2003 17:42:06 -0000 1.831.4.85 *************** *** 5,8 **** --- 5,17 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) + What's New in Python 2.3.3c2? + ============================= + + Core and builtins + ----------------- + + - Removed PendingDeprecationWarning from apply(). apply() remains + deprecated, but the nuissance warning will not be issued. + What's New in Python 2.3.3c1? ============================= From fdrake at users.sourceforge.net Fri Dec 5 12:43:49 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 12:43:54 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.907,1.908 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25745 Modified Files: NEWS Log Message: Add news about removal of the PendingDeprecationWarning from apply(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.907 retrieving revision 1.908 diff -C2 -d -r1.907 -r1.908 *** NEWS 3 Dec 2003 20:26:04 -0000 1.907 --- NEWS 5 Dec 2003 17:43:47 -0000 1.908 *************** *** 13,16 **** --- 13,19 ---- ----------------- + - Removed PendingDeprecationWarning from apply(). apply() remains + deprecated, but the nuissance warning will not be issued. + - At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage collection twice, both before and after tearing down modules. The From fdrake at users.sourceforge.net Fri Dec 5 12:51:42 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 12:51:46 2003 Subject: [Python-checkins] python/nondist/peps pep-0290.txt,1.10,1.11 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27031 Modified Files: pep-0290.txt Log Message: Note that the Pending Deprecation warning was removed from apply() in 2.3.3, but that the function remains deprecated. Index: pep-0290.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0290.txt,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pep-0290.txt 27 Sep 2003 02:53:59 -0000 1.10 --- pep-0290.txt 5 Dec 2003 17:51:40 -0000 1.11 *************** *** 130,133 **** --- 130,138 ---- apply(f, args, kwds) --> f(*args, **kwds) + Note: The Pending Deprecation was removed from apply() in Python 2.3.3 + since it creates pain for people who need to maintain code that works + with Python versions as far back as 1.5.2, where there was no + alternative to apply(). The function remains deprecated, however. + Python 2.2 or Later From fdrake at users.sourceforge.net Fri Dec 5 12:56:21 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 12:56:24 2003 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.7, 2.74.4.8 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv27716 Modified Files: Tag: release23-maint patchlevel.h Log Message: Bump version number. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.7 retrieving revision 2.74.4.8 diff -C2 -d -r2.74.4.7 -r2.74.4.8 *** patchlevel.h 4 Dec 2003 20:25:10 -0000 2.74.4.7 --- patchlevel.h 5 Dec 2003 17:56:18 -0000 2.74.4.8 *************** *** 24,31 **** #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.3.3c1" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 24,31 ---- #define PY_MICRO_VERSION 3 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.3.3c2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From fdrake at users.sourceforge.net Fri Dec 5 13:02:27 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 13:02:30 2003 Subject: [Python-checkins] python/dist/src/Doc/tools push-docs.sh, 1.15.18.3, 1.15.18.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv28884/tools Modified Files: Tag: release23-maint push-docs.sh Log Message: One more backported patch related to the removal of version numbers from the Doc/ tree on this branch. Index: push-docs.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/push-docs.sh,v retrieving revision 1.15.18.3 retrieving revision 1.15.18.4 diff -C2 -d -r1.15.18.3 -r1.15.18.4 *** push-docs.sh 30 Sep 2003 20:21:03 -0000 1.15.18.3 --- push-docs.sh 5 Dec 2003 18:02:23 -0000 1.15.18.4 *************** *** 11,17 **** ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' ! VERSION=`echo '$Revision$' | sed 's/[$]Revision: \(.*\) [$]/\1/'` EXTRA=`echo "$VERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*//'` ! if [ "$EXTRA" ] ; then DOCLABEL="maintenance" DOCTYPE="maint" --- 11,21 ---- ADDRESSES='python-dev@python.org doc-sig@python.org python-list@python.org' ! TOOLDIR="`dirname $0`" ! VERSION=`$TOOLDIR/getversioninfo` ! ! # Set $EXTRA to something non-empty if this is a non-trunk version: EXTRA=`echo "$VERSION" | sed 's/^[0-9][0-9]*\.[0-9][0-9]*//'` ! ! if echo "$EXTRA" | grep -q '[.]' ; then DOCLABEL="maintenance" DOCTYPE="maint" *************** *** 74,79 **** # now in .../Doc/ make --no-print-directory bziphtml || exit $? ! RELEASE=`grep '^RELEASE=' Makefile | sed 's|RELEASE=||'` ! PACKAGE="html-$RELEASE.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? --- 78,82 ---- # now in .../Doc/ make --no-print-directory bziphtml || exit $? ! PACKAGE="html-$VERSION.tar.bz2" scp "$PACKAGE" tools/update-docs.sh $TARGET/ || exit $? ssh "$TARGETHOST" tmp/update-docs.sh $DOCTYPE $PACKAGE '&&' rm tmp/update-docs.sh || exit $? From fdrake at users.sourceforge.net Fri Dec 5 13:55:49 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 13:55:53 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.143.8.7, 1.143.8.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5390 Modified Files: Tag: release23-maint libfuncs.tex Log Message: - fix markup in the bool() description - note the behavior of bool() with no arg in the main body of the description Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.143.8.7 retrieving revision 1.143.8.8 diff -C2 -d -r1.143.8.7 -r1.143.8.8 *** libfuncs.tex 18 Nov 2003 19:48:41 -0000 1.143.8.7 --- libfuncs.tex 5 Dec 2003 18:55:46 -0000 1.143.8.8 *************** *** 92,106 **** \begin{funcdesc}{bool}{\optional{x}} Convert a value to a Boolean, using the standard truth testing ! procedure. If \code{x} is false, this returns \code{False}; ! otherwise it returns \code{True}. \code{bool} is also a class, ! which is a subclass of \code{int}. Class \code{bool} cannot be ! subclassed further. Its only instances are \code{False} and ! \code{True}. ! ! \indexii{Boolean}{type} ! \versionadded{2.2.1} \versionchanged[If no argument is given, this function returns ! \code{False}]{2.3} \end{funcdesc} --- 92,105 ---- \begin{funcdesc}{bool}{\optional{x}} Convert a value to a Boolean, using the standard truth testing ! procedure. If \var{x} is false or omitted, this returns ! \constant{False}; otherwise it returns \constant{True}. ! \class{bool} is also a class, which is a subclass of \class{int}. ! Class \class{bool} cannot be subclassed further. Its only instances ! are \constant{False} and \constant{True}. + \indexii{Boolean}{type} + \versionadded{2.2.1} \versionchanged[If no argument is given, this function returns ! \constant{False}]{2.3} \end{funcdesc} From fdrake at users.sourceforge.net Fri Dec 5 13:57:02 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Fri Dec 5 13:57:05 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.155,1.156 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5676 Modified Files: libfuncs.tex Log Message: - fix markup in the bool() description - note the behavior of bool() with no arg in the main body of the description Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.155 retrieving revision 1.156 diff -C2 -d -r1.155 -r1.156 *** libfuncs.tex 26 Nov 2003 17:52:45 -0000 1.155 --- libfuncs.tex 5 Dec 2003 18:57:00 -0000 1.156 *************** *** 72,86 **** \begin{funcdesc}{bool}{\optional{x}} Convert a value to a Boolean, using the standard truth testing ! procedure. If \code{x} is false, this returns \code{False}; ! otherwise it returns \code{True}. \code{bool} is also a class, ! which is a subclass of \code{int}. Class \code{bool} cannot be ! subclassed further. Its only instances are \code{False} and ! \code{True}. ! ! \indexii{Boolean}{type} ! \versionadded{2.2.1} \versionchanged[If no argument is given, this function returns ! \code{False}]{2.3} \end{funcdesc} --- 72,85 ---- \begin{funcdesc}{bool}{\optional{x}} Convert a value to a Boolean, using the standard truth testing ! procedure. If \var{x} is false or omitted, this returns ! \constant{False}; otherwise it returns \constant{True}. ! \class{bool} is also a class, which is a subclass of \class{int}. ! Class \class{bool} cannot be subclassed further. Its only instances ! are \constant{False} and \constant{True}. + \indexii{Boolean}{type} + \versionadded{2.2.1} \versionchanged[If no argument is given, this function returns ! \constant{False}]{2.3} \end{funcdesc} From theller at users.sourceforge.net Fri Dec 5 15:12:25 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Fri Dec 5 15:12:29 2003 Subject: [Python-checkins] python/dist/src/Lib/distutils msvccompiler.py, 1.58, 1.59 ccompiler.py, 1.57, 1.58 bcppcompiler.py, 1.15, 1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/distutils In directory sc8-pr-cvs1:/tmp/cvs-serv21054 Modified Files: msvccompiler.py ccompiler.py bcppcompiler.py Log Message: Compile the files in the same order they are passed to the compiler. Use case: Sometimes 'compiling' source files (with SWIG, for example) creates additionl files which included by later sources. The win32all setup script requires this. There is no SF item for this, but it was discussed on distutils-sig: http://mail.python.org/pipermail/distutils-sig/2003-November/003514.html Index: msvccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/msvccompiler.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** msvccompiler.py 28 Nov 2003 19:42:51 -0000 1.58 --- msvccompiler.py 5 Dec 2003 20:12:23 -0000 1.59 *************** *** 292,296 **** compile_opts.extend(self.compile_options) ! for obj, (src, ext) in build.items(): if debug: # pass the full pathname to MSVC in debug mode, --- 292,300 ---- compile_opts.extend(self.compile_options) ! for obj in objects: ! try: ! src, ext = build[obj] ! except KeyError: ! continue if debug: # pass the full pathname to MSVC in debug mode, Index: ccompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/ccompiler.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** ccompiler.py 24 Apr 2003 19:49:23 -0000 1.57 --- ccompiler.py 5 Dec 2003 20:12:23 -0000 1.58 *************** *** 692,696 **** cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) ! for obj, (src, ext) in build.items(): self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) --- 692,700 ---- cc_args = self._get_cc_args(pp_opts, debug, extra_preargs) ! for obj in objects: ! try: ! src, ext = build[obj] ! except KeyError: ! continue self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) Index: bcppcompiler.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/distutils/bcppcompiler.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** bcppcompiler.py 19 Nov 2002 13:12:26 -0000 1.15 --- bcppcompiler.py 5 Dec 2003 20:12:23 -0000 1.16 *************** *** 97,101 **** compile_opts.extend (self.compile_options) ! for obj, (src, ext) in build.items(): # XXX why do the normpath here? src = os.path.normpath(src) --- 97,105 ---- compile_opts.extend (self.compile_options) ! for obj in objects: ! try: ! src, ext = build[obj] ! except KeyError: ! continue # XXX why do the normpath here? src = os.path.normpath(src) From theller at users.sourceforge.net Fri Dec 5 15:28:11 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Fri Dec 5 15:28:14 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.908,1.909 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv23971 Modified Files: NEWS Log Message: distutils compilers now compile source files in the same order as they are passed to the compiler. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.908 retrieving revision 1.909 diff -C2 -d -r1.908 -r1.909 *** NEWS 5 Dec 2003 17:43:47 -0000 1.908 --- NEWS 5 Dec 2003 20:28:07 -0000 1.909 *************** *** 174,177 **** --- 174,180 ---- ------- + - distutils compilers now compile source files in the same order as + they are passed to the compiler. + - pprint.pprint() and pprint.pformat() now have additional parameters indent, width and depth. From jackjansen at users.sourceforge.net Fri Dec 5 18:51:56 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri Dec 5 18:52:01 2003 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon WASTEconst.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv558 Modified Files: WASTEconst.py Log Message: Reverting to previous version, which works. And I don't really care about the new waste functionality because it's probably going to be dropped anyway. Index: WASTEconst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/WASTEconst.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WASTEconst.py 3 Dec 2003 22:34:19 -0000 1.2 --- WASTEconst.py 5 Dec 2003 23:51:54 -0000 1.3 *************** *** 52,56 **** kObjectEdge = 2 weFAutoScroll = 0 - weFAutoIdle = 1 weFOutlineHilite = 2 weFReadOnly = 5 --- 52,55 ---- *************** *** 64,74 **** weFMonoStyled = 13 weFMultipleUndo = 14 - weFLeftMarginClick = 16 - weFNoAutoTabForHangingIndent = 28 weFNoKeyboardSync = 29 weFInhibitICSupport = 30 weFInhibitColor = 31 # weDoAutoScroll = 1UL << weFAutoScroll - weDoAutoIdle = 1UL << weFAutoIdle # weDoOutlineHilite = 1UL << weFOutlineHilite # weDoReadOnly = 1UL << weFReadOnly --- 63,70 ---- *************** *** 82,87 **** # weDoMonoStyled = 1UL << weFMonoStyled # weDoMultipleUndo = 1UL << weFMultipleUndo - weDoLeftMarginClick = 1UL << weFLeftMarginClick - weDoNoAutoTabForHangingIndent = 1UL << weFNoAutoTabForHangingIndent # weDoNoKeyboardSync = 1UL << weFNoKeyboardSync # weDoInhibitICSupport = 1UL << weFInhibitICSupport --- 78,81 ---- *************** *** 93,99 **** weLowerCase = 0 weUpperCase = 1 - weRedWigglyUnderline = 29303 - weGreenWigglyUnderline = 26487 - weOrangeWigglyUnderline = 28535 weFindWholeWords = 0x00000001 weFindCaseInsensitive = 0x00000002 --- 87,90 ---- *************** *** 104,114 **** weStreamDestinationKindMask = 0x000000FF weStreamIncludeObjects = 0x00000100 - weCopyPromiseFlavors = 0x00000001 weGetAddUnicodeBOM = 0x00000200 weGetLittleEndian = 0x00000400 - weSaveAddResources = 0x00000001 - weSaveCompatibilityResources = 0x00000002 - weSaveLittleEndian = 0x00000004 - kWASTECreator = FOUR_CHAR_CODE('OEDE') weTagFontFamily = FOUR_CHAR_CODE('font') weTagFontSize = FOUR_CHAR_CODE('ptsz') --- 95,100 ---- *************** *** 122,138 **** weTagExtended = FOUR_CHAR_CODE('pexp') weTagStrikethrough = FOUR_CHAR_CODE('strk') - weTagHidden = FOUR_CHAR_CODE('hidn') - weTagAllCaps = FOUR_CHAR_CODE('alcp') - weTagAllLowercase = FOUR_CHAR_CODE('lowc') weTagTextColor = FOUR_CHAR_CODE('colr') weTagBackgroundColor = FOUR_CHAR_CODE('pbcl') weTagTransferMode = FOUR_CHAR_CODE('pptm') weTagVerticalShift = FOUR_CHAR_CODE('xshf') - weTagLanguage = FOUR_CHAR_CODE('lang') - weTagUnderlineStyle = FOUR_CHAR_CODE('unds') - weTagSmallCaps = FOUR_CHAR_CODE('smcp') - weTagDoubleStrikethrough = FOUR_CHAR_CODE('dstr') - weTagEmbossed = FOUR_CHAR_CODE('embo') - weTagEngraved = FOUR_CHAR_CODE('engr') weTagAlignment = FOUR_CHAR_CODE('pjst') weTagDirection = FOUR_CHAR_CODE('LDIR') --- 108,115 ---- *************** *** 143,178 **** weTagSpaceBefore = FOUR_CHAR_CODE('spbe') weTagSpaceAfter = FOUR_CHAR_CODE('spaf') - weTagTabList = FOUR_CHAR_CODE('tabs') weTagBottomBorderStyle = FOUR_CHAR_CODE('BBRD') - weTagKeepTogether = FOUR_CHAR_CODE('keep') - weTagKeepWithNext = FOUR_CHAR_CODE('kepn') - weTagPageBreakBefore = FOUR_CHAR_CODE('pbrb') - weTagWidowOrphanOverride = FOUR_CHAR_CODE('wdov') - weTagWidowOrphanControl = FOUR_CHAR_CODE('wido') - weTagNoLineNumbering = FOUR_CHAR_CODE('!ln#') - weTagNoHyphenation = FOUR_CHAR_CODE('!hyp') - weTagParagraphUserData = FOUR_CHAR_CODE('pusr') weTagForceFontFamily = FOUR_CHAR_CODE('ffnt') weTagAddFontSize = FOUR_CHAR_CODE('+siz') weTagAddVerticalShift = FOUR_CHAR_CODE('+shf') - weTagAddLeftIndent = FOUR_CHAR_CODE('+lei') - weTagAddRightIndent = FOUR_CHAR_CODE('+rii') - weTagAddFirstLineIndent = FOUR_CHAR_CODE('+fid') - weTagAddSpaceBefore = FOUR_CHAR_CODE('+spb') - weTagAddSpaceAfter = FOUR_CHAR_CODE('+spa') - weTagAddLineSpacing = FOUR_CHAR_CODE('+led') weTagTextEncoding = FOUR_CHAR_CODE('ptxe') weTagQDStyles = FOUR_CHAR_CODE('qdst') weTagTETextStyle = FOUR_CHAR_CODE('tets') - weTagRunDirection = FOUR_CHAR_CODE('rdir') - weTagUnderlineDefault = FOUR_CHAR_CODE('deft') - weTagUnderlineWord = FOUR_CHAR_CODE('word') - weTagUnderlineDouble = FOUR_CHAR_CODE('dubl') - weTagUnderlineThick = FOUR_CHAR_CODE('thck') - weTagUnderlineDash = FOUR_CHAR_CODE('- ') - weTagUnderlineDot = FOUR_CHAR_CODE('. ') - weTagUnderlineDotDash = FOUR_CHAR_CODE('.- ') - weTagUnderlineDotDotDash = FOUR_CHAR_CODE('..- ') - weTagUnderlineWave = FOUR_CHAR_CODE('wave') weTagAlignmentDefault = FOUR_CHAR_CODE('deft') weTagAlignmentLeft = FOUR_CHAR_CODE('left') --- 120,130 ---- *************** *** 180,206 **** weTagAlignmentRight = FOUR_CHAR_CODE('rght') weTagAlignmentFull = FOUR_CHAR_CODE('full') - weTagAlignmentDecimal = FOUR_CHAR_CODE('decm') weTagDirectionDefault = FOUR_CHAR_CODE('deft') weTagDirectionLeftToRight = FOUR_CHAR_CODE('L->R') weTagDirectionRightToLeft = FOUR_CHAR_CODE('R->L') - weTagLeaderNone = FOUR_CHAR_CODE('NONE') - weTagLeaderDots = FOUR_CHAR_CODE('DOTS') - weTagLeaderHyphens = FOUR_CHAR_CODE('HYPH') - weTagLeaderUnderline = FOUR_CHAR_CODE('UNDL') - weTagLeaderThickLine = FOUR_CHAR_CODE('THKL') - weTagLeaderEqualSigns = FOUR_CHAR_CODE('= ') weTagBorderStyleNone = FOUR_CHAR_CODE('NONE') weTagBorderStyleThin = FOUR_CHAR_CODE('SLDL') weTagBorderStyleDotted = FOUR_CHAR_CODE('DTDL') weTagBorderStyleThick = FOUR_CHAR_CODE('THKL') - weTagLineSpacingAbsolute = FOUR_CHAR_CODE('abso') - weTagLineSpacingAtLeast = FOUR_CHAR_CODE('atle') - weTagLineSpacingRelative = FOUR_CHAR_CODE('rele') weLineSpacingSingle = 0x00000000 weLineSpacingOneAndHalf = 0x00008000 weLineSpacingDouble = 0x00010000 - weAutoScrollDelay = FOUR_CHAR_CODE('ausd') - weBusyProc = FOUR_CHAR_CODE('busy') - weBusyInterval = FOUR_CHAR_CODE('bzin') weCharByteHook = FOUR_CHAR_CODE('cbyt') weCharToPixelHook = FOUR_CHAR_CODE('c2p ') --- 132,145 ---- *************** *** 227,231 **** weTSMPreUpdate = FOUR_CHAR_CODE('pre ') weTSMPostUpdate = FOUR_CHAR_CODE('post') - weUndoProc = FOUR_CHAR_CODE('undo') weURLHint = FOUR_CHAR_CODE('urlh') weWordBreakHook = FOUR_CHAR_CODE('wbrk') --- 166,169 ---- *************** *** 247,252 **** kTypeUTF8Text = FOUR_CHAR_CODE('UTF8') kTypeStyledText = FOUR_CHAR_CODE('STXT') - kTypeRTF = FOUR_CHAR_CODE('RTF ') - kTypeRTFD = FOUR_CHAR_CODE('RTFD') weAKNone = 0 weAKUnspecified = 1 --- 185,188 ---- *************** *** 262,268 **** weAKCaseChange = 11 weAKObjectChange = 12 - weUndoNewAction = 0 - weUndoNewSubAction = 1 - weUndoBeginSequence = 2 weToScrap = 0 weToDrag = 1 --- 198,201 ---- *************** *** 271,290 **** weMouseWithin = 1 weMouseLeave = 2 - weBusyRecalBreaks = 0 - weCreatorDocumentInfo = FOUR_CHAR_CODE('Info') - weTagDocumentTitle = FOUR_CHAR_CODE('Titl') - weTagDocumentSubject = FOUR_CHAR_CODE('Subj') - weTagDocumentAuthor = FOUR_CHAR_CODE('Auth') - weTagDocumentManager = FOUR_CHAR_CODE('Mngr') - weTagDocumentCompany = FOUR_CHAR_CODE('Cmpy') - weTagDocumentCategory = FOUR_CHAR_CODE('Ctgy') - weTagDocumentKeywords = FOUR_CHAR_CODE('Keyw') - weTagDocumentComments = FOUR_CHAR_CODE('Cmnt') - weTagDocumentOperator = FOUR_CHAR_CODE('Oper') - weTagDocumentBaseAddress = FOUR_CHAR_CODE('Hlnk') - weTagPageInfo = FOUR_CHAR_CODE('Page') - weTagMacPrintRecord = FOUR_CHAR_CODE('PRec') kCurrentSelection = -1 kNullStyle = -2 - kMaxTabCount = 20 - kMaxLanguageTagSize = 32 --- 204,207 ---- From jackjansen at users.sourceforge.net Fri Dec 5 18:59:39 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri Dec 5 18:59:46 2003 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon Appearance.py, 1.1, 1.2 AppleEvents.py, 1.1, 1.2 CarbonEvents.py, 1.1, 1.2 Controls.py, 1.1, 1.2 CoreGraphics.py, 1.1, 1.2 Dialogs.py, 1.1, 1.2 Dragconst.py, 1.1, 1.2 Events.py, 1.1, 1.2 Files.py, 1.1, 1.2 Folders.py, 1.1, 1.2 Fonts.py, 1.1, 1.2 Icons.py, 1.1, 1.2 LaunchServices.py, 1.1, 1.2 MacTextEditor.py, 1.1, 1.2 Menus.py, 1.1, 1.2 OSAconst.py, 1.1, 1.2 QuickDraw.py, 1.1, 1.2 QuickTime.py, 1.1, 1.2 Windows.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv1453 Modified Files: Appearance.py AppleEvents.py CarbonEvents.py Controls.py CoreGraphics.py Dialogs.py Dragconst.py Events.py Files.py Folders.py Fonts.py Icons.py LaunchServices.py MacTextEditor.py Menus.py OSAconst.py QuickDraw.py QuickTime.py Windows.py Log Message: Finished update to universal header 3.4.2. Index: Appearance.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Appearance.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Appearance.py 30 Dec 2002 22:04:20 -0000 1.1 --- Appearance.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 60,67 **** kThemeBrushNotificationWindowBackground = 48 kThemeBrushMovableModalBackground = 49 ! kThemeBrushSheetBackground = 50 kThemeBrushDrawerBackground = 51 kThemeBrushBlack = -1 kThemeBrushWhite = -2 kThemeTextColorDialogActive = 1 kThemeTextColorDialogInactive = 2 --- 60,74 ---- kThemeBrushNotificationWindowBackground = 48 kThemeBrushMovableModalBackground = 49 ! kThemeBrushSheetBackgroundOpaque = 50 kThemeBrushDrawerBackground = 51 + kThemeBrushToolbarBackground = 52 + kThemeBrushSheetBackgroundTransparent = 53 + kThemeBrushMenuBackground = 54 + kThemeBrushMenuBackgroundSelected = 55 + kThemeBrushSheetBackground = kThemeBrushSheetBackgroundOpaque kThemeBrushBlack = -1 kThemeBrushWhite = -2 + kThemeBrushPrimaryHighlightColor = -3 + kThemeBrushSecondaryHighlightColor = -4 kThemeTextColorDialogActive = 1 kThemeTextColorDialogInactive = 2 *************** *** 158,162 **** kThemeMenuItemHierBackground = 0x0400 kThemeMenuItemPopUpBackground = 0x0800 ! kThemeMenuItemHasIcon = 0x8000 kThemeBackgroundTabPane = 1 kThemeBackgroundPlacard = 2 --- 165,170 ---- kThemeMenuItemHierBackground = 0x0400 kThemeMenuItemPopUpBackground = 0x0800 ! kThemeMenuItemHasIcon = 0x8000 ! kThemeMenuItemNoBackground = 0x4000 kThemeBackgroundTabPane = 1 kThemeBackgroundPlacard = 2 *************** *** 166,169 **** --- 174,178 ---- kThemeNameTag = FOUR_CHAR_CODE('name') kThemeVariantNameTag = FOUR_CHAR_CODE('varn') + kThemeVariantBaseTintTag = FOUR_CHAR_CODE('tint') kThemeHighlightColorTag = FOUR_CHAR_CODE('hcol') kThemeScrollBarArrowStyleTag = FOUR_CHAR_CODE('sbar') *************** *** 188,191 **** --- 197,205 ---- kThemeSmoothFontEnabledTag = FOUR_CHAR_CODE('smoo') kThemeSmoothFontMinSizeTag = FOUR_CHAR_CODE('smos') + kTiledOnScreen = 1 + kCenterOnScreen = 2 + kFitToScreen = 3 + kFillScreen = 4 + kUseBestGuess = 5 kThemeCheckBoxClassicX = 0 kThemeCheckBoxCheckMark = 1 *************** *** 259,263 **** kThemeTrackShowThumb = (1 << 2) kThemeTrackThumbRgnIsNotGhost = (1 << 3) ! kThemeTrackNoScrollBarArrows = (1 << 4) kThemeWindowHasGrow = (1 << 0) kThemeWindowHasHorizontalZoom = (1 << 3) --- 273,277 ---- kThemeTrackShowThumb = (1 << 2) kThemeTrackThumbRgnIsNotGhost = (1 << 3) ! kThemeTrackNoScrollBarArrows = (1 << 4) kThemeWindowHasGrow = (1 << 0) kThemeWindowHasHorizontalZoom = (1 << 3) *************** *** 280,283 **** --- 294,298 ---- kThemeUtilitySideWindow = 9 kThemeSheetWindow = 10 + kThemeDrawerWindow = 11 kThemeWidgetCloseBox = 0 kThemeWidgetZoomBox = 1 *************** *** 541,544 **** --- 556,566 ---- kThemeMetricPrimaryGroupBoxContentInset = 61 kThemeMetricSecondaryGroupBoxContentInset = 62 + kThemeMetricMenuMarkColumnWidth = 63 + kThemeMetricMenuExcludedMarkColumnWidth = 64 + kThemeMetricMenuMarkIndent = 65 + kThemeMetricMenuTextLeadingEdgeMargin = 66 + kThemeMetricMenuTextTrailingEdgeMargin = 67 + kThemeMetricMenuIndentWidth = 68 + kThemeMetricMenuIconTrailingEdgeMargin = 69 # appearanceBadBrushIndexErr = themeInvalidBrushErr # appearanceProcessRegisteredErr = themeProcessRegisteredErr Index: AppleEvents.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/AppleEvents.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AppleEvents.py 30 Dec 2002 22:04:20 -0000 1.1 --- AppleEvents.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 36,39 **** --- 36,40 ---- typeFSS = FOUR_CHAR_CODE('fss ') typeFSRef = FOUR_CHAR_CODE('fsrf') + typeFileURL = FOUR_CHAR_CODE('furl') typeKeyword = FOUR_CHAR_CODE('keyw') typeSectionH = FOUR_CHAR_CODE('sect') *************** *** 628,631 **** --- 629,633 ---- keyAETSMScriptTag = FOUR_CHAR_CODE('sclg') keyAETSMTextFont = FOUR_CHAR_CODE('ktxf') + keyAETSMTextFMFont = FOUR_CHAR_CODE('ktxm') keyAETSMTextPointSize = FOUR_CHAR_CODE('ktps') keyAETSMEventRecord = FOUR_CHAR_CODE('tevt') Index: CarbonEvents.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/CarbonEvents.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CarbonEvents.py 30 Dec 2002 22:04:21 -0000 1.1 --- CarbonEvents.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 8,11 **** --- 8,12 ---- keyAEEventID = FOUR_CHAR_CODE('evti') eventAlreadyPostedErr = -9860 + eventTargetBusyErr = -9861 eventClassInvalidErr = -9862 eventClassIncorrectErr = -9864 *************** *** 26,37 **** kEventRemoveFromQueue = true kTrackMouseLocationOptionDontConsumeMouseUp = (1 << 0) ! kMouseTrackingMousePressed = 1 ! kMouseTrackingMouseReleased = 2 kMouseTrackingMouseExited = 3 kMouseTrackingMouseEntered = 4 ! kMouseTrackingMouseMoved = 5 kMouseTrackingKeyModifiersChanged = 6 kMouseTrackingUserCancelled = 7 kMouseTrackingTimedOut = 8 kEventAttributeNone = 0 kEventAttributeUserEvent = (1 << 0) --- 27,39 ---- kEventRemoveFromQueue = true kTrackMouseLocationOptionDontConsumeMouseUp = (1 << 0) ! kMouseTrackingMouseDown = 1 ! kMouseTrackingMouseUp = 2 kMouseTrackingMouseExited = 3 kMouseTrackingMouseEntered = 4 ! kMouseTrackingMouseDragged = 5 kMouseTrackingKeyModifiersChanged = 6 kMouseTrackingUserCancelled = 7 kMouseTrackingTimedOut = 8 + kMouseTrackingMouseMoved = 9 kEventAttributeNone = 0 kEventAttributeUserEvent = (1 << 0) *************** *** 47,50 **** --- 49,54 ---- kEventClassTablet = FOUR_CHAR_CODE('tblt') kEventClassVolume = FOUR_CHAR_CODE('vol ') + kEventClassAppearance = FOUR_CHAR_CODE('appm') + kEventClassService = FOUR_CHAR_CODE('serv') kEventMouseDown = 1 kEventMouseUp = 2 *************** *** 79,83 **** kEventAppLaunched = 5 kEventAppTerminated = 6 ! kEventAppFrontSwitched = 7 kEventAppleEvent = 1 kEventWindowUpdate = 1 --- 83,88 ---- kEventAppLaunched = 5 kEventAppTerminated = 6 ! kEventAppFrontSwitched = 7 ! kEventAppGetDockTileMenu = 20 kEventAppleEvent = 1 kEventWindowUpdate = 1 *************** *** 90,93 **** --- 95,103 ---- kEventWindowShown = 24 kEventWindowHidden = 25 + kEventWindowCollapsing = 86 + kEventWindowCollapsed = 67 + kEventWindowExpanding = 87 + kEventWindowExpanded = 70 + kEventWindowZoomed = 76 kEventWindowBoundsChanging = 26 kEventWindowBoundsChanged = 27 *************** *** 96,103 **** --- 106,115 ---- kEventWindowDragStarted = 30 kEventWindowDragCompleted = 31 + kEventWindowClosed = 73 kWindowBoundsChangeUserDrag = (1 << 0) kWindowBoundsChangeUserResize = (1 << 1) kWindowBoundsChangeSizeChanged = (1 << 2) kWindowBoundsChangeOriginChanged = (1 << 3) + kWindowBoundsChangeZoom = (1 << 4) kEventWindowClickDragRgn = 32 kEventWindowClickResizeRgn = 33 *************** *** 107,122 **** kEventWindowClickContentRgn = 37 kEventWindowClickProxyIconRgn = 38 kEventWindowCursorChange = 40 kEventWindowCollapse = 66 - kEventWindowCollapsed = 67 kEventWindowCollapseAll = 68 kEventWindowExpand = 69 - kEventWindowExpanded = 70 kEventWindowExpandAll = 71 kEventWindowClose = 72 - kEventWindowClosed = 73 kEventWindowCloseAll = 74 kEventWindowZoom = 75 - kEventWindowZoomed = 76 kEventWindowZoomAll = 77 kEventWindowContextualMenuSelect = 78 --- 119,132 ---- kEventWindowClickContentRgn = 37 kEventWindowClickProxyIconRgn = 38 + kEventWindowClickToolbarButtonRgn = 41 + kEventWindowClickStructureRgn = 42 kEventWindowCursorChange = 40 kEventWindowCollapse = 66 kEventWindowCollapseAll = 68 kEventWindowExpand = 69 kEventWindowExpandAll = 71 kEventWindowClose = 72 kEventWindowCloseAll = 74 kEventWindowZoom = 75 kEventWindowZoomAll = 77 kEventWindowContextualMenuSelect = 78 *************** *** 129,132 **** --- 139,149 ---- kEventWindowProxyBeginDrag = 128 kEventWindowProxyEndDrag = 129 + kEventWindowToolbarSwitchMode = 150 + kDockChangedUser = 1 + kDockChangedOrientation = 2 + kDockChangedAutohide = 3 + kDockChangedDisplay = 4 + kDockChangedItems = 5 + kDockChangedUnknown = 6 kEventWindowFocusAcquired = 200 kEventWindowFocusRelinquish = 201 *************** *** 153,157 **** --- 170,188 ---- kEventMenuMatchKey = 7 kEventMenuEnableItems = 8 + kEventMenuPopulate = 9 + kEventMenuMeasureItemWidth = 100 + kEventMenuMeasureItemHeight = 101 + kEventMenuDrawItem = 102 + kEventMenuDrawItemContent = 103 kEventMenuDispose = 1001 + kMenuContextMenuBar = 1 << 0 + kMenuContextPullDown = 1 << 8 + kMenuContextPopUp = 1 << 9 + kMenuContextSubmenu = 1 << 10 + kMenuContextMenuBarTracking = 1 << 16 + kMenuContextPopUpTracking = 1 << 17 + kMenuContextKeyMatching = 1 << 18 + kMenuContextMenuEnabling = 1 << 19 + kMenuContextCommandIDSearch = 1 << 20 kEventProcessCommand = 1 kEventCommandProcess = 1 *************** *** 168,177 **** --- 199,228 ---- kHICommandSelectAll = FOUR_CHAR_CODE('sall') kHICommandHide = FOUR_CHAR_CODE('hide') + kHICommandHideOthers = FOUR_CHAR_CODE('hido') + kHICommandShowAll = FOUR_CHAR_CODE('shal') kHICommandPreferences = FOUR_CHAR_CODE('pref') kHICommandZoomWindow = FOUR_CHAR_CODE('zoom') kHICommandMinimizeWindow = FOUR_CHAR_CODE('mini') + kHICommandMinimizeAll = FOUR_CHAR_CODE('mina') + kHICommandMaximizeWindow = FOUR_CHAR_CODE('maxi') + kHICommandMaximizeAll = FOUR_CHAR_CODE('maxa') kHICommandArrangeInFront = FOUR_CHAR_CODE('frnt') + kHICommandBringAllToFront = FOUR_CHAR_CODE('bfrt') + kHICommandWindowListSeparator = FOUR_CHAR_CODE('wldv') + kHICommandWindowListTerminator = FOUR_CHAR_CODE('wlst') + kHICommandSelectWindow = FOUR_CHAR_CODE('swin') kHICommandAbout = FOUR_CHAR_CODE('abou') + kHICommandNew = FOUR_CHAR_CODE('new ') + kHICommandOpen = FOUR_CHAR_CODE('open') + kHICommandClose = FOUR_CHAR_CODE('clos') + kHICommandSave = FOUR_CHAR_CODE('save') + kHICommandSaveAs = FOUR_CHAR_CODE('svas') + kHICommandRevert = FOUR_CHAR_CODE('rvrt') + kHICommandPrint = FOUR_CHAR_CODE('prnt') + kHICommandPageSetup = FOUR_CHAR_CODE('page') + kHICommandAppHelp = FOUR_CHAR_CODE('ahlp') kHICommandFromMenu = (1L << 0) + kHICommandFromControl = (1L << 1) + kHICommandFromWindow = (1L << 2) kEventControlInitialize = 1000 kEventControlDispose = 1001 *************** *** 210,219 **** kControlBoundsChangeSizeChanged = (1 << 2) kControlBoundsChangePositionChanged = (1 << 3) ! kEventTabletPointer = 1 kEventTabletProximity = 2 kEventVolumeMounted = 1 kEventVolumeUnmounted = 2 typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') kEventParamDirectObject = FOUR_CHAR_CODE('----') kEventParamWindowRef = FOUR_CHAR_CODE('wind') kEventParamGrafPort = FOUR_CHAR_CODE('graf') --- 261,278 ---- kControlBoundsChangeSizeChanged = (1 << 2) kControlBoundsChangePositionChanged = (1 << 3) ! kEventTabletPoint = 1 kEventTabletProximity = 2 + kEventTabletPointer = 1 kEventVolumeMounted = 1 kEventVolumeUnmounted = 2 typeFSVolumeRefNum = FOUR_CHAR_CODE('voln') + kEventAppearanceScrollBarVariantChanged = 1 + kEventServiceCopy = 1 + kEventServicePaste = 2 + kEventServiceGetTypes = 3 + kEventServicePerform = 4 kEventParamDirectObject = FOUR_CHAR_CODE('----') + kEventParamPostTarget = FOUR_CHAR_CODE('ptrg') + typeEventTargetRef = FOUR_CHAR_CODE('etrg') kEventParamWindowRef = FOUR_CHAR_CODE('wind') kEventParamGrafPort = FOUR_CHAR_CODE('graf') *************** *** 229,232 **** --- 288,293 ---- kEventParamAEEventClass = keyAEEventClass kEventParamCGContextRef = FOUR_CHAR_CODE('cntx') + kEventParamDeviceDepth = FOUR_CHAR_CODE('devd') + kEventParamDeviceColor = FOUR_CHAR_CODE('devc') typeWindowRef = FOUR_CHAR_CODE('wind') typeGrafPtr = FOUR_CHAR_CODE('graf') *************** *** 238,242 **** typeQDRgnHandle = FOUR_CHAR_CODE('rgnh') typeOSStatus = FOUR_CHAR_CODE('osst') ! typeCGContextRef = FOUR_CHAR_CODE('cntx') kEventParamMouseLocation = FOUR_CHAR_CODE('mloc') kEventParamMouseButton = FOUR_CHAR_CODE('mbtn') --- 299,309 ---- typeQDRgnHandle = FOUR_CHAR_CODE('rgnh') typeOSStatus = FOUR_CHAR_CODE('osst') ! typeCFStringRef = FOUR_CHAR_CODE('cfst') ! typeCFIndex = FOUR_CHAR_CODE('cfix') ! typeCFTypeRef = FOUR_CHAR_CODE('cfty') ! typeCGContextRef = FOUR_CHAR_CODE('cntx') ! typeHIPoint = FOUR_CHAR_CODE('hipt') ! typeHISize = FOUR_CHAR_CODE('hisz') ! typeHIRect = FOUR_CHAR_CODE('hirc') kEventParamMouseLocation = FOUR_CHAR_CODE('mloc') kEventParamMouseButton = FOUR_CHAR_CODE('mbtn') *************** *** 246,249 **** --- 313,317 ---- kEventParamMouseDelta = FOUR_CHAR_CODE('mdta') kEventParamMouseChord = FOUR_CHAR_CODE('chor') + kEventParamTabletEventType = FOUR_CHAR_CODE('tblt') typeMouseButton = FOUR_CHAR_CODE('mbtn') typeMouseWheelAxis = FOUR_CHAR_CODE('mwax') *************** *** 252,255 **** --- 320,324 ---- kEventParamKeyModifiers = FOUR_CHAR_CODE('kmod') kEventParamKeyUnicodes = FOUR_CHAR_CODE('kuni') + kEventParamKeyboardType = FOUR_CHAR_CODE('kbdt') typeEventHotKeyID = FOUR_CHAR_CODE('hkid') kEventParamTextInputSendRefCon = FOUR_CHAR_CODE('tsrc') *************** *** 273,276 **** --- 342,346 ---- kEventParamTextInputReplyPoint = FOUR_CHAR_CODE('trpt') kEventParamTextInputReplyFont = FOUR_CHAR_CODE('trft') + kEventParamTextInputReplyFMFont = FOUR_CHAR_CODE('trfm') kEventParamTextInputReplyPointSize = FOUR_CHAR_CODE('trpz') kEventParamTextInputReplyLineHeight = FOUR_CHAR_CODE('trlh') *************** *** 301,304 **** --- 371,377 ---- kEventParamWindowGrowRect = FOUR_CHAR_CODE('grct') kEventParamAttributes = FOUR_CHAR_CODE('attr') + kEventParamDockChangedReason = FOUR_CHAR_CODE('dcrs') + kEventParamPreviousDockRect = FOUR_CHAR_CODE('pdrc') + kEventParamCurrentDockRect = FOUR_CHAR_CODE('cdrc') typeWindowRegionCode = FOUR_CHAR_CODE('wshp') typeWindowDefPartCode = FOUR_CHAR_CODE('wdpt') *************** *** 338,352 **** kEventParamEnableMenuForKeyEvent = FOUR_CHAR_CODE('fork') kEventParamMenuEventOptions = FOUR_CHAR_CODE('meop') typeMenuItemIndex = FOUR_CHAR_CODE('midx') typeMenuCommand = FOUR_CHAR_CODE('mcmd') typeMenuTrackingMode = FOUR_CHAR_CODE('mtmd') ! typeMenuEventOptions = FOUR_CHAR_CODE('meop') kEventParamProcessID = FOUR_CHAR_CODE('psn ') kEventParamLaunchRefCon = FOUR_CHAR_CODE('lref') kEventParamLaunchErr = FOUR_CHAR_CODE('err ') ! kEventParamTabletPointerRec = FOUR_CHAR_CODE('tbrc') kEventParamTabletProximityRec = FOUR_CHAR_CODE('tbpx') ! typeTabletPointerRec = FOUR_CHAR_CODE('tbrc') ! typeTabletProximityRec = FOUR_CHAR_CODE('tbpx') # sHandler = NewEventHandlerUPP( x ) ! kUserFocusAuto = -1 --- 411,451 ---- kEventParamEnableMenuForKeyEvent = FOUR_CHAR_CODE('fork') kEventParamMenuEventOptions = FOUR_CHAR_CODE('meop') + kEventParamMenuContext = FOUR_CHAR_CODE('mctx') + kEventParamMenuItemBounds = FOUR_CHAR_CODE('mitb') + kEventParamMenuMarkBounds = FOUR_CHAR_CODE('mmkb') + kEventParamMenuIconBounds = FOUR_CHAR_CODE('micb') + kEventParamMenuTextBounds = FOUR_CHAR_CODE('mtxb') + kEventParamMenuTextBaseline = FOUR_CHAR_CODE('mtbl') + kEventParamMenuCommandKeyBounds = FOUR_CHAR_CODE('mcmb') + kEventParamMenuVirtualTop = FOUR_CHAR_CODE('mvrt') + kEventParamMenuVirtualBottom = FOUR_CHAR_CODE('mvrb') + kEventParamMenuDrawState = FOUR_CHAR_CODE('mdrs') + kEventParamMenuItemType = FOUR_CHAR_CODE('mitp') + kEventParamMenuItemWidth = FOUR_CHAR_CODE('mitw') + kEventParamMenuItemHeight = FOUR_CHAR_CODE('mith') typeMenuItemIndex = FOUR_CHAR_CODE('midx') typeMenuCommand = FOUR_CHAR_CODE('mcmd') typeMenuTrackingMode = FOUR_CHAR_CODE('mtmd') ! typeMenuEventOptions = FOUR_CHAR_CODE('meop') ! typeThemeMenuState = FOUR_CHAR_CODE('tmns') ! typeThemeMenuItemType = FOUR_CHAR_CODE('tmit') kEventParamProcessID = FOUR_CHAR_CODE('psn ') kEventParamLaunchRefCon = FOUR_CHAR_CODE('lref') kEventParamLaunchErr = FOUR_CHAR_CODE('err ') ! kEventParamTabletPointRec = FOUR_CHAR_CODE('tbrc') kEventParamTabletProximityRec = FOUR_CHAR_CODE('tbpx') ! typeTabletPointRec = FOUR_CHAR_CODE('tbrc') ! typeTabletProximityRec = FOUR_CHAR_CODE('tbpx') ! kEventParamTabletPointerRec = FOUR_CHAR_CODE('tbrc') ! typeTabletPointerRec = FOUR_CHAR_CODE('tbrc') ! kEventParamNewScrollBarVariant = FOUR_CHAR_CODE('nsbv') ! kEventParamScrapRef = FOUR_CHAR_CODE('scrp') ! kEventParamServiceCopyTypes = FOUR_CHAR_CODE('svsd') ! kEventParamServicePasteTypes = FOUR_CHAR_CODE('svpt') ! kEventParamServiceMessageName = FOUR_CHAR_CODE('svmg') ! kEventParamServiceUserData = FOUR_CHAR_CODE('svud') ! typeScrapRef = FOUR_CHAR_CODE('scrp') ! typeCFMutableArrayRef = FOUR_CHAR_CODE('cfma') # sHandler = NewEventHandlerUPP( x ) ! kMouseTrackingMousePressed = kMouseTrackingMouseDown ! kMouseTrackingMouseReleased = kMouseTrackingMouseUp Index: Controls.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Controls.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Controls.py 30 Dec 2002 22:04:21 -0000 1.1 --- Controls.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 55,59 **** kControlCollectionTagCommand = FOUR_CHAR_CODE('cmd ') kControlCollectionTagVarCode = FOUR_CHAR_CODE('varc') - kControlCollectionTagSubControls = FOUR_CHAR_CODE('subc') kControlContentTextOnly = 0 kControlNoContent = 0 --- 55,58 ---- *************** *** 281,290 **** kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd') kControlBevelButtonMenuRefTag = FOUR_CHAR_CODE('mhnd') ! kControlBevelButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') ! # kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') ! kControlBevelButtonKindTag = FOUR_CHAR_CODE('bebk') kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu') kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly') kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal') kControlSliderProc = 48 kControlSliderLiveFeedback = (1 << 0) --- 280,289 ---- kControlBevelButtonMenuHandleTag = FOUR_CHAR_CODE('mhnd') kControlBevelButtonMenuRefTag = FOUR_CHAR_CODE('mhnd') ! # kControlBevelButtonCenterPopupGlyphTag = FOUR_CHAR_CODE('pglc') kControlBevelButtonLastMenuTag = FOUR_CHAR_CODE('lmnu') kControlBevelButtonMenuDelayTag = FOUR_CHAR_CODE('mdly') kControlBevelButtonScaleIconTag = FOUR_CHAR_CODE('scal') + kControlBevelButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') + kControlBevelButtonKindTag = FOUR_CHAR_CODE('bebk') kControlSliderProc = 48 kControlSliderLiveFeedback = (1 << 0) *************** *** 422,426 **** kControlEditTextInlinePreUpdateProcTag = FOUR_CHAR_CODE('prup') kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') ! kControlEditTextCFStringTag = FOUR_CHAR_CODE('cfst') kControlStaticTextProc = 288 kControlKindStaticText = FOUR_CHAR_CODE('stxt') --- 421,426 ---- kControlEditTextInlinePreUpdateProcTag = FOUR_CHAR_CODE('prup') kControlEditTextInlinePostUpdateProcTag = FOUR_CHAR_CODE('poup') ! kControlEditTextCFStringTag = FOUR_CHAR_CODE('cfst') ! kControlEditTextPasswordCFStringTag = FOUR_CHAR_CODE('pwcf') kControlStaticTextProc = 288 kControlKindStaticText = FOUR_CHAR_CODE('stxt') *************** *** 485,489 **** kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid') kControlPopupButtonExtraHeightTag = FOUR_CHAR_CODE('exht') ! kControlPopupButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') kControlPopupButtonCheckCurrentTag = FOUR_CHAR_CODE('chck') kControlRadioGroupProc = 416 --- 485,489 ---- kControlPopupButtonMenuIDTag = FOUR_CHAR_CODE('mnid') kControlPopupButtonExtraHeightTag = FOUR_CHAR_CODE('exht') ! kControlPopupButtonOwnedMenuRefTag = FOUR_CHAR_CODE('omrf') kControlPopupButtonCheckCurrentTag = FOUR_CHAR_CODE('chck') kControlRadioGroupProc = 416 *************** *** 503,507 **** kControlRoundButtonLargeSize = kControlSizeLarge kControlRoundButtonContentTag = FOUR_CHAR_CODE('cont') ! kControlRoundButtonSizeTag = FOUR_CHAR_CODE('size') kControlKindRoundButton = FOUR_CHAR_CODE('rndb') kControlKindDataBrowser = FOUR_CHAR_CODE('datb') --- 503,507 ---- kControlRoundButtonLargeSize = kControlSizeLarge kControlRoundButtonContentTag = FOUR_CHAR_CODE('cont') ! kControlRoundButtonSizeTag = kControlSizeTag kControlKindRoundButton = FOUR_CHAR_CODE('rndb') kControlKindDataBrowser = FOUR_CHAR_CODE('datb') *************** *** 645,648 **** --- 645,649 ---- kControlEditUnicodeTextProc = 912 kControlEditUnicodeTextPasswordProc = 914 + kControlKindEditUnicodeText = FOUR_CHAR_CODE('eutx') kControlCheckboxUncheckedValue = kControlCheckBoxUncheckedValue kControlCheckboxCheckedValue = kControlCheckBoxCheckedValue Index: CoreGraphics.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/CoreGraphics.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CoreGraphics.py 30 Dec 2002 22:04:21 -0000 1.1 --- CoreGraphics.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 23,24 **** --- 23,28 ---- kCGEncodingFontSpecific = 0 kCGEncodingMacRoman = 1 + kCGInterpolationDefault = 0 + kCGInterpolationNone = 1 + kCGInterpolationLow = 2 + kCGInterpolationHigh = 3 Index: Dialogs.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Dialogs.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Dialogs.py 30 Dec 2002 22:04:21 -0000 1.1 --- Dialogs.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 74,76 **** kHICommandOther = FOUR_CHAR_CODE('othr') kStdCFStringAlertVersionOne = 1 ! kStdAlertDoNotDisposeSheet = 1 << 0 --- 74,79 ---- kHICommandOther = FOUR_CHAR_CODE('othr') kStdCFStringAlertVersionOne = 1 ! kStdAlertDoNotDisposeSheet = 1 << 0 ! kStdAlertDoNotAnimateOnDefault = 1 << 1 ! kStdAlertDoNotAnimateOnCancel = 1 << 2 ! kStdAlertDoNotAnimateOnOther = 1 << 3 Index: Dragconst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Dragconst.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Dragconst.py 30 Dec 2002 22:04:21 -0000 1.1 --- Dragconst.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 4,7 **** --- 4,8 ---- from Carbon.TextEdit import * from Carbon.QuickDraw import * + fkDragActionAll = -1 *************** *** 35,39 **** flavorSenderTranslated = (1 << 1) flavorNotSaved = (1 << 2) ! flavorSystemTranslated = (1 << 8) kDragFlavorTypeHFS = FOUR_CHAR_CODE('hfs ') kDragFlavorTypePromiseHFS = FOUR_CHAR_CODE('phfs') --- 36,41 ---- flavorSenderTranslated = (1 << 1) flavorNotSaved = (1 << 2) ! flavorSystemTranslated = (1 << 8) ! flavorDataPromised = (1 << 9) kDragFlavorTypeHFS = FOUR_CHAR_CODE('hfs ') kDragFlavorTypePromiseHFS = FOUR_CHAR_CODE('phfs') *************** *** 55,58 **** --- 57,68 ---- kDragTrackingLeaveWindow = 4 kDragTrackingLeaveHandler = 5 + kDragActionNothing = 0L + kDragActionCopy = 1L + kDragActionAlias = (1L << 1) + kDragActionGeneric = (1L << 2) + kDragActionPrivate = (1L << 3) + kDragActionMove = (1L << 4) + kDragActionDelete = (1L << 5) + # kDragActionAll = (long)0xFFFFFFFF dragHasLeftSenderWindow = kDragHasLeftSenderWindow dragInsideSenderApplication = kDragInsideSenderApplication Index: Events.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Events.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Events.py 30 Dec 2002 22:04:21 -0000 1.1 --- Events.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 66,69 **** --- 66,73 ---- kReturnCharCode = 13 kFunctionKeyCharCode = 16 + kCommandCharCode = 17 + kCheckCharCode = 18 + kDiamondCharCode = 19 + kAppleLogoCharCode = 20 kEscapeCharCode = 27 kClearCharCode = 27 *************** *** 72,77 **** --- 76,92 ---- kUpArrowCharCode = 30 kDownArrowCharCode = 31 + kSpaceCharCode = 32 kDeleteCharCode = 127 + kBulletCharCode = 165 kNonBreakingSpaceCharCode = 202 + kShiftUnicode = 0x21E7 + kControlUnicode = 0x2303 + kOptionUnicode = 0x2325 + kCommandUnicode = 0x2318 + kPencilUnicode = 0x270E + kCheckUnicode = 0x2713 + kDiamondUnicode = 0x25C6 + kBulletUnicode = 0x2022 + kAppleLogoUnicode = 0xF8FF networkEvt = 10 driverEvt = 11 Index: Files.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Files.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Files.py 30 Dec 2002 22:04:21 -0000 1.1 --- Files.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 78,81 **** --- 78,82 ---- bTrshOffLine = 26 bNoSwitchTo = 25 + bDontShareIt = 21 bNoDeskItems = 20 bNoBootBlks = 19 *************** *** 272,275 **** --- 273,277 ---- kFSCatInfoSharingFlags = 0x00010000 kFSCatInfoUserPrivs = 0x00020000 + kFSCatInfoUserAccess = 0x00080000 kFSCatInfoAllDates = 0x000003E0 kFSCatInfoGettableInfo = 0x0003FFFF *************** *** 339,342 **** --- 341,345 ---- kFSVolFlagSoftwareLockedMask = 0x8000 kFNDirectoryModifiedMessage = 1 + kFNNoImplicitAllSubscription = (1 << 0) rAliasType = FOUR_CHAR_CODE('alis') kARMMountVol = 0x00000001 Index: Folders.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Folders.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Folders.py 30 Dec 2002 22:04:21 -0000 1.1 --- Folders.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 123,127 **** kKernelExtensionsFolderType = FOUR_CHAR_CODE('kext') kDirectoryServicesFolderType = FOUR_CHAR_CODE('dsrv') ! kDirectoryServicesPlugInsFolderType = FOUR_CHAR_CODE('dplg') kLocalesFolderType = FOUR_CHAR_CODE('\xc4loc') kFindByContentPluginsFolderType = FOUR_CHAR_CODE('fbcp') --- 123,132 ---- kKernelExtensionsFolderType = FOUR_CHAR_CODE('kext') kDirectoryServicesFolderType = FOUR_CHAR_CODE('dsrv') ! kDirectoryServicesPlugInsFolderType = FOUR_CHAR_CODE('dplg') ! kInstallerReceiptsFolderType = FOUR_CHAR_CODE('rcpt') ! kFileSystemSupportFolderType = FOUR_CHAR_CODE('fsys') ! kAppleShareSupportFolderType = FOUR_CHAR_CODE('shar') ! kAppleShareAuthenticationFolderType = FOUR_CHAR_CODE('auth') ! kMIDIDriversFolderType = FOUR_CHAR_CODE('midi') kLocalesFolderType = FOUR_CHAR_CODE('\xc4loc') kFindByContentPluginsFolderType = FOUR_CHAR_CODE('fbcp') Index: Fonts.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Fonts.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Fonts.py 30 Dec 2002 22:04:21 -0000 1.1 --- Fonts.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 5,8 **** --- 5,15 ---- systemFont = 0 applFont = 1 + kFMDefaultOptions = kNilOptions + kFMDefaultActivationContext = kFMDefaultOptions + kFMGlobalActivationContext = 0x00000001 + kFMLocalActivationContext = kFMDefaultActivationContext + kFMDefaultIterationScope = kFMDefaultOptions + kFMGlobalIterationScope = 0x00000001 + kFMLocalIterationScope = kFMDefaultIterationScope kPlatformDefaultGuiFontID = applFont kPlatformDefaultGuiFontID = -1 *************** *** 20,23 **** --- 27,31 ---- fxdFntHW = 45059L fontWid = 44208L + kFMUseGlobalScopeOption = 0x00000001 kFontIDNewYork = 2 kFontIDGeneva = 3 Index: Icons.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Icons.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Icons.py 30 Dec 2002 22:04:21 -0000 1.1 --- Icons.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 2,5 **** --- 2,6 ---- def FOUR_CHAR_CODE(x): return x + from Carbon.Files import * kGenericDocumentIconResource = -4000 kGenericStationeryIconResource = -3985 *************** *** 243,248 **** kGenericStationeryIcon = FOUR_CHAR_CODE('sdoc') kGenericSuitcaseIcon = FOUR_CHAR_CODE('suit') kGenericWORMIcon = FOUR_CHAR_CODE('worm') ! kInternationResourcesIcon = FOUR_CHAR_CODE('ifil') kKeyboardLayoutIcon = FOUR_CHAR_CODE('kfil') kSoundFileIcon = FOUR_CHAR_CODE('sfil') --- 244,250 ---- kGenericStationeryIcon = FOUR_CHAR_CODE('sdoc') kGenericSuitcaseIcon = FOUR_CHAR_CODE('suit') + kGenericURLIcon = FOUR_CHAR_CODE('gurl') kGenericWORMIcon = FOUR_CHAR_CODE('worm') ! kInternationalResourcesIcon = FOUR_CHAR_CODE('ifil') kKeyboardLayoutIcon = FOUR_CHAR_CODE('kfil') kSoundFileIcon = FOUR_CHAR_CODE('sfil') *************** *** 253,256 **** --- 255,259 ---- kTrueTypeMultiFlatFontIcon = FOUR_CHAR_CODE('ttcf') kUserIDiskIcon = FOUR_CHAR_CODE('udsk') + kInternationResourcesIcon = kInternationalResourcesIcon kInternetLocationHTTPIcon = FOUR_CHAR_CODE('ilht') kInternetLocationFTPIcon = FOUR_CHAR_CODE('ilft') *************** *** 280,283 **** --- 283,287 ---- kOwnerIcon = FOUR_CHAR_CODE('susr') kGroupIcon = FOUR_CHAR_CODE('grup') + kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') kAppleExtrasFolderIcon = FOUR_CHAR_CODE('aex\xc4') kAppleMenuFolderIcon = FOUR_CHAR_CODE('amnu') *************** *** 285,288 **** --- 289,293 ---- kApplicationSupportFolderIcon = FOUR_CHAR_CODE('asup') kAssistantsFolderIcon = FOUR_CHAR_CODE('ast\xc4') + kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') kContextualMenuItemsFolderIcon = FOUR_CHAR_CODE('cmnu') kControlPanelDisabledFolderIcon = FOUR_CHAR_CODE('ctrD') *************** *** 297,302 **** --- 302,309 ---- kInternetFolderIcon = FOUR_CHAR_CODE('int\xc4') kInternetPlugInFolderIcon = FOUR_CHAR_CODE('\xc4net') + kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') kLocalesFolderIcon = FOUR_CHAR_CODE('\xc4loc') kMacOSReadMeFolderIcon = FOUR_CHAR_CODE('mor\xc4') + kPublicFolderIcon = FOUR_CHAR_CODE('pubf') kPreferencesFolderIcon = FOUR_CHAR_CODE('prf\xc4') kPrinterDescriptionFolderIcon = FOUR_CHAR_CODE('ppdf') *************** *** 317,326 **** kSystemFolderIcon = FOUR_CHAR_CODE('macs') kTextEncodingsFolderIcon = FOUR_CHAR_CODE('\xc4tex') ! kAppearanceFolderIcon = FOUR_CHAR_CODE('appr') kUtilitiesFolderIcon = FOUR_CHAR_CODE('uti\xc4') kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') ! kColorSyncFolderIcon = FOUR_CHAR_CODE('prof') ! kInternetSearchSitesFolderIcon = FOUR_CHAR_CODE('issf') ! kUsersFolderIcon = FOUR_CHAR_CODE('usr\xc4') kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') --- 324,331 ---- kSystemFolderIcon = FOUR_CHAR_CODE('macs') kTextEncodingsFolderIcon = FOUR_CHAR_CODE('\xc4tex') ! kUsersFolderIcon = FOUR_CHAR_CODE('usr\xc4') kUtilitiesFolderIcon = FOUR_CHAR_CODE('uti\xc4') kVoicesFolderIcon = FOUR_CHAR_CODE('fvoc') ! kSystemFolderXIcon = FOUR_CHAR_CODE('macx') kAppleScriptBadgeIcon = FOUR_CHAR_CODE('scrp') kLockedBadgeIcon = FOUR_CHAR_CODE('lbdg') *************** *** 328,331 **** --- 333,337 ---- kSharedBadgeIcon = FOUR_CHAR_CODE('sbdg') kAliasBadgeIcon = FOUR_CHAR_CODE('abdg') + kAlertCautionBadgeIcon = FOUR_CHAR_CODE('cbdg') kAlertNoteIcon = FOUR_CHAR_CODE('note') kAlertCautionIcon = FOUR_CHAR_CODE('caut') *************** *** 338,341 **** --- 344,351 ---- kGenericNetworkIcon = FOUR_CHAR_CODE('gnet') kIPFileServerIcon = FOUR_CHAR_CODE('isrv') + kToolbarCustomizeIcon = FOUR_CHAR_CODE('tcus') + kToolbarDeleteIcon = FOUR_CHAR_CODE('tdel') + kToolbarFavoritesIcon = FOUR_CHAR_CODE('tfav') + kToolbarHomeIcon = FOUR_CHAR_CODE('thom') kAppleLogoIcon = FOUR_CHAR_CODE('capl') kAppleMenuIcon = FOUR_CHAR_CODE('sapl') *************** *** 358,361 **** --- 368,381 ---- kUnlockedIcon = FOUR_CHAR_CODE('ulck') kConnectToIcon = FOUR_CHAR_CODE('cnct') + kGenericWindowIcon = FOUR_CHAR_CODE('gwin') + kQuestionMarkIcon = FOUR_CHAR_CODE('ques') + kDeleteAliasIcon = FOUR_CHAR_CODE('dali') + kEjectMediaIcon = FOUR_CHAR_CODE('ejec') + kBurningIcon = FOUR_CHAR_CODE('burn') + kRightContainerArrowIcon = FOUR_CHAR_CODE('rcar') kIconServicesNormalUsageFlag = 0 + kIconServicesCatalogInfoMask = (kFSCatInfoNodeID | kFSCatInfoParentDirID | kFSCatInfoVolume | kFSCatInfoNodeFlags | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo | kFSCatInfoUserAccess) + kPlotIconRefNormalFlags = 0L + kPlotIconRefNoImage = (1 << 1) + kPlotIconRefNoMask = (1 << 2) kIconFamilyType = FOUR_CHAR_CODE('icns') Index: LaunchServices.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/LaunchServices.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LaunchServices.py 2 Dec 2003 23:01:41 -0000 1.1 --- LaunchServices.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 2,7 **** --- 2,9 ---- def FOUR_CHAR_CODE(x): return x + from Carbon.Files import * kLSRequestAllInfo = -1 kLSRolesAll = -1 + kLSInvalidExtensionIndex = -1 kLSUnknownErr = -10810 kLSNotAnApplicationErr = -10811 *************** *** 16,21 **** kLSAppDoesNotClaimTypeErr = -10820 kLSAppDoesNotSupportSchemeWarning = -10821 ! kLSServerCommunicationErr = -10822 kLSInitializeDefaults = 0x00000001 kLSRequestExtension = 0x00000001 kLSRequestTypeCreator = 0x00000002 --- 18,26 ---- kLSAppDoesNotClaimTypeErr = -10820 kLSAppDoesNotSupportSchemeWarning = -10821 ! kLSServerCommunicationErr = -10822 ! kLSCannotSetInfoErr = -10823 kLSInitializeDefaults = 0x00000001 + kLSMinCatInfoBitmap = (kFSCatInfoNodeFlags | kFSCatInfoParentDirID | kFSCatInfoFinderInfo | kFSCatInfoFinderXInfo) + # kLSInvalidExtensionIndex = (unsigned long)0xFFFFFFFF kLSRequestExtension = 0x00000001 kLSRequestTypeCreator = 0x00000002 *************** *** 24,27 **** --- 29,33 ---- kLSRequestAllFlags = 0x00000010 kLSRequestIconAndKind = 0x00000020 + kLSRequestExtensionFlagsOnly = 0x00000040 # kLSRequestAllInfo = (unsigned long)0xFFFFFFFF kLSItemInfoIsPlainFile = 0x00000001 *************** *** 37,50 **** kLSItemInfoAppPrefersClassic = 0x00000400 kLSItemInfoAppIsScriptable = 0x00000800 ! kLSItemInfoIsVolume = 0x00001000 kLSRolesNone = 0x00000001 kLSRolesViewer = 0x00000002 kLSRolesEditor = 0x00000004 ! # kLSRolesAll = (unsigned long)0xFFFFFFFF kLSUnknownKindID = 0 kLSUnknownType = 0 kLSUnknownCreator = 0 kLSAcceptDefault = 0x00000001 ! kLSAcceptAllowLoginUI = 0x00000002 kLSLaunchDefaults = 0x00000001 kLSLaunchAndPrint = 0x00000002 --- 43,57 ---- kLSItemInfoAppPrefersClassic = 0x00000400 kLSItemInfoAppIsScriptable = 0x00000800 ! kLSItemInfoIsVolume = 0x00001000 ! kLSItemInfoExtensionIsHidden = 0x00100000 kLSRolesNone = 0x00000001 kLSRolesViewer = 0x00000002 kLSRolesEditor = 0x00000004 ! # kLSRolesAll = (unsigned long)0xFFFFFFFF kLSUnknownKindID = 0 kLSUnknownType = 0 kLSUnknownCreator = 0 kLSAcceptDefault = 0x00000001 ! kLSAcceptAllowLoginUI = 0x00000002 kLSLaunchDefaults = 0x00000001 kLSLaunchAndPrint = 0x00000002 Index: MacTextEditor.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/MacTextEditor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MacTextEditor.py 30 Dec 2002 22:04:21 -0000 1.1 --- MacTextEditor.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 15,20 **** --- 15,23 ---- kTXNUseEncodingWordRulesMask = 0x80000000 kTXNFontSizeAttributeSize = 4 + normal = 0 kTXNWillDefaultToATSUIBit = 0 + kTXNWillDefaultToCarbonEventBit = 1 kTXNWillDefaultToATSUIMask = 1L << kTXNWillDefaultToATSUIBit + kTXNWillDefaultToCarbonEventMask = 1L << kTXNWillDefaultToCarbonEventBit kTXNWantMoviesBit = 0 kTXNWantSoundBit = 1 *************** *** 43,46 **** --- 46,50 ---- kTXNSingleLineOnlyBit = 14 kTXNDisableDragAndDropBit = 15 + kTXNUseQDforImagingBit = 16 kTXNDrawGrowIconMask = 1L << kTXNDrawGrowIconBit kTXNShowWindowMask = 1L << kTXNShowWindowBit *************** *** 59,62 **** --- 63,67 ---- kTXNSingleLineOnlyMask = 1L << kTXNSingleLineOnlyBit kTXNDisableDragAndDropMask = 1L << kTXNDisableDragAndDropBit + kTXNUseQDforImagingMask = 1L << kTXNUseQDforImagingBit kTXNSetFlushnessBit = 0 kTXNSetJustificationBit = 1 *************** *** 66,69 **** --- 71,77 ---- kTXNDontUpdateBoxRectBit = 5 kTXNDontDrawTextBit = 6 + kTXNUseCGContextRefBit = 7 + kTXNImageWithQDBit = 8 + kTXNDontWrapTextBit = 9 kTXNSetFlushnessMask = 1L << kTXNSetFlushnessBit kTXNSetJustificationMask = 1L << kTXNSetJustificationBit *************** *** 73,76 **** --- 81,87 ---- kTXNDontUpdateBoxRectMask = 1L << kTXNDontUpdateBoxRectBit kTXNDontDrawTextMask = 1L << kTXNDontDrawTextBit + kTXNUseCGContextRefMask = 1L << kTXNUseCGContextRefBit + kTXNImageWithQDMask = 1L << kTXNImageWithQDBit + kTXNDontWrapTextMask = 1L << kTXNDontWrapTextBit kTXNFontContinuousBit = 0 kTXNSizeContinuousBit = 1 *************** *** 175,185 **** kTXNUseScriptDefaultValue = -1 kTXNNoFontVariations = 0x7FFF ! # kTXNUseCurrentSelection = 0xFFFFFFFFUL ! # kTXNStartOffset = 0UL ! # kTXNEndOffset = 0x7FFFFFFFUL kTXNSingleStylePerTextDocumentResType = FOUR_CHAR_CODE('MPSR') kTXNMultipleStylesPerTextDocumentResType = FOUR_CHAR_CODE('styl') kTXNShowStart = false kTXNShowEnd = true kTXNQDFontNameAttribute = FOUR_CHAR_CODE('fntn') kTXNQDFontFamilyIDAttribute = FOUR_CHAR_CODE('font') --- 186,199 ---- kTXNUseScriptDefaultValue = -1 kTXNNoFontVariations = 0x7FFF ! # kTXNUseCurrentSelection = (unsigned long)0xFFFFFFFF ! # kTXNStartOffset = 0 ! # kTXNEndOffset = 0x7FFFFFFF kTXNSingleStylePerTextDocumentResType = FOUR_CHAR_CODE('MPSR') kTXNMultipleStylesPerTextDocumentResType = FOUR_CHAR_CODE('styl') kTXNShowStart = false kTXNShowEnd = true + kTXNDefaultFontName = 0 + kTXNDefaultFontSize = 0x000C0000 + kTXNDefaultFontStyle = normal kTXNQDFontNameAttribute = FOUR_CHAR_CODE('fntn') kTXNQDFontFamilyIDAttribute = FOUR_CHAR_CODE('font') *************** *** 211,213 **** kTXNRestartAppleEventHandlersMask = 1 << kTXNRestartAppleEventHandlersBit # status = TXNInitTextension( &defaults - # justification = LMTESysJust --- 225,226 ---- Index: Menus.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Menus.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Menus.py 30 Dec 2002 22:04:21 -0000 1.1 --- Menus.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 42,46 **** kMenuIconSuiteType = 5 kMenuIconRefType = 6 ! kMenuCGImageRefType = 7 kMenuNullGlyph = 0x00 kMenuTabRightGlyph = 0x02 --- 42,48 ---- kMenuIconSuiteType = 5 kMenuIconRefType = 6 ! kMenuCGImageRefType = 7 ! kMenuSystemIconSelectorType = 8 ! kMenuIconResourceType = 9 kMenuNullGlyph = 0x00 kMenuTabRightGlyph = 0x02 *************** *** 104,107 **** --- 106,110 ---- kMenuAttrAutoDisable = (1 << 2) kMenuAttrUsePencilGlyph = (1 << 3) + kMenuAttrHidden = (1 << 4) kMenuItemAttrDisabled = (1 << 0) kMenuItemAttrIconDisabled = (1 << 1) *************** *** 115,118 **** --- 118,123 ---- kMenuItemAttrAutoRepeat = (1 << 9) kMenuItemAttrUseVirtualKey = (1 << 10) + kMenuItemAttrCustomDraw = (1 << 11) + kMenuItemAttrIncludeInCmdKeyMatching = (1 << 12) kMenuTrackingModeMouse = 1 kMenuTrackingModeKeyboard = 2 *************** *** 149,156 **** --- 154,169 ---- gestaltContextualMenuUnusedBit = 0 gestaltContextualMenuTrapAvailable = 1 + gestaltContextualMenuHasAttributeAndModifierKeys = 2 + gestaltContextualMenuHasUnicodeSupport = 3 kCMHelpItemNoHelp = 0 kCMHelpItemAppleGuide = 1 kCMHelpItemOtherHelp = 2 + kCMHelpItemRemoveHelp = 3 kCMNothingSelected = 0 kCMMenuItemSelected = 1 kCMShowHelpSelected = 3 + keyContextualMenuName = FOUR_CHAR_CODE('pnam') + keyContextualMenuCommandID = FOUR_CHAR_CODE('cmcd') + keyContextualMenuSubmenu = FOUR_CHAR_CODE('cmsb') + keyContextualMenuAttributes = FOUR_CHAR_CODE('cmat') + keyContextualMenuModifiers = FOUR_CHAR_CODE('cmmd') Index: OSAconst.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/OSAconst.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OSAconst.py 3 Dec 2003 22:34:19 -0000 1.1 --- OSAconst.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 82,85 **** --- 82,86 ---- kOSADebuggerGetPreviousCallFrame = 0x090A kOSADebuggerDisposeCallFrame = 0x090B + kOSADebuggerCountVariables = 0x090C kOSASelectComponentSpecificStart = 0x1001 kOSAModePreventGetSource = 0x00000001 *************** *** 121,124 **** --- 122,128 ---- eStepOut = 2 eRun = 3 + eLocal = 0 + eGlobal = 1 + eProperties = 2 keyProgramState = FOUR_CHAR_CODE('dsps') typeStatementRange = FOUR_CHAR_CODE('srng') Index: QuickDraw.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/QuickDraw.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QuickDraw.py 30 Dec 2002 22:04:21 -0000 1.1 --- QuickDraw.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 71,74 **** --- 71,75 ---- gdDevType = 0 interlacedDevice = 2 + hwMirroredDevice = 4 roundedDevice = 5 hasAuxMenuBar = 6 Index: QuickTime.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/QuickTime.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** QuickTime.py 30 Dec 2002 22:04:21 -0000 1.1 --- QuickTime.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 26,29 **** --- 26,30 ---- TweenMediaType = FOUR_CHAR_CODE('twen') ThreeDeeMediaType = FOUR_CHAR_CODE('qd3d') + SkinMediaType = FOUR_CHAR_CODE('skin') HandleDataHandlerSubType = FOUR_CHAR_CODE('hndl') PointerDataHandlerSubType = FOUR_CHAR_CODE('ptr ') *************** *** 39,42 **** --- 40,45 ---- kCharacteristicCanStep = FOUR_CHAR_CODE('step') kCharacteristicHasNoDuration = FOUR_CHAR_CODE('noti') + kCharacteristicHasSkinData = FOUR_CHAR_CODE('skin') + kCharacteristicProvidesKeyFocus = FOUR_CHAR_CODE('keyf') kUserDataMovieControllerType = FOUR_CHAR_CODE('ctyp') kUserDataName = FOUR_CHAR_CODE('name') *************** *** 162,165 **** --- 165,174 ---- kActionMovieChanged = 1037 kActionMovieRestartAtTime = 1038 + kActionMovieGotoNextChapter = 1039 + kActionMovieGotoPreviousChapter = 1040 + kActionMovieGotoFirstChapter = 1041 + kActionMovieGotoLastChapter = 1042 + kActionMovieGotoChapterByIndex = 1043 + kActionMovieSetScale = 1044 kActionTrackSetVolume = 2048 kActionTrackSetBalance = 2049 *************** *** 183,186 **** --- 192,196 ---- kActionSpriteRotate = 3082 kActionSpriteStretch = 3083 + kActionSpriteSetCanBeHitTested = 3094 kActionQTVRSetPanAngle = 4096 kActionQTVRSetTiltAngle = 4097 *************** *** 191,194 **** --- 201,205 ---- kActionQTVRShowHotSpots = 4102 kActionQTVRTranslateObject = 4103 + kActionQTVRSetViewState = 4109 kActionMusicPlayNote = 5120 kActionMusicSetController = 5121 *************** *** 213,216 **** --- 224,228 ---- kActionSetFocus = 6162 kActionDontPassKeyEvent = 6163 + kActionSetRandomSeed = 6164 kActionSpriteTrackSetVariable = 7168 kActionSpriteTrackNewSprite = 7169 *************** *** 220,223 **** --- 232,238 ---- kActionSpriteTrackSetVariableToMovieURL = 7173 kActionSpriteTrackSetVariableToMovieBaseURL = 7174 + kActionSpriteTrackSetAllSpritesHitTestingMode = 7181 + kActionSpriteTrackNewImage = 7182 + kActionSpriteTrackDisposeImage = 7183 kActionApplicationNumberAndString = 8192 kActionQD3DNamedObjectTranslateTo = 9216 *************** *** 307,310 **** --- 322,333 ---- kOperandMovieName = 1036 kOperandMovieID = 1037 + kOperandMovieChapterCount = 1038 + kOperandMovieChapterIndex = 1039 + kOperandMovieChapterName = 1040 + kOperandMovieChapterNameByIndex = 1041 + kOperandMovieChapterIndexByName = 1042 + kOperandMovieAnnotation = 1043 + kOperandMovieConnectionFlags = 1044 + kOperandMovieConnectionString = 1045 kOperandTrackVolume = 2048 kOperandTrackBalance = 2049 *************** *** 343,346 **** --- 366,373 ---- kOperandSpriteTrackSpriteIDAtPoint = 3094 kOperandSpriteName = 3095 + kOperandSpriteCanBeHitTested = 3105 + kOperandSpriteTrackAllSpritesHitTestingMode = 3106 + kOperandSpriteTrackImageIDByIndex = 3107 + kOperandSpriteTrackImageIndexByID = 3108 kOperandQTVRPanAngle = 4096 kOperandQTVRTiltAngle = 4097 *************** *** 350,353 **** --- 377,382 ---- kOperandQTVRViewCenterH = 4101 kOperandQTVRViewCenterV = 4102 + kOperandQTVRViewStateCount = 4103 + kOperandQTVRViewState = 4104 kOperandMouseLocalHLoc = 5120 kOperandMouseLocalVLoc = 5121 *************** *** 385,401 **** kOperandStringConcat = 10243 kFirstMovieAction = kActionMovieSetVolume ! kLastMovieAction = kActionMovieRestartAtTime kFirstTrackAction = kActionTrackSetVolume kLastTrackAction = kActionTrackSetBassTreble kFirstSpriteAction = kActionSpriteSetMatrix ! kLastSpriteAction = kActionSpriteStretch kFirstQTVRAction = kActionQTVRSetPanAngle ! kLastQTVRAction = kActionQTVRTranslateObject kFirstMusicAction = kActionMusicPlayNote kLastMusicAction = kActionMusicSetController kFirstSystemAction = kActionCase ! kLastSystemAction = kActionDontPassKeyEvent kFirstSpriteTrackAction = kActionSpriteTrackSetVariable ! kLastSpriteTrackAction = kActionSpriteTrackSetVariableToMovieBaseURL kFirstApplicationAction = kActionApplicationNumberAndString kLastApplicationAction = kActionApplicationNumberAndString --- 414,430 ---- kOperandStringConcat = 10243 kFirstMovieAction = kActionMovieSetVolume ! kLastMovieAction = kActionMovieSetScale kFirstTrackAction = kActionTrackSetVolume kLastTrackAction = kActionTrackSetBassTreble kFirstSpriteAction = kActionSpriteSetMatrix ! kLastSpriteAction = kActionSpriteSetCanBeHitTested kFirstQTVRAction = kActionQTVRSetPanAngle ! kLastQTVRAction = kActionQTVRSetViewState kFirstMusicAction = kActionMusicPlayNote kLastMusicAction = kActionMusicSetController kFirstSystemAction = kActionCase ! kLastSystemAction = kActionSetRandomSeed kFirstSpriteTrackAction = kActionSpriteTrackSetVariable ! kLastSpriteTrackAction = kActionSpriteTrackDisposeImage kFirstApplicationAction = kActionApplicationNumberAndString kLastApplicationAction = kActionApplicationNumberAndString *************** *** 461,464 **** --- 490,494 ---- kQTEventRequestToModifyMovie = FOUR_CHAR_CODE('reqm') kQTEventListReceived = FOUR_CHAR_CODE('list') + kQTEventKeyUp = FOUR_CHAR_CODE('keyU') kActionFlagActionIsDelta = 1L << 1 kActionFlagParameterWrapsAround = 1L << 2 *************** *** 540,543 **** --- 570,574 ---- newMovieAsyncOK = 1 << 8 newMovieIdleImportOK = 1 << 10 + newMovieDontInteractWithUser = 1 << 11 trackUsageInMovie = 1 << 1 trackUsageInPreview = 1 << 2 *************** *** 595,602 **** --- 626,644 ---- hintsSingleField = 1 << 20 hintsNoRenderingTimeOut = 1 << 21 + hintsFlushVideoInsteadOfDirtying = 1 << 22 + hintsEnableSubPixelPositioning = 1L << 23 mediaHandlerFlagBaseClient = 1 movieTrackMediaType = 1 << 0 movieTrackCharacteristic = 1 << 1 movieTrackEnabledOnly = 1 << 2 + kMovieControlOptionHideController = (1L << 0) + kMovieControlOptionLocateTopLeft = (1L << 1) + kMovieControlOptionEnableEditing = (1L << 2) + kMovieControlOptionHandleEditingHI = (1L << 3) + kMovieControlOptionSetKeysEnabled = (1L << 4) + kMovieControlOptionManuallyIdled = (1L << 5) + kMovieControlDataMovieController = FOUR_CHAR_CODE('mc ') + kMovieControlDataMovie = FOUR_CHAR_CODE('moov') + kMovieControlDataManualIdling = FOUR_CHAR_CODE('manu') movieDrawingCallWhenChanged = 0 movieDrawingCallAlways = 1 *************** *** 610,613 **** --- 652,657 ---- kQTGetMIMETypeInfoIsQuickTimeMovieType = FOUR_CHAR_CODE('moov') kQTGetMIMETypeInfoIsUnhelpfulType = FOUR_CHAR_CODE('dumb') + kQTCopyUserDataReplace = FOUR_CHAR_CODE('rplc') + kQTCopyUserDataMerge = FOUR_CHAR_CODE('merg') kMovieLoadStateError = -1L kMovieLoadStateLoading = 1000 *************** *** 628,631 **** --- 672,685 ---- fullScreenPreflightSize = 1L << 3 movieExecuteWiredActionDontExecute = 1L << 0 + kRefConNavigationNext = 0 + kRefConNavigationPrevious = 1 + kRefConPropertyCanHaveFocus = 1 + kRefConPropertyHasFocus = 2 + kTrackFocusCanEditFlag = FOUR_CHAR_CODE('kedt') + kTrackDefaultFocusFlags = FOUR_CHAR_CODE('kfoc') + kTrackFocusDefaultRefcon = FOUR_CHAR_CODE('kref') + kTrackFocusOn = 1 + kTrackHandlesTabs = 2 + kFlashTrackPropertyAcceptAllClicks = FOUR_CHAR_CODE('clik') kBackgroundSpriteLayerNum = 32767 kSpritePropertyMatrix = 1 *************** *** 637,640 **** --- 691,695 ---- kSpritePropertyImageDataSize = 7 kSpritePropertyActionHandlingSpriteID = 8 + kSpritePropertyCanBeHitTested = 9 kSpritePropertyImageIndex = 100 kSpriteTrackPropertyBackgroundColor = 101 *************** *** 645,651 **** --- 700,715 ---- kSpriteTrackPropertyVisible = 106 kSpriteTrackPropertyQTIdleEventsFrequency = 107 + kSpriteTrackPropertyAllSpritesHitTestingMode = 108 + kSpriteTrackPropertyPreferredDepthInterpretationMode = 109 kSpriteImagePropertyRegistrationPoint = 1000 kSpriteImagePropertyGroupID = 1001 + kSpriteTrackPreferredDepthCompatibilityMode = 0 + kSpriteTrackPreferredDepthModernMode = 1 + kSpriteHitTestUseSpritesOwnPropertiesMode = 0 + kSpriteHitTestTreatAllSpritesAsHitTestableMode = 1 + kSpriteHitTestTreatAllSpritesAsNotHitTestableMode = 2 kNoQTIdleEvents = -1 + kGetSpriteWorldInvalidRegionAndLeaveIntact = -1L + kGetSpriteWorldInvalidRegionAndThenSetEmpty = -2L kOnlyDrawToSpriteWorld = 1L << 0 kSpriteWorldPreflight = 1L << 1 *************** *** 658,662 **** --- 722,729 ---- kSpriteWorldDontAutoInvalidate = 1L << 3 kSpriteWorldInvisible = 1L << 4 + kSpriteWorldDirtyInsteadOfFlush = 1L << 5 kParentAtomIsContainer = 0 + kTweenRecordNoFlags = 0 + kTweenRecordIsAtInterruptTime = 0x00000001 kEffectNameAtom = FOUR_CHAR_CODE('name') kEffectTypeAtom = FOUR_CHAR_CODE('type') *************** *** 674,682 **** pdActionConductStopAlert = 11 pdActionModelessCallback = 12 ! pdActionFetchPreview = 13 elOptionsIncludeNoneInList = 0x00000001 pdOptionsCollectOneValue = 0x00000001 pdOptionsAllowOptionalInterpolations = 0x00000002 ! pdOptionsModalDialogBox = 0x00000004 effectIsRealtime = 0 kAccessKeyAtomType = FOUR_CHAR_CODE('acky') --- 741,779 ---- pdActionConductStopAlert = 11 pdActionModelessCallback = 12 ! pdActionFetchPreview = 13 ! pdActionSetDialogSettings = 14 ! pdActionGetDialogSettings = 15 ! pdActionGetNextSample = 16 ! pdActionGetPreviousSample = 17 ! pdActionCompactSample = 18 ! pdActionSetEditCallout = 19 ! pdActionSetSampleTime = 20 ! pdActionDoEditCommand = 21 ! pdActionGetSubPanelMenuValue = 22 ! pdActionCustomNewControl = 23 ! pdActionCustomDisposeControl = 24 ! pdActionCustomPositionControl = 25 ! pdActionCustomShowHideControl = 26 ! pdActionCustomHandleEvent = 27 ! pdActionCustomSetFocus = 28 ! pdActionCustomSetEditMenu = 29 ! pdActionCustomSetPreviewPicture = 30 ! pdActionCustomSetEditCallout = 31 ! pdActionCustomGetEnableValue = 32 ! pdActionCustomSetSampleTime = 33 ! pdActionCustomGetValue = 34 ! pdActionCustomDoEditCommand = 35 ! pdSampleTimeDisplayOptionsNone = 0x00000000 ! pdActionFocusOff = 0 ! pdActionFocusFirst = 1 ! pdActionFocusLast = 2 ! pdActionFocusForward = 3 ! pdActionFocusBackward = 4 elOptionsIncludeNoneInList = 0x00000001 pdOptionsCollectOneValue = 0x00000001 pdOptionsAllowOptionalInterpolations = 0x00000002 ! pdOptionsModalDialogBox = 0x00000004 ! pdOptionsEditCurrentEffectOnly = 0x00000008 ! pdOptionsHidePreview = 0x00000010 effectIsRealtime = 0 kAccessKeyAtomType = FOUR_CHAR_CODE('acky') *************** *** 739,742 **** --- 836,840 ---- kTrackModifierVerticalFieldOfViewAngle = FOUR_CHAR_CODE('fov ') kTrackModifierObjectQTEventSend = FOUR_CHAR_CODE('evnt') + kTrackModifierObjectCanBeHitTested = 15 kTweenTypeShort = 1 kTweenTypeLong = 2 *************** *** 793,796 **** --- 891,906 ---- kNonLinearTweenHeader = FOUR_CHAR_CODE('nlth') kTweenReturnDelta = 1L << 0 + kQTRestrictionClassSave = FOUR_CHAR_CODE('save') + kQTRestrictionSaveDontAddMovieResource = (1L << 0) + kQTRestrictionSaveDontFlatten = (1L << 1) + kQTRestrictionSaveDontExport = (1L << 2) + kQTRestrictionSaveDontExtract = (1L << 3) + kQTRestrictionClassEdit = FOUR_CHAR_CODE('edit') + kQTRestrictionEditDontCopy = (1L << 0) + kQTRestrictionEditDontCut = (1L << 1) + kQTRestrictionEditDontPaste = (1L << 2) + kQTRestrictionEditDontClear = (1L << 3) + kQTRestrictionEditDontModify = (1L << 4) + kQTRestrictionEditDontExtract = (1L << 5) videoFlagDontLeanAhead = 1L << 0 txtProcDefaultDisplay = 0 *************** *** 808,812 **** spriteHitTestInvisibleSprites = 1L << 2 spriteHitTestIsClick = 1L << 3 ! spriteHitTestLocInDisplayCoordinates = 1L << 4 kSpriteAtomType = FOUR_CHAR_CODE('sprt') kSpriteImagesContainerAtomType = FOUR_CHAR_CODE('imct') --- 918,923 ---- spriteHitTestInvisibleSprites = 1L << 2 spriteHitTestIsClick = 1L << 3 ! spriteHitTestLocInDisplayCoordinates = 1L << 4 ! spriteHitTestTreatAllSpritesAsHitTestable = 1L << 5 kSpriteAtomType = FOUR_CHAR_CODE('sprt') kSpriteImagesContainerAtomType = FOUR_CHAR_CODE('imct') *************** *** 1010,1013 **** --- 1121,1125 ---- kQTCursorUpArrow = -19177 kQTCursorIBeam = -19176 + kControllerUnderstandsIdleManagers = 1 << 0 kVideoMediaResetStatisticsSelect = 0x0105 kVideoMediaGetStatisticsSelect = 0x0106 *************** *** 1050,1053 **** --- 1162,1169 ---- kSpriteMediaSetActionVariableToStringSelect = 0x0116 kSpriteMediaGetActionVariableAsStringSelect = 0x0117 + kSpriteMediaNewImageSelect = 0x011B + kSpriteMediaDisposeImageSelect = 0x011C + kSpriteMediaImageIndexToIDSelect = 0x011D + kSpriteMediaImageIDToIndexSelect = 0x011E kFlashMediaSetPanSelect = 0x0101 kFlashMediaSetZoomSelect = 0x0102 *************** *** 1132,1134 **** --- 1248,1252 ---- kMCAddMovieSegmentSelect = 0x0033 kMCTrimMovieSegmentSelect = 0x0034 + kMCSetIdleManagerSelect = 0x0035 + kMCSetControllerCapabilitiesSelect = 0x0036 kMusicMediaGetIndexedTunePlayerSelect = 0x0101 Index: Windows.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon/Windows.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Windows.py 30 Dec 2002 22:04:21 -0000 1.1 --- Windows.py 5 Dec 2003 23:59:37 -0000 1.2 *************** *** 4,22 **** false = 0 true = 1 ! kAlertWindowClass = 1L ! kMovableAlertWindowClass = 2L ! kModalWindowClass = 3L ! kMovableModalWindowClass = 4L ! kFloatingWindowClass = 5L ! kDocumentWindowClass = 6L ! kUtilityWindowClass = 8L ! kHelpWindowClass = 10L ! kSheetWindowClass = 11L ! kToolbarWindowClass = 12L ! kPlainWindowClass = 13L ! kOverlayWindowClass = 14L ! kSheetAlertWindowClass = 15L ! kAltPlainWindowClass = 16L ! # kAllWindowClasses = (unsigned long)0xFFFFFFFF kWindowNoAttributes = 0L kWindowCloseBoxAttribute = (1L << 0) --- 4,24 ---- false = 0 true = 1 ! kWindowNoConstrainAttribute = 0x80000000 ! kAlertWindowClass = 1 ! kMovableAlertWindowClass = 2 ! kModalWindowClass = 3 ! kMovableModalWindowClass = 4 ! kFloatingWindowClass = 5 ! kDocumentWindowClass = 6 ! kUtilityWindowClass = 8 ! kHelpWindowClass = 10 ! kSheetWindowClass = 11 ! kToolbarWindowClass = 12 ! kPlainWindowClass = 13 ! kOverlayWindowClass = 14 ! kSheetAlertWindowClass = 15 ! kAltPlainWindowClass = 16 ! kDrawerWindowClass = 20 ! # kAllWindowClasses = (unsigned long)0xFFFFFFFF kWindowNoAttributes = 0L kWindowCloseBoxAttribute = (1L << 0) *************** *** 27,30 **** --- 29,33 ---- kWindowResizableAttribute = (1L << 4) kWindowSideTitlebarAttribute = (1L << 5) + kWindowToolbarButtonAttribute = (1L << 6) kWindowNoUpdatesAttribute = (1L << 16) kWindowNoActivatesAttribute = (1L << 17) *************** *** 36,39 **** --- 39,43 ---- kWindowInWindowMenuAttribute = (1L << 27) kWindowLiveResizeAttribute = (1L << 28) + # kWindowNoConstrainAttribute = (unsigned long)((1L << 31)) kWindowStandardDocumentAttributes = (kWindowCloseBoxAttribute | kWindowFullZoomAttribute | kWindowCollapseBoxAttribute | kWindowResizableAttribute) kWindowStandardFloatingAttributes = (kWindowCloseBoxAttribute | kWindowCollapseBoxAttribute) *************** *** 120,132 **** kWindowAlertPositionParentWindowScreen = 0x700A kWindowStaggerParentWindowScreen = 0x780A ! kWindowCenterOnMainScreen = 0x00000001 ! kWindowCenterOnParentWindow = 0x00000002 ! kWindowCenterOnParentWindowScreen = 0x00000003 ! kWindowCascadeOnMainScreen = 0x00000004 ! kWindowCascadeOnParentWindow = 0x00000005 ! kWindowCascadeOnParentWindowScreen = 0x00000006 ! kWindowAlertPositionOnMainScreen = 0x00000007 ! kWindowAlertPositionOnParentWindow = 0x00000008 ! kWindowAlertPositionOnParentWindowScreen = 0x00000009 kWindowTitleBarRgn = 0 kWindowTitleTextRgn = 1 --- 124,137 ---- kWindowAlertPositionParentWindowScreen = 0x700A kWindowStaggerParentWindowScreen = 0x780A ! kWindowCenterOnMainScreen = 1 ! kWindowCenterOnParentWindow = 2 ! kWindowCenterOnParentWindowScreen = 3 ! kWindowCascadeOnMainScreen = 4 ! kWindowCascadeOnParentWindow = 5 ! kWindowCascadeOnParentWindowScreen = 6 ! kWindowCascadeStartAtParentWindowScreen = 10 ! kWindowAlertPositionOnMainScreen = 7 ! kWindowAlertPositionOnParentWindow = 8 ! kWindowAlertPositionOnParentWindowScreen = 9 kWindowTitleBarRgn = 0 kWindowTitleTextRgn = 1 *************** *** 157,161 **** inZoomOut = 8 inCollapseBox = 11 ! inProxyIcon = 12 wNoHit = 0 wInContent = 1 --- 162,168 ---- inZoomOut = 8 inCollapseBox = 11 ! inProxyIcon = 12 ! inToolbarButton = 13 ! inStructure = 15 wNoHit = 0 wInContent = 1 *************** *** 166,170 **** wInZoomOut = 6 wInCollapseBox = 9 ! wInProxyIcon = 10 kWindowMsgDraw = 0 kWindowMsgHitTest = 1 --- 173,179 ---- wInZoomOut = 6 wInCollapseBox = 9 ! wInProxyIcon = 10 ! wInToolbarButton = 11 ! wInStructure = 13 kWindowMsgDraw = 0 kWindowMsgHitTest = 1 *************** *** 228,232 **** kWindowModalityAppModal = 2 kWindowModalityWindowModal = 3 - windowGroupInvalidErr = -5616 kWindowGroupAttrSelectAsLayer = 1 << 0 kWindowGroupAttrMoveTogether = 1 << 1 --- 237,240 ---- *************** *** 246,261 **** kScrollWindowInvalidate = (1L << 0) kScrollWindowEraseToPortBackground = (1L << 1) kWindowZoomTransitionEffect = 1 kWindowSheetTransitionEffect = 2 ! kWindowSlideTransitionEffect = 3 kWindowShowTransitionAction = 1 kWindowHideTransitionAction = 2 kWindowMoveTransitionAction = 3 ! kWindowResizeTransitionAction = 4 kWindowConstrainMayResize = (1L << 0) kWindowConstrainMoveRegardlessOfFit = (1L << 1) kWindowConstrainAllowPartial = (1L << 2) kWindowConstrainCalcOnly = (1L << 3) kWindowConstrainStandardOptions = kWindowConstrainMoveRegardlessOfFit kWindowPropertyPersistent = 0x00000001 kWindowGroupAttrSelectable = kWindowGroupAttrSelectAsLayer --- 254,277 ---- kScrollWindowInvalidate = (1L << 0) kScrollWindowEraseToPortBackground = (1L << 1) + kWindowMenuIncludeRotate = 1 << 0 kWindowZoomTransitionEffect = 1 kWindowSheetTransitionEffect = 2 ! kWindowSlideTransitionEffect = 3 kWindowShowTransitionAction = 1 kWindowHideTransitionAction = 2 kWindowMoveTransitionAction = 3 ! kWindowResizeTransitionAction = 4 kWindowConstrainMayResize = (1L << 0) kWindowConstrainMoveRegardlessOfFit = (1L << 1) kWindowConstrainAllowPartial = (1L << 2) kWindowConstrainCalcOnly = (1L << 3) + kWindowConstrainUseTransitionWindow = (1L << 4) kWindowConstrainStandardOptions = kWindowConstrainMoveRegardlessOfFit + kWindowLatentVisibleFloater = 1 << 0 + kWindowLatentVisibleSuspend = 1 << 1 + kWindowLatentVisibleFullScreen = 1 << 2 + kWindowLatentVisibleAppHidden = 1 << 3 + kWindowLatentVisibleCollapsedOwner = 1 << 4 + kWindowLatentVisibleCollapsedGroup = 1 << 5 kWindowPropertyPersistent = 0x00000001 kWindowGroupAttrSelectable = kWindowGroupAttrSelectAsLayer From jackjansen at users.sourceforge.net Fri Dec 5 19:00:21 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri Dec 5 19:00:26 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/menu _Menumodule.c, 1.19, 1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/menu In directory sc8-pr-cvs1:/tmp/cvs-serv1524/menu Modified Files: _Menumodule.c Log Message: Finished update to UH 3.4.2. Index: _Menumodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/menu/_Menumodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _Menumodule.c 20 Nov 2003 13:30:58 -0000 1.19 --- _Menumodule.c 6 Dec 2003 00:00:04 -0000 1.20 *************** *** 121,125 **** { PyObject *_res = NULL; ! short _rv; #ifndef CountMenuItems PyMac_PRECHECK(CountMenuItems); --- 121,125 ---- { PyObject *_res = NULL; ! UInt16 _rv; #ifndef CountMenuItems PyMac_PRECHECK(CountMenuItems); *************** *** 128,132 **** return NULL; _rv = CountMenuItems(_self->ob_itself); ! _res = Py_BuildValue("h", _rv); return _res; --- 128,132 ---- return NULL; _rv = CountMenuItems(_self->ob_itself); ! _res = Py_BuildValue("H", _rv); return _res; *************** *** 1974,1986 **** PyObject *_res = NULL; Boolean _rv; ! MenuItemIndex item; #ifndef IsMenuItemInvalid PyMac_PRECHECK(IsMenuItemInvalid); #endif if (!PyArg_ParseTuple(_args, "h", ! &item)) return NULL; _rv = IsMenuItemInvalid(_self->ob_itself, ! item); _res = Py_BuildValue("b", _rv); --- 1974,1986 ---- PyObject *_res = NULL; Boolean _rv; ! MenuItemIndex inItem; #ifndef IsMenuItemInvalid PyMac_PRECHECK(IsMenuItemInvalid); #endif if (!PyArg_ParseTuple(_args, "h", ! &inItem)) return NULL; _rv = IsMenuItemInvalid(_self->ob_itself, ! inItem); _res = Py_BuildValue("b", _rv); *************** *** 1992,2007 **** PyObject *_res = NULL; OSStatus _err; ! MenuItemIndex firstItem; ! ItemCount numItems; #ifndef InvalidateMenuItems PyMac_PRECHECK(InvalidateMenuItems); #endif if (!PyArg_ParseTuple(_args, "hl", ! &firstItem, ! &numItems)) return NULL; _err = InvalidateMenuItems(_self->ob_itself, ! firstItem, ! numItems); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); --- 1992,2007 ---- PyObject *_res = NULL; OSStatus _err; ! MenuItemIndex inFirstItem; ! ItemCount inNumItems; #ifndef InvalidateMenuItems PyMac_PRECHECK(InvalidateMenuItems); #endif if (!PyArg_ParseTuple(_args, "hl", ! &inFirstItem, ! &inNumItems)) return NULL; _err = InvalidateMenuItems(_self->ob_itself, ! inFirstItem, ! inNumItems); if (_err != noErr) return PyMac_Error(_err); Py_INCREF(Py_None); *************** *** 2303,2307 **** PyDoc_STR("() -> None")}, {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1, ! PyDoc_STR("() -> (short _rv)")}, {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1, PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")}, --- 2303,2307 ---- PyDoc_STR("() -> None")}, {"CountMenuItems", (PyCFunction)MenuObj_CountMenuItems, 1, ! PyDoc_STR("() -> (UInt16 _rv)")}, {"GetMenuFont", (PyCFunction)MenuObj_GetMenuFont, 1, PyDoc_STR("() -> (SInt16 outFontID, UInt16 outFontSize)")}, *************** *** 2487,2493 **** PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, {"IsMenuItemInvalid", (PyCFunction)MenuObj_IsMenuItemInvalid, 1, ! PyDoc_STR("(MenuItemIndex item) -> (Boolean _rv)")}, {"InvalidateMenuItems", (PyCFunction)MenuObj_InvalidateMenuItems, 1, ! PyDoc_STR("(MenuItemIndex firstItem, ItemCount numItems) -> None")}, {"UpdateInvalidMenuItems", (PyCFunction)MenuObj_UpdateInvalidMenuItems, 1, PyDoc_STR("() -> None")}, --- 2487,2493 ---- PyDoc_STR("(MenuCommand inCommandID, OSType inPropertyCreator, OSType inPropertyTag) -> None")}, {"IsMenuItemInvalid", (PyCFunction)MenuObj_IsMenuItemInvalid, 1, ! PyDoc_STR("(MenuItemIndex inItem) -> (Boolean _rv)")}, {"InvalidateMenuItems", (PyCFunction)MenuObj_InvalidateMenuItems, 1, ! PyDoc_STR("(MenuItemIndex inFirstItem, ItemCount inNumItems) -> None")}, {"UpdateInvalidMenuItems", (PyCFunction)MenuObj_UpdateInvalidMenuItems, 1, PyDoc_STR("() -> None")}, From jackjansen at users.sourceforge.net Fri Dec 5 19:00:22 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri Dec 5 19:00:28 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/qd _Qdmodule.c, 1.19, 1.20 qdscan.py, 1.29, 1.30 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/qd In directory sc8-pr-cvs1:/tmp/cvs-serv1524/qd Modified Files: _Qdmodule.c qdscan.py Log Message: Finished update to UH 3.4.2. Index: _Qdmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/_Qdmodule.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** _Qdmodule.c 20 Nov 2003 13:30:58 -0000 1.19 --- _Qdmodule.c 6 Dec 2003 00:00:14 -0000 1.20 *************** *** 142,145 **** --- 142,163 ---- } + static PyObject *GrafObj_QDSwapPort(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Boolean _rv; + CGrafPtr outOldPort; + #ifndef QDSwapPort + PyMac_PRECHECK(QDSwapPort); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = QDSwapPort(_self->ob_itself, + &outOldPort); + _res = Py_BuildValue("bO&", + _rv, + GrafObj_New, outOldPort); + return _res; + } + static PyObject *GrafObj_IsValidPort(GrafPortObject *_self, PyObject *_args) { *************** *** 601,604 **** --- 619,740 ---- } + static PyObject *GrafObj_IsPortVisibleRegionEmpty(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Boolean _rv; + #ifndef IsPortVisibleRegionEmpty + PyMac_PRECHECK(IsPortVisibleRegionEmpty); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsPortVisibleRegionEmpty(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; + } + + static PyObject *GrafObj_IsPortClipRegionEmpty(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Boolean _rv; + #ifndef IsPortClipRegionEmpty + PyMac_PRECHECK(IsPortClipRegionEmpty); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsPortClipRegionEmpty(_self->ob_itself); + _res = Py_BuildValue("b", + _rv); + return _res; + } + + static PyObject *GrafObj_SectRegionWithPortClipRegion(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + RgnHandle ioRegion; + #ifndef SectRegionWithPortClipRegion + PyMac_PRECHECK(SectRegionWithPortClipRegion); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &ioRegion)) + return NULL; + SectRegionWithPortClipRegion(_self->ob_itself, + ioRegion); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + + static PyObject *GrafObj_SectRegionWithPortVisibleRegion(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + RgnHandle ioRegion; + #ifndef SectRegionWithPortVisibleRegion + PyMac_PRECHECK(SectRegionWithPortVisibleRegion); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &ioRegion)) + return NULL; + SectRegionWithPortVisibleRegion(_self->ob_itself, + ioRegion); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + + static PyObject *GrafObj_SwapPortPicSaveHandle(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Handle _rv; + Handle inPicSaveHdl; + #ifndef SwapPortPicSaveHandle + PyMac_PRECHECK(SwapPortPicSaveHandle); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &inPicSaveHdl)) + return NULL; + _rv = SwapPortPicSaveHandle(_self->ob_itself, + inPicSaveHdl); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + + static PyObject *GrafObj_SwapPortPolySaveHandle(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Handle _rv; + Handle inPolySaveHdl; + #ifndef SwapPortPolySaveHandle + PyMac_PRECHECK(SwapPortPolySaveHandle); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &inPolySaveHdl)) + return NULL; + _rv = SwapPortPolySaveHandle(_self->ob_itself, + inPolySaveHdl); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + + static PyObject *GrafObj_SwapPortRegionSaveHandle(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Handle _rv; + Handle inRegionSaveHdl; + #ifndef SwapPortRegionSaveHandle + PyMac_PRECHECK(SwapPortRegionSaveHandle); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, &inRegionSaveHdl)) + return NULL; + _rv = SwapPortRegionSaveHandle(_self->ob_itself, + inRegionSaveHdl); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + static PyObject *GrafObj_SetPortBounds(GrafPortObject *_self, PyObject *_args) { *************** *** 635,638 **** --- 771,842 ---- } + static PyObject *GrafObj_SetPortTextFont(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + short txFont; + #ifndef SetPortTextFont + PyMac_PRECHECK(SetPortTextFont); + #endif + if (!PyArg_ParseTuple(_args, "h", + &txFont)) + return NULL; + SetPortTextFont(_self->ob_itself, + txFont); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + + static PyObject *GrafObj_SetPortTextSize(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + short txSize; + #ifndef SetPortTextSize + PyMac_PRECHECK(SetPortTextSize); + #endif + if (!PyArg_ParseTuple(_args, "h", + &txSize)) + return NULL; + SetPortTextSize(_self->ob_itself, + txSize); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + + static PyObject *GrafObj_SetPortTextFace(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + StyleParameter face; + #ifndef SetPortTextFace + PyMac_PRECHECK(SetPortTextFace); + #endif + if (!PyArg_ParseTuple(_args, "h", + &face)) + return NULL; + SetPortTextFace(_self->ob_itself, + face); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + + static PyObject *GrafObj_SetPortTextMode(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + short mode; + #ifndef SetPortTextMode + PyMac_PRECHECK(SetPortTextMode); + #endif + if (!PyArg_ParseTuple(_args, "h", + &mode)) + return NULL; + SetPortTextMode(_self->ob_itself, + mode); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyObject *GrafObj_SetPortVisibleRegion(GrafPortObject *_self, PyObject *_args) { *************** *** 785,788 **** --- 989,1094 ---- } + static PyObject *GrafObj_QDLocalToGlobalPoint(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Point point; + #ifndef QDLocalToGlobalPoint + PyMac_PRECHECK(QDLocalToGlobalPoint); + #endif + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetPoint, &point)) + return NULL; + QDLocalToGlobalPoint(_self->ob_itself, + &point); + _res = Py_BuildValue("O&", + PyMac_BuildPoint, point); + return _res; + } + + static PyObject *GrafObj_QDGlobalToLocalPoint(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Point point; + #ifndef QDGlobalToLocalPoint + PyMac_PRECHECK(QDGlobalToLocalPoint); + #endif + if (!PyArg_ParseTuple(_args, "O&", + PyMac_GetPoint, &point)) + return NULL; + QDGlobalToLocalPoint(_self->ob_itself, + &point); + _res = Py_BuildValue("O&", + PyMac_BuildPoint, point); + return _res; + } + + static PyObject *GrafObj_QDLocalToGlobalRect(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Rect bounds; + #ifndef QDLocalToGlobalRect + PyMac_PRECHECK(QDLocalToGlobalRect); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + QDLocalToGlobalRect(_self->ob_itself, + &bounds); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &bounds); + return _res; + } + + static PyObject *GrafObj_QDGlobalToLocalRect(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Rect bounds; + #ifndef QDGlobalToLocalRect + PyMac_PRECHECK(QDGlobalToLocalRect); + #endif + if (!PyArg_ParseTuple(_args, "")) + return NULL; + QDGlobalToLocalRect(_self->ob_itself, + &bounds); + _res = Py_BuildValue("O&", + PyMac_BuildRect, &bounds); + return _res; + } + + static PyObject *GrafObj_QDLocalToGlobalRegion(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + RgnHandle _rv; + RgnHandle region; + #ifndef QDLocalToGlobalRegion + PyMac_PRECHECK(QDLocalToGlobalRegion); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, ®ion)) + return NULL; + _rv = QDLocalToGlobalRegion(_self->ob_itself, + region); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + + static PyObject *GrafObj_QDGlobalToLocalRegion(GrafPortObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + RgnHandle _rv; + RgnHandle region; + #ifndef QDGlobalToLocalRegion + PyMac_PRECHECK(QDGlobalToLocalRegion); + #endif + if (!PyArg_ParseTuple(_args, "O&", + ResObj_Convert, ®ion)) + return NULL; + _rv = QDGlobalToLocalRegion(_self->ob_itself, + region); + _res = Py_BuildValue("O&", + ResObj_New, _rv); + return _res; + } + static PyObject *GrafObj_QDIsPortBuffered(GrafPortObject *_self, PyObject *_args) { *************** *** 873,876 **** --- 1179,1184 ---- {"MacSetPort", (PyCFunction)GrafObj_MacSetPort, 1, PyDoc_STR("() -> None")}, + {"QDSwapPort", (PyCFunction)GrafObj_QDSwapPort, 1, + PyDoc_STR("() -> (Boolean _rv, CGrafPtr outOldPort)")}, {"IsValidPort", (PyCFunction)GrafObj_IsValidPort, 1, PyDoc_STR("() -> (Boolean _rv)")}, *************** *** 931,938 **** --- 1239,1268 ---- {"IsPortColor", (PyCFunction)GrafObj_IsPortColor, 1, PyDoc_STR("() -> (Boolean _rv)")}, + {"IsPortVisibleRegionEmpty", (PyCFunction)GrafObj_IsPortVisibleRegionEmpty, 1, + PyDoc_STR("() -> (Boolean _rv)")}, + {"IsPortClipRegionEmpty", (PyCFunction)GrafObj_IsPortClipRegionEmpty, 1, + PyDoc_STR("() -> (Boolean _rv)")}, + {"SectRegionWithPortClipRegion", (PyCFunction)GrafObj_SectRegionWithPortClipRegion, 1, + PyDoc_STR("(RgnHandle ioRegion) -> None")}, + {"SectRegionWithPortVisibleRegion", (PyCFunction)GrafObj_SectRegionWithPortVisibleRegion, 1, + PyDoc_STR("(RgnHandle ioRegion) -> None")}, + {"SwapPortPicSaveHandle", (PyCFunction)GrafObj_SwapPortPicSaveHandle, 1, + PyDoc_STR("(Handle inPicSaveHdl) -> (Handle _rv)")}, + {"SwapPortPolySaveHandle", (PyCFunction)GrafObj_SwapPortPolySaveHandle, 1, + PyDoc_STR("(Handle inPolySaveHdl) -> (Handle _rv)")}, + {"SwapPortRegionSaveHandle", (PyCFunction)GrafObj_SwapPortRegionSaveHandle, 1, + PyDoc_STR("(Handle inRegionSaveHdl) -> (Handle _rv)")}, {"SetPortBounds", (PyCFunction)GrafObj_SetPortBounds, 1, PyDoc_STR("(Rect rect) -> None")}, {"SetPortOpColor", (PyCFunction)GrafObj_SetPortOpColor, 1, PyDoc_STR("(RGBColor opColor) -> None")}, + {"SetPortTextFont", (PyCFunction)GrafObj_SetPortTextFont, 1, + PyDoc_STR("(short txFont) -> None")}, + {"SetPortTextSize", (PyCFunction)GrafObj_SetPortTextSize, 1, + PyDoc_STR("(short txSize) -> None")}, + {"SetPortTextFace", (PyCFunction)GrafObj_SetPortTextFace, 1, + PyDoc_STR("(StyleParameter face) -> None")}, + {"SetPortTextMode", (PyCFunction)GrafObj_SetPortTextMode, 1, + PyDoc_STR("(short mode) -> None")}, {"SetPortVisibleRegion", (PyCFunction)GrafObj_SetPortVisibleRegion, 1, PyDoc_STR("(RgnHandle visRgn) -> None")}, *************** *** 953,956 **** --- 1283,1298 ---- {"DisposePort", (PyCFunction)GrafObj_DisposePort, 1, PyDoc_STR("() -> None")}, + {"QDLocalToGlobalPoint", (PyCFunction)GrafObj_QDLocalToGlobalPoint, 1, + PyDoc_STR("(Point point) -> (Point point)")}, + {"QDGlobalToLocalPoint", (PyCFunction)GrafObj_QDGlobalToLocalPoint, 1, + PyDoc_STR("(Point point) -> (Point point)")}, + {"QDLocalToGlobalRect", (PyCFunction)GrafObj_QDLocalToGlobalRect, 1, + PyDoc_STR("() -> (Rect bounds)")}, + {"QDGlobalToLocalRect", (PyCFunction)GrafObj_QDGlobalToLocalRect, 1, + PyDoc_STR("() -> (Rect bounds)")}, + {"QDLocalToGlobalRegion", (PyCFunction)GrafObj_QDLocalToGlobalRegion, 1, + PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")}, + {"QDGlobalToLocalRegion", (PyCFunction)GrafObj_QDGlobalToLocalRegion, 1, + PyDoc_STR("(RgnHandle region) -> (RgnHandle _rv)")}, {"QDIsPortBuffered", (PyCFunction)GrafObj_QDIsPortBuffered, 1, PyDoc_STR("() -> (Boolean _rv)")}, Index: qdscan.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/qd/qdscan.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** qdscan.py 12 Dec 2002 10:31:52 -0000 1.29 --- qdscan.py 6 Dec 2003 00:00:17 -0000 1.30 *************** *** 121,124 **** --- 121,125 ---- def makeblacklisttypes(self): return [ + "QDRegionBitsRef", # Should do this, but too lazy now. 'CIconHandle', # Obsolete 'CQDProcs', *************** *** 215,218 **** --- 216,231 ---- ([('Pattern_ptr', '*', 'ReturnMode')], + [('void', '*', 'ReturnMode')]), + + ([('Point_ptr', 'QDLocalToGlobalPoint', 'ReturnMode')], + [('void', '*', 'ReturnMode')]), + + ([('Rect_ptr', 'QDLocalToGlobalRect', 'ReturnMode')], + [('void', '*', 'ReturnMode')]), + + ([('Point_ptr', 'QDGlobalToLocalPoint', 'ReturnMode')], + [('void', '*', 'ReturnMode')]), + + ([('Rect_ptr', 'QDGlobalToLocalRect', 'ReturnMode')], [('void', '*', 'ReturnMode')]), From jackjansen at users.sourceforge.net Fri Dec 5 19:00:35 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri Dec 5 19:00:45 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/carbonevt _CarbonEvtmodule.c, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/carbonevt In directory sc8-pr-cvs1:/tmp/cvs-serv1524/carbonevt Modified Files: _CarbonEvtmodule.c Log Message: Finished update to UH 3.4.2. Index: _CarbonEvtmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/carbonevt/_CarbonEvtmodule.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** _CarbonEvtmodule.c 20 Nov 2003 13:30:56 -0000 1.16 --- _CarbonEvtmodule.c 6 Dec 2003 00:00:00 -0000 1.17 *************** *** 1751,1754 **** --- 1751,1783 ---- } + static PyObject *CarbonEvents_IsMouseCoalescingEnabled(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + Boolean _rv; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _rv = IsMouseCoalescingEnabled(); + _res = Py_BuildValue("b", + _rv); + return _res; + } + + static PyObject *CarbonEvents_SetMouseCoalescingEnabled(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + Boolean inNewState; + Boolean outOldState; + if (!PyArg_ParseTuple(_args, "b", + &inNewState)) + return NULL; + _err = SetMouseCoalescingEnabled(inNewState, + &outOldState); + if (_err != noErr) return PyMac_Error(_err); + _res = Py_BuildValue("b", + outOldState); + return _res; + } + static PyObject *CarbonEvents_GetWindowEventTarget(PyObject *_self, PyObject *_args) { *************** *** 2060,2063 **** --- 2089,2096 ---- {"GetLastUserEventTime", (PyCFunction)CarbonEvents_GetLastUserEventTime, 1, PyDoc_STR("() -> (double _rv)")}, + {"IsMouseCoalescingEnabled", (PyCFunction)CarbonEvents_IsMouseCoalescingEnabled, 1, + PyDoc_STR("() -> (Boolean _rv)")}, + {"SetMouseCoalescingEnabled", (PyCFunction)CarbonEvents_SetMouseCoalescingEnabled, 1, + PyDoc_STR("(Boolean inNewState) -> (Boolean outOldState)")}, {"GetWindowEventTarget", (PyCFunction)CarbonEvents_GetWindowEventTarget, 1, PyDoc_STR("(WindowPtr inWindow) -> (EventTargetRef _rv)")}, From jackjansen at users.sourceforge.net Fri Dec 5 19:00:38 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Fri Dec 5 19:00:47 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/help _Helpmodule.c, 1.11, 1.12 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/help In directory sc8-pr-cvs1:/tmp/cvs-serv1524/help Modified Files: _Helpmodule.c Log Message: Finished update to UH 3.4.2. Index: _Helpmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/help/_Helpmodule.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** _Helpmodule.c 20 Nov 2003 13:30:57 -0000 1.11 --- _Helpmodule.c 6 Dec 2003 00:00:00 -0000 1.12 *************** *** 132,135 **** --- 132,148 ---- } + static PyObject *Help_HMHideTag(PyObject *_self, PyObject *_args) + { + PyObject *_res = NULL; + OSStatus _err; + if (!PyArg_ParseTuple(_args, "")) + return NULL; + _err = HMHideTag(); + if (_err != noErr) return PyMac_Error(_err); + Py_INCREF(Py_None); + _res = Py_None; + return _res; + } + static PyMethodDef Help_methods[] = { {"HMGetHelpMenu", (PyCFunction)Help_HMGetHelpMenu, 1, *************** *** 147,150 **** --- 160,165 ---- {"HMSetDialogHelpFromBalloonRsrc", (PyCFunction)Help_HMSetDialogHelpFromBalloonRsrc, 1, PyDoc_STR("(DialogPtr inDialog, SInt16 inHdlgRsrcID, SInt16 inItemStart) -> None")}, + {"HMHideTag", (PyCFunction)Help_HMHideTag, 1, + PyDoc_STR("() -> None")}, {NULL, NULL, 0} }; From rhettinger at users.sourceforge.net Fri Dec 5 20:35:58 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 5 20:36:03 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libturtle.tex,1.5,1.6 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15159 Modified Files: libturtle.tex Log Message: SF bug #844123: "up" instead of "down" in turtle module documentation Index: libturtle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libturtle.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libturtle.tex 21 Feb 2003 03:14:08 -0000 1.5 --- libturtle.tex 6 Dec 2003 01:35:56 -0000 1.6 *************** *** 66,70 **** \begin{funcdesc}{down}{} ! Move the pen up --- draw when moving. \end{funcdesc} --- 66,70 ---- \begin{funcdesc}{down}{} ! Move the pen down --- draw when moving. \end{funcdesc} From purcell at users.sourceforge.net Sat Dec 6 08:03:15 2003 From: purcell at users.sourceforge.net (purcell@users.sourceforge.net) Date: Sat Dec 6 08:03:19 2003 Subject: [Python-checkins] python/dist/src/Lib unittest.py,1.32,1.33 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv32033/Lib Modified Files: unittest.py Log Message: Variation of Thomas Heller's patch (722638) for improving readability of test failure output. Irrelevant traceback levels are pruned from formatted traceback strings. Index: unittest.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** unittest.py 26 Oct 2003 16:38:16 -0000 1.32 --- unittest.py 6 Dec 2003 13:03:13 -0000 1.33 *************** *** 47,51 **** __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" ! __version__ = "#Revision: 1.62 $"[11:-2] import time --- 47,51 ---- __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" ! __version__ = "#Revision: 1.63 $"[11:-2] import time *************** *** 91,94 **** --- 91,96 ---- return "%s.%s" % (cls.__module__, cls.__name__) + __unittest = 1 + class TestResult: """Holder for test result information. *************** *** 120,129 **** returned by sys.exc_info(). """ ! self.errors.append((test, self._exc_info_to_string(err))) def addFailure(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().""" ! self.failures.append((test, self._exc_info_to_string(err))) def addSuccess(self, test): --- 122,131 ---- returned by sys.exc_info(). """ ! self.errors.append((test, self._exc_info_to_string(err, test))) def addFailure(self, test, err): """Called when an error has occurred. 'err' is a tuple of values as returned by sys.exc_info().""" ! self.failures.append((test, self._exc_info_to_string(err, test))) def addSuccess(self, test): *************** *** 139,145 **** self.shouldStop = True ! def _exc_info_to_string(self, err): """Converts a sys.exc_info()-style tuple of values into a string.""" ! return ''.join(traceback.format_exception(*err)) def __repr__(self): --- 141,165 ---- self.shouldStop = True ! def _exc_info_to_string(self, err, test): """Converts a sys.exc_info()-style tuple of values into a string.""" ! exctype, value, tb = err ! # Skip test runner traceback levels ! while tb and self._is_relevant_tb_level(tb): ! tb = tb.tb_next ! if exctype is test.failureException: ! # Skip assert*() traceback levels ! length = self._count_relevant_tb_levels(tb) ! return ''.join(traceback.format_exception(exctype, value, tb, length)) ! return ''.join(traceback.format_exception(exctype, value, tb)) ! ! def _is_relevant_tb_level(self, tb): ! return tb.tb_frame.f_globals.has_key('__unittest') ! ! def _count_relevant_tb_levels(self, tb): ! length = 0 ! while tb and not self._is_relevant_tb_level(tb): ! length += 1 ! tb = tb.tb_next ! return length def __repr__(self): *************** *** 148,152 **** len(self.failures)) - class TestCase: """A class whose instances are single test cases. --- 168,171 ---- *************** *** 275,282 **** if sys.platform[:4] == 'java': ## tracebacks look different in Jython return (exctype, excvalue, tb) ! newtb = tb.tb_next ! if newtb is None: ! return (exctype, excvalue, tb) ! return (exctype, excvalue, newtb) def fail(self, msg=None): --- 294,298 ---- if sys.platform[:4] == 'java': ## tracebacks look different in Jython return (exctype, excvalue, tb) ! return (exctype, excvalue, tb) def fail(self, msg=None): From rhettinger at users.sourceforge.net Sat Dec 6 11:23:08 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 6 11:23:13 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.909,1.910 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv31126/Misc Modified Files: NEWS Log Message: Implement itertools.groupby() Original idea by Guido van Rossum. Idea for skipable inner iterators by Raymond Hettinger. Idea for argument order and identity function default by Alex Martelli. Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.909 retrieving revision 1.910 diff -C2 -d -r1.909 -r1.910 *** NEWS 5 Dec 2003 20:28:07 -0000 1.909 --- NEWS 6 Dec 2003 16:23:06 -0000 1.910 *************** *** 165,168 **** --- 165,173 ---- issue a warning when randrange() is called with a range that large. + - itertools has a new function, groupby() for aggregating iterables + into groups sharing the same key (as determined by a key function). + It offers some of functionality of SQL's groupby keyword and of + the Unix uniq filter. + - itertools now has a new function, tee() which produces two independent iterators from a single iterable. From rhettinger at users.sourceforge.net Sat Dec 6 11:23:08 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 6 11:23:15 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex, 1.22, 1.23 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv31126/Doc/lib Modified Files: libitertools.tex Log Message: Implement itertools.groupby() Original idea by Guido van Rossum. Idea for skipable inner iterators by Raymond Hettinger. Idea for argument order and identity function default by Alex Martelli. Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger). Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** libitertools.tex 12 Nov 2003 14:32:25 -0000 1.22 --- libitertools.tex 6 Dec 2003 16:23:06 -0000 1.23 *************** *** 131,134 **** --- 131,182 ---- \end{funcdesc} + \begin{funcdesc}{groupby}{iterable\optional{, key}} + Make an iterator that returns consecutive keys and groups from the + \var{iterable}. \var{key} is function computing a key value for each + element. If not specified or is \code{None}, \var{key} defaults to an + identity function (returning the element unchanged). Generally, the + iterable needs to already be sorted on the same key function. + + The returned group is itself an iterator that shares the underlying + iterable with \function{groupby()}. Because the source is shared, when + the \function{groupby} object is advanced, the previous group is no + longer visible. So, if that data is needed later, it should be stored + as a list: + + \begin{verbatim} + groups = [] + uniquekeys = [] + for k, g in groupby(data, keyfunc): + groups.append(list(g)) # Store group iterator as a list + uniquekeys.append(k) + \end{verbatim} + + \function{groupby()} is equivalent to: + + \begin{verbatim} + class groupby(object): + def __init__(self, iterable, key=None): + if key is None: + key = lambda x: x + self.keyfunc = key + self.it = iter(iterable) + self.tgtkey = self.currkey = self.currvalue = xrange(0) + def __iter__(self): + return self + def next(self): + while self.currkey == self.tgtkey: + self.currvalue = self.it.next() # Exit on StopIteration + self.currkey = self.keyfunc(self.currvalue) + self.tgtkey = self.currkey + return (self.currkey, self._grouper(self.tgtkey)) + def _grouper(self, tgtkey): + while self.currkey == tgtkey: + yield self.currvalue + self.currvalue = self.it.next() # Exit on StopIteration + self.currkey = self.keyfunc(self.currvalue) + \end{verbatim} + \versionadded{2.4} + \end{funcdesc} + \begin{funcdesc}{ifilter}{predicate, iterable} Make an iterator that filters elements from iterable returning only *************** *** 346,349 **** --- 394,409 ---- Walter Samuele + + # Show a dictionary sorted and grouped by value + >>> from operator import itemgetter + >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) + >>> di = list.sorted(d.iteritems(), key=itemgetter(1)) + >>> for k, g in groupby(di, key=itemgetter(1)): + ... print k, map(itemgetter(0), g) + ... + 1 ['a', 'c', 'e'] + 2 ['b', 'd', 'f'] + 3 ['g'] + \end{verbatim} From rhettinger at users.sourceforge.net Sat Dec 6 11:23:09 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 6 11:23:18 2003 Subject: [Python-checkins] python/dist/src/Modules itertoolsmodule.c, 1.26, 1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv31126/Modules Modified Files: itertoolsmodule.c Log Message: Implement itertools.groupby() Original idea by Guido van Rossum. Idea for skipable inner iterators by Raymond Hettinger. Idea for argument order and identity function default by Alex Martelli. Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger). Index: itertoolsmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/itertoolsmodule.c,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** itertoolsmodule.c 12 Nov 2003 14:32:26 -0000 1.26 --- itertoolsmodule.c 6 Dec 2003 16:23:06 -0000 1.27 *************** *** 8,11 **** --- 8,328 ---- */ + + /* groupby object ***********************************************************/ + + typedef struct { + PyObject_HEAD + PyObject *it; + PyObject *keyfunc; + PyObject *tgtkey; + PyObject *currkey; + PyObject *currvalue; + } groupbyobject; + + static PyTypeObject groupby_type; + static PyObject *_grouper_create(groupbyobject *, PyObject *); + + static PyObject * + groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds) + { + static char *kwargs[] = {"iterable", "key", NULL}; + groupbyobject *gbo; + PyObject *it, *keyfunc = Py_None; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:groupby", kwargs, + &it, &keyfunc)) + return NULL; + + gbo = (groupbyobject *)type->tp_alloc(type, 0); + if (gbo == NULL) + return NULL; + gbo->tgtkey = NULL; + gbo->currkey = NULL; + gbo->currvalue = NULL; + gbo->keyfunc = keyfunc; + Py_INCREF(keyfunc); + gbo->it = PyObject_GetIter(it); + if (gbo->it == NULL) { + Py_DECREF(gbo); + return NULL; + } + return (PyObject *)gbo; + } + + static void + groupby_dealloc(groupbyobject *gbo) + { + PyObject_GC_UnTrack(gbo); + Py_XDECREF(gbo->it); + Py_XDECREF(gbo->keyfunc); + Py_XDECREF(gbo->tgtkey); + Py_XDECREF(gbo->currkey); + Py_XDECREF(gbo->currvalue); + gbo->ob_type->tp_free(gbo); + } + + static int + groupby_traverse(groupbyobject *gbo, visitproc visit, void *arg) + { + int err; + + if (gbo->it) { + err = visit(gbo->it, arg); + if (err) + return err; + } + if (gbo->keyfunc) { + err = visit(gbo->keyfunc, arg); + if (err) + return err; + } + if (gbo->tgtkey) { + err = visit(gbo->tgtkey, arg); + if (err) + return err; + } + if (gbo->currkey) { + err = visit(gbo->currkey, arg); + if (err) + return err; + } + if (gbo->currvalue) { + err = visit(gbo->currvalue, arg); + if (err) + return err; + } + return 0; + } + + static PyObject * + groupby_next(groupbyobject *gbo) + { + PyObject *newvalue, *newkey, *r, *grouper; + + /* skip to next iteration group */ + for (;;) { + if (gbo->currkey == NULL) + /* pass */; + else if (gbo->tgtkey == NULL) + break; + else { + int rcmp; + + rcmp = PyObject_RichCompareBool(gbo->tgtkey, + gbo->currkey, Py_EQ); + if (rcmp == -1) + return NULL; + else if (rcmp == 0) + break; + } + + newvalue = PyIter_Next(gbo->it); + if (newvalue == NULL) + return NULL; + + if (gbo->keyfunc == Py_None) { + newkey = newvalue; + Py_INCREF(newvalue); + } else { + newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, + newvalue, NULL); + if (newkey == NULL) { + Py_DECREF(newvalue); + return NULL; + } + } + + Py_XDECREF(gbo->currkey); + gbo->currkey = newkey; + Py_XDECREF(gbo->currvalue); + gbo->currvalue = newvalue; + } + + Py_XDECREF(gbo->tgtkey); + gbo->tgtkey = gbo->currkey; + Py_INCREF(gbo->currkey); + + grouper = _grouper_create(gbo, gbo->tgtkey); + if (grouper == NULL) + return NULL; + + r = PyTuple_Pack(2, gbo->currkey, grouper); + Py_DECREF(grouper); + return r; + } + + PyDoc_STRVAR(groupby_doc, + "groupby(iterable[, keyfunc]) -> create an iterator which returns\n\ + (key, sub-iterator) grouped by each value of key(value).\n"); + + static PyTypeObject groupby_type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "itertools.groupby", /* tp_name */ + sizeof(groupbyobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)groupby_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 */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | + Py_TPFLAGS_BASETYPE, /* tp_flags */ + groupby_doc, /* tp_doc */ + (traverseproc)groupby_traverse, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)groupby_next, /* 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 */ + groupby_new, /* tp_new */ + PyObject_GC_Del, /* tp_free */ + }; + + + /* _grouper object (internal) ************************************************/ + + typedef struct { + PyObject_HEAD + PyObject *parent; + PyObject *tgtkey; + } _grouperobject; + + static PyTypeObject _grouper_type; + + static PyObject * + _grouper_create(groupbyobject *parent, PyObject *tgtkey) + { + _grouperobject *igo; + + igo = PyObject_New(_grouperobject, &_grouper_type); + if (igo == NULL) + return NULL; + igo->parent = (PyObject *)parent; + Py_INCREF(parent); + igo->tgtkey = tgtkey; + Py_INCREF(tgtkey); + + return (PyObject *)igo; + } + + static void + _grouper_dealloc(_grouperobject *igo) + { + Py_DECREF(igo->parent); + Py_DECREF(igo->tgtkey); + PyObject_Del(igo); + } + + static PyObject * + _grouper_next(_grouperobject *igo) + { + groupbyobject *gbo = (groupbyobject *)igo->parent; + PyObject *newvalue, *newkey, *r; + int rcmp; + + if (gbo->currvalue == NULL) { + newvalue = PyIter_Next(gbo->it); + if (newvalue == NULL) + return NULL; + + if (gbo->keyfunc == Py_None) { + newkey = newvalue; + Py_INCREF(newvalue); + } else { + newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, + newvalue, NULL); + if (newkey == NULL) { + Py_DECREF(newvalue); + return NULL; + } + } + + assert(gbo->currkey == NULL); + gbo->currkey = newkey; + gbo->currvalue = newvalue; + } + + assert(gbo->currkey != NULL); + rcmp = PyObject_RichCompareBool(igo->tgtkey, gbo->currkey, Py_EQ); + if (rcmp <= 0) + /* got any error or current group is end */ + return NULL; + + r = gbo->currvalue; + gbo->currvalue = NULL; + Py_DECREF(gbo->currkey); + gbo->currkey = NULL; + + return r; + } + + static PyTypeObject _grouper_type = { + PyObject_HEAD_INIT(NULL) + 0, /* ob_size */ + "itertools._grouper", /* tp_name */ + sizeof(_grouperobject), /* tp_basicsize */ + 0, /* tp_itemsize */ + /* methods */ + (destructor)_grouper_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 */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + 0, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + PyObject_SelfIter, /* tp_iter */ + (iternextfunc)_grouper_next, /* 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 */ + 0, /* tp_new */ + PyObject_Del, /* tp_free */ + }; + + + /* tee object and with supporting function and objects ***************/ *************** *** 2104,2107 **** --- 2421,2425 ---- takewhile(pred, seq) --> seq[0], seq[1], until pred fails\n\ dropwhile(pred, seq) --> seq[n], seq[n+1], starting when pred fails\n\ + groupby(iterable[, keyfunc]) --> sub-iterators grouped by value of keyfunc(v)\n\ "); *************** *** 2131,2134 **** --- 2449,2453 ---- &izip_type, &repeat_type, + &groupby_type, NULL }; *************** *** 2149,2152 **** if (PyType_Ready(&tee_type) < 0) return; ! } --- 2468,2472 ---- if (PyType_Ready(&tee_type) < 0) return; ! if (PyType_Ready(&_grouper_type) < 0) ! return; } From rhettinger at users.sourceforge.net Sat Dec 6 11:23:09 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 6 11:23:21 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.25, 1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv31126/Lib/test Modified Files: test_itertools.py Log Message: Implement itertools.groupby() Original idea by Guido van Rossum. Idea for skipable inner iterators by Raymond Hettinger. Idea for argument order and identity function default by Alex Martelli. Implementation by Hye-Shik Chang (with tweaks by Raymond Hettinger). Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** test_itertools.py 12 Nov 2003 14:32:25 -0000 1.25 --- test_itertools.py 6 Dec 2003 16:23:06 -0000 1.26 *************** *** 62,65 **** --- 62,153 ---- self.assertEqual(list(islice(cycle(gen3()),10)), [0,1,2,0,1,2,0,1,2,0]) + def test_groupby(self): + # Check whether it accepts arguments correctly + self.assertEqual([], list(groupby([]))) + self.assertEqual([], list(groupby([], key=id))) + self.assertRaises(TypeError, list, groupby('abc', [])) + self.assertRaises(TypeError, groupby, None) + + # Check normal input + s = [(0, 10, 20), (0, 11,21), (0,12,21), (1,13,21), (1,14,22), + (2,15,22), (3,16,23), (3,17,23)] + dup = [] + for k, g in groupby(s, lambda r:r[0]): + for elem in g: + self.assertEqual(k, elem[0]) + dup.append(elem) + self.assertEqual(s, dup) + + # Check nested case + dup = [] + for k, g in groupby(s, lambda r:r[0]): + for ik, ig in groupby(g, lambda r:r[2]): + for elem in ig: + self.assertEqual(k, elem[0]) + self.assertEqual(ik, elem[2]) + dup.append(elem) + self.assertEqual(s, dup) + + # Check case where inner iterator is not used + keys = [k for k, g in groupby(s, lambda r:r[0])] + expectedkeys = set([r[0] for r in s]) + self.assertEqual(set(keys), expectedkeys) + self.assertEqual(len(keys), len(expectedkeys)) + + # Exercise pipes and filters style + s = 'abracadabra' + # sort s | uniq + r = [k for k, g in groupby(list.sorted(s))] + self.assertEqual(r, ['a', 'b', 'c', 'd', 'r']) + # sort s | uniq -d + r = [k for k, g in groupby(list.sorted(s)) if list(islice(g,1,2))] + self.assertEqual(r, ['a', 'b', 'r']) + # sort s | uniq -c + r = [(len(list(g)), k) for k, g in groupby(list.sorted(s))] + self.assertEqual(r, [(5, 'a'), (2, 'b'), (1, 'c'), (1, 'd'), (2, 'r')]) + # sort s | uniq -c | sort -rn | head -3 + r = list.sorted([(len(list(g)) , k) for k, g in groupby(list.sorted(s))], reverse=True)[:3] + self.assertEqual(r, [(5, 'a'), (2, 'r'), (2, 'b')]) + + # iter.next failure + class ExpectedError(Exception): + pass + def delayed_raise(n=0): + for i in range(n): + yield 'yo' + raise ExpectedError + def gulp(iterable, keyp=None, func=list): + return [func(g) for k, g in groupby(iterable, keyp)] + + # iter.next failure on outer object + self.assertRaises(ExpectedError, gulp, delayed_raise(0)) + # iter.next failure on inner object + self.assertRaises(ExpectedError, gulp, delayed_raise(1)) + + # __cmp__ failure + class DummyCmp: + def __cmp__(self, dst): + raise ExpectedError + s = [DummyCmp(), DummyCmp(), None] + + # __cmp__ failure on outer object + self.assertRaises(ExpectedError, gulp, s, func=id) + # __cmp__ failure on inner object + self.assertRaises(ExpectedError, gulp, s) + + # keyfunc failure + def keyfunc(obj): + if keyfunc.skip > 0: + keyfunc.skip -= 1 + return obj + else: + raise ExpectedError + + # keyfunc failure on outer object + keyfunc.skip = 0 + self.assertRaises(ExpectedError, gulp, [None], keyfunc) + keyfunc.skip = 1 + self.assertRaises(ExpectedError, gulp, [None, None], keyfunc) + def test_ifilter(self): self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) *************** *** 269,273 **** self.assertRaises(StopIteration, izip().next) ! for f in (chain, cycle, izip): self.assertRaises(StopIteration, f([]).next) self.assertRaises(StopIteration, f(StopNow()).next) --- 357,361 ---- self.assertRaises(StopIteration, izip().next) ! for f in (chain, cycle, izip, groupby): self.assertRaises(StopIteration, f([]).next) self.assertRaises(StopIteration, f(StopNow()).next) *************** *** 427,430 **** --- 515,526 ---- self.assertRaises(ZeroDivisionError, list, cycle(E(s))) + def test_groupby(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([k for k, sb in groupby(g(s))], list(g(s))) + self.assertRaises(TypeError, groupby, X(s)) + self.assertRaises(TypeError, list, groupby(N(s))) + self.assertRaises(ZeroDivisionError, list, groupby(E(s))) + def test_ifilter(self): for s in (range(10), range(0), range(1000), (7,11), xrange(2000,2200,5)): *************** *** 571,574 **** --- 667,680 ---- Walter Samuele + + >>> from operator import itemgetter + >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) + >>> di = list.sorted(d.iteritems(), key=itemgetter(1)) + >>> for k, g in groupby(di, itemgetter(1)): + ... print k, map(itemgetter(0), g) + ... + 1 ['a', 'c', 'e'] + 2 ['b', 'd', 'f'] + 3 ['g'] >>> def take(n, seq): From rhettinger at users.sourceforge.net Sat Dec 6 15:12:02 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 6 15:12:05 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.218,1.219 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv3079 Modified Files: tut.tex Log Message: Incorporate suggestions from Aahz. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.218 retrieving revision 1.219 diff -C2 -d -r1.218 -r1.219 *** tut.tex 5 Dec 2003 07:53:50 -0000 1.218 --- tut.tex 6 Dec 2003 20:12:00 -0000 1.219 *************** *** 3,9 **** % Things to do: - % Add a section on file I/O - % Write a chapter entitled ``Some Useful Modules'' - % --re, math+cmath % Should really move the Python startup file info to an appendix --- 3,6 ---- *************** *** 4398,4402 **** \begin{verbatim} >>> import os ! >>> os.system('copy /data/mydata.fil /backup/mydata.fil') 0 >>> os.getcwd() # Return the current working directory --- 4395,4399 ---- \begin{verbatim} >>> import os ! >>> os.system('time 0:02') 0 >>> os.getcwd() # Return the current working directory *************** *** 4485,4491 **** The \ulink{\module{re}}{../lib/module-re.html} module provides regular expression tools for advanced string processing. ! When only simple capabilities are needed, string methods are preferred ! because they are easier to read and debug. However, for more ! sophisticated applications, regular expressions can provide succinct, optimized solutions: --- 4482,4486 ---- The \ulink{\module{re}}{../lib/module-re.html} module provides regular expression tools for advanced string processing. ! For complex matching and manipulation, regular expressions offer succinct, optimized solutions: *************** *** 4498,4501 **** --- 4493,4503 ---- \end{verbatim} + When only simple capabilities are needed, string methods are preferred + because they are easier to read and debug: + + \begin{verbatim} + >>> 'tea for too'.replace('too', 'two') + 'tea for two' + \end{verbatim} \section{Mathematics\label{mathematics}} From akuchling at users.sourceforge.net Sat Dec 6 17:29:45 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Dec 6 17:29:49 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex, 1.23, 1.24 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv23353 Modified Files: libitertools.tex Log Message: Edit description a bit Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** libitertools.tex 6 Dec 2003 16:23:06 -0000 1.23 --- libitertools.tex 6 Dec 2003 22:29:43 -0000 1.24 *************** *** 133,139 **** \begin{funcdesc}{groupby}{iterable\optional{, key}} Make an iterator that returns consecutive keys and groups from the ! \var{iterable}. \var{key} is function computing a key value for each element. If not specified or is \code{None}, \var{key} defaults to an ! identity function (returning the element unchanged). Generally, the iterable needs to already be sorted on the same key function. --- 133,139 ---- \begin{funcdesc}{groupby}{iterable\optional{, key}} Make an iterator that returns consecutive keys and groups from the ! \var{iterable}. \var{key} is a function computing a key value for each element. If not specified or is \code{None}, \var{key} defaults to an ! identity function and returns the element unchanged. Generally, the iterable needs to already be sorted on the same key function. From akuchling at users.sourceforge.net Sat Dec 6 18:19:25 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Sat Dec 6 18:19:29 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv30514 Modified Files: whatsnew24.tex Log Message: Add groupby() Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** whatsnew24.tex 26 Nov 2003 18:05:26 -0000 1.16 --- whatsnew24.tex 6 Dec 2003 23:19:23 -0000 1.17 *************** *** 267,270 **** --- 267,298 ---- (Contributed by Yves Dionne.) + \item The \module{itertools} module gained a + \function{groupby(\var{iterable}\optional{, \var{func}})} function, + inspired by the GROUP BY clause from SQL. + \var{iterable} returns a succession of elements, and the optional + \var{func} is a function that takes an element and returns a key + value; if omitted, the key is simply the element itself. + \function{groupby()} then groups the elements into subsequences + which have matching values of the key, and returns a series of 2-tuples + containing the key value and an iterator over the subsequence. + + Here's an example. The \var{key} function simply returns whether a + number is even or odd, so the result of \function{groupby()} is to + return consecutive runs of odd or even numbers. + + \begin{verbatim} + >>> import itertools + >>> L = [2,4,6, 7,8,9,11, 12, 14] + >>> for key_val, it in itertools.groupby(L, lambda x: x % 2): + ... print key_val, list(it) + ... + 0 [2, 4, 6] + 1 [7] + 0 [8] + 1 [9, 11] + 0 [12, 14] + >>> + \end{verbatim} + \item A new \function{getsid()} function was added to the \module{posix} module that underlies the \module{os} module. From rhettinger at users.sourceforge.net Sun Dec 7 05:48:05 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 05:48:10 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex, 1.16, 1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12290 Modified Files: libunittest.tex Log Message: SF bug #855317: unittest: 5.3.9 Getting Extended Error Information The example code did not work and could not easily be made to work. Since the docs were already complex and the feature was not used (it took two years for the errors to surface), we decided to dedocument it entirely, leaving unittest cleaner than before. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** libunittest.tex 20 Sep 2003 11:09:28 -0000 1.16 --- libunittest.tex 7 Dec 2003 10:48:03 -0000 1.17 *************** *** 901,944 **** the \class{TestSuite} class. \end{memberdesc} - - - \subsection{Getting Extended Error Information - \label{unittest-error-info}} - - Some applications can make use of more error information (for example, - an integrated development environment, or IDE). Such an application - can retrieve supplemental information about errors and failures by - using an alternate \class{TestResult} implementation, and extending - the \method{defaultTestResult()} method of the \class{TestCase} class - to provide it. - - Here is a brief example of a \class{TestResult} subclass which stores - the actual exception and traceback objects. (Be aware that storing - traceback objects can cause a great deal of memory not to be reclaimed - when it otherwise would be, which can have effects that affect the - behavior of the tests.) - - \begin{verbatim} - import unittest - - class MyTestCase(unittest.TestCase): - def defaultTestResult(self): - return MyTestResult() - - class MyTestResult(unittest.TestResult): - def __init__(self): - self.errors_tb = [] - self.failures_tb = [] - - def addError(self, test, err): - self.errors_tb.append((test, err)) - unittest.TestResult.addError(self, test, err) - - def addFailure(self, test, err): - self.failures_tb.append((test, err)) - unittest.TestResult.addFailure(self, test, err) - \end{verbatim} - - Tests written using \class{MyTestCase} as the base class, instead of - \class{TestCase}, will allow tools to extract additional information - from the results object. --- 901,902 ---- From rhettinger at users.sourceforge.net Sun Dec 7 05:49:16 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 05:49:19 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex, 1.14.8.2, 1.14.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12697 Modified Files: Tag: release23-maint libunittest.tex Log Message: SF bug #855317: unittest: 5.3.9 Getting Extended Error Information The example code did not work and could not easily be made to work. Since the docs were already complex and the feature was not used (it took two years for the errors to surface), we decided to dedocument it entirely, leaving unittest cleaner than before. Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.14.8.2 retrieving revision 1.14.8.3 diff -C2 -d -r1.14.8.2 -r1.14.8.3 *** libunittest.tex 20 Sep 2003 11:09:06 -0000 1.14.8.2 --- libunittest.tex 7 Dec 2003 10:49:13 -0000 1.14.8.3 *************** *** 901,944 **** the \class{TestSuite} class. \end{memberdesc} - - - \subsection{Getting Extended Error Information - \label{unittest-error-info}} - - Some applications can make use of more error information (for example, - an integrated development environment, or IDE). Such an application - can retrieve supplemental information about errors and failures by - using an alternate \class{TestResult} implementation, and extending - the \method{defaultTestResult()} method of the \class{TestCase} class - to provide it. - - Here is a brief example of a \class{TestResult} subclass which stores - the actual exception and traceback objects. (Be aware that storing - traceback objects can cause a great deal of memory not to be reclaimed - when it otherwise would be, which can have effects that affect the - behavior of the tests.) - - \begin{verbatim} - import unittest - - class MyTestCase(unittest.TestCase): - def defaultTestResult(self): - return MyTestResult() - - class MyTestResult(unittest.TestResult): - def __init__(self): - self.errors_tb = [] - self.failures_tb = [] - - def addError(self, test, err): - self.errors_tb.append((test, err)) - unittest.TestResult.addError(self, test, err) - - def addFailure(self, test, err): - self.failures_tb.append((test, err)) - unittest.TestResult.addFailure(self, test, err) - \end{verbatim} - - Tests written using \class{MyTestCase} as the base class, instead of - \class{TestCase}, will allow tools to extract additional information - from the results object. --- 901,902 ---- From rhettinger at users.sourceforge.net Sun Dec 7 06:03:11 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:03:16 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.143.8.8, 1.143.8.9 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14229 Modified Files: Tag: release23-maint libfuncs.tex Log Message: Backports: * Put str() in alphabetical order * Move apply(), buffer(), coerce(), and intern() to a separate section. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.143.8.8 retrieving revision 1.143.8.9 diff -C2 -d -r1.143.8.8 -r1.143.8.9 *** libfuncs.tex 5 Dec 2003 18:55:46 -0000 1.143.8.8 --- libfuncs.tex 7 Dec 2003 11:03:08 -0000 1.143.8.9 *************** *** 61,84 **** \end{funcdesc} - \begin{funcdesc}{apply}{function, args\optional{, keywords}} - The \var{function} argument must be a callable object (a - user-defined or built-in function or method, or a class object) and - the \var{args} argument must be a sequence. The \var{function} is - called with \var{args} as the argument list; the number of arguments - is the length of the tuple. - If the optional \var{keywords} argument is present, it must be a - dictionary whose keys are strings. It specifies keyword arguments - to be added to the end of the argument list. - Calling \function{apply()} is different from just calling - \code{\var{function}(\var{args})}, since in that case there is always - exactly one argument. The use of \function{apply()} is equivalent - to \code{\var{function}(*\var{args}, **\var{keywords})}. - Use of \function{apply()} is not necessary since the ``extended call - syntax,'' as used in the last example, is completely equivalent. - - \deprecated{2.3}{Use the extended call syntax instead, as described - above.} - \end{funcdesc} - \begin{funcdesc}{basestring}{} This abstract type is the superclass for \class{str} and \class{unicode}. --- 61,64 ---- *************** *** 104,117 **** \end{funcdesc} - \begin{funcdesc}{buffer}{object\optional{, offset\optional{, size}}} - The \var{object} argument must be an object that supports the buffer - call interface (such as strings, arrays, and buffers). A new buffer - object will be created which references the \var{object} argument. - The buffer object will be a slice from the beginning of \var{object} - (or from the specified \var{offset}). The slice will extend to the - end of \var{object} (or will have a length given by the \var{size} - argument). - \end{funcdesc} - \begin{funcdesc}{callable}{object} Return true if the \var{object} argument appears callable, false if --- 84,87 ---- *************** *** 162,171 **** \end{funcdesc} - \begin{funcdesc}{coerce}{x, y} - Return a tuple consisting of the two numeric arguments converted to - a common type, using the same rules as used by arithmetic - operations. - \end{funcdesc} - \begin{funcdesc}{compile}{string, filename, kind\optional{, flags\optional{, dont_inherit}}} --- 132,135 ---- *************** *** 571,589 **** \end{funcdesc} - \begin{funcdesc}{intern}{string} - Enter \var{string} in the table of ``interned'' strings and return - the interned string -- which is \var{string} itself or a copy. - Interning strings is useful to gain a little performance on - dictionary lookup -- if the keys in a dictionary are interned, and - the lookup key is interned, the key comparisons (after hashing) can - be done by a pointer compare instead of a string compare. Normally, - the names used in Python programs are automatically interned, and - the dictionaries used to hold module, class or instance attributes - have interned keys. \versionchanged[Interned strings are not - immortal (like they used to be in Python 2.2 and before); - you must keep a reference to the return value of \function{intern()} - around to benefit from it]{2.3} - \end{funcdesc} - \begin{funcdesc}{isinstance}{object, classinfo} Return true if the \var{object} argument is an instance of the --- 535,538 ---- *************** *** 933,936 **** --- 882,895 ---- \end{funcdesc} + \begin{funcdesc}{str}{\optional{object}} + Return a string containing a nicely printable representation of an + object. For strings, this returns the string itself. The + difference with \code{repr(\var{object})} is that + \code{str(\var{object})} does not always attempt to return a string + that is acceptable to \function{eval()}; its goal is to return a + printable string. If no argument is given, returns the empty + string, \code{''}. + \end{funcdesc} + \begin{funcdesc}{sum}{sequence\optional{, start}} Sums \var{start} and the items of a \var{sequence}, from left to *************** *** 961,974 **** \end{funcdesc} - \begin{funcdesc}{str}{\optional{object}} - Return a string containing a nicely printable representation of an - object. For strings, this returns the string itself. The - difference with \code{repr(\var{object})} is that - \code{str(\var{object})} does not always attempt to return a string - that is acceptable to \function{eval()}; its goal is to return a - printable string. If no argument is given, returns the empty - string, \code{''}. - \end{funcdesc} - \begin{funcdesc}{tuple}{\optional{sequence}} Return a tuple whose items are the same and in the same order as --- 920,923 ---- *************** *** 1084,1086 **** --- 1033,1103 ---- With a single sequence argument, it returns a list of 1-tuples. \versionadded{2.0} + \end{funcdesc} + + + % --------------------------------------------------------------------------- + + + \section{Non-essential Built-in Functions \label{non-essential-built-in-funcs}} + + There are several built-in functions that are no longer essential to learn, + know or use in modern Python programming. They have been kept here to + maintain backwards compatability with programs written for older versions + of Python. + + Python programmers, trainers, students and bookwriters should feel free to + bypass these functions without concerns about missing something important. + + + \setindexsubitem{(non-essential built-in functions)} + + \begin{funcdesc}{apply}{function, args\optional{, keywords}} + The \var{function} argument must be a callable object (a + user-defined or built-in function or method, or a class object) and + the \var{args} argument must be a sequence. The \var{function} is + called with \var{args} as the argument list; the number of arguments + is the length of the tuple. + If the optional \var{keywords} argument is present, it must be a + dictionary whose keys are strings. It specifies keyword arguments + to be added to the end of the argument list. + Calling \function{apply()} is different from just calling + \code{\var{function}(\var{args})}, since in that case there is always + exactly one argument. The use of \function{apply()} is equivalent + to \code{\var{function}(*\var{args}, **\var{keywords})}. + Use of \function{apply()} is not necessary since the ``extended call + syntax,'' as used in the last example, is completely equivalent. + + \deprecated{2.3}{Use the extended call syntax instead, as described + above.} + \end{funcdesc} + + \begin{funcdesc}{buffer}{object\optional{, offset\optional{, size}}} + The \var{object} argument must be an object that supports the buffer + call interface (such as strings, arrays, and buffers). A new buffer + object will be created which references the \var{object} argument. + The buffer object will be a slice from the beginning of \var{object} + (or from the specified \var{offset}). The slice will extend to the + end of \var{object} (or will have a length given by the \var{size} + argument). + \end{funcdesc} + + \begin{funcdesc}{coerce}{x, y} + Return a tuple consisting of the two numeric arguments converted to + a common type, using the same rules as used by arithmetic + operations. + \end{funcdesc} + + \begin{funcdesc}{intern}{string} + Enter \var{string} in the table of ``interned'' strings and return + the interned string -- which is \var{string} itself or a copy. + Interning strings is useful to gain a little performance on + dictionary lookup -- if the keys in a dictionary are interned, and + the lookup key is interned, the key comparisons (after hashing) can + be done by a pointer compare instead of a string compare. Normally, + the names used in Python programs are automatically interned, and + the dictionaries used to hold module, class or instance attributes + have interned keys. \versionchanged[Interned strings are not + immortal (like they used to be in Python 2.2 and before); + you must keep a reference to the return value of \function{intern()} + around to benefit from it]{2.3} \end{funcdesc} From rhettinger at users.sourceforge.net Sun Dec 7 06:06:33 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:06:38 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libsets.tex, 1.11.16.2, 1.11.16.3 libturtle.tex, 1.5, 1.5.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14632 Modified Files: Tag: release23-maint libsets.tex libturtle.tex Log Message: Backport various fixups (with permission from the RM). Index: libsets.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsets.tex,v retrieving revision 1.11.16.2 retrieving revision 1.11.16.3 diff -C2 -d -r1.11.16.2 -r1.11.16.3 *** libsets.tex 16 Nov 2003 13:45:21 -0000 1.11.16.2 --- libsets.tex 7 Dec 2003 11:06:31 -0000 1.11.16.3 *************** *** 92,96 **** \end{tableiii} ! Note, this non-operator versions of \method{union()}, \method{intersection()}, \method{difference()}, and \method{symmetric_difference()} will accept any iterable as an argument. --- 92,96 ---- \end{tableiii} ! Note, the non-operator versions of \method{union()}, \method{intersection()}, \method{difference()}, and \method{symmetric_difference()} will accept any iterable as an argument. *************** *** 159,166 **** \end{tableiii} ! \versionchanged[Earlier versions had an \method{update()} method; use ! \method{union_update()} instead]{2.3.1} ! ! Note, this non-operator versions of \method{union_update()}, \method{intersection_update()}, \method{difference_update()}, and \method{symmetric_difference_update()} will accept any iterable as --- 159,163 ---- \end{tableiii} ! Note, the non-operator versions of \method{union_update()}, \method{intersection_update()}, \method{difference_update()}, and \method{symmetric_difference_update()} will accept any iterable as Index: libturtle.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libturtle.tex,v retrieving revision 1.5 retrieving revision 1.5.12.1 diff -C2 -d -r1.5 -r1.5.12.1 *** libturtle.tex 21 Feb 2003 03:14:08 -0000 1.5 --- libturtle.tex 7 Dec 2003 11:06:31 -0000 1.5.12.1 *************** *** 66,70 **** \begin{funcdesc}{down}{} ! Move the pen up --- draw when moving. \end{funcdesc} --- 66,70 ---- \begin{funcdesc}{down}{} ! Move the pen down --- draw when moving. \end{funcdesc} From rhettinger at users.sourceforge.net Sun Dec 7 06:15:21 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:15:24 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.13, 1.196.8.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv15505 Modified Files: Tag: release23-maint tut.tex Log Message: Backport various tutorial fixups (with permission from the RM). Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.13 retrieving revision 1.196.8.14 diff -C2 -d -r1.196.8.13 -r1.196.8.14 *** tut.tex 5 Dec 2003 08:03:09 -0000 1.196.8.13 --- tut.tex 7 Dec 2003 11:15:16 -0000 1.196.8.14 *************** *** 3,9 **** % Things to do: - % Add a section on file I/O - % Write a chapter entitled ``Some Useful Modules'' - % --re, math+cmath % Should really move the Python startup file info to an appendix --- 3,6 ---- *************** *** 332,348 **** encoding. The list of possible encodings can be found in the \citetitle[../lib/lib.html]{Python Library Reference}, in the section ! on \module{codecs}. ! If your editor supports saving files as \code{UTF-8} with an UTF-8 ! signature (aka BOM -- Byte Order Mark), you can use that instead of an encoding declaration. IDLE supports this capability if \code{Options/General/Default Source Encoding/UTF-8} is set. Notice that this signature is not understood in older Python releases (2.2 and earlier), and also not understood by the operating system for ! \code{\#!} files. By using UTF-8 (either through the signature or an encoding declaration), characters of most languages in the world can be used ! simultaneously in string literals and comments. Using non-ASCII characters in identifiers is not supported. To display all these characters properly, your editor must recognize that the file is --- 329,345 ---- encoding. The list of possible encodings can be found in the \citetitle[../lib/lib.html]{Python Library Reference}, in the section ! on \ulink{\module{codecs}}{../lib/module-codecs.html}. ! If your editor supports saving files as \code{UTF-8} with a UTF-8 ! \emph{byte order mark} (aka BOM), you can use that instead of an encoding declaration. IDLE supports this capability if \code{Options/General/Default Source Encoding/UTF-8} is set. Notice that this signature is not understood in older Python releases (2.2 and earlier), and also not understood by the operating system for ! \code{\#!} files. By using UTF-8 (either through the signature or an encoding declaration), characters of most languages in the world can be used ! simultaneously in string literals and comments. Using non-\ASCII characters in identifiers is not supported. To display all these characters properly, your editor must recognize that the file is *************** *** 660,672 **** \begin{verbatim} - >>> import string >>> 'str' 'ing' # <- This is ok 'string' ! >>> string.strip('str') + 'ing' # <- This is ok 'string' ! >>> string.strip('str') 'ing' # <- This is invalid File "", line 1, in ? ! string.strip('str') 'ing' ! ^ SyntaxError: invalid syntax \end{verbatim} --- 657,668 ---- \begin{verbatim} >>> 'str' 'ing' # <- This is ok 'string' ! >>> 'str'.strip() + 'ing' # <- This is ok 'string' ! >>> 'str'.strip() 'ing' # <- This is invalid File "", line 1, in ? ! 'str'.strip() 'ing' ! ^ SyntaxError: invalid syntax \end{verbatim} *************** *** 810,813 **** --- 806,824 ---- + \begin{seealso} + \seetitle[../lib/typesseq.html]{Sequence Types}% + {Strings, and the Unicode strings described in the next + section, are examples of \emph{sequence types}, and + support the common operations supported by such types.} + \seetitle[../lib/string-methods.html]{String Methods}% + {Both strings and Unicode strings support a large number of + methods for basic transformations and searching.} + \seetitle[../lib/typesseq-strings.html]{String Formatting Operations}% + {The formatting operations invoked when strings and Unicode + strings are the left operand of the \code{\%} operator are + described in more detail here.} + \end{seealso} + + \subsection{Unicode Strings \label{unicodeStrings}} \sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com} *************** *** 882,886 **** The latter two are variable-length encodings that store each Unicode character in one or more bytes. The default encoding is ! normally set to ASCII, which passes through characters in the range 0 to 127 and rejects any other characters with an error. When a Unicode string is printed, written to a file, or converted --- 893,897 ---- The latter two are variable-length encodings that store each Unicode character in one or more bytes. The default encoding is ! normally set to \ASCII, which passes through characters in the range 0 to 127 and rejects any other characters with an error. When a Unicode string is printed, written to a file, or converted *************** *** 1519,1523 **** When a final formal parameter of the form \code{**\var{name}} is ! present, it receives a dictionary containing all keyword arguments whose keyword doesn't correspond to a formal parameter. This may be combined with a formal parameter of the form --- 1530,1534 ---- When a final formal parameter of the form \code{**\var{name}} is ! present, it receives a \ulink{dictionary}{../lib/typesmapping.html} containing all keyword arguments whose keyword doesn't correspond to a formal parameter. This may be combined with a formal parameter of the form *************** *** 1839,1855 **** many arguments as there are sequences and is called with the corresponding item from each sequence (or \code{None} if some sequence ! is shorter than another). If \code{None} is passed for the function, ! a function returning its argument(s) is substituted. ! ! Combining these two special cases, we see that ! \samp{map(None, \var{list1}, \var{list2})} is a convenient way of ! turning a pair of lists into a list of pairs. For example: \begin{verbatim} >>> seq = range(8) ! >>> def square(x): return x*x ... ! >>> map(None, seq, map(square, seq)) ! [(0, 0), (1, 1), (2, 4), (3, 9), (4, 16), (5, 25), (6, 36), (7, 49)] \end{verbatim} --- 1850,1861 ---- many arguments as there are sequences and is called with the corresponding item from each sequence (or \code{None} if some sequence ! is shorter than another). For example: \begin{verbatim} >>> seq = range(8) ! >>> def add(x, y): return x+y ... ! >>> map(add, seq, seq) ! [0, 2, 4, 6, 8, 10, 12, 14] \end{verbatim} *************** *** 1974,1980 **** We saw that lists and strings have many common properties, such as indexing and slicing operations. They are two examples of ! \emph{sequence} data types. Since Python is an evolving language, ! other sequence data types may be added. There is also another ! standard sequence data type: the \emph{tuple}. A tuple consists of a number of values separated by commas, for --- 1980,1987 ---- We saw that lists and strings have many common properties, such as indexing and slicing operations. They are two examples of ! \ulink{\emph{sequence} data types}{../lib/typesseq.html}. Since ! Python is an evolving language, other sequence data types may be ! added. There is also another standard sequence data type: the ! \emph{tuple}. A tuple consists of a number of values separated by commas, for *************** *** 2046,2050 **** \section{Dictionaries \label{dictionaries}} ! Another useful data type built into Python is the \emph{dictionary}. Dictionaries are sometimes found in other languages as ``associative memories'' or ``associative arrays''. Unlike sequences, which are --- 2053,2058 ---- \section{Dictionaries \label{dictionaries}} ! Another useful data type built into Python is the ! \ulink{\emph{dictionary}}{../lib/typesmapping.html}. Dictionaries are sometimes found in other languages as ``associative memories'' or ``associative arrays''. Unlike sequences, which are *************** *** 2074,2082 **** value using a non-existent key. ! The \code{keys()} method of a dictionary object returns a list of all the keys used in the dictionary, in random order (if you want it ! sorted, just apply the \code{sort()} method to the list of keys). To check whether a single key is in the dictionary, use the ! \code{has_key()} method of the dictionary. Here is a small example using a dictionary: --- 2082,2090 ---- value using a non-existent key. ! The \method{keys()} method of a dictionary object returns a list of all the keys used in the dictionary, in random order (if you want it ! sorted, just apply the \method{sort()} method to the list of keys). To check whether a single key is in the dictionary, use the ! \method{has_key()} method of the dictionary. Here is a small example using a dictionary: *************** *** 2152,2155 **** --- 2160,2178 ---- \end{verbatim} + To loop over a sequence in reverse, first specify the sequence + in a forward direction and then call the \function{reversed()} + function. + + \begin{verbatim} + >>> for i in reversed(xrange(1,10,2)): + ... print i + ... + 9 + 7 + 5 + 3 + 1 + \end{verbatim} + \section{More on Conditions \label{conditions}} *************** *** 2389,2393 **** attempt to load the script as a module when that module is imported. This will generally be an error. See section~\ref{standardModules}, ! ``Standard Modules.'' for more information. --- 2412,2416 ---- attempt to load the script as a module when that module is imported. This will generally be an error. See section~\ref{standardModules}, ! ``Standard Modules,'' for more information. *************** *** 2455,2461 **** \item ! The module \module{compileall}\refstmodindex{compileall} can create ! \file{.pyc} files (or \file{.pyo} files when \programopt{-O} is used) for ! all modules in a directory. \end{itemize} --- 2478,2485 ---- \item ! The module \ulink{\module{compileall}}{../lib/module-compileall.html}% ! {} \refstmodindex{compileall} can create \file{.pyc} files (or ! \file{.pyo} files when \programopt{-O} is used) for all modules in a ! directory. \end{itemize} *************** *** 2474,2478 **** the \module{amoeba} module is only provided on systems that somehow support Amoeba primitives. One particular module deserves some ! attention: \module{sys}\refstmodindex{sys}, which is built into every Python interpreter. The variables \code{sys.ps1} and \code{sys.ps2} define the strings used as primary and secondary --- 2498,2503 ---- the \module{amoeba} module is only provided on systems that somehow support Amoeba primitives. One particular module deserves some ! attention: \ulink{\module{sys}}{../lib/module-sys.html}% ! \refstmodindex{sys}, which is built into every Python interpreter. The variables \code{sys.ps1} and \code{sys.ps2} define the strings used as primary and secondary *************** *** 2757,2768 **** The submodules often need to refer to each other. For example, the ! \module{surround} module might use the \module{echo} module. In fact, such references ! are so common that the \code{import} statement first looks in the containing package before looking in the standard module search path. Thus, the surround module can simply use \code{import echo} or \code{from echo import echofilter}. If the imported module is not found in the current package (the package of which the current module ! is a submodule), the \code{import} statement looks for a top-level module ! with the given name. When packages are structured into subpackages (as with the --- 2782,2794 ---- The submodules often need to refer to each other. For example, the ! \module{surround} module might use the \module{echo} module. In fact, ! such references ! are so common that the \keyword{import} statement first looks in the containing package before looking in the standard module search path. Thus, the surround module can simply use \code{import echo} or \code{from echo import echofilter}. If the imported module is not found in the current package (the package of which the current module ! is a submodule), the \keyword{import} statement looks for a top-level ! module with the given name. When packages are structured into subpackages (as with the *************** *** 2774,2786 **** Sound.Effects import echo}. - %(One could design a notation to refer to parent packages, similar to - %the use of ".." to refer to the parent directory in \UNIX{} and Windows - %filesystems. In fact, the \module{ni} module, which was the - %ancestor of this package system, supported this using \code{__} for - %the package containing the current module, - %\code{__.__} for the parent package, and so on. This feature was dropped - %because of its awkwardness; since most packages will have a relative - %shallow substructure, this is no big loss.) - \subsection{Packages in Multiple Directories} --- 2800,2803 ---- *************** *** 2874,2882 **** \begin{verbatim} - >>> 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 --- 2891,2898 ---- \begin{verbatim} >>> for x in range(1, 11): ! ... print repr(x).rjust(2), repr(x*x).rjust(3), ... # Note trailing comma on previous line ! ... print repr(x*x*x).rjust(4) ... 1 1 1 *************** *** 2908,2933 **** \keyword{print} works: it always adds spaces between its arguments.) ! This example demonstrates the function \function{string.rjust()}, which right-justifies a string in a field of a given width by padding ! it with spaces on the left. There are similar functions ! \function{string.ljust()} and \function{string.center()}. These ! functions do not write anything, they just return a new string. If the input string is too long, they don't truncate it, but return it unchanged; this will mess up your column lay-out but that's usually better than the alternative, which would be lying about a value. (If you really want truncation you can always add a slice operation, as in ! \samp{string.ljust(x,~n)[0:n]}.) ! There is another function, \function{string.zfill()}, which pads a numeric string on the left with zeros. It understands about plus and minus signs: \begin{verbatim} ! >>> import string ! >>> string.zfill('12', 5) '00012' ! >>> string.zfill('-3.14', 7) '-003.14' ! >>> string.zfill('3.14159265359', 5) '3.14159265359' \end{verbatim} --- 2924,2948 ---- \keyword{print} works: it always adds spaces between its arguments.) ! This example demonstrates the \method{rjust()} method of string objects, which right-justifies a string in a field of a given width by padding ! it with spaces on the left. There are similar methods ! \method{ljust()} and \method{center()}. These ! methods do not write anything, they just return a new string. If the input string is too long, they don't truncate it, but return it unchanged; this will mess up your column lay-out but that's usually better than the alternative, which would be lying about a value. (If you really want truncation you can always add a slice operation, as in ! \samp{x.ljust(~n)[:n]}.) ! There is another method, \method{zfill()}, which pads a numeric string on the left with zeros. It understands about plus and minus signs: \begin{verbatim} ! >>> '12'.zfill(5) '00012' ! >>> '-3.14'.zfill(7) '-003.14' ! >>> '3.14159265359'.zfill(5) '3.14159265359' \end{verbatim} *************** *** 3112,3116 **** bit more effort, since the \method{read()} method only returns strings, which will have to be passed to a function like ! \function{string.atoi()}, which takes a string like \code{'123'} and returns its numeric value 123. However, when you want to save more complex data types like lists, dictionaries, or class instances, --- 3127,3131 ---- bit more effort, since the \method{read()} method only returns strings, which will have to be passed to a function like ! \function{int()}, which takes a string like \code{'123'} and returns its numeric value 123. However, when you want to save more complex data types like lists, dictionaries, or class instances, *************** *** 3119,3123 **** Rather than have users be constantly writing and debugging code to save complicated data types, Python provides a standard module called ! \module{pickle}. This is an amazing module that can take almost any Python object (even some forms of Python code!), and convert it to a string representation; this process is called \dfn{pickling}. --- 3134,3139 ---- Rather than have users be constantly writing and debugging code to save complicated data types, Python provides a standard module called ! \ulink{\module{pickle}}{../lib/module-pickle.html}. This is an ! amazing module that can take almost any Python object (even some forms of Python code!), and convert it to a string representation; this process is called \dfn{pickling}. *************** *** 3144,3153 **** (There are other variants of this, used when pickling many objects or when you don't want to write the pickled data to a file; consult the ! complete documentation for \module{pickle} in the Library Reference.) ! \module{pickle} is the standard way to make Python objects which can ! be stored and reused by other programs or by a future invocation of ! the same program; the technical term for this is a ! \dfn{persistent} object. Because \module{pickle} is so widely used, many authors who write Python extensions take care to ensure that new data types such as matrices can be properly pickled and unpickled. --- 3160,3172 ---- (There are other variants of this, used when pickling many objects or when you don't want to write the pickled data to a file; consult the ! complete documentation for ! \ulink{\module{pickle}}{../lib/module-pickle.html} in the ! \citetitle[../lib/]{Python Library Reference}.) ! \ulink{\module{pickle}}{../lib/module-pickle.html} is the standard way ! to make Python objects which can be stored and reused by other ! programs or by a future invocation of the same program; the technical ! term for this is a \dfn{persistent} object. Because ! \ulink{\module{pickle}}{../lib/module-pickle.html} is so widely used, many authors who write Python extensions take care to ensure that new data types such as matrices can be properly pickled and unpickled. *************** *** 3295,3304 **** \begin{verbatim} ! import string, sys try: f = open('myfile.txt') s = f.readline() ! i = int(string.strip(s)) except IOError, (errno, strerror): print "I/O error(%s): %s" % (errno, strerror) --- 3314,3323 ---- \begin{verbatim} ! import sys try: f = open('myfile.txt') s = f.readline() ! i = int(s.strip()) except IOError, (errno, strerror): print "I/O error(%s): %s" % (errno, strerror) *************** *** 4339,4343 **** \begin{verbatim} >>> import os ! >>> os.system('copy /data/mydata.fil /backup/mydata.fil') 0 >>> os.getcwd() # Return the current working directory --- 4358,4362 ---- \begin{verbatim} >>> import os ! >>> os.system('time 0:02') 0 >>> os.getcwd() # Return the current working directory *************** *** 4426,4432 **** The \ulink{\module{re}}{../lib/module-re.html} module provides regular expression tools for advanced string processing. ! When only simple capabilities are needed, string methods are preferred ! because they are easier to read and debug. However, for more ! sophisticated applications, regular expressions can provide succinct, optimized solutions: --- 4445,4449 ---- The \ulink{\module{re}}{../lib/module-re.html} module provides regular expression tools for advanced string processing. ! For complex matching and manipulation, regular expressions offer succinct, optimized solutions: *************** *** 4439,4442 **** --- 4456,4466 ---- \end{verbatim} + When only simple capabilities are needed, string methods are preferred + because they are easier to read and debug: + + \begin{verbatim} + >>> 'tea for too'.replace('too', 'two') + 'tea for two' + \end{verbatim} \section{Mathematics\label{mathematics}} *************** *** 4677,4682 **** bunch of Python-related personal home pages; many people have downloadable software there. Many more user-created Python modules ! can be found in a third-party repository at ! \url{http://www.vex.net/parnassus}. For Python-related questions and problem reports, you can post to the --- 4701,4706 ---- bunch of Python-related personal home pages; many people have downloadable software there. Many more user-created Python modules ! can be found in the \ulink{Python Package ! Index}{http://www.python.org/pypi} (PyPI). For Python-related questions and problem reports, you can post to the *************** *** 4691,4696 **** asking (and answering) questions, suggesting new features, and announcing new modules. Before posting, be sure to check the list of ! Frequently Asked Questions (also called the FAQ), at ! \url{http://www.python.org/doc/FAQ.html}, or look for it in the \file{Misc/} directory of the Python source distribution. Mailing list archives are available at \url{http://www.python.org/pipermail/}. --- 4715,4719 ---- asking (and answering) questions, suggesting new features, and announcing new modules. Before posting, be sure to check the list of ! \ulink{Frequently Asked Questions}{http://www.python.org/doc/faq/} (also called the FAQ), or look for it in the \file{Misc/} directory of the Python source distribution. Mailing list archives are available at \url{http://www.python.org/pipermail/}. *************** *** 4790,4794 **** in your \file{\~{}/.inputrc}. (Of course, this makes it harder to ! type indented continuation lines.) Automatic completion of variable and module names is optionally --- 4813,4818 ---- in your \file{\~{}/.inputrc}. (Of course, this makes it harder to ! type indented continuation lines if you're accustomed to using ! \kbd{Tab} for that purpose.) Automatic completion of variable and module names is optionally *************** *** 4819,4823 **** the interactive commands, and removing the names avoids creating side effects in the interactive environments. You may find it convenient ! to keep some of the imported modules, such as \module{os}, which turn out to be needed in most sessions with the interpreter. --- 4843,4848 ---- the interactive commands, and removing the names avoids creating side effects in the interactive environments. You may find it convenient ! to keep some of the imported modules, such as ! \ulink{\module{os}}{../lib/module-os.html}, which turn out to be needed in most sessions with the interpreter. From rhettinger at users.sourceforge.net Sun Dec 7 06:24:06 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:24:12 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.156,1.157 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv16378 Modified Files: libfuncs.tex Log Message: Put str() in alphabetical order. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.156 retrieving revision 1.157 diff -C2 -d -r1.156 -r1.157 *** libfuncs.tex 5 Dec 2003 18:57:00 -0000 1.156 --- libfuncs.tex 7 Dec 2003 11:24:03 -0000 1.157 *************** *** 909,912 **** --- 909,922 ---- \end{funcdesc} + \begin{funcdesc}{str}{\optional{object}} + Return a string containing a nicely printable representation of an + object. For strings, this returns the string itself. The + difference with \code{repr(\var{object})} is that + \code{str(\var{object})} does not always attempt to return a string + that is acceptable to \function{eval()}; its goal is to return a + printable string. If no argument is given, returns the empty + string, \code{''}. + \end{funcdesc} + \begin{funcdesc}{sum}{sequence\optional{, start}} Sums \var{start} and the items of a \var{sequence}, from left to *************** *** 935,948 **** \end{verbatim} \versionadded{2.2} - \end{funcdesc} - - \begin{funcdesc}{str}{\optional{object}} - Return a string containing a nicely printable representation of an - object. For strings, this returns the string itself. The - difference with \code{repr(\var{object})} is that - \code{str(\var{object})} does not always attempt to return a string - that is acceptable to \function{eval()}; its goal is to return a - printable string. If no argument is given, returns the empty - string, \code{''}. \end{funcdesc} --- 945,948 ---- From rhettinger at users.sourceforge.net Sun Dec 7 06:40:19 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:40:22 2003 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex,1.34,1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv17796/ext Modified Files: newtypes.tex Log Message: SF patch #838938: Typos in the docs (Extending/Embedding + Python/C API) (Contributed by Florent Rougon.) Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** newtypes.tex 20 Oct 2003 14:01:46 -0000 1.34 --- newtypes.tex 7 Dec 2003 11:40:17 -0000 1.35 *************** *** 538,542 **** \end{verbatim} ! Note that used the \constant{METH_NOARGS} flag to indicate that the method is passed no arguments. --- 538,542 ---- \end{verbatim} ! Note that we used the \constant{METH_NOARGS} flag to indicate that the method is passed no arguments. *************** *** 684,688 **** In this example, we create a list that contains itself. When we delete ! it, it still has a reference from itself. It's reference count doesn't drop to zero. Fortunately, Python's cyclic-garbage collector will eventually figure out that the list is garbage and free it. --- 684,688 ---- In this example, we create a list that contains itself. When we delete ! it, it still has a reference from itself. Its reference count doesn't drop to zero. Fortunately, Python's cyclic-garbage collector will eventually figure out that the list is garbage and free it. From rhettinger at users.sourceforge.net Sun Dec 7 06:40:19 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:40:25 2003 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex, 1.28, 1.29 exceptions.tex, 1.15, 1.16 newtypes.tex, 1.25, 1.26 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv17796/api Modified Files: abstract.tex exceptions.tex newtypes.tex Log Message: SF patch #838938: Typos in the docs (Extending/Embedding + Python/C API) (Contributed by Florent Rougon.) Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** abstract.tex 7 Sep 2003 02:22:16 -0000 1.28 --- abstract.tex 7 Dec 2003 11:40:16 -0000 1.29 *************** *** 268,272 **** char *method, char *format, \moreargs} ! Call the method named \var{m} of object \var{o} with a variable number of C arguments. The C arguments are described by a \cfunction{Py_BuildValue()} format string. The format may be \NULL, --- 268,272 ---- char *method, char *format, \moreargs} ! Call the method named \var{method} of object \var{o} with a variable number of C arguments. The C arguments are described by a \cfunction{Py_BuildValue()} format string. The format may be \NULL, Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** exceptions.tex 29 May 2003 02:17:22 -0000 1.15 --- exceptions.tex 7 Dec 2003 11:40:16 -0000 1.16 *************** *** 332,338 **** The function is called with a single argument \var{obj} that ! identifies where the context in which the unraisable exception ! occurred. The repr of \var{obj} will be printed in the warning ! message. \end{cfuncdesc} --- 332,337 ---- The function is called with a single argument \var{obj} that ! identifies the context in which the unraisable exception occurred. ! The repr of \var{obj} will be printed in the warning message. \end{cfuncdesc} Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** newtypes.tex 19 Oct 2003 07:32:23 -0000 1.25 --- newtypes.tex 7 Dec 2003 11:40:17 -0000 1.26 *************** *** 167,171 **** the \ctype{PyObject} type; it is used when declaring new types which represent objects without a varying length. The specific fields it ! expands to depends on the definition of \csimplemacro{Py_TRACE_REFS}. By default, that macro is not defined, and \csimplemacro{PyObject_HEAD} expands to: --- 167,171 ---- the \ctype{PyObject} type; it is used when declaring new types which represent objects without a varying length. The specific fields it ! expands to depend on the definition of \csimplemacro{Py_TRACE_REFS}. By default, that macro is not defined, and \csimplemacro{PyObject_HEAD} expands to: *************** *** 398,402 **** \cfunction{PyType_Ready()} checks if \member{ob_type} is \NULL, and if so, initializes it: in Python 2.2, it is set to ! \code{\&PyType_Type}; in Python 2.2.1 and later it will be initialized to the \member{ob_type} field of the base class. \cfunction{PyType_Ready()} will not change this field if it is --- 398,402 ---- \cfunction{PyType_Ready()} checks if \member{ob_type} is \NULL, and if so, initializes it: in Python 2.2, it is set to ! \code{\&PyType_Type}; in Python 2.2.1 and later it is initialized to the \member{ob_type} field of the base class. \cfunction{PyType_Ready()} will not change this field if it is *************** *** 705,709 **** \begin{cmemberdesc}{PyTypeObject}{PyBufferProcs*}{tp_as_buffer} ! Pointer to an additional structure contains fields relevant only to objects which implement the buffer interface. These fields are documented in ``Buffer Object Structures'' (section --- 705,709 ---- \begin{cmemberdesc}{PyTypeObject}{PyBufferProcs*}{tp_as_buffer} ! Pointer to an additional structure that contains fields relevant only to objects which implement the buffer interface. These fields are documented in ``Buffer Object Structures'' (section From rhettinger at users.sourceforge.net Sun Dec 7 06:43:58 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:44:01 2003 Subject: [Python-checkins] python/dist/src/Doc/ext newtypes.tex, 1.31.8.3, 1.31.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ext In directory sc8-pr-cvs1:/tmp/cvs-serv18153/ext Modified Files: Tag: release23-maint newtypes.tex Log Message: SF patch #838938: Typos in the docs (Extending/Embedding + Python/C API) (Contributed by Florent Rougon.) Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ext/newtypes.tex,v retrieving revision 1.31.8.3 retrieving revision 1.31.8.4 diff -C2 -d -r1.31.8.3 -r1.31.8.4 *** newtypes.tex 20 Oct 2003 14:34:44 -0000 1.31.8.3 --- newtypes.tex 7 Dec 2003 11:43:56 -0000 1.31.8.4 *************** *** 538,542 **** \end{verbatim} ! Note that used the \constant{METH_NOARGS} flag to indicate that the method is passed no arguments. --- 538,542 ---- \end{verbatim} ! Note that we used the \constant{METH_NOARGS} flag to indicate that the method is passed no arguments. *************** *** 684,688 **** In this example, we create a list that contains itself. When we delete ! it, it still has a reference from itself. It's reference count doesn't drop to zero. Fortunately, Python's cyclic-garbage collector will eventually figure out that the list is garbage and free it. --- 684,688 ---- In this example, we create a list that contains itself. When we delete ! it, it still has a reference from itself. Its reference count doesn't drop to zero. Fortunately, Python's cyclic-garbage collector will eventually figure out that the list is garbage and free it. From rhettinger at users.sourceforge.net Sun Dec 7 06:43:58 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:44:03 2003 Subject: [Python-checkins] python/dist/src/Doc/api abstract.tex, 1.26.12.2, 1.26.12.3 exceptions.tex, 1.15, 1.15.10.1 newtypes.tex, 1.23.8.2, 1.23.8.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv18153/api Modified Files: Tag: release23-maint abstract.tex exceptions.tex newtypes.tex Log Message: SF patch #838938: Typos in the docs (Extending/Embedding + Python/C API) (Contributed by Florent Rougon.) Index: abstract.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/abstract.tex,v retrieving revision 1.26.12.2 retrieving revision 1.26.12.3 diff -C2 -d -r1.26.12.2 -r1.26.12.3 *** abstract.tex 7 Sep 2003 02:26:54 -0000 1.26.12.2 --- abstract.tex 7 Dec 2003 11:43:56 -0000 1.26.12.3 *************** *** 268,272 **** char *method, char *format, \moreargs} ! Call the method named \var{m} of object \var{o} with a variable number of C arguments. The C arguments are described by a \cfunction{Py_BuildValue()} format string. The format may be \NULL, --- 268,272 ---- char *method, char *format, \moreargs} ! Call the method named \var{method} of object \var{o} with a variable number of C arguments. The C arguments are described by a \cfunction{Py_BuildValue()} format string. The format may be \NULL, Index: exceptions.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/exceptions.tex,v retrieving revision 1.15 retrieving revision 1.15.10.1 diff -C2 -d -r1.15 -r1.15.10.1 *** exceptions.tex 29 May 2003 02:17:22 -0000 1.15 --- exceptions.tex 7 Dec 2003 11:43:56 -0000 1.15.10.1 *************** *** 332,338 **** The function is called with a single argument \var{obj} that ! identifies where the context in which the unraisable exception ! occurred. The repr of \var{obj} will be printed in the warning ! message. \end{cfuncdesc} --- 332,337 ---- The function is called with a single argument \var{obj} that ! identifies the context in which the unraisable exception occurred. ! The repr of \var{obj} will be printed in the warning message. \end{cfuncdesc} Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.23.8.2 retrieving revision 1.23.8.3 diff -C2 -d -r1.23.8.2 -r1.23.8.3 *** newtypes.tex 19 Oct 2003 07:31:14 -0000 1.23.8.2 --- newtypes.tex 7 Dec 2003 11:43:56 -0000 1.23.8.3 *************** *** 167,171 **** the \ctype{PyObject} type; it is used when declaring new types which represent objects without a varying length. The specific fields it ! expands to depends on the definition of \csimplemacro{Py_TRACE_REFS}. By default, that macro is not defined, and \csimplemacro{PyObject_HEAD} expands to: --- 167,171 ---- the \ctype{PyObject} type; it is used when declaring new types which represent objects without a varying length. The specific fields it ! expands to depend on the definition of \csimplemacro{Py_TRACE_REFS}. By default, that macro is not defined, and \csimplemacro{PyObject_HEAD} expands to: *************** *** 398,402 **** \cfunction{PyType_Ready()} checks if \member{ob_type} is \NULL, and if so, initializes it: in Python 2.2, it is set to ! \code{\&PyType_Type}; in Python 2.2.1 and later it will be initialized to the \member{ob_type} field of the base class. \cfunction{PyType_Ready()} will not change this field if it is --- 398,402 ---- \cfunction{PyType_Ready()} checks if \member{ob_type} is \NULL, and if so, initializes it: in Python 2.2, it is set to ! \code{\&PyType_Type}; in Python 2.2.1 and later it is initialized to the \member{ob_type} field of the base class. \cfunction{PyType_Ready()} will not change this field if it is *************** *** 705,709 **** \begin{cmemberdesc}{PyTypeObject}{PyBufferProcs*}{tp_as_buffer} ! Pointer to an additional structure contains fields relevant only to objects which implement the buffer interface. These fields are documented in ``Buffer Object Structures'' (section --- 705,709 ---- \begin{cmemberdesc}{PyTypeObject}{PyBufferProcs*}{tp_as_buffer} ! Pointer to an additional structure that contains fields relevant only to objects which implement the buffer interface. These fields are documented in ``Buffer Object Structures'' (section From rhettinger at users.sourceforge.net Sun Dec 7 06:50:04 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 06:50:07 2003 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex, 1.23.8.3, 1.23.8.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv18809 Modified Files: Tag: release23-maint newtypes.tex Log Message: Fixed unmatched paren. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.23.8.3 retrieving revision 1.23.8.4 diff -C2 -d -r1.23.8.3 -r1.23.8.4 *** newtypes.tex 7 Dec 2003 11:43:56 -0000 1.23.8.3 --- newtypes.tex 7 Dec 2003 11:50:02 -0000 1.23.8.4 *************** *** 855,859 **** present in the type object; but those fields also exist when \constant{Py_TPFLAGS_HAVE_GC} is clear but ! \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} is set). \end{datadesc} --- 855,859 ---- present in the type object; but those fields also exist when \constant{Py_TPFLAGS_HAVE_GC} is clear but ! \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} is set. \end{datadesc} From rhettinger at users.sourceforge.net Sun Dec 7 07:46:18 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 07:46:21 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26362 Modified Files: libhtmlparser.tex Log Message: Fix double hyphen markup. Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libhtmlparser.tex 25 Aug 2003 03:31:28 -0000 1.4 --- libhtmlparser.tex 7 Dec 2003 12:46:16 -0000 1.5 *************** *** 110,116 **** This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{} delimiters, but not the delimiters ! themselves. For example, the comment \samp{} will cause ! this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class implementation does nothing. --- 110,116 ---- This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{{-}{-}} and \samp{{-}{-}} delimiters, but not the delimiters ! themselves. For example, the comment \samp{} will ! cause this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class implementation does nothing. From rhettinger at users.sourceforge.net Sun Dec 7 07:47:02 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 07:47:05 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex, 1.3.12.1, 1.3.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv26446 Modified Files: Tag: release23-maint libhtmlparser.tex Log Message: Fix double hyphen markup. Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.3.12.1 retrieving revision 1.3.12.2 diff -C2 -d -r1.3.12.1 -r1.3.12.2 *** libhtmlparser.tex 25 Aug 2003 03:31:05 -0000 1.3.12.1 --- libhtmlparser.tex 7 Dec 2003 12:47:00 -0000 1.3.12.2 *************** *** 110,116 **** This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{} delimiters, but not the delimiters ! themselves. For example, the comment \samp{} will cause ! this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class implementation does nothing. --- 110,116 ---- This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{{-}{-}} and \samp{{-}{-}} delimiters, but not the delimiters ! themselves. For example, the comment \samp{} will ! cause this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class implementation does nothing. From rhettinger at users.sourceforge.net Sun Dec 7 07:49:50 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 07:49:54 2003 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.26,1.27 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv26838 Modified Files: newtypes.tex Log Message: Fix missing paren. Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** newtypes.tex 7 Dec 2003 11:40:17 -0000 1.26 --- newtypes.tex 7 Dec 2003 12:49:48 -0000 1.27 *************** *** 855,859 **** present in the type object; but those fields also exist when \constant{Py_TPFLAGS_HAVE_GC} is clear but ! \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} is set). \end{datadesc} --- 855,859 ---- present in the type object; but those fields also exist when \constant{Py_TPFLAGS_HAVE_GC} is clear but ! \constant{Py_TPFLAGS_HAVE_RICHCOMPARE} is set. \end{datadesc} From rhettinger at users.sourceforge.net Sun Dec 7 08:00:31 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 08:00:35 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex, 1.14, 1.15 libcurses.tex, 1.45, 1.46 libfcntl.tex, 1.31, 1.32 libitertools.tex, 1.24, 1.25 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28592 Modified Files: libbsddb.tex libcurses.tex libfcntl.tex libitertools.tex Log Message: SF patch #855195: fix typos (Contributed by George Yoshida.) Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libbsddb.tex 13 Nov 2003 08:30:03 -0000 1.14 --- libbsddb.tex 7 Dec 2003 13:00:23 -0000 1.15 *************** *** 192,196 **** 8 64 9 81 ! >>> 8 in db True >>> db.sync() --- 192,196 ---- 8 64 9 81 ! >>> '8' in db True >>> db.sync() Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** libcurses.tex 14 Aug 2003 04:51:24 -0000 1.45 --- libcurses.tex 7 Dec 2003 13:00:24 -0000 1.46 *************** *** 363,367 **** \begin{funcdesc}{noecho}{} ! Leave echo mode. Echoing of input characters is turned off, \end{funcdesc} --- 363,367 ---- \begin{funcdesc}{noecho}{} ! Leave echo mode. Echoing of input characters is turned off. \end{funcdesc} Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** libfcntl.tex 3 Mar 2003 12:29:42 -0000 1.31 --- libfcntl.tex 7 Dec 2003 13:00:25 -0000 1.32 *************** *** 88,92 **** \begin{verbatim} ! >>> import array, fnctl, struct, termios, os >>> os.getpgrp() 13341 --- 88,92 ---- \begin{verbatim} ! >>> import array, fcntl, struct, termios, os >>> os.getpgrp() 13341 Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libitertools.tex 6 Dec 2003 22:29:43 -0000 1.24 --- libitertools.tex 7 Dec 2003 13:00:25 -0000 1.25 *************** *** 77,80 **** --- 77,81 ---- \begin{funcdesc}{count}{\optional{n}} Make an iterator that returns consecutive integers starting with \var{n}. + If not specified \var{n} defaults to zero. Does not currently support python long integers. Often used as an argument to \function{imap()} to generate consecutive data points. From rhettinger at users.sourceforge.net Sun Dec 7 08:05:17 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 08:05:20 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libbsddb.tex, 1.11.10.2, 1.11.10.3 libcurses.tex, 1.42.8.1, 1.42.8.2 libfcntl.tex, 1.31, 1.31.12.1 libitertools.tex, 1.12.6.7, 1.12.6.8 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv29593 Modified Files: Tag: release23-maint libbsddb.tex libcurses.tex libfcntl.tex libitertools.tex Log Message: SF patch #855195: fix typos (Contributed by George Yoshida.) Index: libbsddb.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libbsddb.tex,v retrieving revision 1.11.10.2 retrieving revision 1.11.10.3 diff -C2 -d -r1.11.10.2 -r1.11.10.3 *** libbsddb.tex 1 Oct 2003 06:02:05 -0000 1.11.10.2 --- libbsddb.tex 7 Dec 2003 13:05:15 -0000 1.11.10.3 *************** *** 200,204 **** 8 64 9 81 ! >>> 8 in db True >>> db.sync() --- 200,204 ---- 8 64 9 81 ! >>> '8' in db True >>> db.sync() Index: libcurses.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcurses.tex,v retrieving revision 1.42.8.1 retrieving revision 1.42.8.2 diff -C2 -d -r1.42.8.1 -r1.42.8.2 *** libcurses.tex 11 Aug 2003 23:43:04 -0000 1.42.8.1 --- libcurses.tex 7 Dec 2003 13:05:15 -0000 1.42.8.2 *************** *** 363,367 **** \begin{funcdesc}{noecho}{} ! Leave echo mode. Echoing of input characters is turned off, \end{funcdesc} --- 363,367 ---- \begin{funcdesc}{noecho}{} ! Leave echo mode. Echoing of input characters is turned off. \end{funcdesc} Index: libfcntl.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfcntl.tex,v retrieving revision 1.31 retrieving revision 1.31.12.1 diff -C2 -d -r1.31 -r1.31.12.1 *** libfcntl.tex 3 Mar 2003 12:29:42 -0000 1.31 --- libfcntl.tex 7 Dec 2003 13:05:15 -0000 1.31.12.1 *************** *** 88,92 **** \begin{verbatim} ! >>> import array, fnctl, struct, termios, os >>> os.getpgrp() 13341 --- 88,92 ---- \begin{verbatim} ! >>> import array, fcntl, struct, termios, os >>> os.getpgrp() 13341 Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.12.6.7 retrieving revision 1.12.6.8 diff -C2 -d -r1.12.6.7 -r1.12.6.8 *** libitertools.tex 20 Oct 2003 20:45:33 -0000 1.12.6.7 --- libitertools.tex 7 Dec 2003 13:05:15 -0000 1.12.6.8 *************** *** 77,80 **** --- 77,81 ---- \begin{funcdesc}{count}{\optional{n}} Make an iterator that returns consecutive integers starting with \var{n}. + If not specified \var{n} defaults to zero. Does not currently support python long integers. Often used as an argument to \function{imap()} to generate consecutive data points. From jvr at users.sourceforge.net Sun Dec 7 13:11:53 2003 From: jvr at users.sourceforge.net (jvr@users.sourceforge.net) Date: Sun Dec 7 13:12:05 2003 Subject: [Python-checkins] python/dist/src/Mac/Tools/IDE PythonIDEMain.py, 1.36, 1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Tools/IDE In directory sc8-pr-cvs1:/tmp/cvs-serv20164 Modified Files: PythonIDEMain.py Log Message: fixed long standing typo Index: PythonIDEMain.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Tools/IDE/PythonIDEMain.py,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** PythonIDEMain.py 19 Nov 2003 13:45:26 -0000 1.36 --- PythonIDEMain.py 7 Dec 2003 18:11:51 -0000 1.37 *************** *** 14,20 **** if MacOS.runtimemodel == 'macho': ! ELIPSES = '...' else: ! ELIPSES = '\xc9' def runningOnOSX(): --- 14,20 ---- if MacOS.runtimemodel == 'macho': ! ELLIPSIS = '...' else: ! ELLIPSIS = '\xc9' def runningOnOSX(): *************** *** 75,80 **** m = Wapplication.Menu(self.menubar, "File") newitem = FrameWork.MenuItem(m, "New", "N", 'new') ! openitem = FrameWork.MenuItem(m, "Open"+ELIPSES, "O", 'open') ! openbynameitem = FrameWork.MenuItem(m, "Open File by Name"+ELIPSES, "D", 'openbyname') self.openrecentmenu = FrameWork.SubMenu(m, "Open Recent") self.makeopenrecentmenu() --- 75,80 ---- m = Wapplication.Menu(self.menubar, "File") newitem = FrameWork.MenuItem(m, "New", "N", 'new') ! openitem = FrameWork.MenuItem(m, "Open"+ELLIPSIS, "O", 'open') ! openbynameitem = FrameWork.MenuItem(m, "Open File by Name"+ELLIPSIS, "D", 'openbyname') self.openrecentmenu = FrameWork.SubMenu(m, "Open Recent") self.makeopenrecentmenu() *************** *** 82,88 **** closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') ! saveasitem = FrameWork.MenuItem(m, "Save as"+ELIPSES, None, 'save_as') FrameWork.Separator(m) ! saveasappletitem = FrameWork.MenuItem(m, "Save as Applet"+ELIPSES, None, 'save_as_applet') FrameWork.Separator(m) instmgritem = FrameWork.MenuItem(m, "Package Manager", None, 'openpackagemanager') --- 82,88 ---- closeitem = FrameWork.MenuItem(m, "Close", "W", 'close') saveitem = FrameWork.MenuItem(m, "Save", "S", 'save') ! saveasitem = FrameWork.MenuItem(m, "Save as"+ELLIPSIS, None, 'save_as') FrameWork.Separator(m) ! saveasappletitem = FrameWork.MenuItem(m, "Save as Applet"+ELLIPSIS, None, 'save_as_applet') FrameWork.Separator(m) instmgritem = FrameWork.MenuItem(m, "Package Manager", None, 'openpackagemanager') *************** *** 105,109 **** sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline") FrameWork.Separator(m) ! finditem = FrameWork.MenuItem(m, "Find"+ELIPSES, "F", "find") findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext") enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring") --- 105,109 ---- sellineitem = FrameWork.MenuItem(m, "Select line", "L", "selectline") FrameWork.Separator(m) ! finditem = FrameWork.MenuItem(m, "Find"+ELLIPSIS, "F", "find") findagainitem = FrameWork.MenuItem(m, "Find again", 'G', "findnext") enterselitem = FrameWork.MenuItem(m, "Enter search string", "E", "entersearchstring") *************** *** 118,127 **** runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection') FrameWork.Separator(m) ! moditem = FrameWork.MenuItem(m, "Module browser"+ELIPSES, "M", self.domenu_modulebrowser) FrameWork.Separator(m) mm = FrameWork.SubMenu(m, "Preferences") ! FrameWork.MenuItem(mm, "Set Scripts folder"+ELIPSES, None, self.do_setscriptsfolder) ! FrameWork.MenuItem(mm, "Editor default settings"+ELIPSES, None, self.do_editorprefs) ! FrameWork.MenuItem(mm, "Set default window font"+ELIPSES, None, self.do_setwindowfont) self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') --- 118,127 ---- runselitem = FrameWork.MenuItem(m, "Run selection", None, 'runselection') FrameWork.Separator(m) ! moditem = FrameWork.MenuItem(m, "Module browser"+ELLIPSIS, "M", self.domenu_modulebrowser) FrameWork.Separator(m) mm = FrameWork.SubMenu(m, "Preferences") ! FrameWork.MenuItem(mm, "Set Scripts folder"+ELLIPSIS, None, self.do_setscriptsfolder) ! FrameWork.MenuItem(mm, "Editor default settings"+ELLIPSIS, None, self.do_editorprefs) ! FrameWork.MenuItem(mm, "Set default window font"+ELLIPSIS, None, self.do_setwindowfont) self.openwindowsmenu = Wapplication.Menu(self.menubar, 'Windows') *************** *** 147,151 **** if not os.path.exists(path): os.makedirs(path) ! f = open(os.path.join(path, "Place your scripts here"+ELIPSES), "w") f.close() fsr = File.FSRef(path) --- 147,151 ---- if not os.path.exists(path): os.makedirs(path) ! f = open(os.path.join(path, "Place your scripts here"+ELLIPSIS), "w") f.close() fsr = File.FSRef(path) *************** *** 197,201 **** def getabouttext(self): ! return "About Python IDE"+ELIPSES def do_about(self, id, item, window, event): --- 197,201 ---- def getabouttext(self): ! return "About Python IDE"+ELLIPSIS def do_about(self, id, item, window, event): From jackjansen at users.sourceforge.net Sun Dec 7 16:52:09 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 7 16:52:13 2003 Subject: [Python-checkins] python/dist/src Makefile.pre.in,1.140,1.141 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv29230 Modified Files: Makefile.pre.in Log Message: forward port of 1.136.6.2: $(prefix) wasn't communicated to Mac/OSX/Makefile for all targets. Fixed. Index: Makefile.pre.in =================================================================== RCS file: /cvsroot/python/python/dist/src/Makefile.pre.in,v retrieving revision 1.140 retrieving revision 1.141 diff -C2 -d -r1.140 -r1.141 *** Makefile.pre.in 18 Nov 2003 19:54:20 -0000 1.140 --- Makefile.pre.in 7 Dec 2003 21:52:07 -0000 1.141 *************** *** 876,880 **** $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) # This install the unix python and pythonw tools in /usr/local/bin --- 876,880 ---- $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installapps \ $(RUNSHARED) BUILDPYTHON=./$(BUILDPYTHON) DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix) # This install the unix python and pythonw tools in /usr/local/bin *************** *** 882,886 **** $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) # This installs the Demos and Tools into the applications directory. --- 882,886 ---- $(MAKE) -f $(srcdir)/Mac/OSX/Makefile installunixtools \ DIRMODE=$(DIRMODE) FILEMODE=$(FILEMODE) \ ! srcdir=$(srcdir) builddir=. DESTDIR=$(DESTDIR) prefix=$(prefix) # This installs the Demos and Tools into the applications directory. From rhettinger at users.sourceforge.net Sun Dec 7 19:40:24 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 7 19:40:27 2003 Subject: [Python-checkins] python/nondist/peps pep-0320.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv27127 Modified Files: pep-0320.txt Log Message: Known updates to Py2.4 plans. Index: pep-0320.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0320.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0320.txt 19 Nov 2003 17:03:32 -0000 1.2 --- pep-0320.txt 8 Dec 2003 00:40:21 -0000 1.3 *************** *** 2,6 **** Title: Python 2.4 Release Schedule Version: $Revision$ ! Author: Barry Warsaw Status: Incomplete Type: Informational --- 2,6 ---- Title: Python 2.4 Release Schedule Version: $Revision$ ! Author: Barry Warsaw and Raymond Hettinger Status: Incomplete Type: Informational *************** *** 17,25 **** There will be at least two alpha releases, two beta releases, and ! one release candidate. Other than that, no claims are made on ! release plans, nor what will actually be in Python 2.4 at this ! early date. There were 19 months between the Python 2.2 final and ! Python 2.3 final releases. If that schedule holds true for Python ! 2.4, you can expect it some time around February 2005. --- 17,22 ---- There will be at least two alpha releases, two beta releases, and ! one release candidate. The release date is not yet fixed but a ! rough target is June or July of 2004. *************** *** 31,39 **** Completed features for 2.4 ! None Planned features for 2.4 Deprecate and/or remove the modules listed in PEP 4 (posixfile, gopherlib, audioop, pre, others) --- 28,54 ---- Completed features for 2.4 ! PEP 218 Builtin Set Objects ! ! PEP 322 Reverse Iteration ! ! Encapsulate the decorate-sort-undecorate patten in a keyword for ! list.sort(). ! ! Added a classmethod called list.sorted() which may be used in ! expressions. ! ! The itertools module has two new functions, tee() and groupby(). ! Planned features for 2.4 + PEP 289 Generator expressions. + + PEP 292 Simpler String Substitutions to be implemented as a module + or codec. + + A Decimal package for fixed precision arithmetic. + Deprecate and/or remove the modules listed in PEP 4 (posixfile, gopherlib, audioop, pre, others) *************** *** 83,91 **** - The import lock could use some redesign. (SF 683658.) - - Set API issues; is the sets module perfect? - - I expect it's good enough to stop polishing it until we've had - more widespread user experience. - - A nicer API to open text files, replacing the ugly (in some people's eyes) "U" mode flag. There's a proposal out there to --- 98,101 ---- *************** *** 93,98 **** (Shouldn't it have a bufsize argument too?) - Ditto. - - New widgets for Tkinter??? --- 103,106 ---- *************** *** 101,109 **** already (though not on Windows yet). - - Fredrik Lundh's basetime proposal: - http://effbot.org/ideas/time-type.htm - - I believe this is dead now. - - PEP 304 (Controlling Generation of Bytecode Files by Montanaro) seems to have lost steam. --- 109,112 ---- *************** *** 133,141 **** It seems we can't get consensus on this. - - Deprecate the buffer object. - http://mail.python.org/pipermail/python-dev/2002-July/026388.html - http://mail.python.org/pipermail/python-dev/2002-July/026408.html - It seems that this is never going to be resolved. - - PEP 269 Pgen Module for Python Riehl --- 136,139 ---- *************** *** 157,165 **** slow and the compiler is only the first step. Maybe we'll be able to refactor the compiler in this release. I'm tempted to ! say we won't hold our breath. In the mean time, Oren Tirosh has ! a much simpler idea that may give a serious boost to the ! performance of accessing globals and built-ins, by optimizing ! and inlining the dict access: ! http://tothink.com/python/fastnames/ - Lazily tracking tuples? --- 155,159 ---- slow and the compiler is only the first step. Maybe we'll be able to refactor the compiler in this release. I'm tempted to ! say we won't hold our breath. - Lazily tracking tuples? From jackjansen at users.sourceforge.net Sun Dec 7 20:10:15 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 7 20:10:19 2003 Subject: [Python-checkins] python/dist/src configure.in, 1.441, 1.442 configure, 1.431, 1.432 Message-ID: Update of /cvsroot/python/python/dist/src In directory sc8-pr-cvs1:/tmp/cvs-serv31459 Modified Files: configure.in configure Log Message: Revamped framework search path handling for MacOSX. This should allow two framework builds (in /Library and /System/Library) to coexist with distutils linking against the right one. Should be backported to 2.3, but getting Apple-supplied Python to pick up these fixes is going to be non-trivial. Index: configure.in =================================================================== RCS file: /cvsroot/python/python/dist/src/configure.in,v retrieving revision 1.441 retrieving revision 1.442 diff -C2 -d -r1.441 -r1.442 *** configure.in 18 Nov 2003 20:00:44 -0000 1.441 --- configure.in 8 Dec 2003 01:10:12 -0000 1.442 *************** *** 1186,1190 **** # -F. is needed to allow linking to the framework while # in the build location. - LDFLAGS="$LDFLAGS -Wl,-F." AC_DEFINE(WITH_NEXT_FRAMEWORK, 1, [Define if you want to produce an OpenStep/Rhapsody framework --- 1186,1189 ---- *************** *** 1269,1273 **** if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)' else # No framework. Ignore undefined symbols, assuming they come from Python --- 1268,1273 ---- if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)' ! LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)' else # No framework. Ignore undefined symbols, assuming they come from Python *************** *** 1278,1282 **** if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader --- 1278,1283 ---- if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)' ! LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader *************** *** 1371,1375 **** if test "$enable_framework" then ! LINKFORSHARED="$LINKFORSHARED -framework Python" fi LINKFORSHARED="$LINKFORSHARED $extra_frameworks";; --- 1372,1376 ---- if test "$enable_framework" then ! LINKFORSHARED="$LINKFORSHARED -Wl,-F. -framework Python" fi LINKFORSHARED="$LINKFORSHARED $extra_frameworks";; Index: configure =================================================================== RCS file: /cvsroot/python/python/dist/src/configure,v retrieving revision 1.431 retrieving revision 1.432 diff -C2 -d -r1.431 -r1.432 *** configure 18 Nov 2003 20:00:15 -0000 1.431 --- configure 8 Dec 2003 01:10:12 -0000 1.432 *************** *** 1,4 **** #! /bin/sh ! # From configure.in Revision: 1.440 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. --- 1,4 ---- #! /bin/sh ! # From configure.in Revision: 1.441 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. *************** *** 9992,9996 **** # -F. is needed to allow linking to the framework while # in the build location. - LDFLAGS="$LDFLAGS -Wl,-F." cat >>confdefs.h <<\_ACEOF --- 9992,9995 ---- *************** *** 10086,10090 **** if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)' else # No framework. Ignore undefined symbols, assuming they come from Python --- 10085,10090 ---- if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)' ! LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)' else # No framework. Ignore undefined symbols, assuming they come from Python *************** *** 10095,10099 **** if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! LDSHARED="$LDSHARED "'-framework $(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader --- 10095,10100 ---- if test "$enable_framework" ; then # Link against the framework. All externals should be defined. ! BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)' ! LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)' else # No framework, use the Python app as bundle-loader *************** *** 10192,10196 **** if test "$enable_framework" then ! LINKFORSHARED="$LINKFORSHARED -framework Python" fi LINKFORSHARED="$LINKFORSHARED $extra_frameworks";; --- 10193,10197 ---- if test "$enable_framework" then ! LINKFORSHARED="$LINKFORSHARED -Wl,-F. -framework Python" fi LINKFORSHARED="$LINKFORSHARED $extra_frameworks";; From theller at users.sourceforge.net Mon Dec 8 04:23:25 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Dec 8 04:23:30 2003 Subject: [Python-checkins] python/dist/src/PCbuild make_versioninfo.dsp, 1.1.2.1, 1.1.2.2 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv29575 Modified Files: Tag: release23-maint make_versioninfo.dsp Log Message: Sigh. dsp files must be marked as binary files for cvs, otherwise MSVC isn't able to read them. Thanks to David Rushby. Index: make_versioninfo.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/make_versioninfo.dsp,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** make_versioninfo.dsp 22 Oct 2003 19:38:10 -0000 1.1.2.1 --- make_versioninfo.dsp 8 Dec 2003 09:23:23 -0000 1.1.2.2 *************** *** 1,108 **** ! # Microsoft Developer Studio Project File - Name="make_versioninfo" - Package Owner=<4> ! # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** DO NOT EDIT ** ! ! # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! ! CFG=make_versioninfo - Win32 Release ! !MESSAGE This is not a valid makefile. To build this project using NMAKE, ! !MESSAGE use the Export Makefile command and run ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak". ! !MESSAGE ! !MESSAGE You can specify a configuration when running NMAKE ! !MESSAGE by defining the macro CFG on the command line. For example: ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak" CFG="make_versioninfo - Win32 Release" ! !MESSAGE ! !MESSAGE Possible choices for configuration are: ! !MESSAGE ! !MESSAGE "make_versioninfo - Win32 Release" (based on "Win32 (x86) Console Application") ! !MESSAGE "make_versioninfo - Win32 Debug" (based on "Win32 (x86) Console Application") ! !MESSAGE ! ! # Begin Project ! # PROP AllowPerConfigDependencies 0 ! # PROP Scc_ProjName "make_versioninfo" ! # PROP Scc_LocalPath ".." ! CPP=cl.exe ! RSC=rc.exe ! ! !IF "$(CFG)" == "make_versioninfo - Win32 Release" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 0 ! # PROP BASE Output_Dir "Release" ! # PROP BASE Intermediate_Dir "Release" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-release\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "NDEBUG" ! # ADD RSC /l 0x409 /d "NDEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo.exe >..\PC\pythonnt_rc.h ! ! # End Custom Build ! ! !ELSEIF "$(CFG)" == "make_versioninfo - Win32 Debug" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 1 ! # PROP BASE Output_Dir "Debug" ! # PROP BASE Intermediate_Dir "Debug" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-debug\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "_DEBUG" ! # ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 /out:"./make_versioninfo_d.exe" /pdbtype:sept ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo_d.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc_d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo_d.exe >..\PC\pythonnt_rc_d.h ! ! # End Custom Build ! ! !ENDIF ! ! # Begin Target ! ! # Name "make_versioninfo - Win32 Release" ! # Name "make_versioninfo - Win32 Debug" ! # Begin Source File ! ! SOURCE=..\PC\make_versioninfo.c ! # End Source File ! # End Target ! # End Project --- 1,108 ---- ! # Microsoft Developer Studio Project File - Name="make_versioninfo" - Package Owner=<4> ! # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** DO NOT EDIT ** ! ! # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! ! CFG=make_versioninfo - Win32 Release ! !MESSAGE This is not a valid makefile. To build this project using NMAKE, ! !MESSAGE use the Export Makefile command and run ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak". ! !MESSAGE ! !MESSAGE You can specify a configuration when running NMAKE ! !MESSAGE by defining the macro CFG on the command line. For example: ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak" CFG="make_versioninfo - Win32 Release" ! !MESSAGE ! !MESSAGE Possible choices for configuration are: ! !MESSAGE ! !MESSAGE "make_versioninfo - Win32 Release" (based on "Win32 (x86) Console Application") ! !MESSAGE "make_versioninfo - Win32 Debug" (based on "Win32 (x86) Console Application") ! !MESSAGE ! ! # Begin Project ! # PROP AllowPerConfigDependencies 0 ! # PROP Scc_ProjName "make_versioninfo" ! # PROP Scc_LocalPath ".." ! CPP=cl.exe ! RSC=rc.exe ! ! !IF "$(CFG)" == "make_versioninfo - Win32 Release" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 0 ! # PROP BASE Output_Dir "Release" ! # PROP BASE Intermediate_Dir "Release" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-release\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "NDEBUG" ! # ADD RSC /l 0x409 /d "NDEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo.exe >..\PC\pythonnt_rc.h ! ! # End Custom Build ! ! !ELSEIF "$(CFG)" == "make_versioninfo - Win32 Debug" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 1 ! # PROP BASE Output_Dir "Debug" ! # PROP BASE Intermediate_Dir "Debug" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-debug\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "_DEBUG" ! # ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 /out:"./make_versioninfo_d.exe" /pdbtype:sept ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo_d.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc_d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo_d.exe >..\PC\pythonnt_rc_d.h ! ! # End Custom Build ! ! !ENDIF ! ! # Begin Target ! ! # Name "make_versioninfo - Win32 Release" ! # Name "make_versioninfo - Win32 Debug" ! # Begin Source File ! ! SOURCE=..\PC\make_versioninfo.c ! # End Source File ! # End Target ! # End Project From theller at users.sourceforge.net Mon Dec 8 04:31:54 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Mon Dec 8 04:31:58 2003 Subject: [Python-checkins] python/dist/src/PCbuild make_versioninfo.dsp, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv30805 Modified Files: make_versioninfo.dsp Log Message: Sigh. dsp files must be marked as binary files for cvs, otherwise MSVC isn't able to read them. Thanks to David Rushby. Index: make_versioninfo.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/make_versioninfo.dsp,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** make_versioninfo.dsp 10 Oct 2003 16:57:45 -0000 1.1 --- make_versioninfo.dsp 8 Dec 2003 09:31:52 -0000 1.2 *************** *** 1,108 **** ! # Microsoft Developer Studio Project File - Name="make_versioninfo" - Package Owner=<4> ! # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** DO NOT EDIT ** ! ! # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! ! CFG=make_versioninfo - Win32 Release ! !MESSAGE This is not a valid makefile. To build this project using NMAKE, ! !MESSAGE use the Export Makefile command and run ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak". ! !MESSAGE ! !MESSAGE You can specify a configuration when running NMAKE ! !MESSAGE by defining the macro CFG on the command line. For example: ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak" CFG="make_versioninfo - Win32 Release" ! !MESSAGE ! !MESSAGE Possible choices for configuration are: ! !MESSAGE ! !MESSAGE "make_versioninfo - Win32 Release" (based on "Win32 (x86) Console Application") ! !MESSAGE "make_versioninfo - Win32 Debug" (based on "Win32 (x86) Console Application") ! !MESSAGE ! ! # Begin Project ! # PROP AllowPerConfigDependencies 0 ! # PROP Scc_ProjName "make_versioninfo" ! # PROP Scc_LocalPath ".." ! CPP=cl.exe ! RSC=rc.exe ! ! !IF "$(CFG)" == "make_versioninfo - Win32 Release" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 0 ! # PROP BASE Output_Dir "Release" ! # PROP BASE Intermediate_Dir "Release" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-release\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "NDEBUG" ! # ADD RSC /l 0x409 /d "NDEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo.exe >..\PC\pythonnt_rc.h ! ! # End Custom Build ! ! !ELSEIF "$(CFG)" == "make_versioninfo - Win32 Debug" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 1 ! # PROP BASE Output_Dir "Debug" ! # PROP BASE Intermediate_Dir "Debug" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-debug\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "_DEBUG" ! # ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 /out:"./make_versioninfo_d.exe" /pdbtype:sept ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo_d.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc_d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo_d.exe >..\PC\pythonnt_rc_d.h ! ! # End Custom Build ! ! !ENDIF ! ! # Begin Target ! ! # Name "make_versioninfo - Win32 Release" ! # Name "make_versioninfo - Win32 Debug" ! # Begin Source File ! ! SOURCE=..\PC\make_versioninfo.c ! # End Source File ! # End Target ! # End Project --- 1,108 ---- ! # Microsoft Developer Studio Project File - Name="make_versioninfo" - Package Owner=<4> ! # Microsoft Developer Studio Generated Build File, Format Version 6.00 ! # ** DO NOT EDIT ** ! ! # TARGTYPE "Win32 (x86) Console Application" 0x0103 ! ! CFG=make_versioninfo - Win32 Release ! !MESSAGE This is not a valid makefile. To build this project using NMAKE, ! !MESSAGE use the Export Makefile command and run ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak". ! !MESSAGE ! !MESSAGE You can specify a configuration when running NMAKE ! !MESSAGE by defining the macro CFG on the command line. For example: ! !MESSAGE ! !MESSAGE NMAKE /f "make_versioninfo.mak" CFG="make_versioninfo - Win32 Release" ! !MESSAGE ! !MESSAGE Possible choices for configuration are: ! !MESSAGE ! !MESSAGE "make_versioninfo - Win32 Release" (based on "Win32 (x86) Console Application") ! !MESSAGE "make_versioninfo - Win32 Debug" (based on "Win32 (x86) Console Application") ! !MESSAGE ! ! # Begin Project ! # PROP AllowPerConfigDependencies 0 ! # PROP Scc_ProjName "make_versioninfo" ! # PROP Scc_LocalPath ".." ! CPP=cl.exe ! RSC=rc.exe ! ! !IF "$(CFG)" == "make_versioninfo - Win32 Release" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 0 ! # PROP BASE Output_Dir "Release" ! # PROP BASE Intermediate_Dir "Release" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 0 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-release\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MD /W3 /GX /Zi /O2 /I "..\Include" /I "..\PC" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "NDEBUG" ! # ADD RSC /l 0x409 /d "NDEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo.exe >..\PC\pythonnt_rc.h ! ! # End Custom Build ! ! !ELSEIF "$(CFG)" == "make_versioninfo - Win32 Debug" ! ! # PROP BASE Use_MFC 0 ! # PROP BASE Use_Debug_Libraries 1 ! # PROP BASE Output_Dir "Debug" ! # PROP BASE Intermediate_Dir "Debug" ! # PROP BASE Target_Dir "" ! # PROP Use_MFC 0 ! # PROP Use_Debug_Libraries 1 ! # PROP Output_Dir "." ! # PROP Intermediate_Dir "x86-temp-debug\make_versioninfo" ! # PROP Ignore_Export_Lib 0 ! # PROP Target_Dir "" ! # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c ! # ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\PC" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /c ! # ADD BASE RSC /l 0x409 /d "_DEBUG" ! # ADD RSC /l 0x409 /i "..\Include" /d "_DEBUG" ! BSC32=bscmake.exe ! # ADD BASE BSC32 /nologo ! # ADD BSC32 /nologo ! LINK32=link.exe ! # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept ! # ADD LINK32 odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x1d000000" /subsystem:console /debug /machine:I386 /out:"./make_versioninfo_d.exe" /pdbtype:sept ! # SUBTRACT LINK32 /pdb:none ! # Begin Custom Build ! InputPath=.\make_versioninfo_d.exe ! SOURCE="$(InputPath)" ! ! "..\PC\pythonnt_rc_d.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" ! .\make_versioninfo_d.exe >..\PC\pythonnt_rc_d.h ! ! # End Custom Build ! ! !ENDIF ! ! # Begin Target ! ! # Name "make_versioninfo - Win32 Release" ! # Name "make_versioninfo - Win32 Debug" ! # Begin Source File ! ! SOURCE=..\PC\make_versioninfo.c ! # End Source File ! # End Target ! # End Project From sjoerd at acm.org Mon Dec 8 04:42:15 2003 From: sjoerd at acm.org (Sjoerd Mullender) Date: Mon Dec 8 04:42:23 2003 Subject: [Python-checkins] python/dist/src/PCbuild make_versioninfo.dsp, 1.1.2.1, 1.1.2.2 In-Reply-To: References: Message-ID: <3FD44777.2090107@acm.org> theller@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/PCbuild > In directory sc8-pr-cvs1:/tmp/cvs-serv29575 > > Modified Files: > Tag: release23-maint > make_versioninfo.dsp > Log Message: > Sigh. dsp files must be marked as binary files for cvs, otherwise > MSVC isn't able to read them. Thanks to David Rushby. Actually, this is not entirely true. They must be marked with -ko, i.e. CVS keywords must not be expanded. But it is ok if they are treated as text files. -- Sjoerd Mullender From theller at python.net Mon Dec 8 04:59:35 2003 From: theller at python.net (Thomas Heller) Date: Mon Dec 8 04:59:44 2003 Subject: [Python-Dev] Re: [Python-checkins] python/dist/src/PCbuild make_versioninfo.dsp, 1.1.2.1, 1.1.2.2 In-Reply-To: <3FD44777.2090107@acm.org> (Sjoerd Mullender's message of "Mon, 08 Dec 2003 10:42:15 +0100") References: <3FD44777.2090107@acm.org> Message-ID: Sjoerd Mullender writes: > theller@users.sourceforge.net wrote: >> Update of /cvsroot/python/python/dist/src/PCbuild >> In directory sc8-pr-cvs1:/tmp/cvs-serv29575 >> Modified Files: >> Tag: release23-maint >> make_versioninfo.dsp Log Message: >> Sigh. dsp files must be marked as binary files for cvs, otherwise >> MSVC isn't able to read them. Thanks to David Rushby. > > Actually, this is not entirely true. > They must be marked with -ko, i.e. CVS keywords must not be > expanded. But it is ok if they are treated as text files. That may be, but the real problem is that MSVC refuses to load them if they have unix line endings. And the source tarball is built on a unix like system. Thomas From doerwalter at users.sourceforge.net Mon Dec 8 06:38:47 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Dec 8 06:38:51 2003 Subject: [Python-checkins] python/dist/src/Lib/test/output test_types, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv15675/Lib/test/output Modified Files: test_types Log Message: Move list and tuple tests from test_types.py to their own scripts: test_tuple.py and test_list.py. Common tests for tuple, list and UserList are shared (in seq_tests.py and list_tests.py). Port tests to PyUnit. (From SF patch #736962) Index: test_types =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/output/test_types,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_types 24 Mar 2002 01:24:54 -0000 1.2 --- test_types 8 Dec 2003 11:38:45 -0000 1.3 *************** *** 10,16 **** 6.5 Sequence types 6.5.1 Strings ! 6.5.2 Tuples ! 6.5.3 Lists ! 6.5.3a Additional list operations 6.6 Mappings == Dictionaries Buffers --- 10,15 ---- 6.5 Sequence types 6.5.1 Strings ! 6.5.2 Tuples [see test_tuple.py] ! 6.5.3 Lists [see test_list.py] 6.6 Mappings == Dictionaries Buffers From doerwalter at users.sourceforge.net Mon Dec 8 06:38:47 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Dec 8 06:38:56 2003 Subject: [Python-checkins] python/dist/src/Lib/test list_tests.py, NONE, 1.1 seq_tests.py, NONE, 1.1 test_list.py, NONE, 1.1 test_tuple.py, NONE, 1.1 test_types.py, 1.55, 1.56 test_userlist.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv15675/Lib/test Modified Files: test_types.py test_userlist.py Added Files: list_tests.py seq_tests.py test_list.py test_tuple.py Log Message: Move list and tuple tests from test_types.py to their own scripts: test_tuple.py and test_list.py. Common tests for tuple, list and UserList are shared (in seq_tests.py and list_tests.py). Port tests to PyUnit. (From SF patch #736962) --- NEW FILE: list_tests.py --- """ Tests common to list and UserList.UserList """ import sys import unittest from test import test_support, seq_tests class CommonTest(seq_tests.CommonTest): def test_repr(self): l0 = [] l2 = [0, 1, 2] a0 = self.type2test(l0) a2 = self.type2test(l2) self.assertEqual(str(a0), str(l0)) self.assertEqual(repr(a0), repr(l0)) self.assertEqual(`a2`, `l2`) self.assertEqual(str(a2), "[0, 1, 2]") self.assertEqual(repr(a2), "[0, 1, 2]") def test_setitem(self): a = self.type2test([0, 1]) a[0] = 0 a[1] = 100 self.assertEqual(a, self.type2test([0, 100])) a[-1] = 200 self.assertEqual(a, self.type2test([0, 200])) a[-2] = 100 self.assertEqual(a, self.type2test([100, 200])) self.assertRaises(IndexError, a.__setitem__, -3, 200) self.assertRaises(IndexError, a.__setitem__, 2, 200) a = self.type2test([]) self.assertRaises(IndexError, a.__setitem__, 0, 200) self.assertRaises(IndexError, a.__setitem__, -1, 200) self.assertRaises(TypeError, a.__setitem__) a = self.type2test([0,1,2,3,4]) a[0L] = 1 a[1L] = 2 a[2L] = 3 self.assertEqual(a, self.type2test([1,2,3,3,4])) a[0] = 5 a[1] = 6 a[2] = 7 self.assertEqual(a, self.type2test([5,6,7,3,4])) a[-2L] = 88 a[-1L] = 99 self.assertEqual(a, self.type2test([5,6,7,88,99])) a[-2] = 8 a[-1] = 9 self.assertEqual(a, self.type2test([5,6,7,8,9])) def test_delitem(self): a = self.type2test([0, 1]) del a[1] self.assertEqual(a, [0]) del a[0] self.assertEqual(a, []) a = self.type2test([0, 1]) del a[-2] self.assertEqual(a, [1]) del a[-1] self.assertEqual(a, []) a = self.type2test([0, 1]) self.assertRaises(IndexError, a.__delitem__, -3) self.assertRaises(IndexError, a.__delitem__, 2) a = self.type2test([]) self.assertRaises(IndexError, a.__delitem__, 0) self.assertRaises(TypeError, a.__delitem__) def test_setslice(self): l = [0, 1] a = self.type2test(l) for i in range(-3, 4): a[:i] = l[:i] self.assertEqual(a, l) a2 = a[:] a2[:i] = a[:i] self.assertEqual(a2, a) a[i:] = l[i:] self.assertEqual(a, l) a2 = a[:] a2[i:] = a[i:] self.assertEqual(a2, a) for j in range(-3, 4): a[i:j] = l[i:j] self.assertEqual(a, l) a2 = a[:] a2[i:j] = a[i:j] self.assertEqual(a2, a) aa2 = a2[:] aa2[:0] = [-2, -1] self.assertEqual(aa2, [-2, -1, 0, 1]) aa2[0:] = [] self.assertEqual(aa2, []) a = self.type2test([1, 2, 3, 4, 5]) a[:-1] = a self.assertEqual(a, self.type2test([1, 2, 3, 4, 5, 5])) a = self.type2test([1, 2, 3, 4, 5]) a[1:] = a self.assertEqual(a, self.type2test([1, 1, 2, 3, 4, 5])) a = self.type2test([1, 2, 3, 4, 5]) a[1:-1] = a self.assertEqual(a, self.type2test([1, 1, 2, 3, 4, 5, 5])) a = self.type2test([]) a[:] = tuple(range(10)) self.assertEqual(a, self.type2test(range(10))) self.assertRaises(TypeError, a.__setslice__, 0, 1, 5) self.assertRaises(TypeError, a.__setslice__) def test_delslice(self): a = self.type2test([0, 1]) del a[1:2] del a[0:1] self.assertEqual(a, self.type2test([])) a = self.type2test([0, 1]) del a[1L:2L] del a[0L:1L] self.assertEqual(a, self.type2test([])) a = self.type2test([0, 1]) del a[-2:-1] self.assertEqual(a, self.type2test([1])) a = self.type2test([0, 1]) del a[-2L:-1L] self.assertEqual(a, self.type2test([1])) a = self.type2test([0, 1]) del a[1:] del a[:1] self.assertEqual(a, self.type2test([])) a = self.type2test([0, 1]) del a[1L:] del a[:1L] self.assertEqual(a, self.type2test([])) a = self.type2test([0, 1]) del a[-1:] self.assertEqual(a, self.type2test([0])) a = self.type2test([0, 1]) del a[-1L:] self.assertEqual(a, self.type2test([0])) a = self.type2test([0, 1]) del a[:] self.assertEqual(a, self.type2test([])) def test_append(self): a = self.type2test([]) a.append(0) a.append(1) a.append(2) self.assertEqual(a, self.type2test([0, 1, 2])) self.assertRaises(TypeError, a.append) def test_extend(self): a1 = self.type2test([0]) a2 = self.type2test((0, 1)) a = a1[:] a.extend(a2) self.assertEqual(a, a1 + a2) a.extend(self.type2test([])) self.assertEqual(a, a1 + a2) a.extend(a) self.assertEqual(a, self.type2test([0, 0, 1, 0, 0, 1])) a = self.type2test("spam") a.extend("eggs") self.assertEqual(a, list("spameggs")) self.assertRaises(TypeError, a.extend, None) self.assertRaises(TypeError, a.extend) def test_insert(self): a = self.type2test([0, 1, 2]) a.insert(0, -2) a.insert(1, -1) a.insert(2, 0) self.assertEqual(a, [-2, -1, 0, 0, 1, 2]) b = a[:] b.insert(-2, "foo") b.insert(-200, "left") b.insert(200, "right") self.assertEqual(b, self.type2test(["left",-2,-1,0,0,"foo",1,2,"right"])) self.assertRaises(TypeError, a.insert) def test_pop(self): a = self.type2test([-1, 0, 1]) a.pop() self.assertEqual(a, [-1, 0]) a.pop(0) self.assertEqual(a, [0]) self.assertRaises(IndexError, a.pop, 5) a.pop(0) self.assertEqual(a, []) self.assertRaises(IndexError, a.pop) self.assertRaises(TypeError, a.pop, 42, 42) def test_remove(self): a = self.type2test([0, 0, 1]) a.remove(1) self.assertEqual(a, [0, 0]) a.remove(0) self.assertEqual(a, [0]) a.remove(0) self.assertEqual(a, []) self.assertRaises(ValueError, a.remove, 0) self.assertRaises(TypeError, a.remove) class BadExc(Exception): pass class BadCmp: def __eq__(self, other): if other == 2: raise BadExc() return False a = self.type2test([0, 1, 2, 3]) self.assertRaises(BadExc, a.remove, BadCmp()) def test_count(self): a = self.type2test([0, 1, 2])*3 self.assertEqual(a.count(0), 3) self.assertEqual(a.count(1), 3) self.assertEqual(a.count(3), 0) self.assertRaises(TypeError, a.count) class BadExc(Exception): pass class BadCmp: def __eq__(self, other): if other == 2: raise BadExc() return False self.assertRaises(BadExc, a.count, BadCmp()) def test_index(self): u = self.type2test([0, 1]) self.assertEqual(u.index(0), 0) self.assertEqual(u.index(1), 1) self.assertRaises(ValueError, u.index, 2) u = self.type2test([-2, -1, 0, 0, 1, 2]) self.assertEqual(u.count(0), 2) self.assertEqual(u.index(0), 2) self.assertEqual(u.index(0, 2), 2) self.assertEqual(u.index(-2, -10), 0) self.assertEqual(u.index(0, 3), 3) self.assertEqual(u.index(0, 3, 4), 3) self.assertRaises(ValueError, u.index, 2, 0, -10) self.assertRaises(TypeError, u.index) class BadExc(Exception): pass class BadCmp: def __eq__(self, other): if other == 2: raise BadExc() return False a = self.type2test([0, 1, 2, 3]) self.assertRaises(BadExc, a.index, BadCmp()) a = self.type2test([-2, -1, 0, 0, 1, 2]) self.assertEqual(a.index(0), 2) self.assertEqual(a.index(0, 2), 2) self.assertEqual(a.index(0, -4), 2) self.assertEqual(a.index(-2, -10), 0) self.assertEqual(a.index(0, 3), 3) self.assertEqual(a.index(0, -3), 3) self.assertEqual(a.index(0, 3, 4), 3) self.assertEqual(a.index(0, -3, -2), 3) self.assertEqual(a.index(0, -4*sys.maxint, 4*sys.maxint), 2) self.assertRaises(ValueError, a.index, 0, 4*sys.maxint,-4*sys.maxint) self.assertRaises(ValueError, a.index, 2, 0, -10) a.remove(0) self.assertRaises(ValueError, a.index, 2, 0, 4) self.assertEqual(a, self.type2test([-2, -1, 0, 1, 2])) def test_reverse(self): u = self.type2test([-2, -1, 0, 1, 2]) u2 = u[:] u.reverse() self.assertEqual(u, [2, 1, 0, -1, -2]) u.reverse() self.assertEqual(u, u2) self.assertRaises(TypeError, u.reverse, 42) def test_sort(self): u = self.type2test([1, 0]) u.sort() self.assertEqual(u, [0, 1]) u = self.type2test([2,1,0,-1,-2]) u.sort() self.assertEqual(u, self.type2test([-2,-1,0,1,2])) self.assertRaises(TypeError, u.sort, 42, 42) def revcmp(a, b): return cmp(b, a) u.sort(revcmp) self.assertEqual(u, self.type2test([2,1,0,-1,-2])) # The following dumps core in unpatched Python 1.5: def myComparison(x,y): return cmp(x%3, y%7) z = self.type2test(range(12)) z.sort(myComparison) self.assertRaises(TypeError, z.sort, 2) def selfmodifyingComparison(x,y): z.append(1) return cmp(x, y) self.assertRaises(ValueError, z.sort, selfmodifyingComparison) self.assertRaises(TypeError, z.sort, lambda x, y: 's') self.assertRaises(TypeError, z.sort, 42, 42, 42, 42) def test_slice(self): u = self.type2test("spam") u[:2] = "h" self.assertEqual(u, list("ham")) def test_iadd(self): super(CommonTest, self).test_iadd() u = self.type2test([0, 1]) u2 = u u += [2, 3] self.assert_(u is u2) u = self.type2test("spam") u += "eggs" self.assertEqual(u, self.type2test("spameggs")) self.assertRaises(TypeError, u.__iadd__, None) def test_imul(self): u = self.type2test([0, 1]) u *= 3 self.assertEqual(u, self.type2test([0, 1, 0, 1, 0, 1])) u *= 0 self.assertEqual(u, self.type2test([])) def test_extendedslicing(self): # subscript a = self.type2test([0,1,2,3,4]) # deletion del a[::2] self.assertEqual(a, self.type2test([1,3])) a = self.type2test(range(5)) del a[1::2] self.assertEqual(a, self.type2test([0,2,4])) a = self.type2test(range(5)) del a[1::-2] self.assertEqual(a, self.type2test([0,2,3,4])) a = self.type2test(range(10)) del a[::1000] self.assertEqual(a, self.type2test([1, 2, 3, 4, 5, 6, 7, 8, 9])) # assignment a = self.type2test(range(10)) a[::2] = [-1]*5 self.assertEqual(a, self.type2test([-1, 1, -1, 3, -1, 5, -1, 7, -1, 9])) a = self.type2test(range(10)) a[::-4] = [10]*3 self.assertEqual(a, self.type2test([0, 10, 2, 3, 4, 10, 6, 7, 8 ,10])) a = self.type2test(range(4)) a[::-1] = a self.assertEqual(a, self.type2test([3, 2, 1, 0])) a = self.type2test(range(10)) b = a[:] c = a[:] a[2:3] = self.type2test(["two", "elements"]) b[slice(2,3)] = self.type2test(["two", "elements"]) c[2:3:] = self.type2test(["two", "elements"]) self.assertEqual(a, b) self.assertEqual(a, c) a = self.type2test(range(10)) a[::2] = tuple(range(5)) self.assertEqual(a, self.type2test([0, 1, 1, 3, 2, 5, 3, 7, 4, 9])) --- NEW FILE: seq_tests.py --- """ Tests common to tuple, list and UserList.UserList """ import unittest from test import test_support class CommonTest(unittest.TestCase): # The type to be tested type2test = None def test_constructors(self): l0 = [] l1 = [0] l2 = [0, 1] u = self.type2test() u0 = self.type2test(l0) u1 = self.type2test(l1) u2 = self.type2test(l2) uu = self.type2test(u) uu0 = self.type2test(u0) uu1 = self.type2test(u1) uu2 = self.type2test(u2) v = self.type2test(tuple(u)) class OtherSeq: def __init__(self, initseq): self.__data = initseq def __len__(self): return len(self.__data) def __getitem__(self, i): return self.__data[i] s = OtherSeq(u0) v0 = self.type2test(s) self.assertEqual(len(v0), len(s)) s = "this is also a sequence" vv = self.type2test(s) self.assertEqual(len(vv), len(s)) def test_truth(self): self.assert_(not self.type2test()) self.assert_(self.type2test([42])) def test_getitem(self): u = self.type2test([0, 1, 2, 3, 4]) for i in xrange(len(u)): self.assertEqual(u[i], i) for i in xrange(-len(u), -1): self.assertEqual(u[i], len(u)+i) self.assertRaises(IndexError, u.__getitem__, -len(u)-1) self.assertRaises(IndexError, u.__getitem__, len(u)) u = self.type2test() self.assertRaises(IndexError, u.__getitem__, 0) self.assertRaises(IndexError, u.__getitem__, -1) self.assertRaises(TypeError, u.__getitem__) def test_getslice(self): l = [0, 1, 2, 3, 4] u = self.type2test(l) self.assertEqual(u[0:0], self.type2test()) self.assertEqual(u[1:2], self.type2test([1])) self.assertEqual(u[-2:-1], self.type2test([3])) self.assertEqual(u[-1000:1000], u) self.assertEqual(u[1000:-1000], self.type2test([])) self.assertEqual(u[:], u) self.assertEqual(u[1:None], self.type2test([1, 2, 3, 4])) self.assertEqual(u[None:3], self.type2test([0, 1, 2])) # Extended slices self.assertEqual(u[::], u) self.assertEqual(u[::2], self.type2test([0, 2, 4])) self.assertEqual(u[1::2], self.type2test([1, 3])) self.assertEqual(u[::-1], self.type2test([4, 3, 2, 1, 0])) self.assertEqual(u[::-2], self.type2test([4, 2, 0])) self.assertEqual(u[3::-2], self.type2test([3, 1])) self.assertEqual(u[3:3:-2], self.type2test([])) self.assertEqual(u[3:2:-2], self.type2test([3])) self.assertEqual(u[3:1:-2], self.type2test([3])) self.assertEqual(u[3:0:-2], self.type2test([3, 1])) self.assertEqual(u[::-100], self.type2test([4])) self.assertEqual(u[100:-100:], self.type2test([])) self.assertEqual(u[-100:100:], u) self.assertEqual(u[100:-100:-1], u[::-1]) self.assertEqual(u[-100:100:-1], self.type2test([])) self.assertEqual(u[-100L:100L:2L], self.type2test([0, 2, 4])) # Test extreme cases with long ints a = self.type2test([0,1,2,3,4]) self.assertEqual(a[ -pow(2,128L): 3 ], self.type2test([0,1,2])) self.assertEqual(a[ 3: pow(2,145L) ], self.type2test([3,4])) self.assertRaises(TypeError, u.__getslice__) def test_contains(self): u = self.type2test([0, 1, 2]) for i in u: self.assert_(i in u) for i in min(u)-1, max(u)+1: self.assert_(i not in u) self.assertRaises(TypeError, u.__contains__) def test_len(self): self.assertEqual(len(self.type2test()), 0) self.assertEqual(len(self.type2test([])), 0) self.assertEqual(len(self.type2test([0])), 1) self.assertEqual(len(self.type2test([0, 1, 2])), 3) def test_minmax(self): u = self.type2test([0, 1, 2]) self.assertEqual(min(u), 0) self.assertEqual(max(u), 2) def test_addmul(self): u1 = self.type2test([0]) u2 = self.type2test([0, 1]) self.assertEqual(u1, u1 + self.type2test()) self.assertEqual(u1, self.type2test() + u1) self.assertEqual(u1 + self.type2test([1]), u2) self.assertEqual(self.type2test([-1]) + u1, self.type2test([-1, 0])) self.assertEqual(self.type2test(), u2*0) self.assertEqual(self.type2test(), 0*u2) self.assertEqual(self.type2test(), u2*0L) self.assertEqual(self.type2test(), 0L*u2) self.assertEqual(u2, u2*1) self.assertEqual(u2, 1*u2) self.assertEqual(u2, u2*1L) self.assertEqual(u2, 1L*u2) self.assertEqual(u2+u2, u2*2) self.assertEqual(u2+u2, 2*u2) self.assertEqual(u2+u2, u2*2L) self.assertEqual(u2+u2, 2L*u2) self.assertEqual(u2+u2+u2, u2*3) self.assertEqual(u2+u2+u2, 3*u2) class subclass(self.type2test): pass u3 = subclass([0, 1]) self.assertEqual(u3, u3*1) self.assert_(u3 is not u3*1) def test_iadd(self): u = self.type2test([0, 1]) u += self.type2test() self.assertEqual(u, self.type2test([0, 1])) u += self.type2test([2, 3]) self.assertEqual(u, self.type2test([0, 1, 2, 3])) u += self.type2test([4, 5]) self.assertEqual(u, self.type2test([0, 1, 2, 3, 4, 5])) u = self.type2test("spam") u += self.type2test("eggs") self.assertEqual(u, self.type2test("spameggs")) def test_imul(self): u = self.type2test([0, 1]) u *= 3 self.assertEqual(u, self.type2test([0, 1, 0, 1, 0, 1])) def test_getitemoverwriteiter(self): # Verify that __getitem__ overrides are not recognized by __iter__ class T(self.type2test): def __getitem__(self, key): return str(key) + '!!!' self.assertEqual(iter(T((1,2))).next(), 1) --- NEW FILE: test_list.py --- import unittest from test import test_support, list_tests class ListTest(list_tests.CommonTest): type2test = list def test_truth(self): super(ListTest, self).test_truth() self.assert_(not []) self.assert_([42]) def test_identity(self): self.assert_([] is not []) def test_len(self): super(ListTest, self).test_len() self.assertEqual(len([]), 0) self.assertEqual(len([0]), 1) self.assertEqual(len([0, 1, 2]), 3) def test_main(): test_support.run_unittest(ListTest) if __name__=="__main__": test_main() --- NEW FILE: test_tuple.py --- import unittest from test import test_support, seq_tests class TupleTest(seq_tests.CommonTest): type2test = tuple def test_constructors(self): super(TupleTest, self).test_len() # calling built-in types without argument must return empty self.assertEqual(tuple(), ()) def test_truth(self): super(TupleTest, self).test_truth() self.assert_(not ()) self.assert_((42, )) def test_len(self): super(TupleTest, self).test_len() self.assertEqual(len(()), 0) self.assertEqual(len((0,)), 1) self.assertEqual(len((0, 1, 2)), 3) def test_iadd(self): super(TupleTest, self).test_iadd() u = (0, 1) u2 = u u += (2, 3) self.assert_(u is not u2) def test_imul(self): super(TupleTest, self).test_imul() u = (0, 1) u2 = u u *= 3 self.assert_(u is not u2) def test_tupleresizebug(self): # Check that a specific bug in _PyTuple_Resize() is squashed. def f(): for i in range(1000): yield i self.assertEqual(list(tuple(f())), range(1000)) def test_main(): test_support.run_unittest(TupleTest) if __name__=="__main__": test_main() Index: test_types.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_types.py,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** test_types.py 17 Jun 2003 19:27:39 -0000 1.55 --- test_types.py 8 Dec 2003 11:38:45 -0000 1.56 *************** *** 11,16 **** if 0.0: raise TestFailed, '0.0 is true instead of false' if '': raise TestFailed, '\'\' is true instead of false' - if (): raise TestFailed, '() is true instead of false' - if []: raise TestFailed, '[] is true instead of false' if {}: raise TestFailed, '{} is true instead of false' if not 1: raise TestFailed, '1 is false instead of true' --- 11,14 ---- *************** *** 18,23 **** if not 1.0: raise TestFailed, '1.0 is false instead of true' if not 'x': raise TestFailed, '\'x\' is false instead of true' - if not (1, 1): raise TestFailed, '(1, 1) is false instead of true' - if not [1]: raise TestFailed, '[1] is false instead of true' if not {'x': 1}: raise TestFailed, '{\'x\': 1} is false instead of true' def f(): pass --- 16,19 ---- *************** *** 45,51 **** if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass else: raise TestFailed, 'string comparisons failed' ! if 0 in [0] and 0 not in [1]: pass ! else: raise TestFailed, 'membership test failed' ! if None is None and [] is not []: pass else: raise TestFailed, 'identity test failed' --- 41,45 ---- if '' < 'a' <= 'a' == 'a' < 'abc' < 'abd' < 'b': pass else: raise TestFailed, 'string comparisons failed' ! if None is None: pass else: raise TestFailed, 'identity test failed' *************** *** 218,491 **** ! print '6.5.2 Tuples' ! # calling built-in types without argument must return empty ! if tuple() != (): raise TestFailed,'tuple() does not return ()' ! if len(()) != 0: raise TestFailed, 'len(())' ! if len((1,)) != 1: raise TestFailed, 'len((1,))' ! if len((1,2,3,4,5,6)) != 6: raise TestFailed, 'len((1,2,3,4,5,6))' ! if (1,2)+(3,4) != (1,2,3,4): raise TestFailed, 'tuple concatenation' ! if (1,2)*3 != (1,2,1,2,1,2): raise TestFailed, 'tuple repetition *3' ! if 0*(1,2,3) != (): raise TestFailed, 'tuple repetition 0*' ! if min((1,2)) != 1 or max((1,2)) != 2: raise TestFailed, 'min/max tuple' ! if 0 in (0,1,2) and 1 in (0,1,2) and 2 in (0,1,2) and 3 not in (0,1,2): pass ! else: raise TestFailed, 'in/not in tuple' ! try: ()[0] ! except IndexError: pass ! else: raise TestFailed, "tuple index error didn't raise IndexError" ! x = () ! x += () ! if x != (): raise TestFailed, 'tuple inplace add from () to () failed' ! x += (1,) ! if x != (1,): raise TestFailed, 'tuple resize from () failed' ! ! # extended slicing - subscript only for tuples ! a = (0,1,2,3,4) ! vereq(a[::], a) ! vereq(a[::2], (0,2,4)) ! vereq(a[1::2], (1,3)) ! vereq(a[::-1], (4,3,2,1,0)) ! vereq(a[::-2], (4,2,0)) ! vereq(a[3::-2], (3,1)) ! vereq(a[-100:100:], a) ! vereq(a[100:-100:-1], a[::-1]) ! vereq(a[-100L:100L:2L], (0,2,4)) ! ! # Check that a specific bug in _PyTuple_Resize() is squashed. ! def f(): ! for i in range(1000): ! yield i ! 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' ! # calling built-in types without argument must return empty ! if list() != []: raise TestFailed,'list() does not return []' ! if len([]) != 0: raise TestFailed, 'len([])' ! if len([1,]) != 1: raise TestFailed, 'len([1,])' ! if len([1,2,3,4,5,6]) != 6: raise TestFailed, 'len([1,2,3,4,5,6])' ! if [1,2]+[3,4] != [1,2,3,4]: raise TestFailed, 'list concatenation' ! if [1,2]*3 != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3' ! if [1,2]*3L != [1,2,1,2,1,2]: raise TestFailed, 'list repetition *3L' ! if 0*[1,2,3] != []: raise TestFailed, 'list repetition 0*' ! if 0L*[1,2,3] != []: raise TestFailed, 'list repetition 0L*' ! if min([1,2]) != 1 or max([1,2]) != 2: raise TestFailed, 'min/max list' ! if 0 in [0,1,2] and 1 in [0,1,2] and 2 in [0,1,2] and 3 not in [0,1,2]: pass ! else: raise TestFailed, 'in/not in list' ! a = [1, 2, 3, 4, 5] ! a[:-1] = a ! if a != [1, 2, 3, 4, 5, 5]: ! raise TestFailed, "list self-slice-assign (head)" ! a = [1, 2, 3, 4, 5] ! a[1:] = a ! if a != [1, 1, 2, 3, 4, 5]: ! raise TestFailed, "list self-slice-assign (tail)" ! a = [1, 2, 3, 4, 5] ! a[1:-1] = a ! if a != [1, 1, 2, 3, 4, 5, 5]: ! raise TestFailed, "list self-slice-assign (center)" ! try: [][0] ! except IndexError: pass ! else: raise TestFailed, "list index error didn't raise IndexError" ! try: [][0] = 5 ! except IndexError: pass ! else: raise TestFailed, "list assignment index error didn't raise IndexError" ! try: [].pop() ! except IndexError: pass ! else: raise TestFailed, "empty list.pop() didn't raise IndexError" ! try: [1].pop(5) ! except IndexError: pass ! else: raise TestFailed, "[1].pop(5) didn't raise IndexError" ! try: [][0:1] = 5 ! except TypeError: pass ! else: raise TestFailed, "bad list slice assignment didn't raise TypeError" ! try: [].extend(None) ! except TypeError: pass ! else: raise TestFailed, "list.extend(None) didn't raise TypeError" ! a = [1, 2, 3, 4] ! a *= 0 ! if a != []: ! raise TestFailed, "list inplace repeat" ! ! a = [] ! a[:] = tuple(range(10)) ! if a != range(10): ! raise TestFailed, "assigning tuple to slice" ! ! print '6.5.3a Additional list operations' ! a = [0,1,2,3,4] ! a[0L] = 1 ! a[1L] = 2 ! a[2L] = 3 ! if a != [1,2,3,3,4]: raise TestFailed, 'list item assignment [0L], [1L], [2L]' ! a[0] = 5 ! a[1] = 6 ! a[2] = 7 ! if a != [5,6,7,3,4]: raise TestFailed, 'list item assignment [0], [1], [2]' ! a[-2L] = 88 ! a[-1L] = 99 ! if a != [5,6,7,88,99]: raise TestFailed, 'list item assignment [-2L], [-1L]' ! a[-2] = 8 ! a[-1] = 9 ! if a != [5,6,7,8,9]: raise TestFailed, 'list item assignment [-2], [-1]' ! a[:2] = [0,4] ! a[-3:] = [] ! a[1:1] = [1,2,3] ! if a != [0,1,2,3,4]: raise TestFailed, 'list slice assignment' ! a[ 1L : 4L] = [7,8,9] ! if a != [0,7,8,9,4]: raise TestFailed, 'list slice assignment using long ints' ! del a[1:4] ! if a != [0,4]: raise TestFailed, 'list slice deletion' ! del a[0] ! if a != [4]: raise TestFailed, 'list item deletion [0]' ! del a[-1] ! if a != []: raise TestFailed, 'list item deletion [-1]' ! a=range(0,5) ! del a[1L:4L] ! if a != [0,4]: raise TestFailed, 'list slice deletion' ! del a[0L] ! if a != [4]: raise TestFailed, 'list item deletion [0]' ! del a[-1L] ! if a != []: raise TestFailed, 'list item deletion [-1]' ! a.append(0) ! a.append(1) ! a.append(2) ! if a != [0,1,2]: raise TestFailed, 'list append' ! a.insert(0, -2) ! a.insert(1, -1) ! a.insert(2,0) ! if a != [-2,-1,0,0,1,2]: raise TestFailed, 'list insert' ! b = a[:] ! b.insert(-2, "foo") ! b.insert(-200, "left") ! b.insert(200, "right") ! if b != ["left",-2,-1,0,0,"foo",1,2,"right"]: raise TestFailed, 'list insert2' ! # a = [-2,-1,0,0,1,2] ! if a.count(0) != 2: raise TestFailed, ' list count' ! if a.index(0) != 2: raise TestFailed, 'list index' ! if a.index(0,2) != 2: raise TestFailed, 'list index, start argument' ! if a.index(0,-4) != 2: raise TestFailed, 'list index, -start argument' ! if a.index(-2,-10) != 0: raise TestFailed, 'list index, very -start argument' ! if a.index(0,3) != 3: raise TestFailed, 'list index, start argument' ! if a.index(0,-3) != 3: raise TestFailed, 'list index, -start argument' ! if a.index(0,3,4) != 3: raise TestFailed, 'list index, stop argument' ! if a.index(0,-3,-2) != 3: raise TestFailed, 'list index, -stop argument' ! if a.index(0,-4*sys.maxint,4*sys.maxint) != 2: ! raise TestFailed, 'list index, -maxint, maxint argument' ! try: ! a.index(0, 4*sys.maxint,-4*sys.maxint) ! except ValueError: ! pass ! else: ! raise TestFailed, 'list index, maxint,-maxint argument' ! ! try: ! a.index(2,0,-10) ! except ValueError: ! pass ! else: ! raise TestFailed, 'list index, very -stop argument' ! a.remove(0) ! try: ! a.index(2,0,4) ! except ValueError: ! pass ! else: ! raise TestFailed, 'list index, stop argument.' ! if a != [-2,-1,0,1,2]: raise TestFailed, 'list remove' ! a.reverse() ! if a != [2,1,0,-1,-2]: raise TestFailed, 'list reverse' ! a.sort() ! if a != [-2,-1,0,1,2]: raise TestFailed, 'list sort' ! def revcmp(a, b): return cmp(b, a) ! a.sort(revcmp) ! if a != [2,1,0,-1,-2]: raise TestFailed, 'list sort with cmp func' ! # The following dumps core in unpatched Python 1.5: ! def myComparison(x,y): ! return cmp(x%3, y%7) ! z = range(12) ! z.sort(myComparison) ! ! try: z.sort(2) ! except TypeError: pass ! else: raise TestFailed, 'list sort compare function is not callable' ! ! def selfmodifyingComparison(x,y): ! z.append(1) ! return cmp(x, y) ! try: z.sort(selfmodifyingComparison) ! except ValueError: pass ! else: raise TestFailed, 'modifying list during sort' ! ! try: z.sort(lambda x, y: 's') ! except TypeError: pass ! else: raise TestFailed, 'list sort compare function does not return int' ! ! # Test extreme cases with long ints ! a = [0,1,2,3,4] ! if a[ -pow(2,128L): 3 ] != [0,1,2]: ! raise TestFailed, "list slicing with too-small long integer" ! if a[ 3: pow(2,145L) ] != [3,4]: ! raise TestFailed, "list slicing with too-large long integer" ! ! ! # extended slicing ! ! # subscript ! a = [0,1,2,3,4] ! vereq(a[::], a) ! vereq(a[::2], [0,2,4]) ! vereq(a[1::2], [1,3]) ! vereq(a[::-1], [4,3,2,1,0]) ! vereq(a[::-2], [4,2,0]) ! vereq(a[3::-2], [3,1]) ! vereq(a[-100:100:], a) ! vereq(a[100:-100:-1], a[::-1]) ! vereq(a[-100L:100L:2L], [0,2,4]) ! vereq(a[1000:2000:2], []) ! vereq(a[-1000:-2000:-2], []) ! # deletion ! del a[::2] ! vereq(a, [1,3]) ! a = range(5) ! del a[1::2] ! vereq(a, [0,2,4]) ! a = range(5) ! del a[1::-2] ! vereq(a, [0,2,3,4]) ! a = range(10) ! del a[::1000] ! vereq(a, [1, 2, 3, 4, 5, 6, 7, 8, 9]) ! # assignment ! a = range(10) ! a[::2] = [-1]*5 ! vereq(a, [-1, 1, -1, 3, -1, 5, -1, 7, -1, 9]) ! a = range(10) ! a[::-4] = [10]*3 ! vereq(a, [0, 10, 2, 3, 4, 10, 6, 7, 8 ,10]) ! a = range(4) ! a[::-1] = a ! vereq(a, [3, 2, 1, 0]) ! a = range(10) ! b = a[:] ! c = a[:] ! a[2:3] = ["two", "elements"] ! b[slice(2,3)] = ["two", "elements"] ! c[2:3:] = ["two", "elements"] ! vereq(a, b) ! vereq(a, c) ! a = range(10) ! a[::2] = tuple(range(5)) ! 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) --- 212,218 ---- ! print '6.5.2 Tuples [see test_tuple.py]' ! print '6.5.3 Lists [see test_list.py]' Index: test_userlist.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_userlist.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_userlist.py 17 Jun 2003 05:05:49 -0000 1.10 --- test_userlist.py 8 Dec 2003 11:38:45 -0000 1.11 *************** *** 2,164 **** from UserList import UserList ! import unittest, test.test_support ! ! class UserListTest(unittest.TestCase): ! ! def test_constructors(self): ! l0 = [] ! l1 = [0] ! l2 = [0, 1] ! ! u = UserList() ! u0 = UserList(l0) ! u1 = UserList(l1) ! u2 = UserList(l2) ! ! uu = UserList(u) ! uu0 = UserList(u0) ! uu1 = UserList(u1) ! uu2 = UserList(u2) ! ! v = UserList(tuple(u)) ! class OtherList: ! def __init__(self, initlist): ! self.__data = initlist ! def __len__(self): ! return len(self.__data) ! def __getitem__(self, i): ! return self.__data[i] ! v0 = UserList(OtherList(u0)) ! vv = UserList("this is also a sequence") ! ! def test_repr(self): ! l0 = [] ! l2 = [0, 1, 2] ! u0 = UserList(l0) ! u2 = UserList(l2) ! ! self.assertEqual(str(u0), str(l0)) ! self.assertEqual(repr(u0), repr(l0)) ! self.assertEqual(`u2`, `l2`) ! ! def test_cmplen(self): ! l0 = [] ! l1 = [0] ! l2 = [0, 1] ! ! # Test constructors ! ! u = UserList() ! u0 = UserList(l0) ! u1 = UserList(l1) ! u2 = UserList(l2) ! ! uu = UserList(u) ! uu0 = UserList(u0) ! uu1 = UserList(u1) ! uu2 = UserList(u2) ! ! def mycmp(x, y): ! r = cmp(x, y) ! if r < 0: return -1 ! if r > 0: return 1 ! return r ! ! all = [l0, l1, l2, u, u0, u1, u2, uu, uu0, uu1, uu2] ! for a in all: ! for b in all: ! self.assertEqual(mycmp(a, b), mycmp(len(a), len(b))) ! ! self.assert_(u0 <= u2) ! self.assert_(u2 >= u0) ! ! def test_getitem(self): ! u = UserList([0, 1, 2]) ! for i in xrange(len(u)): ! self.assertEqual(u[i], i) ! ! def test_setitem(self): ! u = UserList([0, 1]) ! u[0] = 0 ! u[1] = 100 ! self.assertEqual(u, [0, 100]) ! self.assertRaises(IndexError, u.__setitem__, 2, 200) ! ! def test_delitem(self): ! u = UserList([0, 1]) ! del u[1] ! del u[0] ! self.assertRaises(IndexError, u.__delitem__, 0) ! ! def test_getslice(self): ! l = [0, 1] ! u = UserList(l) ! for i in xrange(-3, 4): ! self.assertEqual(u[:i], l[:i]) ! self.assertEqual(u[i:], l[i:]) ! for j in xrange(-3, 4): ! self.assertEqual(u[i:j], l[i:j]) ! ! def test_setslice(self): ! l = [0, 1] ! u = UserList(l) ! ! # Test __setslice__ ! for i in range(-3, 4): ! u[:i] = l[:i] ! self.assertEqual(u, l) ! u2 = u[:] ! u2[:i] = u[:i] ! self.assertEqual(u2, u) ! u[i:] = l[i:] ! self.assertEqual(u, l) ! u2 = u[:] ! u2[i:] = u[i:] ! self.assertEqual(u2, u) ! for j in range(-3, 4): ! u[i:j] = l[i:j] ! self.assertEqual(u, l) ! u2 = u[:] ! u2[i:j] = u[i:j] ! self.assertEqual(u2, u) ! ! uu2 = u2[:] ! uu2[:0] = [-2, -1] ! self.assertEqual(uu2, [-2, -1, 0, 1]) ! uu2[0:] = [] ! self.assertEqual(uu2, []) ! ! def test_contains(self): ! u = UserList([0, 1, 2]) ! for i in u: ! self.assert_(i in u) ! for i in min(u)-1, max(u)+1: ! self.assert_(i not in u) ! ! def test_delslice(self): ! u = UserList([0, 1]) ! del u[1:2] ! del u[0:1] ! self.assertEqual(u, []) ! ! u = UserList([0, 1]) ! del u[1:] ! del u[:1] ! self.assertEqual(u, []) ! ! def test_addmul(self): ! u1 = UserList([0]) ! u2 = UserList([0, 1]) ! self.assertEqual(u1, u1 + []) ! self.assertEqual(u1, [] + u1) ! self.assertEqual(u1 + [1], u2) ! self.assertEqual([-1] + u1, [-1, 0]) ! self.assertEqual(u2, u2*1) ! self.assertEqual(u2, 1*u2) ! self.assertEqual(u2+u2, u2*2) ! self.assertEqual(u2+u2, 2*u2) ! self.assertEqual(u2+u2+u2, u2*3) ! self.assertEqual(u2+u2+u2, 3*u2) def test_add_specials(self): u = UserList("spam") --- 2,21 ---- from UserList import UserList ! import unittest ! from test import test_support, list_tests + class UserListTest(list_tests.CommonTest): + type2test = UserList + + def test_getslice(self): + super(UserListTest, self).test_getslice() + l = [0, 1, 2, 3, 4] + u = self.type2test(l) + for i in range(-3, 6): + self.assertEqual(u[:i], l[:i]) + self.assertEqual(u[i:], l[i:]) + for j in xrange(-3, 6): + self.assertEqual(u[i:j], l[i:j]) + def test_add_specials(self): u = UserList("spam") *************** *** 173,266 **** self.assertEqual(u2, list("spameggs")) ! def test_append(self): ! u = UserList((0, )) ! u.append(1) ! self.assertEqual(u, [0, 1]) ! ! def test_insert(self): ! u = UserList((0, 1)) ! u.insert(0, -1) ! self.assertEqual(u, [-1, 0, 1]) ! ! def test_pop(self): ! u = UserList((-1, 0, 1)) ! u.pop() ! self.assertEqual(u, [-1, 0]) ! u.pop(0) ! self.assertEqual(u, [0]) ! ! def test_remove(self): ! u = UserList((0, 1)) ! u.remove(1) ! self.assertEqual(u, [0]) ! ! def test_count(self): ! u = UserList((0, 1))*3 ! self.assertEqual(u.count(0), 3) ! self.assertEqual(u.count(1), 3) ! self.assertEqual(u.count(2), 0) ! ! def test_index(self): ! u = UserList((0, 1)) ! self.assertEqual(u.index(0), 0) ! self.assertEqual(u.index(1), 1) ! self.assertRaises(ValueError, u.index, 2) ! ! u = UserList([-2,-1,0,0,1,2]) ! self.assertEqual(u.count(0), 2) ! self.assertEqual(u.index(0), 2) ! self.assertEqual(u.index(0,2), 2) ! self.assertEqual(u.index(-2,-10), 0) ! self.assertEqual(u.index(0,3), 3) ! self.assertEqual(u.index(0,3,4), 3) ! self.assertRaises(ValueError, u.index, 2,0,-10) ! ! def test_reverse(self): ! u = UserList((0, 1)) ! u2 = u[:] ! u.reverse() ! self.assertEqual(u, [1, 0]) ! u.reverse() ! self.assertEqual(u, u2) ! ! def test_sort(self): ! u = UserList([1, 0]) ! u.sort() ! self.assertEqual(u, [0, 1]) ! ! def test_slice(self): ! u = UserList("spam") ! u[:2] = "h" ! self.assertEqual(u, list("ham")) ! ! def test_iadd(self): ! u = UserList((0, 1)) ! u += [0, 1] ! self.assertEqual(u, [0, 1, 0, 1]) ! u += UserList([0, 1]) ! self.assertEqual(u, [0, 1, 0, 1, 0, 1]) ! ! u = UserList("spam") ! u += "eggs" ! self.assertEqual(u, list("spameggs")) ! ! def test_extend(self): ! u1 = UserList((0, )) ! u2 = UserList((0, 1)) ! u = u1[:] ! u.extend(u2) ! self.assertEqual(u, u1 + u2) ! ! u = UserList("spam") ! u.extend("eggs") ! self.assertEqual(u, list("spameggs")) ! ! def test_imul(self): ! u = UserList((0, 1)) ! u *= 3 ! self.assertEqual(u, [0, 1, 0, 1, 0, 1]) def test_main(): ! test.test_support.run_unittest(UserListTest) if __name__ == "__main__": --- 30,59 ---- self.assertEqual(u2, list("spameggs")) ! def test_iadd(self): ! super(UserListTest, self).test_iadd() ! u = [0, 1] ! u += UserList([0, 1]) ! self.assertEqual(u, [0, 1, 0, 1]) ! ! def test_mixedcmp(self): ! u = self.type2test([0, 1]) ! self.assertEqual(u, [0, 1]) ! self.assertNotEqual(u, [0]) ! self.assertNotEqual(u, [0, 2]) ! ! def test_mixedadd(self): ! u = self.type2test([0, 1]) ! self.assertEqual(u + [], u) ! self.assertEqual(u + [2], [0, 1, 2]) ! ! def test_getitemoverwriteiter(self): ! # Verify that __getitem__ overrides *are* recognized by __iter__ ! class T(self.type2test): ! def __getitem__(self, key): ! return str(key) + '!!!' ! self.assertEqual(iter(T((1,2))).next(), "0!!!") def test_main(): ! test_support.run_unittest(UserListTest) if __name__ == "__main__": From python at rcn.com Mon Dec 8 09:59:04 2003 From: python at rcn.com (Raymond Hettinger) Date: Mon Dec 8 09:59:21 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_support.py, 1.59, 1.60 test_unicode_file.py, 1.11, 1.12 In-Reply-To: Message-ID: <005f01c3bd9b$d2da2c80$0705a044@oemcomputer> test_unicode_file.py is now failing Raymond Hettinger From jackjansen at users.sourceforge.net Tue Dec 9 09:51:23 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 9 09:51:27 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/launch setup.py, NONE, 1.1 _Launchmodule.c, 1.3, 1.4 launchsupport.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/launch In directory sc8-pr-cvs1:/tmp/cvs-serv6829 Modified Files: _Launchmodule.c launchsupport.py Added Files: setup.py Log Message: Made this module compatible with Python2.3, and added a temporary setup script that allows it to be built for that Python. --- NEW FILE: setup.py --- # This is a temporary setup script to allow distribution of # MacPython 2.4 modules for MacPython 2.3. from distutils.core import Extension, setup setup(name="LaunchServices", version="0.1", ext_modules=[ Extension('_Launch', ['_Launchmodule.c'], extra_link_args=['-framework', 'ApplicationServices']) ], py_modules=['LaunchServices.Launch', 'LaunchServices.LaunchServices'], package_dir={'LaunchServices':'../../../Lib/plat-mac/Carbon'} ) Index: _Launchmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/_Launchmodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** _Launchmodule.c 3 Dec 2003 23:20:12 -0000 1.3 --- _Launchmodule.c 9 Dec 2003 14:51:21 -0000 1.4 *************** *** 16,19 **** --- 16,23 ---- + #if PY_VERSION_HEX < 0x02040000 + PyObject *PyMac_GetOSErrException(void); + #endif + #include Index: launchsupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/launch/launchsupport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** launchsupport.py 3 Dec 2003 23:20:12 -0000 1.2 --- launchsupport.py 9 Dec 2003 14:51:21 -0000 1.3 *************** *** 30,33 **** --- 30,37 ---- includestuff = includestuff + """ + #if PY_VERSION_HEX < 0x02040000 + PyObject *PyMac_GetOSErrException(void); + #endif + #include From jackjansen at users.sourceforge.net Tue Dec 9 10:06:20 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 9 10:06:24 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/osa setup.py, NONE, 1.1 _OSAmodule.c, 1.1, 1.2 osasupport.py, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/osa In directory sc8-pr-cvs1:/tmp/cvs-serv10297 Modified Files: _OSAmodule.c osasupport.py Added Files: setup.py Log Message: Make this module Python 2.3 compatible, and add a setup script that allows it to be built for that python. --- NEW FILE: setup.py --- # This is a temporary setup script to allow distribution of # MacPython 2.4 modules for MacPython 2.3. from distutils.core import Extension, setup setup(name="OSA", version="0.1", ext_modules=[ Extension('_OSA', ['_OSAmodule.c'], extra_link_args=['-framework', 'Carbon']) ], py_modules=['OSA.OSA', 'OSA.OSAconst'], package_dir={'OSA':'../../../Lib/plat-mac/Carbon'} ) Index: _OSAmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/osa/_OSAmodule.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** _OSAmodule.c 3 Dec 2003 22:34:19 -0000 1.1 --- _OSAmodule.c 9 Dec 2003 15:06:17 -0000 1.2 *************** *** 16,19 **** --- 16,22 ---- + #if PY_VERSION_HEX < 0x02040000 + PyObject *PyMac_GetOSErrException(void); + #endif #include Index: osasupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/osa/osasupport.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** osasupport.py 3 Dec 2003 23:20:13 -0000 1.2 --- osasupport.py 9 Dec 2003 15:06:18 -0000 1.3 *************** *** 21,24 **** --- 21,27 ---- includestuff = includestuff + """ + #if PY_VERSION_HEX < 0x02040000 + PyObject *PyMac_GetOSErrException(void); + #endif #include From jackjansen at users.sourceforge.net Tue Dec 9 10:07:03 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Tue Dec 9 10:07:08 2003 Subject: [Python-checkins] python/dist/src/Lib/plat-mac/Carbon Launch.py, NONE, 1.1 OSA.py, NONE, 1.1 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/plat-mac/Carbon In directory sc8-pr-cvs1:/tmp/cvs-serv10625 Added Files: Launch.py OSA.py Log Message: Wrapper modules for _Launch and _OSA weren't added yet. Fixed. --- NEW FILE: Launch.py --- from _Launch import * --- NEW FILE: OSA.py --- from _OSA import * From rhettinger at users.sourceforge.net Tue Dec 9 20:58:54 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 9 20:58:59 2003 Subject: [Python-checkins] python/dist/src/Demo/scripts mpzpi.py,1.2,1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv6924 Modified Files: mpzpi.py Log Message: Update to use python ints and int/long unification. Index: mpzpi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/mpzpi.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** mpzpi.py 27 Nov 1996 19:47:00 -0000 1.2 --- mpzpi.py 10 Dec 2003 01:58:52 -0000 1.3 *************** *** 9,34 **** import sys - from mpz import mpz def main(): ! mpzone, mpztwo, mpzten = mpz(1), mpz(2), mpz(10) ! k, a, b, a1, b1 = mpz(2), mpz(4), mpz(1), mpz(12), mpz(4) ! while 1: ! # Next approximation ! p, q, k = k*k, mpztwo*k+mpzone, k+mpzone ! a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 ! # Print common digits ! d, d1 = a/b, a1/b1 ! while d == d1: ! output(d) ! a, a1 = mpzten*(a%b), mpzten*(a1%b1) ! d, d1 = a/b, a1/b1 def output(d): ! # Use write() to avoid spaces between the digits ! # Use int(d) to avoid a trailing L after each digit ! sys.stdout.write(`int(d)`) ! # Flush so the output is seen immediately ! sys.stdout.flush() main() --- 9,32 ---- import sys def main(): ! k, a, b, a1, b1 = 2, 4, 1, 12, 4 ! while 1: ! # Next approximation ! p, q, k = k*k, 2*k+1, k+1 ! a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 ! # Print common digits ! d, d1 = a/b, a1/b1 ! while d == d1: ! output(d) ! a, a1 = 10*(a%b), 10*(a1%b1) ! d, d1 = a/b, a1/b1 def output(d): ! # Use write() to avoid spaces between the digits ! # Use int(d) to avoid a trailing L after each digit ! sys.stdout.write(`int(d)`) ! # Flush so the output is seen immediately ! sys.stdout.flush() main() From perky at users.sourceforge.net Wed Dec 10 02:31:11 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Dec 10 02:31:15 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.167,2.168 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv2892 Modified Files: listobject.c Log Message: Fix memory error treatment correctly. Going to dsu_fail causes deallocating garbage pointers; saved_ob_item and empty_ob_item. (Reviewed by Raymond Hettinger) Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.167 retrieving revision 2.168 diff -C2 -d -r2.167 -r2.168 *** listobject.c 4 Dec 2003 11:25:46 -0000 2.167 --- listobject.c 10 Dec 2003 07:31:08 -0000 2.168 *************** *** 1867,1871 **** compare = build_cmpwrapper(compare); if (compare == NULL) ! goto dsu_fail; } else Py_XINCREF(compare); --- 1867,1871 ---- compare = build_cmpwrapper(compare); if (compare == NULL) ! return NULL; } else Py_XINCREF(compare); From jackjansen at users.sourceforge.net Wed Dec 10 10:18:20 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Wed Dec 10 10:18:27 2003 Subject: [Python-checkins] python/dist/src/Mac/Modules/osa _OSAmodule.c, 1.2, 1.3 osasupport.py, 1.3, 1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Mac/Modules/osa In directory sc8-pr-cvs1:/tmp/cvs-serv29540 Modified Files: _OSAmodule.c osasupport.py Log Message: - Renamed OSA.ComponentInstance to OSA.OSAComponentInstance. It is not a real subtype of Cm.ComponentInstance right now, it turns out that is too difficult. - OSA.OSAComponentInstance initializer does accept a Cm.ComponentInstance instance, though, so at least things are becoming useable. Index: _OSAmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/osa/_OSAmodule.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** _OSAmodule.c 9 Dec 2003 15:06:17 -0000 1.2 --- _OSAmodule.c 10 Dec 2003 15:18:18 -0000 1.3 *************** *** 31,53 **** static PyObject *OSA_Error; ! /* ----------------- Object type ComponentInstance ------------------ */ ! PyTypeObject ComponentInstance_Type; ! #define OSAObj_Check(x) ((x)->ob_type == &ComponentInstance_Type || PyObject_TypeCheck((x), &ComponentInstance_Type)) ! typedef struct ComponentInstanceObject { PyObject_HEAD ComponentInstance ob_itself; ! } ComponentInstanceObject; PyObject *OSAObj_New(ComponentInstance itself) { ! ComponentInstanceObject *it; if (itself == NULL) { PyErr_SetString(OSA_Error,"NULL ComponentInstance"); return NULL; } ! it = PyObject_NEW(ComponentInstanceObject, &ComponentInstance_Type); if (it == NULL) return NULL; it->ob_itself = itself; --- 31,53 ---- static PyObject *OSA_Error; ! /* ---------------- Object type OSAComponentInstance ---------------- */ ! PyTypeObject OSAComponentInstance_Type; ! #define OSAObj_Check(x) ((x)->ob_type == &OSAComponentInstance_Type || PyObject_TypeCheck((x), &OSAComponentInstance_Type)) ! typedef struct OSAComponentInstanceObject { PyObject_HEAD ComponentInstance ob_itself; ! } OSAComponentInstanceObject; PyObject *OSAObj_New(ComponentInstance itself) { ! OSAComponentInstanceObject *it; if (itself == NULL) { PyErr_SetString(OSA_Error,"NULL ComponentInstance"); return NULL; } ! it = PyObject_NEW(OSAComponentInstanceObject, &OSAComponentInstance_Type); if (it == NULL) return NULL; it->ob_itself = itself; *************** *** 56,69 **** int OSAObj_Convert(PyObject *v, ComponentInstance *p_itself) { if (!OSAObj_Check(v)) { ! PyErr_SetString(PyExc_TypeError, "ComponentInstance required"); return 0; } ! *p_itself = ((ComponentInstanceObject *)v)->ob_itself; return 1; } ! static void OSAObj_dealloc(ComponentInstanceObject *self) { /* Cleanup of self->ob_itself goes here */ --- 56,74 ---- int OSAObj_Convert(PyObject *v, ComponentInstance *p_itself) { + + if (CmpInstObj_Convert(v, p_itself)) + return 1; + PyErr_Clear(); + if (!OSAObj_Check(v)) { ! PyErr_SetString(PyExc_TypeError, "OSAComponentInstance required"); return 0; } ! *p_itself = ((OSAComponentInstanceObject *)v)->ob_itself; return 1; } ! static void OSAObj_dealloc(OSAComponentInstanceObject *self) { /* Cleanup of self->ob_itself goes here */ *************** *** 71,75 **** } ! static PyObject *OSAObj_OSALoad(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 76,80 ---- } ! static PyObject *OSAObj_OSALoad(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 95,99 **** } ! static PyObject *OSAObj_OSAStore(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 100,104 ---- } ! static PyObject *OSAObj_OSAStore(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 122,126 **** } ! static PyObject *OSAObj_OSAExecute(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 127,131 ---- } ! static PyObject *OSAObj_OSAExecute(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 149,153 **** } ! static PyObject *OSAObj_OSADisplay(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 154,158 ---- } ! static PyObject *OSAObj_OSADisplay(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 176,180 **** } ! static PyObject *OSAObj_OSAScriptError(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 181,185 ---- } ! static PyObject *OSAObj_OSAScriptError(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 200,204 **** } ! static PyObject *OSAObj_OSADispose(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 205,209 ---- } ! static PyObject *OSAObj_OSADispose(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 219,223 **** } ! static PyObject *OSAObj_OSASetScriptInfo(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 224,228 ---- } ! static PyObject *OSAObj_OSASetScriptInfo(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 244,248 **** } ! static PyObject *OSAObj_OSAGetScriptInfo(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 249,253 ---- } ! static PyObject *OSAObj_OSAGetScriptInfo(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 268,272 **** } ! static PyObject *OSAObj_OSAScriptingComponentName(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 273,277 ---- } ! static PyObject *OSAObj_OSAScriptingComponentName(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 286,290 **** } ! static PyObject *OSAObj_OSACompile(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 291,295 ---- } ! static PyObject *OSAObj_OSACompile(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 310,314 **** } ! static PyObject *OSAObj_OSACopyID(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 315,319 ---- } ! static PyObject *OSAObj_OSACopyID(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 331,335 **** } ! static PyObject *OSAObj_OSAGetSource(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 336,340 ---- } ! static PyObject *OSAObj_OSAGetSource(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 355,359 **** } ! static PyObject *OSAObj_OSACoerceFromDesc(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 360,364 ---- } ! static PyObject *OSAObj_OSACoerceFromDesc(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 379,383 **** } ! static PyObject *OSAObj_OSACoerceToDesc(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 384,388 ---- } ! static PyObject *OSAObj_OSACoerceToDesc(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 406,410 **** } ! static PyObject *OSAObj_OSASetDefaultTarget(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 411,415 ---- } ! static PyObject *OSAObj_OSASetDefaultTarget(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 425,429 **** } ! static PyObject *OSAObj_OSAStartRecording(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 430,434 ---- } ! static PyObject *OSAObj_OSAStartRecording(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 443,447 **** } ! static PyObject *OSAObj_OSAStopRecording(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 448,452 ---- } ! static PyObject *OSAObj_OSAStopRecording(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 462,466 **** } ! static PyObject *OSAObj_OSALoadExecute(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 467,471 ---- } ! static PyObject *OSAObj_OSALoadExecute(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 489,493 **** } ! static PyObject *OSAObj_OSACompileExecute(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 494,498 ---- } ! static PyObject *OSAObj_OSACompileExecute(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 516,520 **** } ! static PyObject *OSAObj_OSADoScript(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 521,525 ---- } ! static PyObject *OSAObj_OSADoScript(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 546,550 **** } ! static PyObject *OSAObj_OSASetCurrentDialect(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 551,555 ---- } ! static PyObject *OSAObj_OSASetCurrentDialect(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 565,569 **** } ! static PyObject *OSAObj_OSAGetCurrentDialect(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 570,574 ---- } ! static PyObject *OSAObj_OSAGetCurrentDialect(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 583,587 **** } ! static PyObject *OSAObj_OSAAvailableDialects(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 588,592 ---- } ! static PyObject *OSAObj_OSAAvailableDialects(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 601,605 **** } ! static PyObject *OSAObj_OSAGetDialectInfo(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 606,610 ---- } ! static PyObject *OSAObj_OSAGetDialectInfo(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 625,629 **** } ! static PyObject *OSAObj_OSAAvailableDialectCodeList(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 630,634 ---- } ! static PyObject *OSAObj_OSAAvailableDialectCodeList(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 643,647 **** } ! static PyObject *OSAObj_OSAExecuteEvent(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 648,652 ---- } ! static PyObject *OSAObj_OSAExecuteEvent(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 670,674 **** } ! static PyObject *OSAObj_OSADoEvent(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 675,679 ---- } ! static PyObject *OSAObj_OSADoEvent(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 697,701 **** } ! static PyObject *OSAObj_OSAMakeContext(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 702,706 ---- } ! static PyObject *OSAObj_OSAMakeContext(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 721,725 **** } ! static PyObject *OSAObj_OSADebuggerCreateSession(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 726,730 ---- } ! static PyObject *OSAObj_OSADebuggerCreateSession(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 745,749 **** } ! static PyObject *OSAObj_OSADebuggerGetSessionState(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 750,754 ---- } ! static PyObject *OSAObj_OSADebuggerGetSessionState(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 766,770 **** } ! static PyObject *OSAObj_OSADebuggerSessionStep(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 771,775 ---- } ! static PyObject *OSAObj_OSADebuggerSessionStep(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 788,792 **** } ! static PyObject *OSAObj_OSADebuggerDisposeSession(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 793,797 ---- } ! static PyObject *OSAObj_OSADebuggerDisposeSession(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 807,811 **** } ! static PyObject *OSAObj_OSADebuggerGetStatementRanges(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 812,816 ---- } ! static PyObject *OSAObj_OSADebuggerGetStatementRanges(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 828,832 **** } ! static PyObject *OSAObj_OSADebuggerGetBreakpoint(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 833,837 ---- } ! static PyObject *OSAObj_OSADebuggerGetBreakpoint(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 852,856 **** } ! static PyObject *OSAObj_OSADebuggerSetBreakpoint(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 857,861 ---- } ! static PyObject *OSAObj_OSADebuggerSetBreakpoint(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 877,881 **** } ! static PyObject *OSAObj_OSADebuggerGetDefaultBreakpoint(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 882,886 ---- } ! static PyObject *OSAObj_OSADebuggerGetDefaultBreakpoint(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 898,902 **** } ! static PyObject *OSAObj_OSADebuggerGetCurrentCallFrame(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 903,907 ---- } ! static PyObject *OSAObj_OSADebuggerGetCurrentCallFrame(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 919,923 **** } ! static PyObject *OSAObj_OSADebuggerGetCallFrameState(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 924,928 ---- } ! static PyObject *OSAObj_OSADebuggerGetCallFrameState(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 940,944 **** } ! static PyObject *OSAObj_OSADebuggerGetVariable(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 945,949 ---- } ! static PyObject *OSAObj_OSADebuggerGetVariable(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 964,968 **** } ! static PyObject *OSAObj_OSADebuggerSetVariable(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 969,973 ---- } ! static PyObject *OSAObj_OSADebuggerSetVariable(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 989,993 **** } ! static PyObject *OSAObj_OSADebuggerGetPreviousCallFrame(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 994,998 ---- } ! static PyObject *OSAObj_OSADebuggerGetPreviousCallFrame(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1010,1014 **** } ! static PyObject *OSAObj_OSADebuggerDisposeCallFrame(ComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; --- 1015,1019 ---- } ! static PyObject *OSAObj_OSADebuggerDisposeCallFrame(OSAComponentInstanceObject *_self, PyObject *_args) { PyObject *_res = NULL; *************** *** 1137,1141 **** if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, OSAObj_Convert, &itself)) return NULL; if ((self = type->tp_alloc(type, 0)) == NULL) return NULL; ! ((ComponentInstanceObject *)self)->ob_itself = itself; return self; } --- 1142,1146 ---- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&", kw, OSAObj_Convert, &itself)) return NULL; if ((self = type->tp_alloc(type, 0)) == NULL) return NULL; ! ((OSAComponentInstanceObject *)self)->ob_itself = itself; return self; } *************** *** 1144,1152 **** ! PyTypeObject ComponentInstance_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ ! "_OSA.ComponentInstance", /*tp_name*/ ! sizeof(ComponentInstanceObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ --- 1149,1157 ---- ! PyTypeObject OSAComponentInstance_Type = { PyObject_HEAD_INIT(NULL) 0, /*ob_size*/ ! "_OSA.OSAComponentInstance", /*tp_name*/ ! sizeof(OSAComponentInstanceObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ /* methods */ *************** *** 1188,1192 **** }; ! /* --------------- End object type ComponentInstance ---------------- */ --- 1193,1197 ---- }; ! /* -------------- End object type OSAComponentInstance -------------- */ *************** *** 1217,1227 **** PyDict_SetItemString(d, "Error", OSA_Error) != 0) return; ! ComponentInstance_Type.ob_type = &PyType_Type; ! if (PyType_Ready(&ComponentInstance_Type) < 0) return; ! Py_INCREF(&ComponentInstance_Type); ! PyModule_AddObject(m, "ComponentInstance", (PyObject *)&ComponentInstance_Type); /* Backward-compatible name */ ! Py_INCREF(&ComponentInstance_Type); ! PyModule_AddObject(m, "ComponentInstanceType", (PyObject *)&ComponentInstance_Type); } --- 1222,1232 ---- PyDict_SetItemString(d, "Error", OSA_Error) != 0) return; ! OSAComponentInstance_Type.ob_type = &PyType_Type; ! if (PyType_Ready(&OSAComponentInstance_Type) < 0) return; ! Py_INCREF(&OSAComponentInstance_Type); ! PyModule_AddObject(m, "OSAComponentInstance", (PyObject *)&OSAComponentInstance_Type); /* Backward-compatible name */ ! Py_INCREF(&OSAComponentInstance_Type); ! PyModule_AddObject(m, "OSAComponentInstanceType", (PyObject *)&OSAComponentInstance_Type); } Index: osasupport.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Modules/osa/osasupport.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** osasupport.py 9 Dec 2003 15:06:18 -0000 1.3 --- osasupport.py 10 Dec 2003 15:18:18 -0000 1.4 *************** *** 69,76 **** return NULL; }""") # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) ! object = MyObjectDefinition('ComponentInstance', OBJECTPREFIX, 'ComponentInstance') module.addobject(object) --- 69,84 ---- return NULL; }""") + + def outputCheckConvertArg(self): + Output(""" + if (CmpInstObj_Convert(v, p_itself)) + return 1; + PyErr_Clear(); + """) + # Create the generator groups and link them module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) ! object = MyObjectDefinition('OSAComponentInstance', OBJECTPREFIX, 'ComponentInstance') module.addobject(object) From rhettinger at users.sourceforge.net Wed Dec 10 10:22:26 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 10 10:22:28 2003 Subject: [Python-checkins] python/dist/src/Demo/scripts mpzpi.py,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Demo/scripts In directory sc8-pr-cvs1:/tmp/cvs-serv30802 Modified Files: mpzpi.py Log Message: Revert previous change which didn't make sense the next day :-) Index: mpzpi.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Demo/scripts/mpzpi.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** mpzpi.py 10 Dec 2003 01:58:52 -0000 1.3 --- mpzpi.py 10 Dec 2003 15:22:23 -0000 1.4 *************** *** 9,32 **** import sys def main(): ! k, a, b, a1, b1 = 2, 4, 1, 12, 4 ! while 1: ! # Next approximation ! p, q, k = k*k, 2*k+1, k+1 ! a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 ! # Print common digits ! d, d1 = a/b, a1/b1 ! while d == d1: ! output(d) ! a, a1 = 10*(a%b), 10*(a1%b1) ! d, d1 = a/b, a1/b1 def output(d): ! # Use write() to avoid spaces between the digits ! # Use int(d) to avoid a trailing L after each digit ! sys.stdout.write(`int(d)`) ! # Flush so the output is seen immediately ! sys.stdout.flush() main() --- 9,34 ---- import sys + from mpz import mpz def main(): ! mpzone, mpztwo, mpzten = mpz(1), mpz(2), mpz(10) ! k, a, b, a1, b1 = mpz(2), mpz(4), mpz(1), mpz(12), mpz(4) ! while 1: ! # Next approximation ! p, q, k = k*k, mpztwo*k+mpzone, k+mpzone ! a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 ! # Print common digits ! d, d1 = a/b, a1/b1 ! while d == d1: ! output(d) ! a, a1 = mpzten*(a%b), mpzten*(a1%b1) ! d, d1 = a/b, a1/b1 def output(d): ! # Use write() to avoid spaces between the digits ! # Use int(d) to avoid a trailing L after each digit ! sys.stdout.write(`int(d)`) ! # Flush so the output is seen immediately ! sys.stdout.flush() main() From bcannon at users.sourceforge.net Wed Dec 10 23:37:27 2003 From: bcannon at users.sourceforge.net (bcannon@users.sourceforge.net) Date: Wed Dec 10 23:37:29 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libcolorsys.tex,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11907/Doc/lib Modified Files: libcolorsys.tex Log Message: Fix broken link (closes bug #852236). Thanks to Fedor Baart for bug file and finding proper link. Index: libcolorsys.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcolorsys.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libcolorsys.tex 19 Apr 1999 21:20:13 -0000 1.1 --- libcolorsys.tex 11 Dec 2003 04:37:24 -0000 1.2 *************** *** 16,20 **** More information about color spaces can be found at ! \url{http://www.inforamp.net/\%7epoynton/ColorFAQ.html}. The \module{colorsys} module defines the following functions: --- 16,20 ---- More information about color spaces can be found at ! \url{http://www.poynton.com/ColorFAQ.html}. The \module{colorsys} module defines the following functions: From doerwalter at users.sourceforge.net Thu Dec 11 07:34:07 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu Dec 11 07:34:10 2003 Subject: [Python-checkins] python/dist/src/Lib/test/output test_md5, 1.1, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv21792/Lib/test/output Removed Files: test_md5 Log Message: Add tests to test_weakref.py to bring code coverage in _weakref.c up to 100%. Port test_md5.py to PyUnit. (Written by Neal Norwitz; from SF patch 736962) (Backport candidate) --- test_md5 DELETED --- From doerwalter at users.sourceforge.net Thu Dec 11 07:34:07 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Thu Dec 11 07:34:13 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_weakref.py, 1.32, 1.33 test_md5.py, 1.4, 1.5 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv21792/Lib/test Modified Files: test_weakref.py test_md5.py Log Message: Add tests to test_weakref.py to bring code coverage in _weakref.c up to 100%. Port test_md5.py to PyUnit. (Written by Neal Norwitz; from SF patch 736962) (Backport candidate) Index: test_weakref.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_weakref.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** test_weakref.py 20 Nov 2003 21:21:46 -0000 1.32 --- test_weakref.py 11 Dec 2003 12:33:54 -0000 1.33 *************** *** 250,253 **** --- 250,257 ---- "got wrong number of weak reference objects") + # assumes ints do not support weakrefs + self.assert_(weakref.getweakrefcount(1) == 0, + "got wrong number of weak reference objects for int") + def test_getweakrefs(self): o = C() *************** *** 264,267 **** --- 268,275 ---- self.assert_(weakref.getweakrefs(o) == [ref1], "list of refs does not match") + + # assumes ints do not support weakrefs + self.assert_(weakref.getweakrefs(1) == [], + "list of refs does not match for int") def test_newstyle_number_ops(self): Index: test_md5.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_md5.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** test_md5.py 12 Dec 2000 23:11:42 -0000 1.4 --- test_md5.py 11 Dec 2003 12:33:58 -0000 1.5 *************** *** 1,8 **** # Testing md5 module ! import string from md5 import md5 def hexstr(s): h = string.hexdigits r = '' --- 1,10 ---- # Testing md5 module ! import unittest from md5 import md5 + from test import test_support def hexstr(s): + import string h = string.hexdigits r = '' *************** *** 12,30 **** return r ! def md5test(s): ! return 'MD5 ("' + s + '") = ' + hexstr(md5(s).digest()) ! print 'MD5 test suite:' ! print md5test('') ! print md5test('a') ! print md5test('abc') ! print md5test('message digest') ! print md5test('abcdefghijklmnopqrstuvwxyz') ! print md5test('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') ! print md5test('12345678901234567890123456789012345678901234567890123456789012345678901234567890') ! # hexdigest is new with Python 2.0 ! m = md5('testing the hexdigest method') ! h = m.hexdigest() ! if hexstr(m.digest()) != h: ! print 'hexdigest() failed' --- 14,58 ---- return r ! class MD5_Test(unittest.TestCase): ! def md5test(self, s, expected): ! self.assertEqual(hexstr(md5(s).digest()), expected) ! self.assertEqual(md5(s).hexdigest(), expected) ! def test_basics(self): ! eq = self.md5test ! eq('', 'd41d8cd98f00b204e9800998ecf8427e') ! eq('a', '0cc175b9c0f1b6a831c399e269772661') ! eq('abc', '900150983cd24fb0d6963f7d28e17f72') ! eq('message digest', 'f96b697d7cb7938d525a2f31aaf161d0') ! eq('abcdefghijklmnopqrstuvwxyz', 'c3fcd3d76192e4007dfb496cca67e13b') ! eq('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', ! 'd174ab98d277d9f5a5611c2c9f419d9f') ! eq('12345678901234567890123456789012345678901234567890123456789012345678901234567890', ! '57edf4a22be3c955ac49da2e2107b67a') ! ! def test_hexdigest(self): ! # hexdigest is new with Python 2.0 ! m = md5('testing the hexdigest method') ! h = m.hexdigest() ! self.assertEqual(hexstr(m.digest()), h) ! ! def test_large_update(self): ! aas = 'a' * 64 ! bees = 'b' * 64 ! cees = 'c' * 64 ! ! m1 = md5() ! m1.update(aas) ! m1.update(bees) ! m1.update(cees) ! ! m2 = md5() ! m2.update(aas + bees + cees) ! self.assertEqual(m1.digest(), m2.digest()) ! ! def test_main(): ! test_support.run_unittest(MD5_Test) ! ! if __name__ == '__main__': ! test_main() From fdrake at users.sourceforge.net Thu Dec 11 14:45:23 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 11 14:45:26 2003 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.36,1.36.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv15747 Modified Files: Tag: release23-maint ref4.tex Log Message: fix typo and join two paragraphs Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.36 retrieving revision 1.36.10.1 diff -C2 -d -r1.36 -r1.36.10.1 *** ref4.tex 29 May 2003 02:17:23 -0000 1.36 --- ref4.tex 11 Dec 2003 19:45:21 -0000 1.36.10.1 *************** *** 81,86 **** current block. This can lead to errors when a name is used within a block before it is bound. ! ! The previous rule is a subtle. Python lacks declarations and allows name binding operations to occur anywhere within a code block. The local variables of a code block can be determined by scanning the --- 81,85 ---- current block. This can lead to errors when a name is used within a block before it is bound. ! This rule is subtle. Python lacks declarations and allows name binding operations to occur anywhere within a code block. The local variables of a code block can be determined by scanning the From fdrake at users.sourceforge.net Thu Dec 11 14:45:56 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 11 14:46:04 2003 Subject: [Python-checkins] python/dist/src/Doc/ref ref4.tex,1.36,1.37 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/ref In directory sc8-pr-cvs1:/tmp/cvs-serv15835 Modified Files: ref4.tex Log Message: fix typo and join two paragraphs Index: ref4.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/ref/ref4.tex,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** ref4.tex 29 May 2003 02:17:23 -0000 1.36 --- ref4.tex 11 Dec 2003 19:45:53 -0000 1.37 *************** *** 81,86 **** current block. This can lead to errors when a name is used within a block before it is bound. ! ! The previous rule is a subtle. Python lacks declarations and allows name binding operations to occur anywhere within a code block. The local variables of a code block can be determined by scanning the --- 81,85 ---- current block. This can lead to errors when a name is used within a block before it is bound. ! This rule is subtle. Python lacks declarations and allows name binding operations to occur anywhere within a code block. The local variables of a code block can be determined by scanning the From rhettinger at users.sourceforge.net Fri Dec 12 08:13:49 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Fri Dec 12 08:13:52 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.17, 1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv9803 Modified Files: whatsnew24.tex Log Message: Expand the groupby() example to: * show that it is typically used with sorted data, * highlight commonalities with SQL's groupby and Unix's uniq, * demonstrate valid uses for the default identity function, * add some excitement by suggesting the range of possibilities. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** whatsnew24.tex 6 Dec 2003 23:19:23 -0000 1.17 --- whatsnew24.tex 12 Dec 2003 13:13:47 -0000 1.18 *************** *** 295,298 **** --- 295,313 ---- \end{verbatim} + Like its SQL counterpart, \function{groupby()} is typically used with + sorted input. The logic for \function{groupby()} is similar to the + \UNIX{} \code{uniq} filter which makes it handy for eliminating, + counting, or identifying duplicate elements: + + \begin{verbatim} + >>> word = 'abracadabra' + >>> [k for k, g in groupby(list.sorted(word))] + ['a', 'b', 'c', 'd', 'r'] + >>> [(k, len(list(g))) for k, g in groupby(list.sorted(word))] + [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] + >>> [k for k, g in groupby(list.sorted(word)) if len(list(g)) > 1] + ['a', 'b', 'r'] + \end{verbatim} + \item A new \function{getsid()} function was added to the \module{posix} module that underlies the \module{os} module. From rhettinger at users.sourceforge.net Sat Dec 13 06:26:13 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 13 06:26:16 2003 Subject: [Python-checkins] python/dist/src/Include methodobject.h,2.26,2.27 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv7484/Include Modified Files: methodobject.h Log Message: * Added a new method flag, METH_COEXIST. * Used the flag to optimize set.__contains__(), dict.__contains__(), dict.__getitem__(), and list.__getitem__(). Index: methodobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/methodobject.h,v retrieving revision 2.26 retrieving revision 2.27 diff -C2 -d -r2.26 -r2.27 *** methodobject.h 31 Jan 2003 18:33:15 -0000 2.26 --- methodobject.h 13 Dec 2003 11:26:10 -0000 2.27 *************** *** 59,62 **** --- 59,69 ---- #define METH_STATIC 0x0020 + /* METH_COEXIST allows a method to be entered eventhough a slot has + already filled the entry. When defined, the flag allows a separate + method, "__contains__" for example, to coexist with a defined + slot like sq_contains. */ + + #define METH_COEXIST 0x0040 + typedef struct PyMethodChain { PyMethodDef *methods; /* Methods of this type */ From rhettinger at users.sourceforge.net Sat Dec 13 06:26:13 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 13 06:26:19 2003 Subject: [Python-checkins] python/dist/src/Doc/api newtypes.tex,1.27,1.28 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv7484/Doc/api Modified Files: newtypes.tex Log Message: * Added a new method flag, METH_COEXIST. * Used the flag to optimize set.__contains__(), dict.__contains__(), dict.__getitem__(), and list.__getitem__(). Index: newtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/newtypes.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** newtypes.tex 7 Dec 2003 12:49:48 -0000 1.27 --- newtypes.tex 13 Dec 2003 11:26:10 -0000 1.28 *************** *** 307,310 **** --- 307,325 ---- \end{datadesc} + One other constant controls whether a method is loaded in place of + another definition with the same method name. + + \begin{datadesc}{METH_COEXIST} + The method will be loaded in place of existing definitions. Without + \var{METH_COEXIST}, the default is to skip repeated definitions. Since + slot wrappers are loaded before the method table, the existence of a + \var{sq_contains} slot, for example, would generate a wrapped method + named \method{__contains__()} and preclude the loading of a + corresponding PyCFunction with the same name. With the flag defined, + the PyCFunction will be loaded in place of the wrapper object and will + co-exist with the slot. This is helpful because calls to PyCFunctions + are optimized more than wrapper object calls. + \versionadded{2.4} + \end{datadesc} \begin{cfuncdesc}{PyObject*}{Py_FindMethod}{PyMethodDef table[], From rhettinger at users.sourceforge.net Sat Dec 13 06:26:13 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 13 06:26:23 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.910,1.911 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv7484/Misc Modified Files: NEWS Log Message: * Added a new method flag, METH_COEXIST. * Used the flag to optimize set.__contains__(), dict.__contains__(), dict.__getitem__(), and list.__getitem__(). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.910 retrieving revision 1.911 diff -C2 -d -r1.910 -r1.911 *** NEWS 6 Dec 2003 16:23:06 -0000 1.910 --- NEWS 13 Dec 2003 11:26:11 -0000 1.911 *************** *** 282,285 **** --- 282,291 ---- ----- + - Created a new method flag, METH_COEXIST, which causes a method to be loaded + even if already defined by a slot wrapper. This allows a __contains__ + method, for example, to co-exist with a defined sq_contains slot. This + is helpful because the PyCFunction can take advantage of optimized calls + whenever METH_O or METH_NOARGS flags are defined. + - Added a new function, PyDict_Contains(d, k) which is like PySequence_Contains() but is specific to dictionaries and executes From rhettinger at users.sourceforge.net Sat Dec 13 06:26:14 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 13 06:26:26 2003 Subject: [Python-checkins] python/dist/src/Objects dictobject.c, 2.148, 2.149 listobject.c, 2.168, 2.169 methodobject.c, 2.47, 2.48 setobject.c, 1.14, 1.15 typeobject.c, 2.253, 2.254 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv7484/Objects Modified Files: dictobject.c listobject.c methodobject.c setobject.c typeobject.c Log Message: * Added a new method flag, METH_COEXIST. * Used the flag to optimize set.__contains__(), dict.__contains__(), dict.__getitem__(), and list.__getitem__(). Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.148 retrieving revision 2.149 diff -C2 -d -r2.148 -r2.149 *** dictobject.c 25 Nov 2003 21:12:14 -0000 2.148 --- dictobject.c 13 Dec 2003 11:26:11 -0000 2.149 *************** *** 499,502 **** --- 499,527 ---- } + static PyObject * + dict_getitem(PyObject *op, PyObject *key) + { + long hash; + dictobject *mp = (dictobject *)op; + PyObject *v; + + if (!PyDict_Check(op)) { + return NULL; + } + if (!PyString_CheckExact(key) || + (hash = ((PyStringObject *) key)->ob_shash) == -1) + { + hash = PyObject_Hash(key); + if (hash == -1) + return NULL; + } + v = (mp->ma_lookup)(mp, key, hash) -> me_value; + if (v == NULL) + PyErr_SetObject(PyExc_KeyError, key); + else + Py_INCREF(v); + return v; + } + /* CAUTION: PyDict_SetItem() must guarantee that it won't resize the * dictionary if it is merely replacing the value for an existing key. *************** *** 1736,1739 **** --- 1761,1769 ---- "D.has_key(k) -> True if D has a key k, else False"); + PyDoc_STRVAR(contains__doc__, + "D.__contains__(k) -> True if D has a key k, else False"); + + PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); + PyDoc_STRVAR(get__doc__, "D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); *************** *** 1782,1785 **** --- 1812,1819 ---- static PyMethodDef mapp_methods[] = { + {"__contains__",(PyCFunction)dict_has_key, METH_O | METH_COEXIST, + contains__doc__}, + {"__getitem__", (PyCFunction)dict_getitem, METH_O | METH_COEXIST, + getitem__doc__}, {"has_key", (PyCFunction)dict_has_key, METH_O, has_key__doc__}, Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.168 retrieving revision 2.169 diff -C2 -d -r2.168 -r2.169 *** listobject.c 10 Dec 2003 07:31:08 -0000 2.168 --- listobject.c 13 Dec 2003 11:26:11 -0000 2.169 *************** *** 2372,2375 **** --- 2372,2377 ---- static PyObject *list_reversed(PyListObject* seq, PyObject* unused); + PyDoc_STRVAR(getitem_doc, + "x.__getitem__(y) <==> x[y]"); PyDoc_STRVAR(reversed_doc, "L.__reversed__() -- return a reverse iterator over the list"); *************** *** 2397,2401 **** --- 2399,2406 ---- cmp(x, y) -> -1, 0, 1"); + static PyObject *list_subscript(PyListObject*, PyObject*); + static PyMethodDef list_methods[] = { + {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, getitem_doc}, {"__reversed__",(PyCFunction)list_reversed, METH_NOARGS, reversed_doc}, {"append", (PyCFunction)listappend, METH_O, append_doc}, Index: methodobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/methodobject.c,v retrieving revision 2.47 retrieving revision 2.48 diff -C2 -d -r2.47 -r2.48 *** methodobject.c 18 Feb 2003 17:18:34 -0000 2.47 --- methodobject.c 13 Dec 2003 11:26:11 -0000 2.48 *************** *** 68,72 **** int size; ! switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC)) { case METH_VARARGS: if (kw == NULL || PyDict_Size(kw) == 0) --- 68,72 ---- int size; ! switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { case METH_VARARGS: if (kw == NULL || PyDict_Size(kw) == 0) Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** setobject.c 25 Nov 2003 21:12:14 -0000 1.14 --- setobject.c 13 Dec 2003 11:26:11 -0000 1.15 *************** *** 157,160 **** --- 157,182 ---- static PyObject * + set_direct_contains(PySetObject *so, PyObject *key) + { + PyObject *tmp; + long result; + + result = PyDict_Contains(so->data, key); + if (result == -1 && PyAnySet_Check(key)) { + PyErr_Clear(); + tmp = frozenset_dict_wrapper(((PySetObject *)(key))->data); + if (tmp == NULL) + return NULL; + result = PyDict_Contains(so->data, tmp); + Py_DECREF(tmp); + } + if (result == -1) + return NULL; + return PyBool_FromLong(result); + } + + PyDoc_STRVAR(contains_doc, "x.__contains__(y) <==> y in x."); + + static PyObject * set_copy(PySetObject *so) { *************** *** 969,972 **** --- 991,996 ---- {"clear", (PyCFunction)set_clear, METH_NOARGS, clear_doc}, + {"__contains__", (PyCFunction)set_direct_contains, METH_O | METH_COEXIST, + contains_doc}, {"copy", (PyCFunction)set_copy, METH_NOARGS, copy_doc}, *************** *** 1095,1098 **** --- 1119,1124 ---- static PyMethodDef frozenset_methods[] = { + {"__contains__", (PyCFunction)set_direct_contains, METH_O | METH_COEXIST, + contains_doc}, {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, copy_doc}, Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.253 retrieving revision 2.254 diff -C2 -d -r2.253 -r2.254 *** typeobject.c 13 Nov 2003 22:50:00 -0000 2.253 --- typeobject.c 13 Dec 2003 11:26:12 -0000 2.254 *************** *** 2793,2798 **** for (; meth->ml_name != NULL; meth++) { PyObject *descr; ! if (PyDict_GetItemString(dict, meth->ml_name)) ! continue; if (meth->ml_flags & METH_CLASS) { if (meth->ml_flags & METH_STATIC) { --- 2793,2799 ---- for (; meth->ml_name != NULL; meth++) { PyObject *descr; ! if (PyDict_GetItemString(dict, meth->ml_name) && ! !(meth->ml_flags & METH_COEXIST)) ! continue; if (meth->ml_flags & METH_CLASS) { if (meth->ml_flags & METH_STATIC) { From rhettinger at users.sourceforge.net Sat Dec 13 06:59:08 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 13 06:59:11 2003 Subject: [Python-checkins] python/dist/src/Objects descrobject.c,2.37,2.38 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv11859 Modified Files: descrobject.c Log Message: Use PyDict_Contains() instead of PySequence_Contains(). Index: descrobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/descrobject.c,v retrieving revision 2.37 retrieving revision 2.38 diff -C2 -d -r2.37 -r2.38 *** descrobject.c 9 Oct 2003 03:47:08 -0000 2.37 --- descrobject.c 13 Dec 2003 11:58:56 -0000 2.38 *************** *** 691,695 **** proxy_contains(proxyobject *pp, PyObject *key) { ! return PySequence_Contains(pp->dict, key); } --- 691,695 ---- proxy_contains(proxyobject *pp, PyObject *key) { ! return PyDict_Contains(pp->dict, key); } *************** *** 710,714 **** proxy_has_key(proxyobject *pp, PyObject *key) { ! int res = PySequence_Contains(pp->dict, key); if (res < 0) return NULL; --- 710,714 ---- proxy_has_key(proxyobject *pp, PyObject *key) { ! int res = PyDict_Contains(pp->dict, key); if (res < 0) return NULL; From rhettinger at users.sourceforge.net Sat Dec 13 08:31:57 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 13 08:32:01 2003 Subject: [Python-checkins] python/dist/src/Objects dictobject.c,2.149,2.150 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv27263 Modified Files: dictobject.c Log Message: Simplify previous checkin -- a new function was not needed. Index: dictobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v retrieving revision 2.149 retrieving revision 2.150 diff -C2 -d -r2.149 -r2.150 *** dictobject.c 13 Dec 2003 11:26:11 -0000 2.149 --- dictobject.c 13 Dec 2003 13:31:55 -0000 2.150 *************** *** 499,527 **** } - static PyObject * - dict_getitem(PyObject *op, PyObject *key) - { - long hash; - dictobject *mp = (dictobject *)op; - PyObject *v; - - if (!PyDict_Check(op)) { - return NULL; - } - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) - { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - v = (mp->ma_lookup)(mp, key, hash) -> me_value; - if (v == NULL) - PyErr_SetObject(PyExc_KeyError, key); - else - Py_INCREF(v); - return v; - } - /* CAUTION: PyDict_SetItem() must guarantee that it won't resize the * dictionary if it is merely replacing the value for an existing key. --- 499,502 ---- *************** *** 1814,1818 **** {"__contains__",(PyCFunction)dict_has_key, METH_O | METH_COEXIST, contains__doc__}, ! {"__getitem__", (PyCFunction)dict_getitem, METH_O | METH_COEXIST, getitem__doc__}, {"has_key", (PyCFunction)dict_has_key, METH_O, --- 1789,1793 ---- {"__contains__",(PyCFunction)dict_has_key, METH_O | METH_COEXIST, contains__doc__}, ! {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, getitem__doc__}, {"has_key", (PyCFunction)dict_has_key, METH_O, From nnorwitz at users.sourceforge.net Sat Dec 13 17:43:36 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 14 03:37:53 2003 Subject: [Python-checkins] python/dist/src/Lib/test badsyntax_future8.py, NONE, 1.1 badsyntax_future9.py, NONE, 1.1 badsyntax_future3.py, 1.1, 1.2 badsyntax_future4.py, 1.1, 1.2 badsyntax_future5.py, 1.1, 1.2 badsyntax_future6.py, 1.1, 1.2 badsyntax_future7.py, 1.1, 1.2 test_future.py, 1.6, 1.7 test_future1.py, 1.2, 1.3 test_future2.py, 1.1, 1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv29656/Lib/test Modified Files: badsyntax_future3.py badsyntax_future4.py badsyntax_future5.py badsyntax_future6.py badsyntax_future7.py test_future.py test_future1.py test_future2.py Added Files: badsyntax_future8.py badsyntax_future9.py Log Message: SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald --- NEW FILE: badsyntax_future8.py --- """This is a test""" from __future__ import * def f(x): def g(y): return x + y return g print f(2)(4) --- NEW FILE: badsyntax_future9.py --- """This is a test""" from __future__ import nested_scopes, braces def f(x): def g(y): return x + y return g print f(2)(4) Index: badsyntax_future3.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/badsyntax_future3.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** badsyntax_future3.py 18 Apr 2001 01:19:27 -0000 1.1 --- badsyntax_future3.py 13 Dec 2003 22:43:33 -0000 1.2 *************** *** 8,10 **** return g ! print f(2)(4) --- 8,10 ---- return g ! result = f(2)(4) Index: badsyntax_future4.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/badsyntax_future4.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** badsyntax_future4.py 18 Apr 2001 01:19:27 -0000 1.1 --- badsyntax_future4.py 13 Dec 2003 22:43:33 -0000 1.2 *************** *** 8,10 **** return g ! print f(2)(4) --- 8,10 ---- return g ! result = f(2)(4) Index: badsyntax_future5.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/badsyntax_future5.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** badsyntax_future5.py 18 Apr 2001 01:19:27 -0000 1.1 --- badsyntax_future5.py 13 Dec 2003 22:43:33 -0000 1.2 *************** *** 10,12 **** return g ! print f(2)(4) --- 10,12 ---- return g ! result = f(2)(4) Index: badsyntax_future6.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/badsyntax_future6.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** badsyntax_future6.py 18 Apr 2001 01:19:27 -0000 1.1 --- badsyntax_future6.py 13 Dec 2003 22:43:33 -0000 1.2 *************** *** 8,10 **** return g ! print f(2)(4) --- 8,10 ---- return g ! result = f(2)(4) Index: badsyntax_future7.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/badsyntax_future7.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** badsyntax_future7.py 18 Apr 2001 01:19:27 -0000 1.1 --- badsyntax_future7.py 13 Dec 2003 22:43:33 -0000 1.2 *************** *** 9,11 **** return g ! print f(2)(4) --- 9,11 ---- return g ! result = f(2)(4) Index: test_future.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** test_future.py 30 Jul 2002 23:27:11 -0000 1.6 --- test_future.py 13 Dec 2003 22:43:33 -0000 1.7 *************** *** 1,47 **** # Test various flavors of legal and illegal future statements ! from test.test_support import unload import re rx = re.compile('\((\S+).py, line (\d+)') ! def check_error_location(msg): ! mo = rx.search(msg) ! print "SyntaxError %s %s" % mo.group(1, 2) ! # The first two tests should work ! unload('test_future1') ! from test import test_future1 ! unload('test_future2') ! from test import test_future2 ! unload('test_future3') ! from test import test_future3 ! # The remaining tests should fail ! try: ! from test import badsyntax_future3 ! except SyntaxError, msg: ! check_error_location(str(msg)) ! try: ! from test import badsyntax_future4 ! except SyntaxError, msg: ! check_error_location(str(msg)) ! try: ! from test import badsyntax_future5 ! except SyntaxError, msg: ! check_error_location(str(msg)) ! try: ! from test import badsyntax_future6 ! except SyntaxError, msg: ! check_error_location(str(msg)) ! try: ! from test import badsyntax_future7 ! except SyntaxError, msg: ! check_error_location(str(msg)) --- 1,89 ---- # Test various flavors of legal and illegal future statements ! import unittest ! from test import test_support import re rx = re.compile('\((\S+).py, line (\d+)') ! def get_error_location(msg): ! mo = rx.search(str(msg)) ! return mo.group(1, 2) ! class FutureTest(unittest.TestCase): ! def test_future1(self): ! test_support.unload('test_future1') ! from test import test_future1 ! self.assertEqual(test_future1.result, 6) ! def test_future2(self): ! test_support.unload('test_future2') ! from test import test_future2 ! self.assertEqual(test_future2.result, 6) ! def test_future3(self): ! test_support.unload('test_future3') ! from test import test_future3 ! def test_badfuture3(self): ! try: ! from test import badsyntax_future3 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future3", '3')) ! else: ! self.fail("expected exception didn't occur") ! def test_badfuture4(self): ! try: ! from test import badsyntax_future4 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future4", '3')) ! else: ! self.fail("expected exception didn't occur") ! def test_badfuture5(self): ! try: ! from test import badsyntax_future5 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future5", '4')) ! else: ! self.fail("expected exception didn't occur") ! def test_badfuture6(self): ! try: ! from test import badsyntax_future6 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future6", '3')) ! else: ! self.fail("expected exception didn't occur") ! def test_badfuture7(self): ! try: ! from test import badsyntax_future7 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future7", '3')) ! else: ! self.fail("expected exception didn't occur") ! ! def test_badfuture8(self): ! try: ! from test import badsyntax_future8 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future8", '3')) ! else: ! self.fail("expected exception didn't occur") ! ! def test_badfuture9(self): ! try: ! from test import badsyntax_future9 ! except SyntaxError, msg: ! self.assertEqual(get_error_location(msg), ("badsyntax_future9", '3')) ! else: ! self.fail("expected exception didn't occur") ! ! def test_main(): ! test_support.run_unittest(FutureTest) ! ! if __name__ == "__main__": ! test_main() Index: test_future1.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_future1.py 10 Mar 2001 02:18:47 -0000 1.2 --- test_future1.py 13 Dec 2003 22:43:33 -0000 1.3 *************** *** 9,11 **** return g ! print f(2)(4) --- 9,11 ---- return g ! result = f(2)(4) Index: test_future2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_future2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** test_future2.py 28 Feb 2001 17:48:06 -0000 1.1 --- test_future2.py 13 Dec 2003 22:43:33 -0000 1.2 *************** *** 8,10 **** return g ! print f(2)(4) --- 8,10 ---- return g ! result = f(2)(4) From gvanrossum at users.sourceforge.net Sat Dec 13 17:12:55 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Sun Dec 14 03:38:25 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.78,1.79 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11462 Modified Files: libsocket.tex Log Message: After hearing from someone who gave up on timeout sockets due to a mistake in his code, I'm adding a note explaining that you should call settimeout() before connect(). Index: libsocket.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** libsocket.tex 27 Nov 2003 19:40:21 -0000 1.78 --- libsocket.tex 13 Dec 2003 22:12:53 -0000 1.79 *************** *** 626,629 **** --- 626,633 ---- immediately will fail. + Note that the \method{connect()} operation is subject to the timeout + setting, and in general it is recommended to call + \method{settimeout()} before calling \method{connect()}. + \begin{methoddesc}[socket]{setsockopt}{level, optname, value} Set the value of the given socket option (see the \UNIX{} manual page From rhettinger at users.sourceforge.net Sat Dec 13 14:38:50 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 14 03:39:56 2003 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.17,1.18 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25807 Modified Files: setobject.c Log Message: * Refactor set.__contains__() * Use Py_RETURN_NONE everywhere. * Fix-up the firstpass check for the tp_print slot. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** setobject.c 13 Dec 2003 18:53:18 -0000 1.17 --- setobject.c 13 Dec 2003 19:38:47 -0000 1.18 *************** *** 159,174 **** set_direct_contains(PySetObject *so, PyObject *key) { - PyObject *tmp; long result; ! result = PyDict_Contains(so->data, key); ! if (result == -1 && PyAnySet_Check(key)) { ! PyErr_Clear(); ! tmp = frozenset_dict_wrapper(((PySetObject *)(key))->data); ! if (tmp == NULL) ! return NULL; ! result = PyDict_Contains(so->data, tmp); ! Py_DECREF(tmp); ! } if (result == -1) return NULL; --- 159,165 ---- set_direct_contains(PySetObject *so, PyObject *key) { long result; ! result = set_contains(so, key); if (result == -1) return NULL; *************** *** 656,661 **** PyObject *key, *value; int pos = 0; - long hash = 0; if (so->hash != -1) return so->hash; --- 647,652 ---- PyObject *key, *value; int pos = 0; long hash = 0; + if (so->hash != -1) return so->hash; *************** *** 729,737 **** { PyObject *key, *value; ! int pos = 0; fprintf(fp, "%s([", so->ob_type->tp_name); while (PyDict_Next(so->data, &pos, &key, &value)) { ! if (pos) fprintf(fp, ", "); if (PyObject_Print(key, fp, 0) != 0) --- 720,730 ---- { PyObject *key, *value; ! int pos=0, firstpass=1; fprintf(fp, "%s([", so->ob_type->tp_name); while (PyDict_Next(so->data, &pos, &key, &value)) { ! if (firstpass) ! firstpass = 0; ! else fprintf(fp, ", "); if (PyObject_Print(key, fp, 0) != 0) *************** *** 747,752 **** PyDict_Clear(so->data); so->hash = -1; ! Py_INCREF(Py_None); ! return Py_None; } --- 740,744 ---- PyDict_Clear(so->data); so->hash = -1; ! Py_RETURN_NONE; } *************** *** 766,771 **** if (PyDict_SetItem(so->data, item, Py_True) == -1) return NULL; ! Py_INCREF(Py_None); ! return Py_None; } --- 758,762 ---- if (PyDict_SetItem(so->data, item, Py_True) == -1) return NULL; ! Py_RETURN_NONE; } *************** *** 791,796 **** if (PyDict_DelItem(so->data, item) == -1) return NULL; ! Py_INCREF(Py_None); ! return Py_None; } --- 782,786 ---- if (PyDict_DelItem(so->data, item) == -1) return NULL; ! Py_RETURN_NONE; } *************** *** 819,824 **** PyErr_Clear(); } ! Py_INCREF(Py_None); ! return Py_None; } --- 809,813 ---- PyErr_Clear(); } ! Py_RETURN_NONE; } From nnorwitz at users.sourceforge.net Sat Dec 13 17:43:36 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 14 03:41:30 2003 Subject: [Python-checkins] python/dist/src/Lib/test/output test_future, 1.4, NONE Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test/output In directory sc8-pr-cvs1:/tmp/cvs-serv29656/Lib/test/output Removed Files: test_future Log Message: SF #736962, port test_future to unittest, add a bit more coverage, by Walter Dörwald --- test_future DELETED --- From rhettinger at users.sourceforge.net Sat Dec 13 09:46:49 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 14 03:42:06 2003 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.15,1.16 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv6359 Modified Files: setobject.c Log Message: Use dictionary specific looping idiom where possible. Simplifies and speeds-up the code. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** setobject.c 13 Dec 2003 11:26:11 -0000 1.15 --- setobject.c 13 Dec 2003 14:46:46 -0000 1.16 *************** *** 370,374 **** { PySetObject *result, *otherset=NULL; ! PyObject *item, *otherdata, *tgtdata, *it; result = (PySetObject *)make_new_set(so->ob_type, NULL); --- 370,376 ---- { PySetObject *result, *otherset=NULL; ! PyObject *otherdata, *tgtdata; ! PyObject *key, *value; ! int pos = 0; result = (PySetObject *)make_new_set(so->ob_type, NULL); *************** *** 390,417 **** } ! it = PyObject_GetIter(so->data); ! if (it == NULL) { ! Py_XDECREF(otherset); ! Py_DECREF(result); ! return NULL; ! } ! ! while ((item = PyIter_Next(it)) != NULL) { ! if (!PyDict_Contains(otherdata, item)) { ! if (PyDict_SetItem(tgtdata, item, Py_True) == -1) { Py_XDECREF(otherset); - Py_DECREF(it); - Py_DECREF(item); return NULL; } } - Py_DECREF(item); } - Py_DECREF(it); Py_XDECREF(otherset); - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; - } return (PyObject *)result; } --- 392,404 ---- } ! while (PyDict_Next(so->data, &pos, &key, &value)) { ! if (!PyDict_Contains(otherdata, key)) { ! if (PyDict_SetItem(tgtdata, key, Py_True) == -1) { Py_XDECREF(otherset); return NULL; } } } Py_XDECREF(otherset); return (PyObject *)result; } *************** *** 483,491 **** set_symmetric_difference_update(PySetObject *so, PyObject *other) { ! PyObject *item, *selfdata, *it, *otherdata; PySetObject *otherset = NULL; selfdata = so->data; - if (PyDict_Check(other)) otherdata = other; --- 470,479 ---- set_symmetric_difference_update(PySetObject *so, PyObject *other) { ! PyObject *selfdata, *otherdata; PySetObject *otherset = NULL; + PyObject *key, *value; + int pos = 0; selfdata = so->data; if (PyDict_Check(other)) otherdata = other; *************** *** 499,528 **** } ! it = PyObject_GetIter(otherdata); ! if (it == NULL) ! return NULL; ! ! while ((item = PyIter_Next(it)) != NULL) { ! if (PyDict_Contains(selfdata, item)) { ! if (PyDict_DelItem(selfdata, item) == -1) { Py_XDECREF(otherset); - Py_DECREF(it); - Py_DECREF(item); return NULL; } } else { ! if (PyDict_SetItem(selfdata, item, Py_True) == -1) { Py_XDECREF(otherset); - Py_DECREF(it); - Py_DECREF(item); return NULL; } } - Py_DECREF(item); } Py_XDECREF(otherset); - Py_DECREF(it); - if (PyErr_Occurred()) - return NULL; Py_RETURN_NONE; } --- 487,504 ---- } ! while (PyDict_Next(otherdata, &pos, &key, &value)) { ! if (PyDict_Contains(selfdata, key)) { ! if (PyDict_DelItem(selfdata, key) == -1) { Py_XDECREF(otherset); return NULL; } } else { ! if (PyDict_SetItem(selfdata, key, Py_True) == -1) { Py_XDECREF(otherset); return NULL; } } } Py_XDECREF(otherset); Py_RETURN_NONE; } *************** *** 535,539 **** { PySetObject *result; ! PyObject *item, *selfdata, *otherdata, *tgtdata, *it, *rv, *otherset; if (PyDict_Check(other)) --- 511,517 ---- { PySetObject *result; ! PyObject *selfdata, *otherdata, *tgtdata, *rv, *otherset; ! PyObject *key, *value; ! int pos = 0; if (PyDict_Check(other)) *************** *** 558,601 **** selfdata = so->data; ! it = PyObject_GetIter(otherdata); ! if (it == NULL) { ! Py_DECREF(result); ! return NULL; ! } ! while ((item = PyIter_Next(it)) != NULL) { ! if (!PyDict_Contains(selfdata, item)) { ! if (PyDict_SetItem(tgtdata, item, Py_True) == -1) { ! Py_DECREF(it); ! Py_DECREF(item); return NULL; } } - Py_DECREF(item); - } - Py_DECREF(it); - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; } ! it = PyObject_GetIter(selfdata); ! if (it == NULL) { ! Py_DECREF(result); ! return NULL; ! } ! while ((item = PyIter_Next(it)) != NULL) { ! if (!PyDict_Contains(otherdata, item)) { ! if (PyDict_SetItem(tgtdata, item, Py_True) == -1) { ! Py_DECREF(it); ! Py_DECREF(item); return NULL; } } - Py_DECREF(item); - } - Py_DECREF(it); - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; } --- 536,556 ---- selfdata = so->data; ! while (PyDict_Next(otherdata, &pos, &key, &value)) { ! if (!PyDict_Contains(selfdata, key)) { ! if (PyDict_SetItem(tgtdata, key, Py_True) == -1) { ! Py_DECREF(result); return NULL; } } } ! pos = 0; ! while (PyDict_Next(selfdata, &pos, &key, &value)) { ! if (!PyDict_Contains(otherdata, key)) { ! if (PyDict_SetItem(tgtdata, key, Py_True) == -1) { ! Py_DECREF(result); return NULL; } } } *************** *** 638,642 **** set_issubset(PySetObject *so, PyObject *other) { ! PyObject *otherdata, *it, *item, *tmp, *result; if (!PyAnySet_Check(other)) { --- 593,599 ---- set_issubset(PySetObject *so, PyObject *other) { ! PyObject *otherdata, *tmp, *result; ! PyObject *key, *value; ! int pos = 0; if (!PyAnySet_Check(other)) { *************** *** 650,670 **** if (set_len(so) > set_len((PySetObject *)other)) Py_RETURN_FALSE; - - it = PyObject_GetIter(so->data); - if (it == NULL) - return NULL; otherdata = ((PySetObject *)other)->data; ! while ((item = PyIter_Next(it)) != NULL) { ! if (!PyDict_Contains(otherdata, item)) { ! Py_DECREF(it); ! Py_DECREF(item); Py_RETURN_FALSE; - } - Py_DECREF(item); } - Py_DECREF(it); - if (PyErr_Occurred()) - return NULL; Py_RETURN_TRUE; } --- 607,616 ---- if (set_len(so) > set_len((PySetObject *)other)) Py_RETURN_FALSE; otherdata = ((PySetObject *)other)->data; ! while (PyDict_Next(((PySetObject *)so)->data, &pos, &key, &value)) { ! if (!PyDict_Contains(otherdata, key)) Py_RETURN_FALSE; } Py_RETURN_TRUE; } *************** *** 707,722 **** frozenset_hash(PyObject *self) { - PyObject *it, *item; PySetObject *so = (PySetObject *)self; ! long hash = 0; if (so->hash != -1) return so->hash; - - it = PyObject_GetIter(((PySetObject *)so)->data); - if (it == NULL) - return -1; ! while ((item = PyIter_Next(it)) != NULL) { /* Multiplying by a large prime increases the bit dispersion for closely spaced hash values. The is important because some --- 653,665 ---- frozenset_hash(PyObject *self) { PySetObject *so = (PySetObject *)self; ! PyObject *key, *value; ! int pos = 0; + long hash = 0; if (so->hash != -1) return so->hash; ! while (PyDict_Next(so->data, &pos, &key, &value)) { /* Multiplying by a large prime increases the bit dispersion for closely spaced hash values. The is important because some *************** *** 724,733 **** elements with nearby hashes so that many distinct combinations collapse to only a handful of distinct hash values. */ ! hash ^= PyObject_Hash(item) * 3644798167u; ! Py_DECREF(item); } - Py_DECREF(it); - if (PyErr_Occurred()) - return -1; so->hash = hash; return hash; --- 667,672 ---- elements with nearby hashes so that many distinct combinations collapse to only a handful of distinct hash values. */ ! hash ^= PyObject_Hash(key) * 3644798167u; } so->hash = hash; return hash; *************** *** 789,816 **** set_tp_print(PySetObject *so, FILE *fp, int flags) { ! PyObject *it, *item; ! int firstpass=1; - it = PyObject_GetIter(so->data); - if (it == NULL) - return -1; fprintf(fp, "%s([", so->ob_type->tp_name); ! ! while ((item = PyIter_Next(it)) != NULL) { ! if (firstpass == 1) ! firstpass = 0; ! else fprintf(fp, ", "); ! if (PyObject_Print(item, fp, 0) != 0) { ! Py_DECREF(it); ! Py_DECREF(item); return -1; - } - Py_DECREF(item); } - Py_DECREF(it); fprintf(fp, "])"); - if (PyErr_Occurred()) - return -1; return 0; } --- 728,742 ---- set_tp_print(PySetObject *so, FILE *fp, int flags) { ! PyObject *key, *value; ! int pos = 0; fprintf(fp, "%s([", so->ob_type->tp_name); ! while (PyDict_Next(so->data, &pos, &key, &value)) { ! if (pos) fprintf(fp, ", "); ! if (PyObject_Print(key, fp, 0) != 0) return -1; } fprintf(fp, "])"); return 0; } From jhylton at users.sourceforge.net Sun Dec 14 00:27:36 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun Dec 14 03:52:01 2003 Subject: [Python-checkins] python/dist/src/Doc/lib liburllib2.tex,1.13,1.14 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20853/Doc/lib Modified Files: liburllib2.tex Log Message: SF patch 852995: add processors feature to urllib2 John J. Lee writes: "the patch makes it possible to implement functionality like HTTP cookie handling, Refresh handling, etc. etc. using handler objects. At the moment urllib2's handler objects aren't quite up to the job, which results in a lot of cut-n-paste and subclassing. I believe the changes are backwards-compatible, with the exception of people who've reimplemented build_opener()'s functionality -- those people would need to call opener.add_handler(HTTPErrorProcessor). The main change is allowing handlers to implement methods like: http_request(request) http_response(request, response) In addition to the usual http_open(request) http_error{_*}(...) " Note that the change isn't well documented at least in part because handlers aren't well documented at all. Need to fix this. Add a bunch of new tests. It appears that none of these tests actually use the network, so they don't need to be guarded by a resource flag. Index: liburllib2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liburllib2.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** liburllib2.tex 14 Jul 2003 21:07:05 -0000 1.13 --- liburllib2.tex 14 Dec 2003 05:27:34 -0000 1.14 *************** *** 53,57 **** \class{ProxyHandler}, \class{UnknownHandler}, \class{HTTPHandler}, \class{HTTPDefaultErrorHandler}, \class{HTTPRedirectHandler}, ! \class{FTPHandler}, \class{FileHandler} If the Python installation has SSL support (\function{socket.ssl()} --- 53,57 ---- \class{ProxyHandler}, \class{UnknownHandler}, \class{HTTPHandler}, \class{HTTPDefaultErrorHandler}, \class{HTTPRedirectHandler}, ! \class{FTPHandler}, \class{FileHandler}, \class{HTTPErrorProcessor}. If the Python installation has SSL support (\function{socket.ssl()} *************** *** 249,252 **** --- 249,261 ---- \end{methoddesc} + \begin{methoddesc}[Request]{add_unredirected_header}{key, header} + Add a header that will not be added to a redirected request. + \end{methoddesc} + + \begin{methoddesc}[Request]{has_header}{header} + Return whether the instance has the named header (checks both regular + and unredirected). + \end{methoddesc} + \begin{methoddesc}[Request]{get_full_url}{} Return the URL given in the constructor. *************** *** 287,290 **** --- 296,305 ---- signal that the handler knows how to handle \var{type} errors from \var{protocol}. + \item \method{\var{protocol}_request()} --- + signal that the handler knows how to pre-process \var{protocol} + requests. + \item \method{\var{protocol}_response()} --- + signal that the handler knows how to post-process \var{protocol} + responses. \end{itemize} \end{methoddesc} *************** *** 618,621 **** --- 633,651 ---- \begin{methoddesc}[UnknownHandler]{unknown_open}{} Raise a \exception{URLError} exception. + \end{methoddesc} + + + \subsection{HTTPErrorProcessor Objects \label{http-error-processor-objects}} + + \begin{methoddesc}[HTTPErrorProcessor]{unknown_open}{} + Process HTTP error responses. + + For 200 error codes, the response object is returned immediately. + + For non-200 error codes, this simply passes the job on to the + \method{\var{protocol}_error_\var{code}()} handler methods, via + \method{OpenerDirector.error()}. Eventually, + \class{urllib2.HTTPDefaultErrorHandler} will raise an + \exception{HTTPError} if no other handler handles the error. \end{methoddesc} From jhylton at users.sourceforge.net Sun Dec 14 00:27:36 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun Dec 14 03:52:07 2003 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.56,1.57 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv20853/Lib Modified Files: urllib2.py Log Message: SF patch 852995: add processors feature to urllib2 John J. Lee writes: "the patch makes it possible to implement functionality like HTTP cookie handling, Refresh handling, etc. etc. using handler objects. At the moment urllib2's handler objects aren't quite up to the job, which results in a lot of cut-n-paste and subclassing. I believe the changes are backwards-compatible, with the exception of people who've reimplemented build_opener()'s functionality -- those people would need to call opener.add_handler(HTTPErrorProcessor). The main change is allowing handlers to implement methods like: http_request(request) http_response(request, response) In addition to the usual http_open(request) http_error{_*}(...) " Note that the change isn't well documented at least in part because handlers aren't well documented at all. Need to fix this. Add a bunch of new tests. It appears that none of these tests actually use the network, so they don't need to be guarded by a resource flag. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.56 retrieving revision 1.57 diff -C2 -d -r1.56 -r1.57 *** urllib2.py 21 Oct 2003 18:07:07 -0000 1.56 --- urllib2.py 14 Dec 2003 05:27:34 -0000 1.57 *************** *** 106,109 **** --- 106,110 ---- import time import urlparse + import bisect try: *************** *** 193,196 **** --- 194,198 ---- for key, value in headers.items(): self.add_header(key, value) + self.unredirected_hdrs = {} def __getattr__(self, attr): *************** *** 249,252 **** --- 251,263 ---- self.headers[key.capitalize()] = val + def add_unredirected_header(self, key, val): + # will not be added to a redirected request + self.unredirected_hdrs[key.capitalize()] = val + + def has_header(self, header_name): + return bool(header_name in self.headers or + header_name in self.unredirected_hdrs) + + class OpenerDirector: def __init__(self): *************** *** 257,277 **** self.handle_open = {} self.handle_error = {} def add_handler(self, handler): ! added = 0 for meth in dir(handler): ! if meth[-5:] == '_open': ! protocol = meth[:-5] ! if protocol in self.handle_open: ! self.handle_open[protocol].append(handler) ! self.handle_open[protocol].sort() ! else: ! self.handle_open[protocol] = [handler] ! added = 1 ! continue ! i = meth.find('_') ! j = meth[i+1:].find('_') + i + 1 ! if j != -1 and meth[i+1:j] == 'error': ! proto = meth[:i] kind = meth[j+1:] try: --- 268,283 ---- self.handle_open = {} self.handle_error = {} + self.process_response = {} + self.process_request = {} def add_handler(self, handler): ! added = False for meth in dir(handler): ! i = meth.find("_") ! protocol = meth[:i] ! condition = meth[i+1:] ! ! if condition.startswith("error"): ! j = meth[i+1:].find("_") + i + 1 kind = meth[j+1:] try: *************** *** 279,294 **** except ValueError: pass ! dict = self.handle_error.get(proto, {}) ! if kind in dict: ! dict[kind].append(handler) ! dict[kind].sort() ! else: ! dict[kind] = [handler] ! self.handle_error[proto] = dict ! added = 1 continue if added: ! self.handlers.append(handler) ! self.handlers.sort() handler.add_parent(self) --- 285,309 ---- except ValueError: pass ! lookup = self.handle_error.get(protocol, {}) ! self.handle_error[protocol] = lookup ! elif condition == "open": ! kind = protocol ! lookup = getattr(self, "handle_"+condition) ! elif condition in ["response", "request"]: ! kind = protocol ! lookup = getattr(self, "process_"+condition) ! else: continue + + handlers = lookup.setdefault(kind, []) + if handlers: + bisect.insort(handlers, handler) + else: + handlers.append(handler) + added = True + if added: ! # XXX why does self.handlers need to be sorted? ! bisect.insort(self.handlers, handler) handler.add_parent(self) *************** *** 321,324 **** --- 336,358 ---- req.add_data(data) + protocol = req.get_type() + + # pre-process request + meth_name = protocol+"_request" + for processor in self.process_request.get(protocol, []): + meth = getattr(processor, meth_name) + req = meth(req) + + response = self._open(req, data) + + # post-process response + meth_name = protocol+"_response" + for processor in self.process_response.get(protocol, []): + meth = getattr(processor, meth_name) + response = meth(req, response) + + return response + + def _open(self, req, data=None): result = self._call_chain(self.handle_open, 'default', 'default_open', req) *************** *** 326,331 **** return result ! type_ = req.get_type() ! result = self._call_chain(self.handle_open, type_, type_ + \ '_open', req) if result: --- 360,365 ---- return result ! protocol = req.get_type() ! result = self._call_chain(self.handle_open, protocol, protocol + '_open', req) if result: *************** *** 340,344 **** dict = self.handle_error['http'] # https is not different than http proto = args[2] # YUCK! ! meth_name = 'http_error_%d' % proto http_err = 1 orig_args = args --- 374,378 ---- dict = self.handle_error['http'] # https is not different than http proto = args[2] # YUCK! ! meth_name = 'http_error_%s' % proto http_err = 1 orig_args = args *************** *** 373,377 **** default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, ! FTPHandler, FileHandler] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) --- 407,411 ---- default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, ! FTPHandler, FileHandler, HTTPErrorProcessor] if hasattr(httplib, 'HTTPS'): default_classes.append(HTTPSHandler) *************** *** 401,406 **** --- 435,442 ---- def add_parent(self, parent): self.parent = parent + def close(self): self.parent = None + def __lt__(self, other): if not hasattr(other, "handler_order"): *************** *** 412,415 **** --- 448,466 ---- + class HTTPErrorProcessor(BaseHandler): + """Process HTTP error responses.""" + handler_order = 1000 # after all other processing + + def http_response(self, request, response): + code, msg, hdrs = response.code, response.msg, response.info() + + if code != 200: + response = self.parent.error( + 'http', request, response, code, msg, hdrs) + + return response + + https_response = http_response + class HTTPDefaultErrorHandler(BaseHandler): def http_error_default(self, req, fp, code, msg, hdrs): *************** *** 417,420 **** --- 468,474 ---- class HTTPRedirectHandler(BaseHandler): + # maximum number of redirections before assuming we're in a loop + max_redirections = 10 + def redirect_request(self, req, fp, code, msg, headers, newurl): """Return a Request or None in response to a redirect. *************** *** 460,471 **** # loop detection ! new.error_302_dict = {} ! if hasattr(req, 'error_302_dict'): ! if len(req.error_302_dict)>10 or \ ! newurl in req.error_302_dict: raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers, fp) ! new.error_302_dict.update(req.error_302_dict) ! new.error_302_dict[newurl] = newurl # Don't close the fp until we are sure that we won't use it --- 514,531 ---- # loop detection ! # .redirect_dict has a key (url, code) if url was previously ! # visited as a result of a redirection with that code. The ! # code is needed in addition to the URL because visiting a URL ! # twice isn't necessarily a loop: there is more than one way ! # to redirect (301, 302, 303, 307, refresh). ! key = (newurl, code) ! if hasattr(req, 'redirect_dict'): ! visited = new.redirect_dict = req.redirect_dict ! if key in visited or len(visited) >= self.max_redirections: raise HTTPError(req.get_full_url(), code, self.inf_msg + msg, headers, fp) ! else: ! visited = new.redirect_dict = req.redirect_dict = {} ! visited[key] = None # Don't close the fp until we are sure that we won't use it *************** *** 854,857 **** --- 914,949 ---- class AbstractHTTPHandler(BaseHandler): + def __init__(self, debuglevel=0): + self._debuglevel = debuglevel + + def set_http_debuglevel(self, level): + self._debuglevel = level + + def do_request(self, request): + host = request.get_host() + if not host: + raise URLError('no host given') + + if request.has_data(): # POST + data = request.get_data() + if not request.has_header('Content-type'): + request.add_unredirected_header( + 'Content-type', + 'application/x-www-form-urlencoded') + if not request.has_header('Content-length'): + request.add_unredirected_header( + 'Content-length', '%d' % len(data)) + + scheme, sel = splittype(request.get_selector()) + sel_host, sel_path = splithost(sel) + if not request.has_header('Host'): + request.add_unredirected_header('Host', sel_host or host) + for name, value in self.parent.addheaders: + name = name.capitalize() + if not request.has_header(name): + request.add_unredirected_header(name, value) + + return request + # XXX Should rewrite do_open() to use the new httplib interface, # would be a little simpler. *************** *** 863,886 **** 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()) ! sel_host, sel_path = splithost(sel) ! h.putheader('Host', sel_host or host) ! for name, value in self.parent.addheaders: ! name = name.capitalize() ! if name not in req.headers: ! h.putheader(name, value) 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. --- 955,965 ---- h = http_class(host) # will parse host:port ! h.set_debuglevel(self._debuglevel) ! h.putrequest(req.get_method(), req.get_selector()) for k, v in req.headers.items(): h.putheader(k, v) + for k, v in req.unredirected_hdrs.items(): + h.putheader(k, v) # httplib will attempt to connect() here. be prepared # to convert a socket error to a URLError. *************** *** 890,901 **** raise URLError(err) if req.has_data(): ! h.send(data) code, msg, hdrs = h.getreply() fp = h.getfile() ! if code == 200: ! return addinfourl(fp, hdrs, req.get_full_url()) ! else: ! return self.parent.error('http', req, fp, code, msg, hdrs) --- 969,981 ---- raise URLError(err) if req.has_data(): ! h.send(req.get_data()) code, msg, hdrs = h.getreply() fp = h.getfile() ! response = addinfourl(fp, hdrs, req.get_full_url()) ! # XXXX should these be methods, for uniformity with rest of interface? ! response.code = code ! response.msg = msg ! return response *************** *** 905,908 **** --- 985,989 ---- return self.do_open(httplib.HTTP, req) + http_request = AbstractHTTPHandler.do_request if hasattr(httplib, 'HTTPS'): *************** *** 912,915 **** --- 993,997 ---- return self.do_open(httplib.HTTPS, req) + https_request = AbstractHTTPHandler.do_request class UnknownHandler(BaseHandler): From jhylton at users.sourceforge.net Sun Dec 14 00:27:36 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun Dec 14 03:52:10 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib2.py,1.7,1.8 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv20853/Lib/test Modified Files: test_urllib2.py Log Message: SF patch 852995: add processors feature to urllib2 John J. Lee writes: "the patch makes it possible to implement functionality like HTTP cookie handling, Refresh handling, etc. etc. using handler objects. At the moment urllib2's handler objects aren't quite up to the job, which results in a lot of cut-n-paste and subclassing. I believe the changes are backwards-compatible, with the exception of people who've reimplemented build_opener()'s functionality -- those people would need to call opener.add_handler(HTTPErrorProcessor). The main change is allowing handlers to implement methods like: http_request(request) http_response(request, response) In addition to the usual http_open(request) http_error{_*}(...) " Note that the change isn't well documented at least in part because handlers aren't well documented at all. Need to fix this. Add a bunch of new tests. It appears that none of these tests actually use the network, so they don't need to be guarded by a resource flag. Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_urllib2.py 23 Jul 2002 19:04:09 -0000 1.7 --- test_urllib2.py 14 Dec 2003 05:27:34 -0000 1.8 *************** *** 1,31 **** ! from test.test_support import verify ! import urllib2 import os ! # A couple trivial tests ! try: ! urllib2.urlopen('bogus url') ! except ValueError: ! pass ! else: ! verify(0) ! # XXX Name hacking to get this to work on Windows. ! fname = os.path.abspath(urllib2.__file__).replace('\\', '/') ! if fname[1:2] == ":": ! fname = fname[2:] ! # And more hacking to get it to work on MacOS. This assumes ! # urllib.pathname2url works, unfortunately... ! if os.name == 'mac': ! fname = '/' + fname.replace(':', '/') ! elif os.name == 'riscos': ! import string ! fname = os.expand(fname) ! fname = fname.translate(string.maketrans("/.", "./")) ! file_url = "file://%s" % fname ! f = urllib2.urlopen(file_url) ! buf = f.read() ! f.close() --- 1,616 ---- ! import unittest ! from test import test_support ! import os + import StringIO ! import urllib2 ! from urllib2 import Request, OpenerDirector ! # XXX ! # Request ! # CacheFTPHandler (hard to write) ! # parse_keqv_list, parse_http_list (I'm leaving this for Anthony Baxter ! # and Greg Stein, since they're doing Digest Authentication) ! # Authentication stuff (ditto) ! # ProxyHandler, CustomProxy, CustomProxyHandler (I don't use a proxy) ! # GopherHandler (haven't used gopher for a decade or so...) ! class TrivialTests(unittest.TestCase): ! def test_trivial(self): ! # A couple trivial tests ! self.assertRaises(ValueError, urllib2.urlopen, 'bogus url') ! # XXX Name hacking to get this to work on Windows. ! fname = os.path.abspath(urllib2.__file__).replace('\\', '/') ! if fname[1:2] == ":": ! fname = fname[2:] ! # And more hacking to get it to work on MacOS. This assumes ! # urllib.pathname2url works, unfortunately... ! if os.name == 'mac': ! fname = '/' + fname.replace(':', '/') ! elif os.name == 'riscos': ! import string ! fname = os.expand(fname) ! fname = fname.translate(string.maketrans("/.", "./")) ! ! file_url = "file://%s" % fname ! f = urllib2.urlopen(file_url) ! ! buf = f.read() ! f.close() ! ! ! class MockOpener: ! addheaders = [] ! def open(self, req, data=None): ! self.req, self.data = req, data ! def error(self, proto, *args): ! self.proto, self.args = proto, args ! ! class MockFile: ! def read(self, count=None): pass ! def readline(self, count=None): pass ! def close(self): pass ! ! class MockResponse(StringIO.StringIO): ! def __init__(self, code, msg, headers, data, url=None): ! StringIO.StringIO.__init__(self, data) ! self.code, self.msg, self.headers, self.url = code, msg, headers, url ! def info(self): ! return self.headers ! def geturl(self): ! return self.url ! ! class FakeMethod: ! def __init__(self, meth_name, action, handle): ! self.meth_name = meth_name ! self.handle = handle ! self.action = action ! def __call__(self, *args): ! return self.handle(self.meth_name, self.action, *args) ! ! class MockHandler: ! def __init__(self, methods): ! self._define_methods(methods) ! def _define_methods(self, methods): ! for spec in methods: ! if len(spec) == 2: name, action = spec ! else: name, action = spec, None ! meth = FakeMethod(name, action, self.handle) ! setattr(self.__class__, name, meth) ! def handle(self, fn_name, action, *args, **kwds): ! self.parent.calls.append((self, fn_name, args, kwds)) ! if action is None: ! return None ! elif action == "return self": ! return self ! elif action == "return response": ! res = MockResponse(200, "OK", {}, "") ! return res ! elif action == "return request": ! return Request("http://blah/") ! elif action.startswith("error"): ! code = action[action.rfind(" ")+1:] ! try: ! code = int(code) ! except ValueError: ! pass ! res = MockResponse(200, "OK", {}, "") ! return self.parent.error("http", args[0], res, code, "", {}) ! elif action == "raise": ! raise urllib2.URLError("blah") ! assert False ! def close(self): pass ! def add_parent(self, parent): ! self.parent = parent ! self.parent.calls = [] ! def __lt__(self, other): ! if not hasattr(other, "handler_order"): ! # No handler_order, leave in original order. Yuck. ! return True ! return self.handler_order < other.handler_order ! ! def add_ordered_mock_handlers(opener, meth_spec): ! """Create MockHandlers and add them to an OpenerDirector. ! ! meth_spec: list of lists of tuples and strings defining methods to define ! on handlers. eg: ! ! [["http_error", "ftp_open"], ["http_open"]] ! ! defines methods .http_error() and .ftp_open() on one handler, and ! .http_open() on another. These methods just record their arguments and ! return None. Using a tuple instead of a string causes the method to ! perform some action (see MockHandler.handle()), eg: ! ! [["http_error"], [("http_open", "return request")]] ! ! defines .http_error() on one handler (which simply returns None), and ! .http_open() on another handler, which returns a Request object. ! ! """ ! handlers = [] ! count = 0 ! for meths in meth_spec: ! class MockHandlerSubclass(MockHandler): pass ! h = MockHandlerSubclass(meths) ! h.handler_order = count ! h.add_parent(opener) ! count = count + 1 ! handlers.append(h) ! opener.add_handler(h) ! return handlers ! ! class OpenerDirectorTests(unittest.TestCase): ! ! def test_handled(self): ! # handler returning non-None means no more handlers will be called ! o = OpenerDirector() ! meth_spec = [ ! ["http_open", "ftp_open", "http_error_302"], ! ["ftp_open"], ! [("http_open", "return self")], ! [("http_open", "return self")], ! ] ! handlers = add_ordered_mock_handlers(o, meth_spec) ! ! req = Request("http://example.com/") ! r = o.open(req) ! # Second .http_open() gets called, third doesn't, since second returned ! # non-None. Handlers without .http_open() never get any methods called ! # on them. ! # In fact, second mock handler defining .http_open() returns self ! # (instead of response), which becomes the OpenerDirector's return ! # value. ! self.assert_(r == handlers[2]) ! calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] ! for expected, got in zip(calls, o.calls): ! handler, name, args, kwds = got ! self.assert_((handler, name) == expected) ! self.assert_(args == (req,)) ! ! def test_handler_order(self): ! o = OpenerDirector() ! handlers = [] ! for meths, handler_order in [ ! ([("http_open", "return self")], 500), ! (["http_open"], 0), ! ]: ! class MockHandlerSubclass(MockHandler): pass ! h = MockHandlerSubclass(meths) ! h.handler_order = handler_order ! handlers.append(h) ! o.add_handler(h) ! ! r = o.open("http://example.com/") ! # handlers called in reverse order, thanks to their sort order ! self.assert_(o.calls[0][0] == handlers[1]) ! self.assert_(o.calls[1][0] == handlers[0]) ! ! def test_raise(self): ! # raising URLError stops processing of request ! o = OpenerDirector() ! meth_spec = [ ! [("http_open", "raise")], ! [("http_open", "return self")], ! ] ! handlers = add_ordered_mock_handlers(o, meth_spec) ! ! req = Request("http://example.com/") ! self.assertRaises(urllib2.URLError, o.open, req) ! self.assert_(o.calls == [(handlers[0], "http_open", (req,), {})]) ! ! ## def test_error(self): ! ## # XXX this doesn't actually seem to be used in standard library, ! ## # but should really be tested anyway... ! ! def test_http_error(self): ! # XXX http_error_default ! # http errors are a special case ! o = OpenerDirector() ! meth_spec = [ ! [("http_open", "error 302")], ! [("http_error_400", "raise"), "http_open"], ! [("http_error_302", "return response"), "http_error_303", ! "http_error"], ! [("http_error_302")], ! ] ! handlers = add_ordered_mock_handlers(o, meth_spec) ! ! class Unknown: ! def __eq__(self, other): return True ! ! req = Request("http://example.com/") ! r = o.open(req) ! assert len(o.calls) == 2 ! calls = [(handlers[0], "http_open", (req,)), ! (handlers[2], "http_error_302", (req, Unknown(), 302, "", {}))] ! for expected, got in zip(calls, o.calls): ! handler, method_name, args = expected ! self.assert_((handler, method_name) == got[:2]) ! assert args == got[2] ! ! def test_processors(self): ! # *_request / *_response methods get called appropriately ! o = OpenerDirector() ! meth_spec = [ ! [("http_request", "return request"), ! ("http_response", "return response")], ! [("http_request", "return request"), ! ("http_response", "return response")], ! ] ! handlers = add_ordered_mock_handlers(o, meth_spec) ! ! req = Request("http://example.com/") ! r = o.open(req) ! # processor methods are called on *all* handlers that define them, ! # not just the first handler that handles the request ! calls = [(handlers[0], "http_request"), (handlers[1], "http_request"), ! (handlers[0], "http_response"), (handlers[1], "http_response")] ! ! for i, (handler, name, args, kwds) in enumerate(o.calls): ! if i < 2: ! # *_request ! self.assert_((handler, name) == calls[i]) ! self.assert_(len(args) == 1) ! self.assert_(isinstance(args[0], Request)) ! else: ! # *_response ! self.assert_((handler, name) == calls[i]) ! self.assert_(len(args) == 2) ! self.assert_(isinstance(args[0], Request)) ! # response from opener.open is None, because there's no ! # handler that defines http_open to handle it ! self.assert_(args[1] is None or ! isinstance(args[1], MockResponse)) ! ! ! class HandlerTests(unittest.TestCase): ! ! def test_ftp(self): ! class MockFTPWrapper: ! def __init__(self, data): self.data = data ! def retrfile(self, filename, filetype): ! self.filename, self.filetype = filename, filetype ! return StringIO.StringIO(self.data), len(self.data) ! ! class NullFTPHandler(urllib2.FTPHandler): ! def __init__(self, data): self.data = data ! def connect_ftp(self, user, passwd, host, port, dirs): ! self.user, self.passwd = user, passwd ! self.host, self.port = host, port ! self.dirs = dirs ! self.ftpwrapper = MockFTPWrapper(self.data) ! return self.ftpwrapper ! ! import ftplib, socket ! data = "rheum rhaponicum" ! h = NullFTPHandler(data) ! o = h.parent = MockOpener() ! ! for url, host, port, type_, dirs, filename, mimetype in [ ! ("ftp://localhost/foo/bar/baz.html", ! "localhost", ftplib.FTP_PORT, "I", ! ["foo", "bar"], "baz.html", "text/html"), ! # XXXX Bug: FTPHandler tries to gethostbyname "localhost:80", with the ! # port still there. ! ## ("ftp://localhost:80/foo/bar/", ! ## "localhost", 80, "D", ! ## ["foo", "bar"], "", None), ! # XXXX bug: second use of splitattr() in FTPHandler should be splitvalue() ! ## ("ftp://localhost/baz.gif;type=a", ! ## "localhost", ftplib.FTP_PORT, "A", ! ## [], "baz.gif", "image/gif"), ! ]: ! r = h.ftp_open(Request(url)) ! # ftp authentication not yet implemented by FTPHandler ! self.assert_(h.user == h.passwd == "") ! self.assert_(h.host == socket.gethostbyname(host)) ! self.assert_(h.port == port) ! self.assert_(h.dirs == dirs) ! self.assert_(h.ftpwrapper.filename == filename) ! self.assert_(h.ftpwrapper.filetype == type_) ! headers = r.info() ! self.assert_(headers["Content-type"] == mimetype) ! self.assert_(int(headers["Content-length"]) == len(data)) ! ! def test_file(self): ! import time, rfc822, socket ! h = urllib2.FileHandler() ! o = h.parent = MockOpener() ! ! #from test_support import TESTFN ! TESTFN = "test.txt" ! towrite = "hello, world\n" ! for url in [ ! "file://localhost%s/%s" % (os.getcwd(), TESTFN), ! "file://%s/%s" % (os.getcwd(), TESTFN), ! "file://%s%s/%s" % (socket.gethostbyname('localhost'), ! os.getcwd(), TESTFN), ! "file://%s%s/%s" % (socket.gethostbyname(socket.gethostname()), ! os.getcwd(), TESTFN), ! # XXX Windows / Mac format(s), ... ? ! ]: ! f = open(TESTFN, "w") ! try: ! try: ! f.write(towrite) ! finally: ! f.close() ! ! r = h.file_open(Request(url)) ! try: ! data = r.read() ! read_time = time.time() ! headers = r.info() ! newurl = r.geturl() ! finally: ! r.close() ! finally: ! os.remove(TESTFN) ! self.assert_(data == towrite) ! self.assert_(headers["Content-type"] == "text/plain") ! self.assert_(headers["Content-length"] == "13") ! # Fudge Last-modified string comparison by one second to ! # prevent spurious failure on crossing a second boundary while ! # executing this test. ! unfudged = rfc822.formatdate(read_time) ! fudged = rfc822.formatdate(read_time-1) ! self.assert_(headers["Last-modified"] in [unfudged, fudged]) ! ! for url in [ ! "file://localhost:80%s/%s" % (os.getcwd(), TESTFN), ! # XXXX bug: these fail with socket.gaierror, should be URLError ! ## "file://%s:80%s/%s" % (socket.gethostbyname('localhost'), ! ## os.getcwd(), TESTFN), ! ## "file://somerandomhost.ontheinternet.com%s/%s" % ! ## (os.getcwd(), TESTFN), ! ]: ! try: ! f = open(TESTFN, "w") ! try: ! f.write(towrite) ! finally: ! f.close() ! ! self.assertRaises(urllib2.URLError, ! h.file_open, Request(url)) ! finally: ! os.remove(TESTFN) ! ! h = urllib2.FileHandler() ! o = h.parent = MockOpener() ! # XXXX why does // mean ftp (and /// mean not ftp!), and where ! # is file: scheme specified? I think this is really a bug, and ! # what was intended was to distinguish between URLs like: ! # file:/blah.txt (a file) ! # file://localhost/blah.txt (a file) ! # file:///blah.txt (a file) ! # file://ftp.example.com/blah.txt (an ftp URL) ! for url, ftp in [ ! ("file://ftp.example.com//foo.txt", True), ! ("file://ftp.example.com///foo.txt", False), ! # XXXX bug: fails with OSError, should be URLError ! ("file://ftp.example.com/foo.txt", False), ! ]: ! req = Request(url) ! try: ! h.file_open(req) ! # XXXX remove OSError when bug fixed ! except (urllib2.URLError, OSError): ! self.assert_(not ftp) ! else: ! self.assert_(o.req is req) ! self.assert_(req.type == "ftp") ! ! def test_http(self): ! class MockHTTPClass: ! def __init__(self): ! self.req_headers = [] ! self.data = None ! self.raise_on_endheaders = False ! def __call__(self, host): ! self.host = host ! return self ! def set_debuglevel(self, level): self.level = level ! def putrequest(self, method, selector): ! self.method, self.selector = method, selector ! def putheader(self, key, value): ! self.req_headers.append((key, value)) ! def endheaders(self): ! if self.raise_on_endheaders: ! import socket ! raise socket.error() ! def send(self, data): self.data = data ! def getreply(self): return 200, "OK", {} ! def getfile(self): return MockFile() ! ! h = urllib2.AbstractHTTPHandler() ! o = h.parent = MockOpener() ! ! url = "http://example.com/" ! for method, data in [("GET", None), ("POST", "blah")]: ! req = Request(url, data, {"Foo": "bar"}) ! req.add_unredirected_header("Spam", "eggs") ! http = MockHTTPClass() ! r = h.do_open(http, req) ! ! # result attributes ! r.read; r.readline # wrapped MockFile methods ! r.info; r.geturl # addinfourl methods ! r.code, r.msg == 200, "OK" # added from MockHTTPClass.getreply() ! hdrs = r.info() ! hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() ! self.assert_(r.geturl() == url) ! ! self.assert_(http.host == "example.com") ! self.assert_(http.level == 0) ! self.assert_(http.method == method) ! self.assert_(http.selector == "/") ! self.assert_(http.req_headers == [("Foo", "bar"), ("Spam", "eggs")]) ! self.assert_(http.data == data) ! ! # check socket.error converted to URLError ! http.raise_on_endheaders = True ! self.assertRaises(urllib2.URLError, h.do_open, http, req) ! ! # check adding of standard headers ! o.addheaders = [("Spam", "eggs")] ! for data in "", None: # POST, GET ! req = Request("http://example.com/", data) ! r = MockResponse(200, "OK", {}, "") ! newreq = h.do_request(req) ! if data is None: # GET ! self.assert_("Content-length" not in req.unredirected_hdrs) ! self.assert_("Content-type" not in req.unredirected_hdrs) ! else: # POST ! self.assert_(req.unredirected_hdrs["Content-length"] == "0") ! self.assert_(req.unredirected_hdrs["Content-type"] == ! "application/x-www-form-urlencoded") ! # XXX the details of Host could be better tested ! self.assert_(req.unredirected_hdrs["Host"] == "example.com") ! self.assert_(req.unredirected_hdrs["Spam"] == "eggs") ! ! # don't clobber existing headers ! req.add_unredirected_header("Content-length", "foo") ! req.add_unredirected_header("Content-type", "bar") ! req.add_unredirected_header("Host", "baz") ! req.add_unredirected_header("Spam", "foo") ! newreq = h.do_request(req) ! self.assert_(req.unredirected_hdrs["Content-length"] == "foo") ! self.assert_(req.unredirected_hdrs["Content-type"] == "bar") ! self.assert_(req.unredirected_hdrs["Host"] == "baz") ! self.assert_(req.unredirected_hdrs["Spam"] == "foo") ! ! def test_errors(self): ! h = urllib2.HTTPErrorProcessor() ! o = h.parent = MockOpener() ! ! url = "http://example.com/" ! req = Request(url) ! # 200 OK is passed through ! r = MockResponse(200, "OK", {}, "", url) ! newr = h.http_response(req, r) ! self.assert_(r is newr) ! self.assert_(not hasattr(o, "proto")) # o.error not called ! # anything else calls o.error (and MockOpener returns None, here) ! r = MockResponse(201, "Created", {}, "", url) ! self.assert_(h.http_response(req, r) is None) ! self.assert_(o.proto == "http") # o.error called ! self.assert_(o.args == (req, r, 201, "Created", {})) ! ! def test_redirect(self): ! from_url = "http://example.com/a.html" ! to_url = "http://example.com/b.html" ! h = urllib2.HTTPRedirectHandler() ! o = h.parent = MockOpener() ! ! # ordinary redirect behaviour ! for code in 301, 302, 303, 307: ! for data in None, "blah\nblah\n": ! method = getattr(h, "http_error_%s" % code) ! req = Request(from_url, data) ! req.add_header("Nonsense", "viking=withhold") ! req.add_unredirected_header("Spam", "spam") ! try: ! method(req, MockFile(), code, "Blah", {"location": to_url}) ! except urllib2.HTTPError: ! # 307 in response to POST requires user OK ! self.assert_(code == 307 and data is not None) ! self.assert_(o.req.get_full_url() == to_url) ! try: ! self.assert_(o.req.get_method() == "GET") ! except AttributeError: ! self.assert_(not o.req.has_data()) ! self.assert_(o.req.headers["Nonsense"] == "viking=withhold") ! self.assert_("Spam" not in o.req.headers) ! self.assert_("Spam" not in o.req.unredirected_hdrs) ! ! # loop detection ! req = Request(from_url) ! req.origin_req_host = "example.com" ! def redirect(h, req, code, url=to_url): ! method = getattr(h, "http_error_%s" % code) ! method(req, MockFile(), code, "Blah", {"location": url}) ! # Note that the *original* request shares the same record of ! # redirections with the sub-requests caused by the redirections. ! # once ! redirect(h, req, 302) ! # twice: loop detected ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 302) ! # and again ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 302) ! # but this is a different redirect code, so OK... ! redirect(h, req, 301) ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 301) ! # order doesn't matter ! redirect(h, req, 303) ! redirect(h, req, 307) ! self.assertRaises(urllib2.HTTPError, redirect, h, req, 303) ! ! # detect endless non-repeating chain of redirects ! req = Request(from_url) ! req.origin_req_host = "example.com" ! count = 0 ! try: ! while 1: ! redirect(h, req, 302, "http://example.com/%d" % count) ! count = count + 1 ! except urllib2.HTTPError: ! self.assert_(count == urllib2.HTTPRedirectHandler.max_redirections) ! ! ! class MiscTests(unittest.TestCase): ! ! def test_build_opener(self): ! class MyHTTPHandler(urllib2.HTTPHandler): pass ! class FooHandler(urllib2.BaseHandler): ! def foo_open(self): pass ! class BarHandler(urllib2.BaseHandler): ! def bar_open(self): pass ! ! build_opener = urllib2.build_opener ! ! o = build_opener(FooHandler, BarHandler) ! self.opener_has_handler(o, FooHandler) ! self.opener_has_handler(o, BarHandler) ! ! # can take a mix of classes and instances ! o = build_opener(FooHandler, BarHandler()) ! self.opener_has_handler(o, FooHandler) ! self.opener_has_handler(o, BarHandler) ! ! # subclasses of default handlers override default handlers ! o = build_opener(MyHTTPHandler) ! self.opener_has_handler(o, MyHTTPHandler) ! ! # a particular case of overriding: default handlers can be passed ! # in explicitly ! o = build_opener() ! self.opener_has_handler(o, urllib2.HTTPHandler) ! o = build_opener(urllib2.HTTPHandler) ! self.opener_has_handler(o, urllib2.HTTPHandler) ! o = build_opener(urllib2.HTTPHandler()) ! self.opener_has_handler(o, urllib2.HTTPHandler) ! ! def opener_has_handler(self, opener, handler_class): ! for h in opener.handlers: ! if h.__class__ == handler_class: ! break ! else: ! self.assert_(False) ! ! ! def test_main(verbose=None): ! from test import test_sets ! test_support.run_unittest( ! TrivialTests, ! OpenerDirectorTests, ! HandlerTests, ! MiscTests, ! ) ! ! if __name__ == "__main__": ! test_main(verbose=True) From jhylton at users.sourceforge.net Sun Dec 14 00:29:48 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Sun Dec 14 04:00:42 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.911,1.912 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv25533 Modified Files: NEWS Log Message: Add news item about processor support in urllib2. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.911 retrieving revision 1.912 diff -C2 -d -r1.911 -r1.912 *** NEWS 13 Dec 2003 11:26:11 -0000 1.911 --- NEWS 14 Dec 2003 05:29:45 -0000 1.912 *************** *** 179,182 **** --- 179,186 ---- ------- + - urllib2 now supports processors. A processor is a handler that + implements an xxx_request or xxx_response method. These methods are + called for all requests. + - distutils compilers now compile source files in the same order as they are passed to the compiler. From nnorwitz at users.sourceforge.net Sat Dec 13 17:34:12 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 14 04:49:32 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libtraceback.tex, 1.18, 1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21780/Doc/lib Modified Files: libtraceback.tex Log Message: Add a versionadded tag for traceback.format_exc() Index: libtraceback.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtraceback.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** libtraceback.tex 5 Nov 2003 23:02:58 -0000 1.18 --- libtraceback.tex 13 Dec 2003 22:34:09 -0000 1.19 *************** *** 52,55 **** --- 52,56 ---- This is like \code{print_exc(\var{limit})} but returns a string instead of printing to a file. + \versionadded{2.4} \end{funcdesc} From nnorwitz at users.sourceforge.net Sat Dec 13 17:31:55 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 14 04:49:37 2003 Subject: [Python-checkins] python/dist/src/Modules heapqmodule.c,1.3,1.4 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv21132/Modules Modified Files: heapqmodule.c Log Message: Make private/local functions static Index: heapqmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/heapqmodule.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** heapqmodule.c 15 Nov 2003 12:40:28 -0000 1.3 --- heapqmodule.c 13 Dec 2003 22:31:53 -0000 1.4 *************** *** 9,13 **** #include "Python.h" ! int _siftdown(PyListObject *heap, int startpos, int pos) { --- 9,13 ---- #include "Python.h" ! static int _siftdown(PyListObject *heap, int startpos, int pos) { *************** *** 43,47 **** } ! int _siftup(PyListObject *heap, int pos) { --- 43,47 ---- } ! static int _siftup(PyListObject *heap, int pos) { *************** *** 91,95 **** } ! PyObject * heappush(PyObject *self, PyObject *args) { --- 91,95 ---- } ! static PyObject * heappush(PyObject *self, PyObject *args) { *************** *** 116,120 **** "Push item onto heap, maintaining the heap invariant."); ! PyObject * heappop(PyObject *self, PyObject *heap) { --- 116,120 ---- "Push item onto heap, maintaining the heap invariant."); ! static PyObject * heappop(PyObject *self, PyObject *heap) { *************** *** 153,157 **** "Pop the smallest item off the heap, maintaining the heap invariant."); ! PyObject * heapreplace(PyObject *self, PyObject *args) { --- 153,157 ---- "Pop the smallest item off the heap, maintaining the heap invariant."); ! static PyObject * heapreplace(PyObject *self, PyObject *args) { *************** *** 189,193 **** this routine.\n"); ! PyObject * heapify(PyObject *self, PyObject *heap) { --- 189,193 ---- this routine.\n"); ! static PyObject * heapify(PyObject *self, PyObject *heap) { From rhettinger at users.sourceforge.net Sat Dec 13 14:48:43 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 14 04:49:45 2003 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.33,1.34 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv31865 Modified Files: concrete.tex Log Message: Note that \var{ppos} values are not consecutive and should not be altered. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** concrete.tex 25 Nov 2003 21:12:14 -0000 1.33 --- concrete.tex 13 Dec 2003 19:48:41 -0000 1.34 *************** *** 1897,1901 **** \ctype{PyObject*} variables that will be filled in with each key and value, respectively, or may be \NULL. Any references returned through ! them are borrowed. For example: --- 1897,1903 ---- \ctype{PyObject*} variables that will be filled in with each key and value, respectively, or may be \NULL. Any references returned through ! them are borrowed. \var{ppos} should not be altered during iteration. ! Its value represents offsets within the internal dictionary structure, ! and since the structure is sparse, the offsets are not consecutive. For example: From niemeyer at users.sourceforge.net Sat Dec 13 15:32:21 2003 From: niemeyer at users.sourceforge.net (niemeyer@users.sourceforge.net) Date: Sun Dec 14 05:41:51 2003 Subject: [Python-checkins] python/dist/src/Modules _sre.c,2.102,2.103 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv22912/Modules Modified Files: _sre.c Log Message: Cleaning up recursive pieces left in the reorganization. Index: _sre.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v retrieving revision 2.102 retrieving revision 2.103 diff -C2 -d -r2.102 -r2.103 *** _sre.c 18 Oct 2003 20:54:44 -0000 2.102 --- _sre.c 13 Dec 2003 20:32:08 -0000 2.103 *************** *** 65,99 **** /* optional features */ - /* prevent run-away recursion (bad patterns on long strings) */ - - #if !defined(USE_STACKCHECK) - #if defined(MS_WIN64) || defined(__LP64__) || defined(_LP64) - /* require smaller recursion limit for a number of 64-bit platforms: - Win64 (MS_WIN64), Linux64 (__LP64__), Monterey (64-bit AIX) (_LP64) */ - /* FIXME: maybe the limit should be 40000 / sizeof(void*) ? */ - #define USE_RECURSION_LIMIT 7500 - #else - - #if defined(__GNUC__) && defined(WITH_THREAD) && defined(__FreeBSD__) - /* the pthreads library on FreeBSD has a fixed 1MB stack size for the - * initial (or "primary") thread, which is insufficient for the default - * recursion limit. gcc 3.x at the default optimisation - * level (-O3) uses stack space more aggressively than gcc 2.95. - */ - #if (__GNUC__ > 2) - #define USE_RECURSION_LIMIT 6500 - #else - #define USE_RECURSION_LIMIT 7500 - #endif - - #else - #define USE_RECURSION_LIMIT 10000 - #endif - #endif - #endif - - /* enables usage of recursive scheme */ - #undef USE_RECURSION - /* enables fast searching */ #define USE_FAST_SEARCH --- 65,68 ---- *************** *** 537,544 **** } ! LOCAL(int) SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level); LOCAL(int) ! SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, int maxcount, int level) { SRE_CODE chr; --- 506,513 ---- } ! LOCAL(int) SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern); LOCAL(int) ! SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, int maxcount) { SRE_CODE chr; *************** *** 610,614 **** TRACE(("|%p|%p|COUNT SUBPATTERN\n", pattern, ptr)); while ((SRE_CHAR*) state->ptr < end) { ! i = SRE_MATCH(state, pattern, level); if (i < 0) return i; --- 579,583 ---- TRACE(("|%p|%p|COUNT SUBPATTERN\n", pattern, ptr)); while ((SRE_CHAR*) state->ptr < end) { ! i = SRE_MATCH(state, pattern); if (i < 0) return i; *************** *** 828,832 **** error, 0 for failure, and 1 for success */ LOCAL(int) ! SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern, int level) { SRE_CHAR* end = state->end; --- 797,801 ---- error, 0 for failure, and 1 for success */ LOCAL(int) ! SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern) { SRE_CHAR* end = state->end; *************** *** 838,852 **** SRE_MATCH_CONTEXT* nextctx; ! TRACE(("|%p|%p|ENTER %d\n", pattern, state->ptr, level)); ! ! #if defined(USE_STACKCHECK) ! if (level % 10 == 0 && PyOS_CheckStack()) ! return SRE_ERROR_RECURSION_LIMIT; ! #endif ! ! #if defined(USE_RECURSION_LIMIT) ! if (level > USE_RECURSION_LIMIT) ! return SRE_ERROR_RECURSION_LIMIT; ! #endif DATA_ALLOC(SRE_MATCH_CONTEXT, ctx); --- 807,811 ---- SRE_MATCH_CONTEXT* nextctx; ! TRACE(("|%p|%p|ENTER\n", pattern, state->ptr)); DATA_ALLOC(SRE_MATCH_CONTEXT, ctx); *************** *** 1030,1038 **** continue; state->ptr = ctx->ptr; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+1, level+1); - #else DO_JUMP(JUMP_BRANCH, jump_branch, ctx->pattern+1); - #endif if (ret) { if (ctx->u.rep) --- 989,993 ---- *************** *** 1067,1072 **** state->ptr = ctx->ptr; ! ctx->count = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2], ! level+1); RETURN_ON_ERROR(ctx->count); --- 1022,1026 ---- state->ptr = ctx->ptr; ! ctx->count = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]); RETURN_ON_ERROR(ctx->count); *************** *** 1102,1112 **** break; state->ptr = ctx->ptr; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+ctx->pattern[0], - level+1); - #else DO_JUMP(JUMP_REPEAT_ONE_1, jump_repeat_one_1, ctx->pattern+ctx->pattern[0]); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1056,1061 ---- *************** *** 1124,1134 **** while (ctx->count >= (int) ctx->pattern[1]) { state->ptr = ctx->ptr; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+ctx->pattern[0], - level+1); - #else DO_JUMP(JUMP_REPEAT_ONE_2, jump_repeat_one_2, ctx->pattern+ctx->pattern[0]); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1073,1078 ---- *************** *** 1165,1169 **** /* count using pattern min as the maximum */ ctx->count = SRE_COUNT(state, ctx->pattern+3, ! ctx->pattern[1], level+1); RETURN_ON_ERROR(ctx->count); if (ctx->count < (int) ctx->pattern[1]) --- 1109,1113 ---- /* count using pattern min as the maximum */ ctx->count = SRE_COUNT(state, ctx->pattern+3, ! ctx->pattern[1]); RETURN_ON_ERROR(ctx->count); if (ctx->count < (int) ctx->pattern[1]) *************** *** 1185,1195 **** || ctx->count <= (int)ctx->pattern[2]) { state->ptr = ctx->ptr; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+ctx->pattern[0], - level+1); - #else DO_JUMP(JUMP_MIN_REPEAT_ONE,jump_min_repeat_one, ctx->pattern+ctx->pattern[0]); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1129,1134 ---- *************** *** 1197,1201 **** } state->ptr = ctx->ptr; ! ret = SRE_COUNT(state, ctx->pattern+3, 1, level+1); RETURN_ON_ERROR(ret); if (ret == 0) --- 1136,1140 ---- } state->ptr = ctx->ptr; ! ret = SRE_COUNT(state, ctx->pattern+3, 1); RETURN_ON_ERROR(ret); if (ret == 0) *************** *** 1225,1233 **** state->ptr = ctx->ptr; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+ctx->pattern[0], level+1); - #else DO_JUMP(JUMP_REPEAT, jump_repeat, ctx->pattern+ctx->pattern[0]); - #endif state->repeat = ctx->u.rep->prev; free(ctx->u.rep); --- 1164,1168 ---- *************** *** 1260,1270 **** /* not enough matches */ ctx->u.rep->count = ctx->count; - #ifdef USE_RECURSION - /* RECURSIVE */ - ret = SRE_MATCH(state, ctx->u.rep->pattern+3, level+1); - #else DO_JUMP(JUMP_MAX_UNTIL_1, jump_max_until_1, ctx->u.rep->pattern+3); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1195,1200 ---- *************** *** 1287,1297 **** DATA_PUSH(&ctx->u.rep->last_ptr); ctx->u.rep->last_ptr = state->ptr; - #ifdef USE_RECURSION - /* RECURSIVE */ - ret = SRE_MATCH(state, ctx->u.rep->pattern+3, level+1); - #else DO_JUMP(JUMP_MAX_UNTIL_2, jump_max_until_2, ctx->u.rep->pattern+3); - #endif DATA_POP(&ctx->u.rep->last_ptr); if (ret) { --- 1217,1222 ---- *************** *** 1309,1317 **** tail matches */ state->repeat = ctx->u.rep->prev; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern, level+1); - #else DO_JUMP(JUMP_MAX_UNTIL_3, jump_max_until_3, ctx->pattern); - #endif RETURN_ON_SUCCESS(ret); state->repeat = ctx->u.rep; --- 1234,1238 ---- *************** *** 1337,1347 **** /* not enough matches */ ctx->u.rep->count = ctx->count; - #ifdef USE_RECURSION - /* RECURSIVE */ - ret = SRE_MATCH(state, ctx->u.rep->pattern+3, level+1); - #else DO_JUMP(JUMP_MIN_UNTIL_1, jump_min_until_1, ctx->u.rep->pattern+3); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1258,1263 ---- *************** *** 1357,1365 **** /* see if the tail matches */ state->repeat = ctx->u.rep->prev; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern, level+1); - #else DO_JUMP(JUMP_MIN_UNTIL_2, jump_min_until_2, ctx->pattern); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1273,1277 ---- *************** *** 1377,1387 **** ctx->u.rep->count = ctx->count; - #ifdef USE_RECURSION - /* RECURSIVE */ - ret = SRE_MATCH(state, ctx->u.rep->pattern+3, level+1); - #else DO_JUMP(JUMP_MIN_UNTIL_3,jump_min_until_3, ctx->u.rep->pattern+3); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1289,1294 ---- *************** *** 1471,1479 **** if (state->ptr < state->beginning) RETURN_FAILURE; - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+2, level+1); - #else DO_JUMP(JUMP_ASSERT, jump_assert, ctx->pattern+2); - #endif RETURN_ON_FAILURE(ret); ctx->pattern += ctx->pattern[0]; --- 1378,1382 ---- *************** *** 1487,1495 **** state->ptr = ctx->ptr - ctx->pattern[1]; if (state->ptr >= state->beginning) { - #ifdef USE_RECURSION - ret = SRE_MATCH(state, ctx->pattern+2, level+1); - #else DO_JUMP(JUMP_ASSERT_NOT, jump_assert_not, ctx->pattern+2); - #endif if (ret) { RETURN_ON_ERROR(ret); --- 1390,1394 ---- *************** *** 1520,1524 **** DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); - #ifndef USE_RECURSION switch (jump) { case JUMP_MAX_UNTIL_2: --- 1419,1422 ---- *************** *** 1565,1569 **** break; } - #endif return ret; /* should never get here */ --- 1463,1466 ---- *************** *** 1636,1640 **** if (flags & SRE_INFO_LITERAL) return 1; /* we got all of it */ ! status = SRE_MATCH(state, pattern + 2*prefix_skip, 1); if (status != 0) return status; --- 1533,1537 ---- if (flags & SRE_INFO_LITERAL) return 1; /* we got all of it */ ! status = SRE_MATCH(state, pattern + 2*prefix_skip); if (status != 0) return status; *************** *** 1667,1671 **** if (flags & SRE_INFO_LITERAL) return 1; /* we got all of it */ ! status = SRE_MATCH(state, pattern + 2, 1); if (status != 0) break; --- 1564,1568 ---- if (flags & SRE_INFO_LITERAL) return 1; /* we got all of it */ ! status = SRE_MATCH(state, pattern + 2); if (status != 0) break; *************** *** 1682,1686 **** state->start = ptr; state->ptr = ptr; ! status = SRE_MATCH(state, pattern, 1); if (status != 0) break; --- 1579,1583 ---- state->start = ptr; state->ptr = ptr; ! status = SRE_MATCH(state, pattern); if (status != 0) break; *************** *** 1692,1696 **** TRACE(("|%p|%p|SEARCH\n", pattern, ptr)); state->start = state->ptr = ptr++; ! status = SRE_MATCH(state, pattern, 1); if (status != 0) break; --- 1589,1593 ---- TRACE(("|%p|%p|SEARCH\n", pattern, ptr)); state->start = state->ptr = ptr++; ! status = SRE_MATCH(state, pattern); if (status != 0) break; *************** *** 2115,2122 **** if (state.charsize == 1) { ! status = sre_match(&state, PatternObject_GetCode(self), 1); } else { #if defined(HAVE_UNICODE) ! status = sre_umatch(&state, PatternObject_GetCode(self), 1); #endif } --- 2012,2019 ---- if (state.charsize == 1) { ! status = sre_match(&state, PatternObject_GetCode(self)); } else { #if defined(HAVE_UNICODE) ! status = sre_umatch(&state, PatternObject_GetCode(self)); #endif } *************** *** 3312,3319 **** if (state->charsize == 1) { ! status = sre_match(state, PatternObject_GetCode(self->pattern), 1); } else { #if defined(HAVE_UNICODE) ! status = sre_umatch(state, PatternObject_GetCode(self->pattern), 1); #endif } --- 3209,3216 ---- if (state->charsize == 1) { ! status = sre_match(state, PatternObject_GetCode(self->pattern)); } else { #if defined(HAVE_UNICODE) ! status = sre_umatch(state, PatternObject_GetCode(self->pattern)); #endif } From rhettinger at users.sourceforge.net Sat Dec 13 13:53:20 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 14 05:52:14 2003 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.16,1.17 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv10758 Modified Files: setobject.c Log Message: Refactor set.discard() and set.remove(). Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** setobject.c 13 Dec 2003 14:46:46 -0000 1.16 --- setobject.c 13 Dec 2003 18:53:18 -0000 1.17 *************** *** 778,796 **** set_remove(PySetObject *so, PyObject *item) { ! PyObject *tmp; ! if (PyDict_DelItem(so->data, item) == -1) { ! if (!PyType_IsSubtype(item->ob_type, &PySet_Type)) ! return NULL; ! PyErr_Clear(); tmp = frozenset_dict_wrapper(((PySetObject *)(item))->data); if (tmp == NULL) return NULL; ! if (PyDict_DelItem(so->data, tmp) == -1) { ! Py_DECREF(tmp); ! return NULL; ! } Py_DECREF(tmp); } Py_INCREF(Py_None); return Py_None; --- 778,794 ---- set_remove(PySetObject *so, PyObject *item) { ! PyObject *tmp, *result; ! if (PyType_IsSubtype(item->ob_type, &PySet_Type)) { tmp = frozenset_dict_wrapper(((PySetObject *)(item))->data); if (tmp == NULL) return NULL; ! result = set_remove(so, tmp); Py_DECREF(tmp); + return result; } + + if (PyDict_DelItem(so->data, item) == -1) + return NULL; Py_INCREF(Py_None); return Py_None; *************** *** 805,830 **** set_discard(PySetObject *so, PyObject *item) { ! PyObject *tmp; if (PyDict_DelItem(so->data, item) == -1) { ! if (PyErr_ExceptionMatches(PyExc_KeyError)) ! PyErr_Clear(); ! else { ! if (!PyType_IsSubtype(item->ob_type, &PySet_Type)) ! return NULL; ! PyErr_Clear(); ! tmp = frozenset_dict_wrapper(((PySetObject *)(item))->data); ! if (tmp == NULL) ! return NULL; ! if (PyDict_DelItem(so->data, tmp) == -1) { ! if (PyErr_ExceptionMatches(PyExc_KeyError)) ! PyErr_Clear(); ! else { ! Py_DECREF(tmp); ! return NULL; ! } ! } ! Py_DECREF(tmp); ! } } Py_INCREF(Py_None); --- 803,821 ---- set_discard(PySetObject *so, PyObject *item) { ! PyObject *tmp, *result; ! ! if (PyType_IsSubtype(item->ob_type, &PySet_Type)) { ! tmp = frozenset_dict_wrapper(((PySetObject *)(item))->data); ! if (tmp == NULL) ! return NULL; ! result = set_discard(so, tmp); ! Py_DECREF(tmp); ! return result; ! } if (PyDict_DelItem(so->data, item) == -1) { ! if (!PyErr_ExceptionMatches(PyExc_KeyError)) ! return NULL; ! PyErr_Clear(); } Py_INCREF(Py_None); *************** *** 917,921 **** {"clear", (PyCFunction)set_clear, METH_NOARGS, clear_doc}, ! {"__contains__", (PyCFunction)set_direct_contains, METH_O | METH_COEXIST, contains_doc}, {"copy", (PyCFunction)set_copy, METH_NOARGS, --- 908,912 ---- {"clear", (PyCFunction)set_clear, METH_NOARGS, clear_doc}, ! {"__contains__",(PyCFunction)set_direct_contains, METH_O | METH_COEXIST, contains_doc}, {"copy", (PyCFunction)set_copy, METH_NOARGS, *************** *** 1045,1049 **** static PyMethodDef frozenset_methods[] = { ! {"__contains__", (PyCFunction)set_direct_contains, METH_O | METH_COEXIST, contains_doc}, {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, --- 1036,1040 ---- static PyMethodDef frozenset_methods[] = { ! {"__contains__",(PyCFunction)set_direct_contains, METH_O | METH_COEXIST, contains_doc}, {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, From rhettinger at users.sourceforge.net Sat Dec 13 10:21:57 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 14 05:54:14 2003 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.254,2.255 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv13787 Modified Files: typeobject.c Log Message: Improve argument checking speed. Index: typeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v retrieving revision 2.254 retrieving revision 2.255 diff -C2 -d -r2.254 -r2.255 *** typeobject.c 13 Dec 2003 11:26:12 -0000 2.254 --- typeobject.c 13 Dec 2003 15:21:55 -0000 2.255 *************** *** 3321,3324 **** --- 3321,3340 ---- } + static int + check_num_args(PyObject *ob, int n) + { + if (!PyTuple_CheckExact(ob)) { + PyErr_SetString(PyExc_SystemError, + "PyArg_UnpackTuple() argument list is not a tuple"); + return 0; + } + if (n == PyTuple_GET_SIZE(ob)) + return 1; + PyErr_Format( + PyExc_TypeError, + "expected %d arguments, got %d", n, PyTuple_GET_SIZE(ob)); + return 0; + } + /* Generic wrappers for overloadable 'operators' such as __getitem__ */ *************** *** 3335,3339 **** int res; ! if (!PyArg_UnpackTuple(args, "", 0, 0)) return NULL; res = (*func)(self); --- 3351,3355 ---- int res; ! if (!check_num_args(args, 0)) return NULL; res = (*func)(self); *************** *** 3349,3353 **** int res; ! if (!PyArg_UnpackTuple(args, "", 0, 0)) return NULL; res = (*func)(self); --- 3365,3369 ---- int res; ! if (!check_num_args(args, 0)) return NULL; res = (*func)(self); *************** *** 3363,3368 **** PyObject *other; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &other)) return NULL; return (*func)(self, other); } --- 3379,3385 ---- PyObject *other; ! if (!check_num_args(args, 1)) return NULL; + other = PyTuple_GET_ITEM(args, 0); return (*func)(self, other); } *************** *** 3374,3379 **** PyObject *other; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &other)) return NULL; if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) && !PyType_IsSubtype(other->ob_type, self->ob_type)) { --- 3391,3397 ---- PyObject *other; ! if (!check_num_args(args, 1)) return NULL; + other = PyTuple_GET_ITEM(args, 0); if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) && !PyType_IsSubtype(other->ob_type, self->ob_type)) { *************** *** 3390,3395 **** PyObject *other; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &other)) return NULL; if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) && !PyType_IsSubtype(other->ob_type, self->ob_type)) { --- 3408,3414 ---- PyObject *other; ! if (!check_num_args(args, 1)) return NULL; + other = PyTuple_GET_ITEM(args, 0); if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) && !PyType_IsSubtype(other->ob_type, self->ob_type)) { *************** *** 3407,3412 **** int ok; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &other)) return NULL; ok = func(&self, &other); if (ok < 0) --- 3426,3432 ---- int ok; ! if (!check_num_args(args, 1)) return NULL; + other = PyTuple_GET_ITEM(args, 0); ok = func(&self, &other); if (ok < 0) *************** *** 3460,3464 **** unaryfunc func = (unaryfunc)wrapped; ! if (!PyArg_UnpackTuple(args, "", 0, 0)) return NULL; return (*func)(self); --- 3480,3484 ---- unaryfunc func = (unaryfunc)wrapped; ! if (!check_num_args(args, 0)) return NULL; return (*func)(self); *************** *** 3510,3514 **** return (*func)(self, i); } ! PyArg_UnpackTuple(args, "", 1, 1, &arg); assert(PyErr_Occurred()); return NULL; --- 3530,3534 ---- return (*func)(self, i); } ! check_num_args(args, 1); assert(PyErr_Occurred()); return NULL; *************** *** 3552,3557 **** PyObject *arg; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &arg)) return NULL; i = getindex(self, arg); if (i == -1 && PyErr_Occurred()) --- 3572,3578 ---- PyObject *arg; ! if (!check_num_args(args, 1)) return NULL; + arg = PyTuple_GET_ITEM(args, 0); i = getindex(self, arg); if (i == -1 && PyErr_Occurred()) *************** *** 3603,3608 **** PyObject *value; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &value)) return NULL; res = (*func)(self, value); if (res == -1 && PyErr_Occurred()) --- 3624,3630 ---- PyObject *value; ! if (!check_num_args(args, 1)) return NULL; + value = PyTuple_GET_ITEM(args, 0); res = (*func)(self, value); if (res == -1 && PyErr_Occurred()) *************** *** 3635,3640 **** PyObject *key; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &key)) return NULL; res = (*func)(self, key, NULL); if (res == -1 && PyErr_Occurred()) --- 3657,3663 ---- PyObject *key; ! if (!check_num_args(args, 1)) return NULL; + key = PyTuple_GET_ITEM(args, 0); res = (*func)(self, key, NULL); if (res == -1 && PyErr_Occurred()) *************** *** 3651,3656 **** PyObject *other; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &other)) return NULL; if (other->ob_type->tp_compare != func && !PyType_IsSubtype(other->ob_type, self->ob_type)) { --- 3674,3680 ---- PyObject *other; ! if (!check_num_args(args, 1)) return NULL; + other = PyTuple_GET_ITEM(args, 0); if (other->ob_type->tp_compare != func && !PyType_IsSubtype(other->ob_type, self->ob_type)) { *************** *** 3712,3717 **** PyObject *name; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &name)) return NULL; if (!hackcheck(self, func, "__delattr__")) return NULL; --- 3736,3742 ---- PyObject *name; ! if (!check_num_args(args, 1)) return NULL; + name = PyTuple_GET_ITEM(args, 0); if (!hackcheck(self, func, "__delattr__")) return NULL; *************** *** 3729,3733 **** long res; ! if (!PyArg_UnpackTuple(args, "", 0, 0)) return NULL; res = (*func)(self); --- 3754,3758 ---- long res; ! if (!check_num_args(args, 0)) return NULL; res = (*func)(self); *************** *** 3751,3756 **** PyObject *other; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &other)) return NULL; return (*func)(self, other, op); } --- 3776,3782 ---- PyObject *other; ! if (!check_num_args(args, 1)) return NULL; + other = PyTuple_GET_ITEM(args, 0); return (*func)(self, other, op); } *************** *** 3777,3781 **** PyObject *res; ! if (!PyArg_UnpackTuple(args, "", 0, 0)) return NULL; res = (*func)(self); --- 3803,3807 ---- PyObject *res; ! if (!check_num_args(args, 0)) return NULL; res = (*func)(self); *************** *** 3829,3834 **** int ret; ! if (!PyArg_UnpackTuple(args, "", 1, 1, &obj)) return NULL; ret = (*func)(self, obj, NULL); if (ret < 0) --- 3855,3861 ---- int ret; ! if (!check_num_args(args, 1)) return NULL; + obj = PyTuple_GET_ITEM(args, 0); ret = (*func)(self, obj, NULL); if (ret < 0) From mwh at python.net Sun Dec 14 09:27:13 2003 From: mwh at python.net (Michael Hudson) Date: Sun Dec 14 09:27:21 2003 Subject: [Python-checkins] python/dist/src/Objects typeobject.c,2.254,2.255 In-Reply-To: (rhettinger@users.sourceforge.net's message of "Sat, 13 Dec 2003 07:21:57 -0800") References: Message-ID: <2m1xr7lbjy.fsf@starship.python.net> rhettinger@users.sourceforge.net writes: > Update of /cvsroot/python/python/dist/src/Objects > In directory sc8-pr-cvs1:/tmp/cvs-serv13787 > > Modified Files: > typeobject.c > Log Message: > Improve argument checking speed. > > Index: typeobject.c > =================================================================== > RCS file: /cvsroot/python/python/dist/src/Objects/typeobject.c,v > retrieving revision 2.254 > retrieving revision 2.255 > diff -C2 -d -r2.254 -r2.255 > *** typeobject.c 13 Dec 2003 11:26:12 -0000 2.254 > --- typeobject.c 13 Dec 2003 15:21:55 -0000 2.255 > *************** > *** 3321,3324 **** > --- 3321,3340 ---- > } > > + static int > + check_num_args(PyObject *ob, int n) > + { > + if (!PyTuple_CheckExact(ob)) { Is it actually possible for this check to fail? I spent a while trying to make it fail, but couldn't manage it. Cheers, mwh -- "Sturgeon's Law (90% of everything is crap) applies to Usenet." "Nothing guarantees that the 10% isn't crap, too." -- Gene Spafford's Axiom #2 of Usenet, and a corollary From nnorwitz at users.sourceforge.net Sun Dec 14 10:01:37 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 14 10:01:41 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libmacos.tex,1.20,1.21 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv14625/Doc/mac Modified Files: libmacos.tex Log Message: SF #859810, typo in doc Index: libmacos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacos.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** libmacos.tex 24 Feb 2003 11:02:36 -0000 1.20 --- libmacos.tex 14 Dec 2003 15:01:35 -0000 1.21 *************** *** 149,153 **** \begin{funcdesc}{WMAvailable}{} ! Checks wether the current process has access to the window manager. The method will return \code{False} if the window manager is not available, for instance when running on Mac OS X Server or when logged in via ssh, --- 149,153 ---- \begin{funcdesc}{WMAvailable}{} ! Checks whether the current process has access to the window manager. The method will return \code{False} if the window manager is not available, for instance when running on Mac OS X Server or when logged in via ssh, From nnorwitz at users.sourceforge.net Sun Dec 14 10:02:56 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 14 10:02:59 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libmacos.tex, 1.21, 1.22 libmacui.tex, 1.21, 1.22 using.tex, 1.9, 1.10 scripting.tex, 1.2, 1.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv14864/Doc/mac Modified Files: libmacos.tex libmacui.tex using.tex scripting.tex Log Message: SF #859811, typo in docs Index: libmacos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacos.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libmacos.tex 14 Dec 2003 15:01:35 -0000 1.21 --- libmacos.tex 14 Dec 2003 15:02:54 -0000 1.22 *************** *** 154,158 **** or when the current interpreter is not running from a fullblown application bundle. A script runs from an application bundle either when it has been ! started with \program{pythonw} in stead of \program{python} or when running as an applet. --- 154,158 ---- or when the current interpreter is not running from a fullblown application bundle. A script runs from an application bundle either when it has been ! started with \program{pythonw} instead of \program{python} or when running as an applet. Index: libmacui.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacui.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libmacui.tex 5 Sep 2003 14:06:35 -0000 1.21 --- libmacui.tex 14 Dec 2003 15:02:54 -0000 1.22 *************** *** 136,142 **** \var{location} is the \code{(x, y)} position on the screen where the dialog is shown, ! \var{actionButtonLabel} is a string to show in stead of ``Open'' in the OK button, ! \var{cancelButtonLabel} is a string to show in stead of ``Cancel'' in the cancel button, \var{wanted} is the type of value wanted as a return: \class{str}, --- 136,142 ---- \var{location} is the \code{(x, y)} position on the screen where the dialog is shown, ! \var{actionButtonLabel} is a string to show instead of ``Open'' in the OK button, ! \var{cancelButtonLabel} is a string to show instead of ``Cancel'' in the cancel button, \var{wanted} is the type of value wanted as a return: \class{str}, Index: using.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/using.tex,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** using.tex 22 Jul 2003 01:09:22 -0000 1.9 --- using.tex 14 Dec 2003 15:02:54 -0000 1.10 *************** *** 87,91 **** There is one Mac OS X quirk that you need to be aware of: programs that talk to the Aqua window manager (in other words, anything that has a GUI) ! need to be run in a special way. Use \program{pythonw} in stead of \program{python} to start such scripts. --- 87,91 ---- There is one Mac OS X quirk that you need to be aware of: programs that talk to the Aqua window manager (in other words, anything that has a GUI) ! need to be run in a special way. Use \program{pythonw} instead of \program{python} to start such scripts. Index: scripting.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/scripting.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** scripting.tex 13 Jun 2003 14:59:26 -0000 1.2 --- scripting.tex 14 Dec 2003 15:02:54 -0000 1.3 *************** *** 70,74 **** current release that is as far as the object orientation goes, so in the example above we need to use ! \code{f.get(f.window(1).name)} in stead of the more Pythonic \code{f.window(1).name.get()}. --- 70,74 ---- current release that is as far as the object orientation goes, so in the example above we need to use ! \code{f.get(f.window(1).name)} instead of the more Pythonic \code{f.window(1).name.get()}. From python at rcn.com Sun Dec 14 11:57:09 2003 From: python at rcn.com (Raymond Hettinger) Date: Sun Dec 14 11:57:23 2003 Subject: [Python-Dev] Re: [Python-checkins] python/dist/src/Objects typeobject.c, 2.254, 2.255 In-Reply-To: <2m1xr7lbjy.fsf@starship.python.net> Message-ID: <001901c3c263$506bd1a0$e841fea9@oemcomputer> > > + static int > > + check_num_args(PyObject *ob, int n) > > + { > > + if (!PyTuple_CheckExact(ob)) { > > Is it actually possible for this check to fail? I spent a while > trying to make it fail, but couldn't manage it. I would support changing this to an assertion. Raymond From gvanrossum at users.sourceforge.net Mon Dec 15 01:06:26 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Mon Dec 15 01:06:30 2003 Subject: [Python-checkins] python/dist/src/Parser pgen.c,2.25,2.26 Message-ID: Update of /cvsroot/python/python/dist/src/Parser In directory sc8-pr-cvs1:/tmp/cvs-serv14903 Modified Files: pgen.c Log Message: Remove a "temporary" piece of code that was probably unneeded since mid 1990. Remove an untrue XXX comment. Index: pgen.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/pgen.c,v retrieving revision 2.25 retrieving revision 2.26 diff -C2 -d -r2.25 -r2.26 *** pgen.c 17 Apr 2003 14:55:42 -0000 2.25 --- pgen.c 15 Dec 2003 06:06:24 -0000 2.26 *************** *** 1,5 **** - /* Parser generator */ - /* XXX This file is not yet fully PROTOized */ /* For a description, see the comments at end of this file */ --- 1,3 ---- *************** *** 232,240 **** n++; for (; --i >= 0; n++) { - if (n->n_type == COMMA) { /* XXX Temporary */ - REQN(i, 1); - --i; - n++; - } REQ(n, ITEM); compile_item(ll, nf, n, &a, &b); --- 230,233 ---- From doerwalter at users.sourceforge.net Mon Dec 15 05:16:12 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Mon Dec 15 05:16:15 2003 Subject: [Python-checkins] python/dist/src/Lib StringIO.py,1.30,1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24762/Lib Modified Files: StringIO.py Log Message: Make the module docstring a raw string, so that the backslash in "read until end of line ('\n') or EOF" will be treated literally. Fixes SF bug #860155. Index: StringIO.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/StringIO.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** StringIO.py 18 Oct 2003 10:20:42 -0000 1.30 --- StringIO.py 15 Dec 2003 10:16:09 -0000 1.31 *************** *** 1,3 **** ! """File-like objects that read from or write to a string buffer. This implements (nearly) all stdio methods. --- 1,3 ---- ! r"""File-like objects that read from or write to a string buffer. This implements (nearly) all stdio methods. From mwh at users.sourceforge.net Mon Dec 15 06:04:03 2003 From: mwh at users.sourceforge.net (mwh@users.sourceforge.net) Date: Mon Dec 15 06:04:07 2003 Subject: [Python-checkins] python/nondist/peps pep-0310.txt,1.2,1.3 Message-ID: Update of /cvsroot/python/python/nondist/peps In directory sc8-pr-cvs1:/tmp/cvs-serv32421 Modified Files: pep-0310.txt Log Message: Long overdue updates. A decision one way or the other should be made wrt. this PEP at some point, I guess. Index: pep-0310.txt =================================================================== RCS file: /cvsroot/python/python/nondist/peps/pep-0310.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pep-0310.txt 10 Feb 2003 15:34:54 -0000 1.2 --- pep-0310.txt 15 Dec 2003 11:04:01 -0000 1.3 *************** *** 67,72 **** finally: ! if hasattr(var, "__exit__"): ! var.__exit__() If the variable is omitted, an unnamed object is allocated on the --- 67,74 ---- finally: ! var.__exit__() ! ! Note that this makes using an object that does not have an ! __exit__() method a fail-fast error. If the variable is omitted, an unnamed object is allocated on the *************** *** 118,133 **** Implementation Notes - The optional assignment in - - 'with' [ var '=' ] expr ':' - - was initially considered to be too hard to parse correctly. - However, by parsing the statement as - - 'with' expr [ '=' expr ] ':' - - and interpreting the result in the compiler phase, this can be - worked around. - There is a potential race condition in the code specified as equivalent to the with statement. For example, if a --- 120,123 ---- *************** *** 158,163 **** If a way of controlling object lifetimes explicitly was available, the function of the __exit__ hook could be taken over by the ! existing __del__ hook. Unfortunately, no workable proposal for ! controlling object lifetimes has been made so far. --- 148,164 ---- If a way of controlling object lifetimes explicitly was available, the function of the __exit__ hook could be taken over by the ! existing __del__ hook. An email exchange[1] with a proponent of ! this approach left one of the authors even more convinced that ! it isn't the right idea... ! ! It has been suggested[2] that the "__exit__" method be called ! "close", or that a "close" method should be considered if no ! __exit__ method is found, to increase the "out-of-the-box utility" ! of the "with ..." construct. ! ! There are some simiralities in concept between 'with ...' blocks ! and generators, which have led to proposals that for loops could ! implement the with block functionality[3]. While neat on some ! levels, we think that for loops should stick to being loops. *************** *** 167,170 **** --- 168,182 ---- (no URL found...) + Holger has much more far-reaching ideas about "execution monitors" + that are informed about details of control flow in the monitored + block. While interesting, these ideas could change the language + in deep and subtle ways and as such belong to a different PEP. + + Any Smalltalk/Ruby anonymous block style extension obviously + subsumes this one. + + PEP 319 is in the same area, but did not win support when aired on + python-dev. + Backwards Compatibility *************** *** 174,177 **** --- 186,209 ---- + Cost of Adoption + + Those who claim the language is getting larger and more + complicated have something else to complain about. It's something + else to teach. + + For the proposal to be useful, many file-like and lock-like + classes in the standard library and other code will have to have + + __exit__ = close + + or similar added. + + + Cost of Non-Adoption + + Writing correct code continues to be more effort than writing + incorrect code. + + References *************** *** 179,182 **** --- 211,228 ---- could be mentioned here. + [1] Off-list conversation between Michael Hudson and Bill Soudan + (made public with permission) + http://starship.python.net/crew/mwh/pep310/ + + [2] Samuele Pedroni on python-dev + http://mail.python.org/pipermail/python-dev/2003-August/037795.html + + [3] Thread on python-dev with subject + + [Python-Dev] pre-PEP: Resource-Release Support for Generators + + starting at + + http://mail.python.org/pipermail/python-dev/2003-August/037803.html Copyright *************** *** 192,194 **** fill-column: 70 End: - --- 238,239 ---- From rhettinger at users.sourceforge.net Mon Dec 15 08:23:57 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 15 08:24:01 2003 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.18,1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv24748 Modified Files: setobject.c Log Message: Improve algorithm for set.difference when the input is not a set. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** setobject.c 13 Dec 2003 19:38:47 -0000 1.18 --- setobject.c 15 Dec 2003 13:23:55 -0000 1.19 *************** *** 358,404 **** static PyObject * - set_difference(PySetObject *so, PyObject *other) - { - PySetObject *result, *otherset=NULL; - PyObject *otherdata, *tgtdata; - PyObject *key, *value; - int pos = 0; - - result = (PySetObject *)make_new_set(so->ob_type, NULL); - if (result == NULL) - return NULL; - tgtdata = result->data; - - if (PyDict_Check(other)) - otherdata = other; - else if (PyAnySet_Check(other)) - otherdata = ((PySetObject *)other)->data; - else { - otherset = (PySetObject *)make_new_set(so->ob_type, other); - if (otherset == NULL) { - Py_DECREF(result); - return NULL; - } - otherdata = otherset->data; - } - - while (PyDict_Next(so->data, &pos, &key, &value)) { - if (!PyDict_Contains(otherdata, key)) { - if (PyDict_SetItem(tgtdata, key, Py_True) == -1) { - Py_XDECREF(otherset); - return NULL; - } - } - } - Py_XDECREF(otherset); - return (PyObject *)result; - } - - PyDoc_STRVAR(difference_doc, - "Return the difference of two sets as a new set.\n\ - \n\ - (i.e. all elements that are in this set but not the other.)"); - - static PyObject * set_difference_update(PySetObject *so, PyObject *other) { --- 358,361 ---- *************** *** 431,434 **** --- 388,434 ---- "Remove all elements of another set from this set."); + static PyObject * + set_difference(PySetObject *so, PyObject *other) + { + PyObject *result, *tmp; + PyObject *otherdata, *tgtdata; + PyObject *key, *value; + int pos = 0; + + if (PyDict_Check(other)) + otherdata = other; + else if (PyAnySet_Check(other)) + otherdata = ((PySetObject *)other)->data; + else { + result = set_copy(so); + if (result == NULL) + return result; + tmp = set_difference_update((PySetObject *)result, other); + if (tmp != NULL) { + Py_DECREF(tmp); + return result; + } + Py_DECREF(result); + return NULL; + } + + result = make_new_set(so->ob_type, NULL); + if (result == NULL) + return NULL; + tgtdata = ((PySetObject *)result)->data; + + while (PyDict_Next(so->data, &pos, &key, &value)) { + if (!PyDict_Contains(otherdata, key)) { + if (PyDict_SetItem(tgtdata, key, Py_True) == -1) + return NULL; + } + } + return result; + } + + PyDoc_STRVAR(difference_doc, + "Return the difference of two sets as a new set.\n\ + \n\ + (i.e. all elements that are in this set but not the other.)"); static PyObject * set_sub(PySetObject *so, PyObject *other) From montanaro at users.sourceforge.net Mon Dec 15 09:38:59 2003 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Dec 15 09:39:11 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libcfgparser.tex, 1.31, 1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5382 Modified Files: libcfgparser.tex Log Message: missing word (should backport - is release23-maint still locked?) Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** libcfgparser.tex 21 Oct 2003 16:50:55 -0000 1.31 --- libcfgparser.tex 15 Dec 2003 14:38:57 -0000 1.32 *************** *** 58,62 **** \begin{classdesc}{ConfigParser}{\optional{defaults}} Derived class of \class{RawConfigParser} that implements the magical ! interpolation feature and adds optional arguments the \method{get()} and \method{items()} methods. The values in \var{defaults} must be appropriate for the \samp{\%()s} string interpolation. Note that --- 58,62 ---- \begin{classdesc}{ConfigParser}{\optional{defaults}} Derived class of \class{RawConfigParser} that implements the magical ! interpolation feature and adds optional arguments to the \method{get()} and \method{items()} methods. The values in \var{defaults} must be appropriate for the \samp{\%()s} string interpolation. Note that From fdrake at users.sourceforge.net Mon Dec 15 10:34:13 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 10:34:17 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libcfgparser.tex, 1.29.16.2, 1.29.16.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17485 Modified Files: Tag: release23-maint libcfgparser.tex Log Message: fix typo: added missing word (backported from trunk revision 1.32) Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.29.16.2 retrieving revision 1.29.16.3 diff -C2 -d -r1.29.16.2 -r1.29.16.3 *** libcfgparser.tex 21 Oct 2003 16:51:40 -0000 1.29.16.2 --- libcfgparser.tex 15 Dec 2003 15:34:11 -0000 1.29.16.3 *************** *** 58,62 **** \begin{classdesc}{ConfigParser}{\optional{defaults}} Derived class of \class{RawConfigParser} that implements the magical ! interpolation feature and adds optional arguments the \method{get()} and \method{items()} methods. The values in \var{defaults} must be appropriate for the \samp{\%()s} string interpolation. Note that --- 58,62 ---- \begin{classdesc}{ConfigParser}{\optional{defaults}} Derived class of \class{RawConfigParser} that implements the magical ! interpolation feature and adds optional arguments to the \method{get()} and \method{items()} methods. The values in \var{defaults} must be appropriate for the \samp{\%()s} string interpolation. Note that From fdrake at users.sourceforge.net Mon Dec 15 10:40:30 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 10:40:34 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libmacos.tex, 1.20, 1.20.12.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv18731 Modified Files: Tag: release23-maint libmacos.tex Log Message: fix typo: added missing letter (backported from trunk revision 1.21) Index: libmacos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacos.tex,v retrieving revision 1.20 retrieving revision 1.20.12.1 diff -C2 -d -r1.20 -r1.20.12.1 *** libmacos.tex 24 Feb 2003 11:02:36 -0000 1.20 --- libmacos.tex 15 Dec 2003 15:40:28 -0000 1.20.12.1 *************** *** 149,153 **** \begin{funcdesc}{WMAvailable}{} ! Checks wether the current process has access to the window manager. The method will return \code{False} if the window manager is not available, for instance when running on Mac OS X Server or when logged in via ssh, --- 149,153 ---- \begin{funcdesc}{WMAvailable}{} ! Checks whether the current process has access to the window manager. The method will return \code{False} if the window manager is not available, for instance when running on Mac OS X Server or when logged in via ssh, From fdrake at users.sourceforge.net Mon Dec 15 10:42:11 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 10:42:22 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libmacos.tex, 1.20.12.1, 1.20.12.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv19128 Modified Files: Tag: release23-maint libmacos.tex Log Message: fix typo (backported from trunk revision 1.22) Index: libmacos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacos.tex,v retrieving revision 1.20.12.1 retrieving revision 1.20.12.2 diff -C2 -d -r1.20.12.1 -r1.20.12.2 *** libmacos.tex 15 Dec 2003 15:40:28 -0000 1.20.12.1 --- libmacos.tex 15 Dec 2003 15:42:03 -0000 1.20.12.2 *************** *** 154,158 **** or when the current interpreter is not running from a fullblown application bundle. A script runs from an application bundle either when it has been ! started with \program{pythonw} in stead of \program{python} or when running as an applet. --- 154,158 ---- or when the current interpreter is not running from a fullblown application bundle. A script runs from an application bundle either when it has been ! started with \program{pythonw} instead of \program{python} or when running as an applet. From fdrake at users.sourceforge.net Mon Dec 15 10:43:41 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 10:43:43 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libmacui.tex, 1.18, 1.18.14.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv19549 Modified Files: Tag: release23-maint libmacui.tex Log Message: fix typo (backported from trunk revision 1.22) Index: libmacui.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libmacui.tex,v retrieving revision 1.18 retrieving revision 1.18.14.1 diff -C2 -d -r1.18 -r1.18.14.1 *** libmacui.tex 12 Feb 2003 09:58:33 -0000 1.18 --- libmacui.tex 15 Dec 2003 15:43:39 -0000 1.18.14.1 *************** *** 136,142 **** \var{location} is the \code{(x, y)} position on the screen where the dialog is shown, ! \var{actionButtonLabel} is a string to show in stead of ``Open'' in the OK button, ! \var{cancelButtonLabel} is a string to show in stead of ``Cancel'' in the cancel button, \var{wanted} is the type of value wanted as a return: \class{string}, --- 136,142 ---- \var{location} is the \code{(x, y)} position on the screen where the dialog is shown, ! \var{actionButtonLabel} is a string to show instead of ``Open'' in the OK button, ! \var{cancelButtonLabel} is a string to show instead of ``Cancel'' in the cancel button, \var{wanted} is the type of value wanted as a return: \class{string}, From fdrake at users.sourceforge.net Mon Dec 15 10:45:09 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 10:45:24 2003 Subject: [Python-checkins] python/dist/src/Doc/mac using.tex,1.9,1.9.6.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv19927 Modified Files: Tag: release23-maint using.tex Log Message: - fix typo (backported from trunk revision 1.10) - wrap long lines Index: using.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/using.tex,v retrieving revision 1.9 retrieving revision 1.9.6.1 diff -C2 -d -r1.9 -r1.9.6.1 *** using.tex 22 Jul 2003 01:09:22 -0000 1.9 --- using.tex 15 Dec 2003 15:45:06 -0000 1.9.6.1 *************** *** 86,92 **** There is one Mac OS X quirk that you need to be aware of: programs ! that talk to the Aqua window manager (in other words, anything that has a GUI) ! need to be run in a special way. Use \program{pythonw} in stead of \program{python} ! to start such scripts. \subsection{configuration} --- 86,92 ---- There is one Mac OS X quirk that you need to be aware of: programs ! that talk to the Aqua window manager (in other words, anything that ! has a GUI) need to be run in a special way. Use \program{pythonw} ! instead of \program{python} to start such scripts. \subsection{configuration} From fdrake at users.sourceforge.net Mon Dec 15 10:46:06 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 10:46:13 2003 Subject: [Python-checkins] python/dist/src/Doc/mac scripting.tex, 1.2, 1.2.10.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv20120 Modified Files: Tag: release23-maint scripting.tex Log Message: fix typo (backported from trunk revision 1.3) Index: scripting.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/scripting.tex,v retrieving revision 1.2 retrieving revision 1.2.10.1 diff -C2 -d -r1.2 -r1.2.10.1 *** scripting.tex 13 Jun 2003 14:59:26 -0000 1.2 --- scripting.tex 15 Dec 2003 15:46:04 -0000 1.2.10.1 *************** *** 70,74 **** current release that is as far as the object orientation goes, so in the example above we need to use ! \code{f.get(f.window(1).name)} in stead of the more Pythonic \code{f.window(1).name.get()}. --- 70,74 ---- current release that is as far as the object orientation goes, so in the example above we need to use ! \code{f.get(f.window(1).name)} instead of the more Pythonic \code{f.window(1).name.get()}. From jhylton at users.sourceforge.net Mon Dec 15 11:08:54 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Mon Dec 15 11:08:58 2003 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.57,1.58 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv25038 Modified Files: urllib2.py Log Message: Remove __del__ methods to avoid creating uncollectable cyclic trash. Keep close() methods for backwards compatibility. Does any call close() explicitly? Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** urllib2.py 14 Dec 2003 05:27:34 -0000 1.57 --- urllib2.py 15 Dec 2003 16:08:48 -0000 1.58 *************** *** 171,180 **** return 'HTTP Error %s: %s' % (self.code, self.msg) - def __del__(self): - # XXX is this safe? what if user catches exception, then - # extracts fp and discards exception? - if self.fp: - self.fp.close() - class GopherError(URLError): pass --- 171,174 ---- *************** *** 308,318 **** handler.add_parent(self) - def __del__(self): - self.close() - def close(self): ! for handler in self.handlers: ! handler.close() ! self.handlers = [] def _call_chain(self, chain, kind, meth_name, *args): --- 302,308 ---- handler.add_parent(self) def close(self): ! # Only exists for backwards compatibility. ! pass def _call_chain(self, chain, kind, meth_name, *args): *************** *** 437,441 **** def close(self): ! self.parent = None def __lt__(self, other): --- 427,432 ---- def close(self): ! # Only exists for backwards compatibility ! pass def __lt__(self, other): From perky at users.sourceforge.net Mon Dec 15 13:49:21 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 13:49:26 2003 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py, 1.34, 1.35 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv28695/Lib/test Modified Files: string_tests.py Log Message: Add rsplit method for str and unicode builtin types. SF feature request #801847. Original patch is written by Sean Reifschneider. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** string_tests.py 26 Nov 2003 08:21:34 -0000 1.34 --- string_tests.py 15 Dec 2003 18:49:19 -0000 1.35 *************** *** 190,193 **** --- 190,213 ---- self.checkraises(TypeError, 'hello', 'split', 42, 42, 42) + def test_rsplit(self): + self.checkequal(['this', 'is', 'the', 'rsplit', 'function'], + 'this is the rsplit function', 'rsplit') + self.checkequal(['a', 'b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|') + self.checkequal(['a|b', 'c', 'd'], 'a|b|c|d', 'rsplit', '|', 2) + self.checkequal(['a b c', 'd'], 'a b c d', 'rsplit', None, 1) + self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2) + self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 3) + self.checkequal(['a', 'b', 'c', 'd'], 'a b c d', 'rsplit', None, 4) + self.checkequal(['a b c d'], 'a b c d', 'rsplit', None, 0) + self.checkequal(['a, b, c', 'd'], 'a, b, c, d', 'rsplit', ', ', 1) + self.checkequal(['a, b', 'c', 'd'], 'a, b, c, d', 'rsplit', ', ', 2) + self.checkequal(['a', 'b', 'c', 'd'], 'a, b, c, d', 'rsplit', ', ', 3) + self.checkequal(['a', 'b', 'c', 'd'], 'a, b, c, d', 'rsplit', ', ', 4) + self.checkequal(['a, b, c, d'], 'a, b, c, d', 'rsplit', ', ', 0) + self.checkequal(['a b', 'c', 'd'], 'a b c d', 'rsplit', None, 2) + self.checkequal(['a\x00b', 'c'], 'a\x00b\x00c', 'rsplit', '\x00', 1) + self.checkequal(['', ''], 'abcd', 'rsplit', 'abcd') + self.checkequal([u'a b', u'c', u'd'], 'a b c d', 'rsplit', u' ', 2) + def test_strip(self): self.checkequal('hello', ' hello ', 'strip') From perky at users.sourceforge.net Mon Dec 15 13:49:21 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 13:49:30 2003 Subject: [Python-checkins] python/dist/src/Lib string.py,1.70,1.71 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv28695/Lib Modified Files: string.py Log Message: Add rsplit method for str and unicode builtin types. SF feature request #801847. Original patch is written by Sean Reifschneider. Index: string.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/string.py,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** string.py 26 Nov 2003 08:21:33 -0000 1.70 --- string.py 15 Dec 2003 18:49:19 -0000 1.71 *************** *** 122,125 **** --- 122,137 ---- splitfields = split + # Split a string into a list of space/tab-separated words + def rsplit(s, sep=None, maxsplit=-1): + """rsplit(s [,sep [,maxsplit]]) -> list of strings + + Return a list of the words in the string s, using sep as the + delimiter string, starting at the end of the string and working + to the front. If maxsplit is given, at most maxsplit splits are + done. If sep is not specified or is None, any whitespace string + is a separator. + """ + return s.rsplit(sep, maxsplit) + # Join fields with optional separator def join(words, sep = ' '): From perky at users.sourceforge.net Mon Dec 15 13:49:21 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 13:49:33 2003 Subject: [Python-checkins] python/dist/src/Include unicodeobject.h, 2.41, 2.42 Message-ID: Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv28695/Include Modified Files: unicodeobject.h Log Message: Add rsplit method for str and unicode builtin types. SF feature request #801847. Original patch is written by Sean Reifschneider. Index: unicodeobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/unicodeobject.h,v retrieving revision 2.41 retrieving revision 2.42 diff -C2 -d -r2.41 -r2.42 *** unicodeobject.h 12 Aug 2002 08:19:10 -0000 2.41 --- unicodeobject.h 15 Dec 2003 18:49:19 -0000 2.42 *************** *** 186,189 **** --- 186,190 ---- # define PyUnicode_SetDefaultEncoding PyUnicodeUCS2_SetDefaultEncoding # define PyUnicode_Split PyUnicodeUCS2_Split + # define PyUnicode_RSplit PyUnicodeUCS2_RSplit # define PyUnicode_Splitlines PyUnicodeUCS2_Splitlines # define PyUnicode_Tailmatch PyUnicodeUCS2_Tailmatch *************** *** 958,961 **** --- 959,981 ---- PyObject *s, /* String to split */ int keepends /* If true, line end markers are included */ + ); + + /* Split a string giving a list of Unicode strings. + + If sep is NULL, splitting will be done at all whitespace + substrings. Otherwise, splits occur at the given separator. + + At most maxsplit splits will be done. But unlike PyUnicode_Split + PyUnicode_RSplit splits from the end of the string. If negative, + no limit is set. + + Separators are not included in the resulting list. + + */ + + PyAPI_FUNC(PyObject*) PyUnicode_RSplit( + PyObject *s, /* String to split */ + PyObject *sep, /* String separator */ + int maxsplit /* Maxsplit count */ ); From perky at users.sourceforge.net Mon Dec 15 13:49:22 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 13:49:35 2003 Subject: [Python-checkins] python/dist/src/Objects stringobject.c, 2.214, 2.215 unicodeobject.c, 2.203, 2.204 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv28695/Objects Modified Files: stringobject.c unicodeobject.c Log Message: Add rsplit method for str and unicode builtin types. SF feature request #801847. Original patch is written by Sean Reifschneider. Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.214 retrieving revision 2.215 diff -C2 -d -r2.214 -r2.215 *** stringobject.c 29 Nov 2003 23:52:13 -0000 2.214 --- stringobject.c 15 Dec 2003 18:49:19 -0000 2.215 *************** *** 1408,1411 **** --- 1408,1534 ---- } + static PyObject * + rsplit_whitespace(const char *s, int len, int maxsplit) + { + int i, j, err; + PyObject* item; + PyObject *list = PyList_New(0); + + if (list == NULL) + return NULL; + + for (i = j = len - 1; i >= 0; ) { + while (i >= 0 && isspace(Py_CHARMASK(s[i]))) + i--; + j = i; + while (i >= 0 && !isspace(Py_CHARMASK(s[i]))) + i--; + if (j > i) { + if (maxsplit-- <= 0) + break; + item = PyString_FromStringAndSize(s+i+1, (int)(j-i)); + if (item == NULL) + goto finally; + err = PyList_Insert(list, 0, item); + Py_DECREF(item); + if (err < 0) + goto finally; + while (i >= 0 && isspace(Py_CHARMASK(s[i]))) + i--; + j = i; + } + } + if (j >= 0) { + item = PyString_FromStringAndSize(s, (int)(j + 1)); + if (item == NULL) + goto finally; + err = PyList_Insert(list, 0, item); + Py_DECREF(item); + if (err < 0) + goto finally; + } + return list; + finally: + Py_DECREF(list); + return NULL; + } + + + PyDoc_STRVAR(rsplit__doc__, + "S.rsplit([sep [,maxsplit]]) -> list of strings\n\ + \n\ + Return a list of the words in the string S, using sep as the\n\ + delimiter string, starting at the end of the string and working\n\ + to the front. If maxsplit is given, at most maxsplit splits are\n\ + done. If sep is not specified or is None, any whitespace string\n\ + is a separator."); + + static PyObject * + string_rsplit(PyStringObject *self, PyObject *args) + { + int len = PyString_GET_SIZE(self), n, i, j, err; + int maxsplit = -1; + const char *s = PyString_AS_STRING(self), *sub; + PyObject *list, *item, *subobj = Py_None; + + if (!PyArg_ParseTuple(args, "|Oi:rsplit", &subobj, &maxsplit)) + return NULL; + if (maxsplit < 0) + maxsplit = INT_MAX; + if (subobj == Py_None) + return rsplit_whitespace(s, len, maxsplit); + if (PyString_Check(subobj)) { + sub = PyString_AS_STRING(subobj); + n = PyString_GET_SIZE(subobj); + } + #ifdef Py_USING_UNICODE + else if (PyUnicode_Check(subobj)) + return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); + #endif + else if (PyObject_AsCharBuffer(subobj, &sub, &n)) + return NULL; + if (n == 0) { + PyErr_SetString(PyExc_ValueError, "empty separator"); + return NULL; + } + + list = PyList_New(0); + if (list == NULL) + return NULL; + + j = len; + i = j - n; + while (i >= 0) { + if (s[i] == sub[0] && memcmp(s+i, sub, n) == 0) { + if (maxsplit-- <= 0) + break; + item = PyString_FromStringAndSize(s+i+n, (int)(j-i-n)); + if (item == NULL) + goto fail; + err = PyList_Insert(list, 0, item); + Py_DECREF(item); + if (err < 0) + goto fail; + j = i; + i -= n; + } + else + i--; + } + item = PyString_FromStringAndSize(s, j); + if (item == NULL) + goto fail; + err = PyList_Insert(list, 0, item); + Py_DECREF(item); + if (err < 0) + goto fail; + + return list; + + fail: + Py_DECREF(list); + return NULL; + } + PyDoc_STRVAR(join__doc__, *************** *** 3065,3068 **** --- 3188,3192 ---- {"join", (PyCFunction)string_join, METH_O, join__doc__}, {"split", (PyCFunction)string_split, METH_VARARGS, split__doc__}, + {"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__}, {"lower", (PyCFunction)string_lower, METH_NOARGS, lower__doc__}, {"upper", (PyCFunction)string_upper, METH_NOARGS, upper__doc__}, Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.203 retrieving revision 2.204 diff -C2 -d -r2.203 -r2.204 *** unicodeobject.c 29 Nov 2003 23:52:13 -0000 2.203 --- unicodeobject.c 15 Dec 2003 18:49:19 -0000 2.204 *************** *** 4054,4058 **** #define SPLIT_APPEND(data, left, right) \ ! str = PyUnicode_FromUnicode(data + left, right - left); \ if (!str) \ goto onError; \ --- 4054,4058 ---- #define SPLIT_APPEND(data, left, right) \ ! str = PyUnicode_FromUnicode((data) + (left), (right) - (left)); \ if (!str) \ goto onError; \ *************** *** 4064,4067 **** --- 4064,4078 ---- Py_DECREF(str); + #define SPLIT_INSERT(data, left, right) \ + str = PyUnicode_FromUnicode((data) + (left), (right) - (left)); \ + if (!str) \ + goto onError; \ + if (PyList_Insert(list, 0, str)) { \ + Py_DECREF(str); \ + goto onError; \ + } \ + else \ + Py_DECREF(str); + static PyObject *split_whitespace(PyUnicodeObject *self, *************** *** 4215,4219 **** --- 4226,4329 ---- } + static + PyObject *rsplit_whitespace(PyUnicodeObject *self, + PyObject *list, + int maxcount) + { + register int i; + register int j; + int len = self->length; + PyObject *str; + + for (i = j = len - 1; i >= 0; ) { + /* find a token */ + while (i >= 0 && Py_UNICODE_ISSPACE(self->str[i])) + i--; + j = i; + while (i >= 0 && !Py_UNICODE_ISSPACE(self->str[i])) + i--; + if (j > i) { + if (maxcount-- <= 0) + break; + SPLIT_INSERT(self->str, i + 1, j + 1); + while (i >= 0 && Py_UNICODE_ISSPACE(self->str[i])) + i--; + j = i; + } + } + if (j >= 0) { + SPLIT_INSERT(self->str, 0, j + 1); + } + return list; + + onError: + Py_DECREF(list); + return NULL; + } + + static + PyObject *rsplit_char(PyUnicodeObject *self, + PyObject *list, + Py_UNICODE ch, + int maxcount) + { + register int i; + register int j; + int len = self->length; + PyObject *str; + + for (i = j = len - 1; i >= 0; ) { + if (self->str[i] == ch) { + if (maxcount-- <= 0) + break; + SPLIT_INSERT(self->str, i + 1, j + 1); + j = i = i - 1; + } else + i--; + } + if (j >= 0) { + SPLIT_INSERT(self->str, 0, j + 1); + } + return list; + + onError: + Py_DECREF(list); + return NULL; + } + + static + PyObject *rsplit_substring(PyUnicodeObject *self, + PyObject *list, + PyUnicodeObject *substring, + int maxcount) + { + register int i; + register int j; + int len = self->length; + int sublen = substring->length; + PyObject *str; + + for (i = len - sublen, j = len; i >= 0; ) { + if (Py_UNICODE_MATCH(self, i, substring)) { + if (maxcount-- <= 0) + break; + SPLIT_INSERT(self->str, i + sublen, j); + j = i; + i -= sublen; + } else + i--; + } + if (j >= 0) { + SPLIT_INSERT(self->str, 0, j); + } + return list; + + onError: + Py_DECREF(list); + return NULL; + } + #undef SPLIT_APPEND + #undef SPLIT_INSERT static *************** *** 4247,4250 **** --- 4357,4389 ---- static + PyObject *rsplit(PyUnicodeObject *self, + PyUnicodeObject *substring, + int maxcount) + { + PyObject *list; + + if (maxcount < 0) + maxcount = INT_MAX; + + list = PyList_New(0); + if (!list) + return NULL; + + if (substring == NULL) + return rsplit_whitespace(self,list,maxcount); + + else if (substring->length == 1) + return rsplit_char(self,list,substring->str[0],maxcount); + + else if (substring->length == 0) { + Py_DECREF(list); + PyErr_SetString(PyExc_ValueError, "empty separator"); + return NULL; + } + else + return rsplit_substring(self,list,substring,maxcount); + } + + static PyObject *replace(PyUnicodeObject *self, PyUnicodeObject *str1, *************** *** 5676,5679 **** --- 5815,5868 ---- } + PyObject *PyUnicode_RSplit(PyObject *s, + PyObject *sep, + int maxsplit) + { + PyObject *result; + + s = PyUnicode_FromObject(s); + if (s == NULL) + return NULL; + if (sep != NULL) { + sep = PyUnicode_FromObject(sep); + if (sep == NULL) { + Py_DECREF(s); + return NULL; + } + } + + result = rsplit((PyUnicodeObject *)s, (PyUnicodeObject *)sep, maxsplit); + + Py_DECREF(s); + Py_XDECREF(sep); + return result; + } + + PyDoc_STRVAR(rsplit__doc__, + "S.rsplit([sep [,maxsplit]]) -> list of strings\n\ + \n\ + Return a list of the words in S, using sep as the\n\ + delimiter string, starting at the end of the string and\n\ + working to the front. If maxsplit is given, at most maxsplit\n\ + splits are done. If sep is not specified, any whitespace string\n\ + is a separator."); + + static PyObject* + unicode_rsplit(PyUnicodeObject *self, PyObject *args) + { + PyObject *substring = Py_None; + int maxcount = -1; + + if (!PyArg_ParseTuple(args, "|Oi:rsplit", &substring, &maxcount)) + return NULL; + + if (substring == Py_None) + return rsplit(self, NULL, maxcount); + else if (PyUnicode_Check(substring)) + return rsplit(self, (PyUnicodeObject *)substring, maxcount); + else + return PyUnicode_RSplit((PyObject *)self, substring, maxcount); + } + PyDoc_STRVAR(splitlines__doc__, "S.splitlines([keepends]]) -> list of strings\n\ *************** *** 5871,5874 **** --- 6060,6064 ---- {"replace", (PyCFunction) unicode_replace, METH_VARARGS, replace__doc__}, {"split", (PyCFunction) unicode_split, METH_VARARGS, split__doc__}, + {"rsplit", (PyCFunction) unicode_rsplit, METH_VARARGS, rsplit__doc__}, {"join", (PyCFunction) unicode_join, METH_O, join__doc__}, {"capitalize", (PyCFunction) unicode_capitalize, METH_NOARGS, capitalize__doc__}, From perky at users.sourceforge.net Mon Dec 15 13:49:55 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 13:49:58 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.143, 1.144 libstring.tex, 1.53, 1.54 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv30041/Doc/lib Modified Files: libstdtypes.tex libstring.tex Log Message: Add rsplit method for str and unicode builtin types. SF feature request #801847. Original patch is written by Sean Reifschneider. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** libstdtypes.tex 26 Nov 2003 14:54:56 -0000 1.143 --- libstdtypes.tex 15 Dec 2003 18:49:53 -0000 1.144 *************** *** 695,698 **** --- 695,716 ---- \end{methoddesc} + \begin{methoddesc}[string]{rsplit}{\optional{, sep\optional{, maxsplit}}} + Return a list of the words of the string, scanning the string from + the end working forward. The resulting list of words is in the + same order as \function{split()}. If the optional second argument + \var{sep} is absent or \code{None}, the words are separated by + arbitrary strings of whitespace characters (space, tab, newline, + return, formfeed). If the second argument \var{sep} is present and + not \code{None}, it specifies a string to be used as the word + separator. The returned list will then have one more item than the + number of non-overlapping occurrences of the separator in the string. + The optional third argument \var{maxsplit} defaults to 0. If it + is nonzero, at most \var{maxsplit} number of splits occur, and the + remainder of the string is returned as the first element of the + list (thus, the list will have at most \code{\var{maxsplit}+1} + elements). + \versionadded{2.4} + \end{methoddesc} + \begin{methoddesc}[string]{rstrip}{\optional{chars}} Return a copy of the string with trailing characters removed. If Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** libstring.tex 18 Nov 2003 19:48:57 -0000 1.53 --- libstring.tex 15 Dec 2003 18:49:53 -0000 1.54 *************** *** 216,219 **** --- 216,236 ---- \end{funcdesc} + \begin{funcdesc}{rsplit}{s\optional{, sep\optional{, maxsplit}}} + Return a list of the words of the string \var{s}, scanning \var{s} from + the end working forward. The resulting list of words is in the same + order as \function{split()}. If the optional second argument \var{sep} + is absent or \code{None}, the words are separated by arbitrary strings + of whitespace characters (space, tab, newline, return, formfeed). + If the second argument \var{sep} is present and not \code{None}, it + specifies a string to be used as the word separator. The returned + list will then have one more item than the number of non-overlapping + occurrences of the separator in the string. The optional third argument + \var{maxsplit} defaults to 0. If it is nonzero, at most \var{maxsplit} + number of splits occur, and the remainder of the string is returned + as the first element of the list (thus, the list will have at most + \code{\var{maxsplit}+1} elements). + \versionadded{2.4} + \end{funcdesc} + \begin{funcdesc}{splitfields}{s\optional{, sep\optional{, maxsplit}}} This function behaves identically to \function{split()}. (In the From perky at users.sourceforge.net Mon Dec 15 13:51:21 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 13:51:24 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.912,1.913 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv30444/Misc Modified Files: NEWS Log Message: Add an entry for addition of {str,unicode}.rsplit. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.912 retrieving revision 1.913 diff -C2 -d -r1.912 -r1.913 *** NEWS 14 Dec 2003 05:29:45 -0000 1.912 --- NEWS 15 Dec 2003 18:51:19 -0000 1.913 *************** *** 115,118 **** --- 115,122 ---- will now just hit the recursion limit. See SF patch 825639. + - str and unicode builtin types now have s.rsplit() method that is + same as s.split() except that it scans the string from the end + working forward. See SF feature request 801847. + Extension modules ----------------- From rhettinger at users.sourceforge.net Mon Dec 15 14:24:36 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 15 14:24:41 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.913,1.914 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv4989 Modified Files: NEWS Log Message: Fix typo and improve wording a bit. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.913 retrieving revision 1.914 diff -C2 -d -r1.913 -r1.914 *** NEWS 15 Dec 2003 18:51:19 -0000 1.913 --- NEWS 15 Dec 2003 19:24:34 -0000 1.914 *************** *** 14,18 **** - Removed PendingDeprecationWarning from apply(). apply() remains ! deprecated, but the nuissance warning will not be issued. - At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage --- 14,18 ---- - Removed PendingDeprecationWarning from apply(). apply() remains ! deprecated, but the nuisance warning will not be issued. - At Python shutdown time (Py_Finalize()), 2.3 called cyclic garbage *************** *** 115,121 **** will now just hit the recursion limit. See SF patch 825639. ! - str and unicode builtin types now have s.rsplit() method that is ! same as s.split() except that it scans the string from the end ! working forward. See SF feature request 801847. Extension modules --- 115,121 ---- will now just hit the recursion limit. See SF patch 825639. ! - str and unicode builtin types now have rsplit() method that is ! same as split() except that it scans the string from the end ! working towards the beginning. See SF feature request 801847. Extension modules From perky at users.sourceforge.net Mon Dec 15 14:46:11 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Mon Dec 15 14:46:13 2003 Subject: [Python-checkins] python/dist/src/Lib UserString.py,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv8525/Lib Modified Files: UserString.py Log Message: Add rsplit method for UserString, too. (Spotted by Raymond Hettinger) Index: UserString.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserString.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** UserString.py 26 Nov 2003 08:21:33 -0000 1.19 --- UserString.py 15 Dec 2003 19:46:09 -0000 1.20 *************** *** 114,117 **** --- 114,119 ---- def split(self, sep=None, maxsplit=-1): return self.data.split(sep, maxsplit) + def rsplit(self, sep=None, maxsplit=-1): + return self.data.rsplit(sep, maxsplit) def splitlines(self, keepends=0): return self.data.splitlines(keepends) def startswith(self, prefix, start=0, end=sys.maxint): From rhettinger at users.sourceforge.net Mon Dec 15 16:16:08 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Mon Dec 15 16:16:13 2003 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.19,1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26902 Modified Files: setobject.c Log Message: Speedup set.update by using the override mode for PyDict_Merge(). Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** setobject.c 15 Dec 2003 13:23:55 -0000 1.19 --- setobject.c 15 Dec 2003 21:16:06 -0000 1.20 *************** *** 16,20 **** if (PyAnySet_Check(other)) { ! if (PyDict_Merge(so->data, ((PySetObject *)other)->data, 0) == -1) return NULL; Py_RETURN_NONE; --- 16,20 ---- if (PyAnySet_Check(other)) { ! if (PyDict_Merge(so->data, ((PySetObject *)other)->data, 1) == -1) return NULL; Py_RETURN_NONE; From fdrake at users.sourceforge.net Mon Dec 15 21:01:25 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Mon Dec 15 21:01:29 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex, 1.3.12.2, 1.3.12.3 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv17837 Modified Files: Tag: release23-maint libhtmlparser.tex Log Message: quick workaround to make "--" in a code sample not be treated wrongly (converted to an en-dash) by LaTeX2HTML Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.3.12.2 retrieving revision 1.3.12.3 diff -C2 -d -r1.3.12.2 -r1.3.12.3 *** libhtmlparser.tex 7 Dec 2003 12:47:00 -0000 1.3.12.2 --- libhtmlparser.tex 16 Dec 2003 02:01:22 -0000 1.3.12.3 *************** *** 110,117 **** This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{{-}{-}} and \samp{{-}{-}} delimiters, but not the delimiters ! themselves. For example, the comment \samp{} will ! cause this method to be called with the argument \code{'text'}. It is ! intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} --- 110,117 ---- This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{-\code{-}} and \samp{-\code{-}} delimiters, but not the delimiters ! themselves. For example, the comment \samp{} ! will cause this method to be called with the argument \code{'text'}. ! It is intended to be overridden by a derived class; the base class implementation does nothing. \end{methoddesc} From akuchling at users.sourceforge.net Tue Dec 16 15:59:39 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 16 15:59:42 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.18, 1.19 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv30782 Modified Files: whatsnew24.tex Log Message: Make example more readable Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** whatsnew24.tex 12 Dec 2003 13:13:47 -0000 1.18 --- whatsnew24.tex 16 Dec 2003 20:59:37 -0000 1.19 *************** *** 302,310 **** \begin{verbatim} >>> word = 'abracadabra' ! >>> [k for k, g in groupby(list.sorted(word))] ['a', 'b', 'c', 'd', 'r'] ! >>> [(k, len(list(g))) for k, g in groupby(list.sorted(word))] [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] ! >>> [k for k, g in groupby(list.sorted(word)) if len(list(g)) > 1] ['a', 'b', 'r'] \end{verbatim} --- 302,313 ---- \begin{verbatim} >>> word = 'abracadabra' ! >>> word = list.sorted(word) # Turn string into sorted list of letters ! >>> word ! ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r'] ! >>> [k for k, g in groupby(word)] # List the various group keys ['a', 'b', 'c', 'd', 'r'] ! >>> [(k, len(list(g))) for k, g in groupby(word)] # List key and group length [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] ! >>> [k for k, g in groupby(word) if len(list(g)) > 1] # All groups of size >1 ['a', 'b', 'r'] \end{verbatim} From perky at users.sourceforge.net Tue Dec 16 21:49:05 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Tue Dec 16 21:49:10 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.144, 1.145 libstring.tex, 1.54, 1.55 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv3686 Modified Files: libstdtypes.tex libstring.tex Log Message: Update documentations for str.rsplit() with Alex Martelli's rewrite. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** libstdtypes.tex 15 Dec 2003 18:49:53 -0000 1.144 --- libstdtypes.tex 17 Dec 2003 02:49:03 -0000 1.145 *************** *** 695,713 **** \end{methoddesc} ! \begin{methoddesc}[string]{rsplit}{\optional{, sep\optional{, maxsplit}}} ! Return a list of the words of the string, scanning the string from ! the end working forward. The resulting list of words is in the ! same order as \function{split()}. If the optional second argument ! \var{sep} is absent or \code{None}, the words are separated by ! arbitrary strings of whitespace characters (space, tab, newline, ! return, formfeed). If the second argument \var{sep} is present and ! not \code{None}, it specifies a string to be used as the word ! separator. The returned list will then have one more item than the ! number of non-overlapping occurrences of the separator in the string. ! The optional third argument \var{maxsplit} defaults to 0. If it ! is nonzero, at most \var{maxsplit} number of splits occur, and the ! remainder of the string is returned as the first element of the ! list (thus, the list will have at most \code{\var{maxsplit}+1} ! elements). \versionadded{2.4} \end{methoddesc} --- 695,703 ---- \end{methoddesc} ! \begin{methoddesc}[string]{rsplit}{\optional{sep \optional{,maxsplit}}} ! Return a list of the words in the string, using \var{sep} as the ! delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} ! splits are done, the \em{rightmost} ones. If \var{sep} is not specified ! or \code{None}, any whitespace string is a separator. \versionadded{2.4} \end{methoddesc} Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** libstring.tex 15 Dec 2003 18:49:53 -0000 1.54 --- libstring.tex 17 Dec 2003 02:49:03 -0000 1.55 *************** *** 217,233 **** \begin{funcdesc}{rsplit}{s\optional{, sep\optional{, maxsplit}}} ! Return a list of the words of the string \var{s}, scanning \var{s} from ! the end working forward. The resulting list of words is in the same ! order as \function{split()}. If the optional second argument \var{sep} ! is absent or \code{None}, the words are separated by arbitrary strings ! of whitespace characters (space, tab, newline, return, formfeed). ! If the second argument \var{sep} is present and not \code{None}, it ! specifies a string to be used as the word separator. The returned ! list will then have one more item than the number of non-overlapping ! occurrences of the separator in the string. The optional third argument ! \var{maxsplit} defaults to 0. If it is nonzero, at most \var{maxsplit} ! number of splits occur, and the remainder of the string is returned ! as the first element of the list (thus, the list will have at most ! \code{\var{maxsplit}+1} elements). \versionadded{2.4} \end{funcdesc} --- 217,228 ---- \begin{funcdesc}{rsplit}{s\optional{, sep\optional{, maxsplit}}} ! Return a list of the words of the string \var{s}, scanning \var{s} ! from the end. To all intents and purposes, the resulting list of ! words is the same as returned by \function{split()}, except when the ! optional third argument \var{maxsplit} is explicitly specified and ! nonzero. When \var{maxsplit} is nonzero, at most \var{maxsplit} ! number of splits -- the \em{rightmost} ones -- occur, and the remainder ! of the string is returned as the first element of the list (thus, the ! list will have at most \code{\var{maxsplit}+1} elements). \versionadded{2.4} \end{funcdesc} From perky at users.sourceforge.net Wed Dec 17 04:40:25 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Wed Dec 17 04:40:29 2003 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.279, 1.280 Message-ID: Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv3617 Modified Files: socketmodule.c Log Message: Fix erroneus argument parsing of socket.htons() on 64bit big endian machines. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.279 retrieving revision 1.280 diff -C2 -d -r1.279 -r1.280 *** socketmodule.c 27 Nov 2003 19:40:22 -0000 1.279 --- socketmodule.c 17 Dec 2003 09:40:23 -0000 1.280 *************** *** 2814,2818 **** socket_htons(PyObject *self, PyObject *args) { ! unsigned long x1, x2; if (!PyArg_ParseTuple(args, "i:htons", &x1)) { --- 2814,2818 ---- socket_htons(PyObject *self, PyObject *args) { ! int x1, x2; if (!PyArg_ParseTuple(args, "i:htons", &x1)) { From jhylton at users.sourceforge.net Wed Dec 17 13:52:18 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed Dec 17 13:52:24 2003 Subject: [Python-checkins] python/dist/src/Lib urllib2.py,1.58,1.59 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv16205 Modified Files: urllib2.py Log Message: Rewrite AbstractHTTPHandler to use modern httplib interface. The chief benefit of this change is that requests will now use HTTP/1.1 instead of HTTP/1.0. Bump the module version number as part of the change. There are two possible incompatibilities that we'll need to watch out for when we get to an alpha release. We may get a different class of exceptions out of httplib, and the do_open() method changed its signature. The latter is only important if anyone actually subclasses AbstractHTTPHandler. Index: urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/urllib2.py,v retrieving revision 1.58 retrieving revision 1.59 diff -C2 -d -r1.58 -r1.59 *** urllib2.py 15 Dec 2003 16:08:48 -0000 1.58 --- urllib2.py 17 Dec 2003 18:52:16 -0000 1.59 *************** *** 121,125 **** from urllib import localhost, url2pathname, getproxies ! __version__ = "2.1" _opener = None --- 121,125 ---- from urllib import localhost, url2pathname, getproxies ! __version__ = "2.4" _opener = None *************** *** 208,211 **** --- 208,213 ---- return "GET" + # XXX these helper methods are lame + def add_data(self, data): self.data = data *************** *** 937,944 **** return request - # XXX Should rewrite do_open() to use the new httplib interface, - # would be a little simpler. - def do_open(self, http_class, req): host = req.get_host() if not host: --- 939,952 ---- return request def do_open(self, http_class, req): + """Return an addinfourl object for the request, using http_class. + + http_class must implement the HTTPConnection API from httplib. + The addinfourl return value is a file-like object. It also + has methods and attributes including: + - info(): return a mimetools.Message object for the headers + - geturl(): return the original request URL + - code: HTTP status code + """ host = req.get_host() if not host: *************** *** 948,972 **** h.set_debuglevel(self._debuglevel) ! h.putrequest(req.get_method(), req.get_selector()) ! for k, v in req.headers.items(): ! h.putheader(k, v) ! for k, v in req.unredirected_hdrs.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(req.get_data()) ! code, msg, hdrs = h.getreply() ! fp = h.getfile() ! response = addinfourl(fp, hdrs, req.get_full_url()) ! # XXXX should these be methods, for uniformity with rest of interface? ! response.code = code ! response.msg = msg ! return response --- 956,973 ---- h.set_debuglevel(self._debuglevel) ! headers = dict(req.headers) ! headers.update(req.unredirected_hdrs) try: ! h.request(req.get_method(), req.get_selector(), req.data, headers) ! r = h.getresponse() ! except socket.error, err: # XXX what error? raise URLError(err) ! # Pick apart the HTTPResponse object to get the various pieces ! # of the ! resp = addinfourl(r.fp, r.msg, req.get_full_url()) ! resp.code = r.status ! resp.msg = r.reason ! return resp *************** *** 974,978 **** def http_open(self, req): ! return self.do_open(httplib.HTTP, req) http_request = AbstractHTTPHandler.do_request --- 975,979 ---- def http_open(self, req): ! return self.do_open(httplib.HTTPConnection, req) http_request = AbstractHTTPHandler.do_request *************** *** 982,986 **** def https_open(self, req): ! return self.do_open(httplib.HTTPS, req) https_request = AbstractHTTPHandler.do_request --- 983,987 ---- def https_open(self, req): ! return self.do_open(httplib.HTTPSConnection, req) https_request = AbstractHTTPHandler.do_request From jhylton at users.sourceforge.net Wed Dec 17 15:42:41 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed Dec 17 15:42:44 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib2.py,1.8,1.9 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv9529 Modified Files: test_urllib2.py Log Message: Add methods to MockHTTPClass for modern httplib interface. Replace lots of assert_(x == y) with assertEqual(x, y). Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_urllib2.py 14 Dec 2003 05:27:34 -0000 1.8 --- test_urllib2.py 17 Dec 2003 20:42:38 -0000 1.9 *************** *** 165,174 **** # (instead of response), which becomes the OpenerDirector's return # value. ! self.assert_(r == handlers[2]) calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] for expected, got in zip(calls, o.calls): handler, name, args, kwds = got ! self.assert_((handler, name) == expected) ! self.assert_(args == (req,)) def test_handler_order(self): --- 165,174 ---- # (instead of response), which becomes the OpenerDirector's return # value. ! self.assertEqual(r, handlers[2]) calls = [(handlers[0], "http_open"), (handlers[2], "http_open")] for expected, got in zip(calls, o.calls): handler, name, args, kwds = got ! self.assertEqual((handler, name), expected) ! self.assertEqual(args, (req,)) def test_handler_order(self): *************** *** 187,192 **** r = o.open("http://example.com/") # handlers called in reverse order, thanks to their sort order ! self.assert_(o.calls[0][0] == handlers[1]) ! self.assert_(o.calls[1][0] == handlers[0]) def test_raise(self): --- 187,192 ---- r = o.open("http://example.com/") # handlers called in reverse order, thanks to their sort order ! self.assertEqual(o.calls[0][0], handlers[1]) ! self.assertEqual(o.calls[1][0], handlers[0]) def test_raise(self): *************** *** 201,205 **** req = Request("http://example.com/") self.assertRaises(urllib2.URLError, o.open, req) ! self.assert_(o.calls == [(handlers[0], "http_open", (req,), {})]) ## def test_error(self): --- 201,205 ---- req = Request("http://example.com/") self.assertRaises(urllib2.URLError, o.open, req) ! self.assertEqual(o.calls, [(handlers[0], "http_open", (req,), {})]) ## def test_error(self): *************** *** 227,235 **** assert len(o.calls) == 2 calls = [(handlers[0], "http_open", (req,)), ! (handlers[2], "http_error_302", (req, Unknown(), 302, "", {}))] for expected, got in zip(calls, o.calls): handler, method_name, args = expected ! self.assert_((handler, method_name) == got[:2]) ! assert args == got[2] def test_processors(self): --- 227,236 ---- assert len(o.calls) == 2 calls = [(handlers[0], "http_open", (req,)), ! (handlers[2], "http_error_302", ! (req, Unknown(), 302, "", {}))] for expected, got in zip(calls, o.calls): handler, method_name, args = expected ! self.assertEqual((handler, method_name), got[:2]) ! self.assertEqual(args, got[2]) def test_processors(self): *************** *** 248,264 **** # processor methods are called on *all* handlers that define them, # not just the first handler that handles the request ! calls = [(handlers[0], "http_request"), (handlers[1], "http_request"), ! (handlers[0], "http_response"), (handlers[1], "http_response")] for i, (handler, name, args, kwds) in enumerate(o.calls): if i < 2: # *_request ! self.assert_((handler, name) == calls[i]) ! self.assert_(len(args) == 1) self.assert_(isinstance(args[0], Request)) else: # *_response ! self.assert_((handler, name) == calls[i]) ! self.assert_(len(args) == 2) self.assert_(isinstance(args[0], Request)) # response from opener.open is None, because there's no --- 249,266 ---- # processor methods are called on *all* handlers that define them, # not just the first handler that handles the request ! calls = [ ! (handlers[0], "http_request"), (handlers[1], "http_request"), ! (handlers[0], "http_response"), (handlers[1], "http_response")] for i, (handler, name, args, kwds) in enumerate(o.calls): if i < 2: # *_request ! self.assertEqual((handler, name), calls[i]) ! self.assertEqual(len(args), 1) self.assert_(isinstance(args[0], Request)) else: # *_response ! self.assertEqual((handler, name), calls[i]) ! self.assertEqual(len(args), 2) self.assert_(isinstance(args[0], Request)) # response from opener.open is None, because there's no *************** *** 308,319 **** # ftp authentication not yet implemented by FTPHandler self.assert_(h.user == h.passwd == "") ! self.assert_(h.host == socket.gethostbyname(host)) ! self.assert_(h.port == port) ! self.assert_(h.dirs == dirs) ! self.assert_(h.ftpwrapper.filename == filename) ! self.assert_(h.ftpwrapper.filetype == type_) headers = r.info() ! self.assert_(headers["Content-type"] == mimetype) ! self.assert_(int(headers["Content-length"]) == len(data)) def test_file(self): --- 310,321 ---- # ftp authentication not yet implemented by FTPHandler self.assert_(h.user == h.passwd == "") ! self.assertEqual(h.host, socket.gethostbyname(host)) ! self.assertEqual(h.port, port) ! self.assertEqual(h.dirs, dirs) ! self.assertEqual(h.ftpwrapper.filename, filename) ! self.assertEqual(h.ftpwrapper.filetype, type_) headers = r.info() ! self.assertEqual(headers["Content-type"], mimetype) ! self.assertEqual(int(headers["Content-length"]), len(data)) def test_file(self): *************** *** 351,357 **** finally: os.remove(TESTFN) ! self.assert_(data == towrite) ! self.assert_(headers["Content-type"] == "text/plain") ! self.assert_(headers["Content-length"] == "13") # Fudge Last-modified string comparison by one second to # prevent spurious failure on crossing a second boundary while --- 353,359 ---- finally: os.remove(TESTFN) ! self.assertEqual(data, towrite) ! self.assertEqual(headers["Content-type"], "text/plain") ! self.assertEqual(headers["Content-length"], "13") # Fudge Last-modified string comparison by one second to # prevent spurious failure on crossing a second boundary while *************** *** 404,410 **** else: self.assert_(o.req is req) ! self.assert_(req.type == "ftp") def test_http(self): class MockHTTPClass: def __init__(self): --- 406,418 ---- else: self.assert_(o.req is req) ! self.assertEqual(req.type, "ftp") def test_http(self): + class MockHTTPResponse: + def __init__(self, fp, msg, status, reason): + self.fp = fp + self.msg = msg + self.status = status + self.reason = reason class MockHTTPClass: def __init__(self): *************** *** 415,419 **** self.host = host return self ! def set_debuglevel(self, level): self.level = level def putrequest(self, method, selector): self.method, self.selector = method, selector --- 423,437 ---- self.host = host return self ! def set_debuglevel(self, level): ! self.level = level ! def request(self, method, url, body=None, headers={}): ! self.method = method ! self.selector = url ! self.req_headers += headers.items() ! if body: ! self.data = body ! if self.raise_on_endheaders: ! import socket ! raise socket.error() def putrequest(self, method, selector): self.method, self.selector = method, selector *************** *** 424,430 **** import socket raise socket.error() ! def send(self, data): self.data = data ! def getreply(self): return 200, "OK", {} ! def getfile(self): return MockFile() h = urllib2.AbstractHTTPHandler() --- 442,453 ---- import socket raise socket.error() ! def send(self, data): ! self.data = data ! def getreply(self): ! return 200, "OK", {} ! def getresponse(self): ! return MockHTTPResponse(MockFile(), {}, 200, "OK") ! def getfile(self): ! return MockFile() h = urllib2.AbstractHTTPHandler() *************** *** 444,455 **** hdrs = r.info() hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() ! self.assert_(r.geturl() == url) ! self.assert_(http.host == "example.com") ! self.assert_(http.level == 0) ! self.assert_(http.method == method) ! self.assert_(http.selector == "/") ! self.assert_(http.req_headers == [("Foo", "bar"), ("Spam", "eggs")]) ! self.assert_(http.data == data) # check socket.error converted to URLError --- 467,479 ---- hdrs = r.info() hdrs.get; hdrs.has_key # r.info() gives dict from .getreply() ! self.assertEqual(r.geturl(), url) ! self.assertEqual(http.host, "example.com") ! self.assertEqual(http.level, 0) ! self.assertEqual(http.method, method) ! self.assertEqual(http.selector, "/") ! self.assertEqual(http.req_headers, ! [("Foo", "bar"), ("Spam", "eggs")]) ! self.assertEqual(http.data, data) # check socket.error converted to URLError *************** *** 467,476 **** self.assert_("Content-type" not in req.unredirected_hdrs) else: # POST ! self.assert_(req.unredirected_hdrs["Content-length"] == "0") ! self.assert_(req.unredirected_hdrs["Content-type"] == "application/x-www-form-urlencoded") # XXX the details of Host could be better tested ! self.assert_(req.unredirected_hdrs["Host"] == "example.com") ! self.assert_(req.unredirected_hdrs["Spam"] == "eggs") # don't clobber existing headers --- 491,500 ---- self.assert_("Content-type" not in req.unredirected_hdrs) else: # POST ! self.assertEqual(req.unredirected_hdrs["Content-length"], "0") ! self.assertEqual(req.unredirected_hdrs["Content-type"], "application/x-www-form-urlencoded") # XXX the details of Host could be better tested ! self.assertEqual(req.unredirected_hdrs["Host"], "example.com") ! self.assertEqual(req.unredirected_hdrs["Spam"], "eggs") # don't clobber existing headers *************** *** 480,487 **** req.add_unredirected_header("Spam", "foo") newreq = h.do_request(req) ! self.assert_(req.unredirected_hdrs["Content-length"] == "foo") ! self.assert_(req.unredirected_hdrs["Content-type"] == "bar") ! self.assert_(req.unredirected_hdrs["Host"] == "baz") ! self.assert_(req.unredirected_hdrs["Spam"] == "foo") def test_errors(self): --- 504,511 ---- req.add_unredirected_header("Spam", "foo") newreq = h.do_request(req) ! self.assertEqual(req.unredirected_hdrs["Content-length"], "foo") ! self.assertEqual(req.unredirected_hdrs["Content-type"], "bar") ! self.assertEqual(req.unredirected_hdrs["Host"], "baz") ! self.assertEqual(req.unredirected_hdrs["Spam"], "foo") def test_errors(self): *************** *** 499,504 **** r = MockResponse(201, "Created", {}, "", url) self.assert_(h.http_response(req, r) is None) ! self.assert_(o.proto == "http") # o.error called ! self.assert_(o.args == (req, r, 201, "Created", {})) def test_redirect(self): --- 523,528 ---- r = MockResponse(201, "Created", {}, "", url) self.assert_(h.http_response(req, r) is None) ! self.assertEqual(o.proto, "http") # o.error called ! self.assertEqual(o.args, (req, r, 201, "Created", {})) def test_redirect(self): *************** *** 520,529 **** # 307 in response to POST requires user OK self.assert_(code == 307 and data is not None) ! self.assert_(o.req.get_full_url() == to_url) try: ! self.assert_(o.req.get_method() == "GET") except AttributeError: self.assert_(not o.req.has_data()) ! self.assert_(o.req.headers["Nonsense"] == "viking=withhold") self.assert_("Spam" not in o.req.headers) self.assert_("Spam" not in o.req.unredirected_hdrs) --- 544,554 ---- # 307 in response to POST requires user OK self.assert_(code == 307 and data is not None) ! self.assertEqual(o.req.get_full_url(), to_url) try: ! self.assertEqual(o.req.get_method(), "GET") except AttributeError: self.assert_(not o.req.has_data()) ! self.assertEqual(o.req.headers["Nonsense"], ! "viking=withhold") self.assert_("Spam" not in o.req.headers) self.assert_("Spam" not in o.req.unredirected_hdrs) *************** *** 560,564 **** count = count + 1 except urllib2.HTTPError: ! self.assert_(count == urllib2.HTTPRedirectHandler.max_redirections) --- 585,590 ---- count = count + 1 except urllib2.HTTPError: ! self.assertEqual(count, ! urllib2.HTTPRedirectHandler.max_redirections) From rhettinger at users.sourceforge.net Wed Dec 17 15:43:34 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:39 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.19, 1.20 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Doc/whatsnew Modified Files: whatsnew24.tex Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** whatsnew24.tex 16 Dec 2003 20:59:37 -0000 1.19 --- whatsnew24.tex 17 Dec 2003 20:43:32 -0000 1.20 *************** *** 178,184 **** people with the same age are in name-sorted order. ! \item The list type gained a \method{sorted(iterable)} method that works ! like the in-place \method{sort()} method but has been made suitable for ! use in expressions. The differences are: \begin{itemize} \item the input may be any iterable; --- 178,184 ---- people with the same age are in name-sorted order. ! \item There is a new builtin function \function{sorted(iterable)} that works ! like the in-place \method{list.sort()} method but has been made suitable ! for use in expressions. The differences are: \begin{itemize} \item the input may be any iterable; *************** *** 189,203 **** \begin{verbatim} >>> L = [9,7,8,3,2,4,1,6,5] ! >>> [10+i for i in list.sorted(L)] # usable in a list comprehension [11, 12, 13, 14, 15, 16, 17, 18, 19] >>> L = [9,7,8,3,2,4,1,6,5] # original is left unchanged [9,7,8,3,2,4,1,6,5] ! >>> list.sorted('Monte Python') # any iterable may be an input [' ', 'M', 'P', 'e', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y'] >>> # List the contents of a dict sorted by key values >>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5) ! >>> for k, v in list.sorted(colormap.iteritems()): ... print k, v ... --- 189,203 ---- \begin{verbatim} >>> L = [9,7,8,3,2,4,1,6,5] ! >>> [10+i for i in sorted(L)] # usable in a list comprehension [11, 12, 13, 14, 15, 16, 17, 18, 19] >>> L = [9,7,8,3,2,4,1,6,5] # original is left unchanged [9,7,8,3,2,4,1,6,5] ! >>> sorted('Monte Python') # any iterable may be an input [' ', 'M', 'P', 'e', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y'] >>> # List the contents of a dict sorted by key values >>> colormap = dict(red=1, blue=2, green=3, black=4, yellow=5) ! >>> for k, v in sorted(colormap.iteritems()): ... print k, v ... *************** *** 302,313 **** \begin{verbatim} >>> word = 'abracadabra' ! >>> word = list.sorted(word) # Turn string into sorted list of letters ! >>> word ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r'] ! >>> [k for k, g in groupby(word)] # List the various group keys ['a', 'b', 'c', 'd', 'r'] ! >>> [(k, len(list(g))) for k, g in groupby(word)] # List key and group length [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] ! >>> [k for k, g in groupby(word) if len(list(g)) > 1] # All groups of size >1 ['a', 'b', 'r'] \end{verbatim} --- 302,313 ---- \begin{verbatim} >>> word = 'abracadabra' ! >>> letters = sorted(word) # Turn string into sorted list of letters ! >>> letters ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r'] ! >>> [k for k, g in groupby(word)] # List unique letters ['a', 'b', 'c', 'd', 'r'] ! >>> [(k, len(list(g))) for k, g in groupby(word)] # Count letter occurences [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] ! >>> [k for k, g in groupby(word) if len(list(g)) > 1] # List duplicate letters ['a', 'b', 'r'] \end{verbatim} From rhettinger at users.sourceforge.net Wed Dec 17 15:43:34 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:42 2003 Subject: [Python-checkins] python/dist/src/Lib UserList.py, 1.21, 1.22 pyclbr.py, 1.31, 1.32 Message-ID: Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Lib Modified Files: UserList.py pyclbr.py Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: UserList.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserList.py,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** UserList.py 29 Oct 2003 06:54:42 -0000 1.21 --- UserList.py 17 Dec 2003 20:43:32 -0000 1.22 *************** *** 79,87 **** def reverse(self): self.data.reverse() def sort(self, *args, **kwds): self.data.sort(*args, **kwds) - def sorted(cls, iterable, *args, **kwds): - s = cls(iterable) - s.sort(*args, **kwds) - return s - sorted = classmethod(sorted) def extend(self, other): if isinstance(other, UserList): --- 79,82 ---- Index: pyclbr.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/pyclbr.py,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** pyclbr.py 1 Dec 2003 20:12:14 -0000 1.31 --- pyclbr.py 17 Dec 2003 20:43:32 -0000 1.32 *************** *** 328,332 **** if isinstance(obj, Class): print "class", obj.name, obj.super, obj.lineno ! methods = list.sorted(obj.methods.iteritems(), key=itemgetter(1)) for name, lineno in methods: if name != "__path__": --- 328,332 ---- if isinstance(obj, Class): print "class", obj.name, obj.super, obj.lineno ! methods = sorted(obj.methods.iteritems(), key=itemgetter(1)) for name, lineno in methods: if name != "__path__": From rhettinger at users.sourceforge.net Wed Dec 17 15:43:34 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:46 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.157, 1.158 libitertools.tex, 1.25, 1.26 libstdtypes.tex, 1.145, 1.146 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Doc/lib Modified Files: libfuncs.tex libitertools.tex libstdtypes.tex Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.157 retrieving revision 1.158 diff -C2 -d -r1.157 -r1.158 *** libfuncs.tex 7 Dec 2003 11:24:03 -0000 1.157 --- libfuncs.tex 17 Dec 2003 20:43:32 -0000 1.158 *************** *** 887,890 **** --- 887,899 ---- \end{funcdesc} + \begin{funcdesc}{sorted(\var{iterable}\optional{, \var{cmp}=None + \optional{, \var{key}=None + \optional{, \var{reverse}=False}}})} + Return a new sorted list from the items in \var{iterable}. + The optional arguments \var{cmp}, \var{key}, and \var{reverse} + have the same meaning as those for the \method{list.sort()} method. + \versionadded{2.4} + \end{funcdesc} + \begin{funcdesc}{staticmethod}{function} Return a static method for \var{function}. Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libitertools.tex 7 Dec 2003 13:00:25 -0000 1.25 --- libitertools.tex 17 Dec 2003 20:43:32 -0000 1.26 *************** *** 399,403 **** >>> from operator import itemgetter >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) ! >>> di = list.sorted(d.iteritems(), key=itemgetter(1)) >>> for k, g in groupby(di, key=itemgetter(1)): ... print k, map(itemgetter(0), g) --- 399,403 ---- >>> from operator import itemgetter >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) ! >>> di = sorted(d.iteritems(), key=itemgetter(1)) >>> for k, g in groupby(di, key=itemgetter(1)): ... print k, map(itemgetter(0), g) Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.145 retrieving revision 1.146 diff -C2 -d -r1.145 -r1.146 *** libstdtypes.tex 17 Dec 2003 02:49:03 -0000 1.145 --- libstdtypes.tex 17 Dec 2003 20:43:32 -0000 1.146 *************** *** 989,995 **** \optional{, \var{reverse}=False}}})} {sort the items of \var{s} in place}{(7), (8), (9), (10)} - \lineiii{\var{s}.sorted(\var{iterable}\optional{, \var{cmp}=None\optional{, \var{key}=None - \optional{, \var{reverse}=False}}})} - {return a new sorted list from the items in \var{iterable}}{(8), (9), (11)} \end{tableiii} \indexiv{operations on}{mutable}{sequence}{types} --- 989,992 ---- *************** *** 1041,1046 **** the sorted or reversed list. ! \item[(8)] The \method{sort()} and \method{sorted()} methods take optional ! arguments for controlling the comparisons. \var{cmp} specifies a custom comparison function of two arguments --- 1038,1043 ---- the sorted or reversed list. ! \item[(8)] The \method{sort()} method takes optional arguments for ! controlling the comparisions. \var{cmp} specifies a custom comparison function of two arguments *************** *** 1069,1074 **** \item[(9)] Starting with Python 2.3, the \method{sort()} method is ! guaranteed to be stable. Starting with Python 2.4, the \method{sorted()} ! method is also guaranteed to be stable. A sort is stable if it does not change the relative order of elements that compare equal --- this is helpful for sorting in multiple passes (for example, sort by --- 1066,1070 ---- \item[(9)] Starting with Python 2.3, the \method{sort()} method is ! guaranteed to be stable. A sort is stable if it guarantees not to change the relative order of elements that compare equal --- this is helpful for sorting in multiple passes (for example, sort by *************** *** 1080,1086 **** \exception{ValueError} if it can detect that the list has been mutated during a sort. - - \item[(11)] \method{sorted()} is a class method that returns a new list. - \versionadded{2.4} \end{description} --- 1076,1079 ---- From rhettinger at users.sourceforge.net Wed Dec 17 15:43:35 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:49 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.169,2.170 Message-ID: Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Objects Modified Files: listobject.c Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.169 retrieving revision 2.170 diff -C2 -d -r2.169 -r2.170 *** listobject.c 13 Dec 2003 11:26:11 -0000 2.169 --- listobject.c 17 Dec 2003 20:43:33 -0000 2.170 *************** *** 2022,2057 **** static PyObject * - listsorted(PyObject *cls, PyObject *args, PyObject *kwds) - { - PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs; - static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0}; - long reverse; - - if (args != NULL) { - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted", - kwlist, &seq, &compare, &keyfunc, &reverse)) - return NULL; - } - - newlist = PyObject_CallFunctionObjArgs(cls, seq, NULL); - if (newlist == NULL) - return NULL; - - newargs = PyTuple_GetSlice(args, 1, 4); - if (newargs == NULL) { - Py_DECREF(newlist); - return NULL; - } - v = listsort((PyListObject *)newlist, newargs, kwds); - Py_DECREF(newargs); - if (v == NULL) { - Py_DECREF(newlist); - return NULL; - } - Py_DECREF(v); - return newlist; - } - - static PyObject * listreverse(PyListObject *self) { --- 2022,2025 ---- *************** *** 2395,2401 **** "L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;\n\ cmp(x, y) -> -1, 0, 1"); - PyDoc_STRVAR(sorted_doc, - "list.sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list;\n\ - cmp(x, y) -> -1, 0, 1"); static PyObject *list_subscript(PyListObject*, PyObject*); --- 2363,2366 ---- *************** *** 2413,2418 **** {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, {"sort", (PyCFunction)listsort, METH_VARARGS | METH_KEYWORDS, sort_doc}, - {"sorted", (PyCFunction)listsorted, - METH_VARARGS | METH_KEYWORDS | METH_CLASS, sorted_doc}, {NULL, NULL} /* sentinel */ }; --- 2378,2381 ---- From rhettinger at users.sourceforge.net Wed Dec 17 15:43:35 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:51 2003 Subject: [Python-checkins] python/dist/src/Python bltinmodule.c,2.304,2.305 Message-ID: Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Python Modified Files: bltinmodule.c Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: bltinmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v retrieving revision 2.304 retrieving revision 2.305 diff -C2 -d -r2.304 -r2.305 *** bltinmodule.c 5 Dec 2003 17:34:27 -0000 2.304 --- bltinmodule.c 17 Dec 2003 20:43:33 -0000 2.305 *************** *** 1759,1762 **** --- 1759,1806 ---- This always returns a floating point number. Precision may be negative."); + static PyObject * + builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds) + { + PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs; + PyObject *callable; + static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0}; + long reverse; + + if (args != NULL) { + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted", + kwlist, &seq, &compare, &keyfunc, &reverse)) + return NULL; + } + + newlist = PySequence_List(seq); + if (newlist == NULL) + return NULL; + + callable = PyObject_GetAttrString(newlist, "sort"); + if (callable == NULL) { + Py_DECREF(newlist); + return NULL; + } + + newargs = PyTuple_GetSlice(args, 1, 4); + if (newargs == NULL) { + Py_DECREF(newlist); + Py_DECREF(callable); + return NULL; + } + + v = PyObject_Call(callable, newargs, kwds); + Py_DECREF(newargs); + Py_DECREF(callable); + if (v == NULL) { + Py_DECREF(newlist); + return NULL; + } + Py_DECREF(v); + return newlist; + } + + PyDoc_STRVAR(sorted_doc, + "sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list"); static PyObject * *************** *** 2056,2059 **** --- 2100,2104 ---- {"round", builtin_round, METH_VARARGS, round_doc}, {"setattr", builtin_setattr, METH_VARARGS, setattr_doc}, + {"sorted", (PyCFunction)builtin_sorted, METH_VARARGS | METH_KEYWORDS, sorted_doc}, {"sum", builtin_sum, METH_VARARGS, sum_doc}, #ifdef Py_USING_UNICODE From rhettinger at users.sourceforge.net Wed Dec 17 15:43:35 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:54 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.914,1.915 Message-ID: Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Misc Modified Files: NEWS Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.914 retrieving revision 1.915 diff -C2 -d -r1.914 -r1.915 *** NEWS 15 Dec 2003 19:24:34 -0000 1.914 --- NEWS 17 Dec 2003 20:43:32 -0000 1.915 *************** *** 76,79 **** --- 76,82 ---- over a sequence. + - Added a sorted() builtin function that returns a new sorted list + from any iterable. + - CObjects are now mutable (on the C level) through PyCObject_SetVoidPtr. *************** *** 86,92 **** starting with Py2.3 are guaranteed to be stable (the relative order of records with equal keys is unchanged). - - - Added a list.sorted() classmethod that returns a new sorted list - from any iterable. - Added test whether wchar_t is signed or not. A signed wchar_t is not --- 89,92 ---- From rhettinger at users.sourceforge.net Wed Dec 17 15:43:35 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:43:57 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_builtin.py, 1.26, 1.27 test_descrtut.py, 1.18, 1.19 test_itertools.py, 1.26, 1.27 test_operator.py, 1.12, 1.13 test_set.py, 1.7, 1.8 test_sort.py, 1.10, 1.11 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv9388/Lib/test Modified Files: test_builtin.py test_descrtut.py test_itertools.py test_operator.py test_set.py test_sort.py Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: test_builtin.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_builtin.py 29 Nov 2003 23:52:12 -0000 1.26 --- test_builtin.py 17 Dec 2003 20:43:32 -0000 1.27 *************** *** 4,8 **** from test.test_support import fcmp, have_unicode, TESTFN, unlink ! import sys, warnings, cStringIO warnings.filterwarnings("ignore", "hex../oct.. of negative int", FutureWarning, __name__) --- 4,8 ---- from test.test_support import fcmp, have_unicode, TESTFN, unlink ! import sys, warnings, cStringIO, random warnings.filterwarnings("ignore", "hex../oct.. of negative int", FutureWarning, __name__) *************** *** 1154,1159 **** self.assertRaises(ValueError, zip, BadSeq(), BadSeq()) def test_main(): ! test.test_support.run_unittest(BuiltinTest) if __name__ == "__main__": --- 1154,1192 ---- self.assertRaises(ValueError, zip, BadSeq(), BadSeq()) + class TestSorted(unittest.TestCase): + + def test_basic(self): + data = range(100) + copy = data[:] + random.shuffle(copy) + self.assertEqual(data, sorted(copy)) + self.assertNotEqual(data, copy) + + data.reverse() + random.shuffle(copy) + self.assertEqual(data, sorted(copy, cmp=lambda x, y: cmp(y,x))) + self.assertNotEqual(data, copy) + random.shuffle(copy) + self.assertEqual(data, sorted(copy, key=lambda x: -x)) + self.assertNotEqual(data, copy) + random.shuffle(copy) + self.assertEqual(data, sorted(copy, reverse=1)) + self.assertNotEqual(data, copy) + + def test_inputtypes(self): + s = 'abracadabra' + for T in [unicode, list, tuple]: + self.assertEqual(sorted(s), sorted(T(s))) + + s = ''.join(dict.fromkeys(s).keys()) # unique letters only + for T in [unicode, set, frozenset, list, tuple, dict.fromkeys]: + self.assertEqual(sorted(s), sorted(T(s))) + + def test_baddecorator(self): + data = 'The quick Brown fox Jumped over The lazy Dog'.split() + self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0) + def test_main(): ! test.test_support.run_unittest(BuiltinTest, TestSorted) if __name__ == "__main__": Index: test_descrtut.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descrtut.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** test_descrtut.py 8 Nov 2003 12:39:53 -0000 1.18 --- test_descrtut.py 17 Dec 2003 20:43:32 -0000 1.19 *************** *** 227,232 **** 'remove', 'reverse', ! 'sort', ! 'sorted'] The new introspection API gives more information than the old one: in --- 227,231 ---- 'remove', 'reverse', ! 'sort'] The new introspection API gives more information than the old one: in Index: test_itertools.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_itertools.py 6 Dec 2003 16:23:06 -0000 1.26 --- test_itertools.py 17 Dec 2003 20:43:32 -0000 1.27 *************** *** 98,111 **** s = 'abracadabra' # sort s | uniq ! r = [k for k, g in groupby(list.sorted(s))] self.assertEqual(r, ['a', 'b', 'c', 'd', 'r']) # sort s | uniq -d ! r = [k for k, g in groupby(list.sorted(s)) if list(islice(g,1,2))] self.assertEqual(r, ['a', 'b', 'r']) # sort s | uniq -c ! r = [(len(list(g)), k) for k, g in groupby(list.sorted(s))] self.assertEqual(r, [(5, 'a'), (2, 'b'), (1, 'c'), (1, 'd'), (2, 'r')]) # sort s | uniq -c | sort -rn | head -3 ! r = list.sorted([(len(list(g)) , k) for k, g in groupby(list.sorted(s))], reverse=True)[:3] self.assertEqual(r, [(5, 'a'), (2, 'r'), (2, 'b')]) --- 98,111 ---- s = 'abracadabra' # sort s | uniq ! r = [k for k, g in groupby(sorted(s))] self.assertEqual(r, ['a', 'b', 'c', 'd', 'r']) # sort s | uniq -d ! r = [k for k, g in groupby(sorted(s)) if list(islice(g,1,2))] self.assertEqual(r, ['a', 'b', 'r']) # sort s | uniq -c ! r = [(len(list(g)), k) for k, g in groupby(sorted(s))] self.assertEqual(r, [(5, 'a'), (2, 'b'), (1, 'c'), (1, 'd'), (2, 'r')]) # sort s | uniq -c | sort -rn | head -3 ! r = sorted([(len(list(g)) , k) for k, g in groupby(sorted(s))], reverse=True)[:3] self.assertEqual(r, [(5, 'a'), (2, 'r'), (2, 'b')]) *************** *** 670,674 **** >>> from operator import itemgetter >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) ! >>> di = list.sorted(d.iteritems(), key=itemgetter(1)) >>> for k, g in groupby(di, itemgetter(1)): ... print k, map(itemgetter(0), g) --- 670,674 ---- >>> from operator import itemgetter >>> d = dict(a=1, b=2, c=1, d=2, e=1, f=2, g=3) ! >>> di = sorted(d.iteritems(), key=itemgetter(1)) >>> for k, g in groupby(di, itemgetter(1)): ... print k, map(itemgetter(0), g) Index: test_operator.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_operator.py,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** test_operator.py 1 Dec 2003 13:18:39 -0000 1.12 --- test_operator.py 17 Dec 2003 20:43:32 -0000 1.13 *************** *** 264,268 **** getcount = operator.itemgetter(1) self.assertEqual(map(getcount, inventory), [3, 2, 5, 1]) ! self.assertEqual(list.sorted(inventory, key=getcount), [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]) --- 264,268 ---- getcount = operator.itemgetter(1) self.assertEqual(map(getcount, inventory), [3, 2, 5, 1]) ! self.assertEqual(sorted(inventory, key=getcount), [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]) Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_set.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_set.py 24 Nov 2003 02:57:33 -0000 1.7 --- test_set.py 17 Dec 2003 20:43:32 -0000 1.8 *************** *** 23,28 **** def test_uniquification(self): ! actual = list.sorted(self.s) ! expected = list.sorted(self.d) self.assertEqual(actual, expected) self.assertRaises(PassThru, self.thetype, check_pass_thru()) --- 23,28 ---- def test_uniquification(self): ! actual = sorted(self.s) ! expected = sorted(self.d) self.assertEqual(actual, expected) self.assertRaises(PassThru, self.thetype, check_pass_thru()) *************** *** 1242,1246 **** 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.sorted(cons(g(s))), list.sorted(g(s))) self.assertRaises(TypeError, cons , X(s)) self.assertRaises(TypeError, cons , N(s)) --- 1242,1246 ---- for s in ("123", "", range(1000), ('do', 1.2), xrange(2000,2200,5)): for g in (G, I, Ig, S, L, R): ! self.assertEqual(sorted(cons(g(s))), sorted(g(s))) self.assertRaises(TypeError, cons , X(s)) self.assertRaises(TypeError, cons , N(s)) *************** *** 1254,1258 **** expected = meth(data) actual = meth(G(data)) ! self.assertEqual(list.sorted(actual), list.sorted(expected)) self.assertRaises(TypeError, meth, X(s)) self.assertRaises(TypeError, meth, N(s)) --- 1254,1258 ---- expected = meth(data) actual = meth(G(data)) ! self.assertEqual(sorted(actual), sorted(expected)) self.assertRaises(TypeError, meth, X(s)) self.assertRaises(TypeError, meth, N(s)) *************** *** 1268,1272 **** getattr(s, methname)(list(g(data))) getattr(t, methname)(g(data)) ! self.assertEqual(list.sorted(s), list.sorted(t)) self.assertRaises(TypeError, getattr(set('january'), methname), X(data)) --- 1268,1272 ---- getattr(s, methname)(list(g(data))) getattr(t, methname)(g(data)) ! self.assertEqual(sorted(s), sorted(t)) self.assertRaises(TypeError, getattr(set('january'), methname), X(data)) Index: test_sort.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_sort.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** test_sort.py 4 Dec 2003 11:41:24 -0000 1.10 --- test_sort.py 17 Dec 2003 20:43:32 -0000 1.11 *************** *** 249,306 **** self.assertEqual(data, copy2) - class TestSorted(unittest.TestCase): - - def test_basic(self): - data = range(100) - copy = data[:] - random.shuffle(copy) - self.assertEqual(data, list.sorted(copy)) - self.assertNotEqual(data, copy) - - data.reverse() - random.shuffle(copy) - self.assertEqual(data, list.sorted(copy, cmp=lambda x, y: cmp(y,x))) - self.assertNotEqual(data, copy) - random.shuffle(copy) - self.assertEqual(data, list.sorted(copy, key=lambda x: -x)) - self.assertNotEqual(data, copy) - random.shuffle(copy) - self.assertEqual(data, list.sorted(copy, reverse=1)) - self.assertNotEqual(data, copy) - - def test_inputtypes(self): - s = 'abracadabra' - for T in [unicode, list, tuple]: - self.assertEqual(list.sorted(s), list.sorted(T(s))) - - s = ''.join(dict.fromkeys(s).keys()) # unique letters only - for T in [unicode, set, frozenset, list, tuple, dict.fromkeys]: - self.assertEqual(list.sorted(s), list.sorted(T(s))) - - def test_baddecorator(self): - data = 'The quick Brown fox Jumped over The lazy Dog'.split() - self.assertRaises(TypeError, list.sorted, data, None, lambda x,y: 0) - - def classmethods(self): - s = "hello world" - a = list.sorted(s) - b = UserList.sorted(s) - c = [].sorted(s) - d = UserList().sorted(s) - class Mylist(list): - def __new__(cls): - return UserList() - e = MyList.sorted(s) - f = MyList().sorted(s) - class Myuserlist(UserList): - def __new__(cls): - return [] - g = MyList.sorted(s) - h = MyList().sorted(s) - self.assert_(a == b == c == d == e == f == g == h) - self.assert_(b.__class__ == d.__class__ == UserList) - self.assert_(e.__class__ == f.__class__ == MyList) - self.assert_(g.__class__ == h.__class__ == Myuserlist) - #============================================================================== --- 249,252 ---- *************** *** 308,312 **** test_classes = ( TestDecorateSortUndecorate, - TestSorted, TestBugs, ) --- 254,257 ---- From jhylton at users.sourceforge.net Wed Dec 17 15:47:31 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Wed Dec 17 15:47:34 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_urllib2.py, 1.9, 1.10 Message-ID: Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv10480 Modified Files: test_urllib2.py Log Message: Remove methods that are no longer called by urllib2. Index: test_urllib2.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_urllib2.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** test_urllib2.py 17 Dec 2003 20:42:38 -0000 1.9 --- test_urllib2.py 17 Dec 2003 20:47:28 -0000 1.10 *************** *** 434,453 **** import socket raise socket.error() - def putrequest(self, method, selector): - self.method, self.selector = method, selector - def putheader(self, key, value): - self.req_headers.append((key, value)) - def endheaders(self): - if self.raise_on_endheaders: - import socket - raise socket.error() - def send(self, data): - self.data = data - def getreply(self): - return 200, "OK", {} def getresponse(self): return MockHTTPResponse(MockFile(), {}, 200, "OK") - def getfile(self): - return MockFile() h = urllib2.AbstractHTTPHandler() --- 434,439 ---- From rhettinger at users.sourceforge.net Wed Dec 17 15:50:48 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 15:50:50 2003 Subject: [Python-checkins] python/dist/src/Doc/lib liboperator.tex, 1.30, 1.31 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10880 Modified Files: liboperator.tex Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: liboperator.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboperator.tex,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** liboperator.tex 1 Dec 2003 13:18:39 -0000 1.30 --- liboperator.tex 17 Dec 2003 20:50:46 -0000 1.31 *************** *** 303,307 **** The \module{operator} module also defines tools for generalized attribute and item lookups. These are useful for making fast field extractors ! as arguments for \function{map()}, \method{list.sort()}, \method{itertools.groupby()}, or other functions that expect a function argument. --- 303,307 ---- The \module{operator} module also defines tools for generalized attribute and item lookups. These are useful for making fast field extractors ! as arguments for \function{map()}, \function{sorted()}, \method{itertools.groupby()}, or other functions that expect a function argument. *************** *** 329,333 **** >>> map(getcount, inventory) [3, 2, 5, 1] ! >>> list.sorted(inventory, key=getcount) [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] \end{verbatim} --- 329,333 ---- >>> map(getcount, inventory) [3, 2, 5, 1] ! >>> sorted(inventory, key=getcount) [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] \end{verbatim} From rhettinger at users.sourceforge.net Wed Dec 17 16:38:28 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 17 16:38:31 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.219,1.220 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv20145 Modified Files: tut.tex Log Message: Guido grants a Christmas wish: sorted() becomes a regular function instead of a classmethod. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.219 retrieving revision 1.220 diff -C2 -d -r1.219 -r1.220 *** tut.tex 6 Dec 2003 20:12:00 -0000 1.219 --- tut.tex 17 Dec 2003 21:38:26 -0000 1.220 *************** *** 2212,2215 **** --- 2212,2229 ---- \end{verbatim} + To loop over a sequence in sorted order, use the \function{sorted()} + function which returns a new sorted list while leaving the source + unaltered. + + \begin{verbatim} + >>> basket = ['apple', 'orange', 'apple', 'pear', 'orange', 'banana'] + >>> for f in sorted(set(basket)): + ... print f + ... + apple + banana + orange + pear + \end{verbatim} \section{More on Conditions \label{conditions}} From fdrake at users.sourceforge.net Wed Dec 17 18:12:17 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 17 18:12:28 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex, 1.3.12.3, 1.3.12.4 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8494/lib Modified Files: Tag: release23-maint libhtmlparser.tex Log Message: fix typo Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.3.12.3 retrieving revision 1.3.12.4 diff -C2 -d -r1.3.12.3 -r1.3.12.4 *** libhtmlparser.tex 16 Dec 2003 02:01:22 -0000 1.3.12.3 --- libhtmlparser.tex 17 Dec 2003 23:12:15 -0000 1.3.12.4 *************** *** 133,137 **** \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instruction. An XHTML processing instruction using the trailing \character{?} will cause the \character{?} to be included in \var{data}.} --- 133,137 ---- \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instructions. An XHTML processing instruction using the trailing \character{?} will cause the \character{?} to be included in \var{data}.} From fdrake at users.sourceforge.net Thu Dec 18 00:27:27 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 00:27:31 2003 Subject: [Python-checkins] python/dist/src/Doc/tools makesec.sh, 1.1, 1.1.16.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv32662 Modified Files: Tag: release23-maint makesec.sh Log Message: avoid bash-isms Index: makesec.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/makesec.sh,v retrieving revision 1.1 retrieving revision 1.1.16.1 diff -C2 -d -r1.1 -r1.1.16.1 *** makesec.sh 13 Feb 2003 18:30:08 -0000 1.1 --- makesec.sh 18 Dec 2003 05:27:25 -0000 1.1.16.1 *************** *** 1,3 **** ! #!/bin/bash # Simple little checker for individual libref manual sections --- 1,3 ---- ! #!/bin/sh # Simple little checker for individual libref manual sections *************** *** 127,129 **** rm -f $tmpf howto.cls pypaper.sty *.idx *.syn ! rm -f lib.{aux,log} --- 127,129 ---- rm -f $tmpf howto.cls pypaper.sty *.idx *.syn ! rm -f lib.aux lib.log From fdrake at users.sourceforge.net Thu Dec 18 00:28:32 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 00:28:35 2003 Subject: [Python-checkins] python/dist/src/Doc/tools makesec.sh,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv321 Modified Files: makesec.sh Log Message: avoid bash-isms Index: makesec.sh =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/makesec.sh,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** makesec.sh 13 Feb 2003 18:30:08 -0000 1.1 --- makesec.sh 18 Dec 2003 05:28:30 -0000 1.2 *************** *** 1,3 **** ! #!/bin/bash # Simple little checker for individual libref manual sections --- 1,3 ---- ! #!/bin/sh # Simple little checker for individual libref manual sections *************** *** 127,129 **** rm -f $tmpf howto.cls pypaper.sty *.idx *.syn ! rm -f lib.{aux,log} --- 127,129 ---- rm -f $tmpf howto.cls pypaper.sty *.idx *.syn ! rm -f lib.aux lib.log From fdrake at users.sourceforge.net Thu Dec 18 00:29:35 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 00:29:39 2003 Subject: [Python-checkins] python/dist/src/Doc/tools checkargs.pm,1.1,1.2 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv457 Modified Files: checkargs.pm Log Message: fix weird sh-bang line Index: checkargs.pm =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/checkargs.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** checkargs.pm 8 Jan 1999 15:25:29 -0000 1.1 --- checkargs.pm 18 Dec 2003 05:29:33 -0000 1.2 *************** *** 1,3 **** ! #!/uns/bin/perl package checkargs; --- 1,3 ---- ! #! /usr/bin/perl package checkargs; From fdrake at users.sourceforge.net Thu Dec 18 00:30:07 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 00:30:21 2003 Subject: [Python-checkins] python/dist/src/Doc/tools checkargs.pm, 1.1, 1.1.48.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/tools In directory sc8-pr-cvs1:/tmp/cvs-serv572 Modified Files: Tag: release23-maint checkargs.pm Log Message: fix weird sh-bang line Index: checkargs.pm =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tools/checkargs.pm,v retrieving revision 1.1 retrieving revision 1.1.48.1 diff -C2 -d -r1.1 -r1.1.48.1 *** checkargs.pm 8 Jan 1999 15:25:29 -0000 1.1 --- checkargs.pm 18 Dec 2003 05:30:05 -0000 1.1.48.1 *************** *** 1,3 **** ! #!/uns/bin/perl package checkargs; --- 1,3 ---- ! #! /usr/bin/perl package checkargs; From fdrake at users.sourceforge.net Thu Dec 18 01:03:55 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:03:58 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libsgmllib.tex, 1.22, 1.22.36.1 Message-ID: Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5108 Modified Files: Tag: release23-maint libsgmllib.tex Log Message: apply hackish work-arounds to make sure double hyphens aren't screwed up in the generated HTML (this won't be needed on the trunk) Index: libsgmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsgmllib.tex,v retrieving revision 1.22 retrieving revision 1.22.36.1 diff -C2 -d -r1.22 -r1.22.36.1 *** libsgmllib.tex 5 Jul 2001 16:34:36 -0000 1.22 --- libsgmllib.tex 18 Dec 2003 06:03:53 -0000 1.22.36.1 *************** *** 34,40 **** \item ! SGML comments of the form \samp{}. Note that spaces, tabs, and newlines are allowed between the trailing ! \samp{>} and the immediately preceding \samp{--}. \end{itemize} --- 34,40 ---- \item ! SGML comments of the form \samp{}. Note that spaces, tabs, and newlines are allowed between the trailing ! \samp{>} and the immediately preceding \samp{-\code{-}}. \end{itemize} *************** *** 51,55 **** \begin{methoddesc}{setnomoretags}{} Stop processing tags. Treat all following input as literal input ! (CDATA). (This is only provided so the HTML tag \code{} can be implemented.) \end{methoddesc} --- 51,55 ---- \begin{methoddesc}{setnomoretags}{} Stop processing tags. Treat all following input as literal input ! (CDATA). (This is only provided so the archaic HTML tag \code{<PLAINTEXT>} can be implemented.) \end{methoddesc} *************** *** 141,146 **** This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{<!--} and \samp{-->} delimiters, but not the delimiters ! themselves. For example, the comment \samp{<!--text-->} will cause this method to be called with the argument \code{'text'}. The default method does nothing. --- 141,146 ---- This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{<!-\code{-}} and \samp{-\code{-}>} delimiters, but not the delimiters ! themselves. For example, the comment \samp{<!-\code{-}text-\code{-}>} will cause this method to be called with the argument \code{'text'}. The default method does nothing. From fdrake at users.sourceforge.net Thu Dec 18 01:08:31 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:08:34 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libdis.tex, 1.41, 1.41.10.1 Message-ID: <E1AWrKp-0001Xu-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5890 Modified Files: Tag: release23-maint libdis.tex Log Message: apply hackish work-around to make sure double hyphens aren't screwed up in the generated HTML (this won't be needed on the trunk) Index: libdis.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdis.tex,v retrieving revision 1.41 retrieving revision 1.41.10.1 diff -C2 -d -r1.41 -r1.41.10.1 *** libdis.tex 10 May 2003 08:51:26 -0000 1.41 --- libdis.tex 18 Dec 2003 06:08:29 -0000 1.41.10.1 *************** *** 57,61 **** \begin{enumerate} \item the line number, for the first instruction of each line ! \item the current instruction, indicated as \samp{-->}, \item a labelled instruction, indicated with \samp{>\code{>}}, \item the address of the instruction, --- 57,61 ---- \begin{enumerate} \item the line number, for the first instruction of each line ! \item the current instruction, indicated as \samp{-\code{-}>}, \item a labelled instruction, indicated with \samp{>\code{>}}, \item the address of the instruction, From fdrake at users.sourceforge.net Thu Dec 18 01:11:39 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:11:43 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libxmllib.tex, 1.33, 1.33.26.1 Message-ID: <E1AWrNr-0001eO-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv6341 Modified Files: Tag: release23-maint libxmllib.tex Log Message: apply hackish work-arounds to make sure double hyphens aren't screwed up in the generated HTML (this won't be needed on the trunk) Index: libxmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxmllib.tex,v retrieving revision 1.33 retrieving revision 1.33.26.1 diff -C2 -d -r1.33 -r1.33.26.1 *** libxmllib.tex 6 Nov 2001 22:10:47 -0000 1.33 --- libxmllib.tex 18 Dec 2003 06:11:37 -0000 1.33.26.1 *************** *** 167,172 **** This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{<!--} and \samp{-->} delimiters, but not the delimiters ! themselves. For example, the comment \samp{<!--text-->} will cause this method to be called with the argument \code{'text'}. The default method does nothing. --- 167,172 ---- This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{<!-\code{-}} and \samp{-\code{-}>} delimiters, but not the delimiters ! themselves. For example, the comment \samp{<!-\code{-}text-\code{-}>} will cause this method to be called with the argument \code{'text'}. The default method does nothing. From fdrake at users.sourceforge.net Thu Dec 18 01:23:35 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:23:38 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libgensuitemodule.tex, 1.1, 1.2 Message-ID: <E1AWrZP-00021F-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv7757 Modified Files: libgensuitemodule.tex Log Message: - use correct markup - re-wrap resulting long lines Index: libgensuitemodule.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libgensuitemodule.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** libgensuitemodule.tex 11 Apr 2003 15:35:27 -0000 1.1 --- libgensuitemodule.tex 18 Dec 2003 06:23:33 -0000 1.2 *************** *** 13,21 **** It is usually invoked by the user through the \program{PythonIDE}, but ! it can also be run as a script from the command line (pass \code{--help} ! for help on the options) or imported from Python code. For an example of ! its use see \file{Mac/scripts/genallsuites.py} in a source distribution, ! which generates the stub packages that are included in the standard ! library. It defines the following public functions: --- 13,21 ---- It is usually invoked by the user through the \program{PythonIDE}, but ! it can also be run as a script from the command line (pass ! \longprogramopt{help} for help on the options) or imported from Python ! code. For an example of its use see \file{Mac/scripts/genallsuites.py} ! in a source distribution, which generates the stub packages that are ! included in the standard library. It defines the following public functions: From fdrake at users.sourceforge.net Thu Dec 18 01:24:15 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:24:17 2003 Subject: [Python-checkins] python/dist/src/Doc/mac libgensuitemodule.tex, 1.1, 1.1.14.1 Message-ID: <E1AWra3-00023d-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/mac In directory sc8-pr-cvs1:/tmp/cvs-serv7906 Modified Files: Tag: release23-maint libgensuitemodule.tex Log Message: - use correct markup - re-wrap resulting long lines Index: libgensuitemodule.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/mac/libgensuitemodule.tex,v retrieving revision 1.1 retrieving revision 1.1.14.1 diff -C2 -d -r1.1 -r1.1.14.1 *** libgensuitemodule.tex 11 Apr 2003 15:35:27 -0000 1.1 --- libgensuitemodule.tex 18 Dec 2003 06:24:13 -0000 1.1.14.1 *************** *** 13,21 **** It is usually invoked by the user through the \program{PythonIDE}, but ! it can also be run as a script from the command line (pass \code{--help} ! for help on the options) or imported from Python code. For an example of ! its use see \file{Mac/scripts/genallsuites.py} in a source distribution, ! which generates the stub packages that are included in the standard ! library. It defines the following public functions: --- 13,21 ---- It is usually invoked by the user through the \program{PythonIDE}, but ! it can also be run as a script from the command line (pass ! \longprogramopt{help} for help on the options) or imported from Python ! code. For an example of its use see \file{Mac/scripts/genallsuites.py} ! in a source distribution, which generates the stub packages that are ! included in the standard library. It defines the following public functions: From fdrake at users.sourceforge.net Thu Dec 18 01:26:18 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:26:21 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmllib.tex, 1.26, 1.26.8.1 Message-ID: <E1AWrc2-00027W-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8150 Modified Files: Tag: release23-maint libhtmllib.tex Log Message: fix loss of a space after indexing markup Index: libhtmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmllib.tex,v retrieving revision 1.26 retrieving revision 1.26.8.1 diff -C2 -d -r1.26 -r1.26.8.1 *** libhtmllib.tex 14 Jul 2003 08:15:47 -0000 1.26 --- libhtmllib.tex 18 Dec 2003 06:26:15 -0000 1.26.8.1 *************** *** 21,25 **** implementation supports the HTML 2.0 language as described in \rfc{1866}. Two implementations of formatter objects are provided in ! the \refmodule{formatter}\refstmodindex{formatter} module; refer to the documentation for that module for information on the formatter interface. --- 21,25 ---- implementation supports the HTML 2.0 language as described in \rfc{1866}. Two implementations of formatter objects are provided in ! the \refmodule{formatter}\refstmodindex{formatter}\ module; refer to the documentation for that module for information on the formatter interface. From fdrake at users.sourceforge.net Thu Dec 18 01:26:58 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 01:27:01 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmllib.tex,1.27,1.28 Message-ID: <E1AWrcg-00027y-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8178 Modified Files: libhtmllib.tex Log Message: fix loss of a space after indexing markup Index: libhtmllib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmllib.tex,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** libhtmllib.tex 27 Oct 2003 15:46:16 -0000 1.27 --- libhtmllib.tex 18 Dec 2003 06:26:56 -0000 1.28 *************** *** 21,25 **** implementation supports the HTML 2.0 language as described in \rfc{1866}. Two implementations of formatter objects are provided in ! the \refmodule{formatter}\refstmodindex{formatter} module; refer to the documentation for that module for information on the formatter interface. --- 21,25 ---- implementation supports the HTML 2.0 language as described in \rfc{1866}. Two implementations of formatter objects are provided in ! the \refmodule{formatter}\refstmodindex{formatter}\ module; refer to the documentation for that module for information on the formatter interface. From anthonybaxter at users.sourceforge.net Thu Dec 18 04:43:35 2003 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu Dec 18 04:43:39 2003 Subject: [Python-checkins] python/dist/src/Lib trace.py,1.12,1.12.6.1 Message-ID: <E1AWugx-0000wL-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv3488 Modified Files: Tag: release23-maint trace.py Log Message: Backport 1.13 through 1.15, after getting a begging letter from a certain BDFL <wink> The fullmodname() function chopped off the first character if the module existed in the current directory. Open results files, which contain binary pickles, in binary mode. Remove fallback code that tries to read marshal data from a results file, since this module never writes marshal data. Index: trace.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/trace.py,v retrieving revision 1.12 retrieving revision 1.12.6.1 diff -C2 -d -r1.12 -r1.12.6.1 *** trace.py 15 Jul 2003 10:34:02 -0000 1.12 --- trace.py 18 Dec 2003 09:43:33 -0000 1.12.6.1 *************** *** 181,185 **** longest = dir ! base = path[len(longest) + 1:].replace("/", ".") filename, ext = os.path.splitext(base) return filename --- 181,189 ---- longest = dir ! if longest: ! base = path[len(longest) + 1:] ! else: ! base = path ! base = base.replace("/", ".") filename, ext = os.path.splitext(base) return filename *************** *** 201,211 **** # Try to merge existing counts file. try: ! counts, calledfuncs = pickle.load(open(self.infile, 'r')) self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError, ValueError), err: print >> sys.stderr, ("Skipping counts file %r: %s" % (self.infile, err)) - except pickle.UnpicklingError: - self.update(self.__class__(marshal.load(open(self.infile)))) def update(self, other): --- 205,213 ---- # Try to merge existing counts file. try: ! counts, calledfuncs = pickle.load(open(self.infile, 'rb')) self.update(self.__class__(counts, calledfuncs)) except (IOError, EOFError, ValueError), err: print >> sys.stderr, ("Skipping counts file %r: %s" % (self.infile, err)) def update(self, other): *************** *** 285,289 **** try: pickle.dump((self.counts, self.calledfuncs), ! open(self.outfile, 'w'), 1) except IOError, err: print >> sys.stderr, "Can't save counts files because %s" % err --- 287,291 ---- try: pickle.dump((self.counts, self.calledfuncs), ! open(self.outfile, 'wb'), 1) except IOError, err: print >> sys.stderr, "Can't save counts files because %s" % err From akuchling at users.sourceforge.net Thu Dec 18 08:28:15 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu Dec 18 08:28:21 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.20, 1.21 Message-ID: <E1AWyCN-00026X-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv8085 Modified Files: whatsnew24.tex Log Message: Add various items Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** whatsnew24.tex 17 Dec 2003 20:43:32 -0000 1.20 --- whatsnew24.tex 18 Dec 2003 13:28:13 -0000 1.21 *************** *** 21,29 **** This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For ! full details, you should refer to the documentation for Python 2.4. ! % add hyperlink when the documentation becomes available online. If you want to understand the complete implementation and design rationale, refer to the PEP for a particular new feature. %====================================================================== \section{PEP 218: Built-In Set Objects} --- 21,31 ---- This article doesn't attempt to provide a complete specification of the new features, but instead provides a convenient overview. For ! full details, you should refer to the documentation for Python 2.4, ! such as the \citetitle[../lib/lib.html]{Python Library Reference} and ! the \citetitle[../ref/ref.html]{Python Reference Manual}. If you want to understand the complete implementation and design rationale, refer to the PEP for a particular new feature. + %====================================================================== \section{PEP 218: Built-In Set Objects} *************** *** 68,71 **** --- 70,75 ---- like \method{add()} and \method{remove()} which could alter its contents. + % XXX what happens to the sets module? + \begin{seealso} \seepep{218}{Adding a Built-In Set Object Type}{Originally proposed by *************** *** 74,77 **** --- 78,86 ---- %====================================================================== + \section{PEP 237: Unifying Long Integers and Integers} + + XXX write this. + + %====================================================================== \section{PEP 322: Reverse Iteration} *************** *** 123,126 **** --- 132,145 ---- fill character other than a space. + \item Strings also gained an \method{rsplit()} method that + works like the \method{split()} method but splits from the end of the string. + + \begin{verbatim} + >>> 'a b c'.split(None, 1) + ['a', 'b c'] + >>> 'a b c'.rsplit(None, 1) + ['a b', 'c'] + \end{verbatim} + \item The \method{sort()} method of lists gained three keyword arguments, \var{cmp}, \var{key}, and \var{reverse}. These arguments *************** *** 178,182 **** people with the same age are in name-sorted order. ! \item There is a new builtin function \function{sorted(iterable)} that works like the in-place \method{list.sort()} method but has been made suitable for use in expressions. The differences are: --- 197,201 ---- people with the same age are in name-sorted order. ! \item There is a new built-in function \function{sorted(iterable)} that works like the in-place \method{list.sort()} method but has been made suitable for use in expressions. The differences are: *************** *** 210,214 **** \end{verbatim} - \item The \function{zip()} built-in function and \function{itertools.izip()} now return an empty list instead of raising a \exception{TypeError} --- 229,232 ---- *************** *** 313,319 **** --- 331,375 ---- \end{verbatim} + \item \module{itertools} also gained a function named \function{tee(\var{iterator}, \var{N})} that returns \var{N} independent iterators + that replicate \var{iterator}. If \var{N} is omitted, the default is + 2. + + \begin{verbatim} + >>> L = [1,2,3] + >>> i1, i2 = itertools.tee(L) + >>> i1,i2 + (<itertools.tee object at 0x402c2080>, <itertools.tee object at 0x402c2090>) + >>> list(i1) + [1, 2, 3] + >>> list(i2) + [1, 2, 3] + >\end{verbatim} + + Note that \function{tee()} has to keep copies of the values returned + by the iterator; in the worst case it may need to keep all of them. + This should therefore be used carefully if \var{iterator} + returns a very large stream of results. + \item A new \function{getsid()} function was added to the \module{posix} module that underlies the \module{os} module. (Contributed by J. Raynor.) + + \item The \module{operator} module gained two new functions, + \function{attrgetter(\var{attr})} and \function{itemgetter(\var{index})}. + Both functions return callables that take a single argument and return + the corresponding attribute or item; these callables are handy for use + with \function{map()} or \function{list.sort()}. For example, here's a simple + us + + \begin{verbatim} + >>> L = [('c', 2), ('d', 1), ('a', '4'), ('b', 3)] + >>> map(operator.itemgetter(0), L) + ['c', 'd', 'a', 'b'] + >>> map(operator.itemgetter(1), L) + [2, 1, '4', 3] + >>> L.sort(key=operator.itemgetter(1)) # Sort list by second item in tuples + >>> L + [('d', 1), ('c', 2), ('b', 3), ('a', '4')] + \end{verbatim} \item The \module{random} module has a new method called \method{getrandbits(N)} From akuchling at users.sourceforge.net Thu Dec 18 08:28:38 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Thu Dec 18 08:28:54 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libitertools.tex, 1.26, 1.27 Message-ID: <E1AWyCk-00027Z-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8146 Modified Files: libitertools.tex Log Message: Fix typo Index: libitertools.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libitertools.tex,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** libitertools.tex 17 Dec 2003 20:43:32 -0000 1.26 --- libitertools.tex 18 Dec 2003 13:28:35 -0000 1.27 *************** *** 355,359 **** Note, this member of the toolkit may require significant auxiliary storage (depending on how much temporary data needs to be stored). ! In general, if one iterator is going use most or all of the data before the other iterator, it is faster to use \function{list()} instead of \function{tee()}. --- 355,359 ---- Note, this member of the toolkit may require significant auxiliary storage (depending on how much temporary data needs to be stored). ! In general, if one iterator is going to use most or all of the data before the other iterator, it is faster to use \function{list()} instead of \function{tee()}. From fdrake at users.sourceforge.net Thu Dec 18 10:07:00 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 10:07:03 2003 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.8, 2.74.4.9 Message-ID: <E1AWzjw-00079z-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv27518/Include Modified Files: Tag: release23-maint patchlevel.h Log Message: Bump version number for release. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.8 retrieving revision 2.74.4.9 diff -C2 -d -r2.74.4.8 -r2.74.4.9 *** patchlevel.h 5 Dec 2003 17:56:18 -0000 2.74.4.8 --- patchlevel.h 18 Dec 2003 15:06:58 -0000 2.74.4.9 *************** *** 23,31 **** #define PY_MINOR_VERSION 3 #define PY_MICRO_VERSION 3 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA ! #define PY_RELEASE_SERIAL 2 /* Version as a string */ ! #define PY_VERSION "2.3.3c2" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. --- 23,31 ---- #define PY_MINOR_VERSION 3 #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.3.3" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From fdrake at users.sourceforge.net Thu Dec 18 10:11:07 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 10:11:10 2003 Subject: [Python-checkins] python/dist/src/Doc/commontex boilerplate.tex, 1.1.2.4, 1.1.2.5 Message-ID: <E1AWznv-0007O7-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1:/tmp/cvs-serv28389/commontex Modified Files: Tag: release23-maint boilerplate.tex Log Message: set release date Index: boilerplate.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/boilerplate.tex,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -C2 -d -r1.1.2.4 -r1.1.2.5 *** boilerplate.tex 5 Dec 2003 16:44:01 -0000 1.1.2.4 --- boilerplate.tex 18 Dec 2003 15:11:05 -0000 1.1.2.5 *************** *** 6,9 **** } ! \date{\today} % XXX update before final release! \input{patchlevel} % include Python version information --- 6,9 ---- } ! \date{December 19, 2003} % XXX update before final release! \input{patchlevel} % include Python version information From theller at users.sourceforge.net Thu Dec 18 14:16:27 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 18 14:16:30 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.85,1.831.4.86 Message-ID: <E1AX3dL-0004gy-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18028 Modified Files: Tag: release23-maint NEWS Log Message: Release date for Python 2.3.3 (final). Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.85 retrieving revision 1.831.4.86 diff -C2 -d -r1.831.4.85 -r1.831.4.86 *** NEWS 5 Dec 2003 17:42:06 -0000 1.831.4.85 --- NEWS 18 Dec 2003 19:16:25 -0000 1.831.4.86 *************** *** 5,10 **** (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.3c2? ! ============================= Core and builtins --- 5,12 ---- (editors: check NEWS.help for information about editing NEWS using ReST.) ! What's New in Python 2.3.3 (final)? ! =================================== ! ! *Release date: 19-Dec-2003* Core and builtins From theller at users.sourceforge.net Thu Dec 18 14:17:02 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 18 14:17:05 2003 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt, 1.51.4.4, 1.51.4.5 Message-ID: <E1AX3du-0004iV-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv18091 Modified Files: Tag: release23-maint BUILDno.txt Log Message: Windows build number for Python 2.3.3 is 51. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.51.4.4 retrieving revision 1.51.4.5 diff -C2 -d -r1.51.4.4 -r1.51.4.5 *** BUILDno.txt 4 Dec 2003 20:35:58 -0000 1.51.4.4 --- BUILDno.txt 18 Dec 2003 19:16:59 -0000 1.51.4.5 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 51 2.3.3 + 19-Dec-2003 50 2.3.3c1 5-Dec-2003 From theller at users.sourceforge.net Thu Dec 18 14:17:20 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 18 14:17:24 2003 Subject: [Python-checkins] python/dist/src/PCbuild pythoncore.dsp, 1.48.4.4, 1.48.4.5 Message-ID: <E1AX3eC-0004jt-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv18213 Modified Files: Tag: release23-maint pythoncore.dsp Log Message: Windows build number for Python 2.3.3 is 51. Index: pythoncore.dsp =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/pythoncore.dsp,v retrieving revision 1.48.4.4 retrieving revision 1.48.4.5 diff -C2 -d -r1.48.4.4 -r1.48.4.5 *** pythoncore.dsp 4 Dec 2003 20:41:59 -0000 1.48.4.4 --- pythoncore.dsp 18 Dec 2003 19:17:18 -0000 1.48.4.5 *************** *** 259,263 **** SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=50 # End Source File # Begin Source File --- 259,263 ---- SOURCE=..\Modules\getbuildinfo.c ! # ADD CPP /D BUILD=51 # End Source File # Begin Source File From theller at users.sourceforge.net Thu Dec 18 14:18:57 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Thu Dec 18 14:19:00 2003 Subject: [Python-checkins] python/dist/src/PCbuild python20.wse, 1.133.4.6, 1.133.4.7 Message-ID: <E1AX3fl-0004rZ-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv18676 Modified Files: Tag: release23-maint python20.wse Log Message: Installer changes for Python 2.3.3. Index: python20.wse =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/python20.wse,v retrieving revision 1.133.4.6 retrieving revision 1.133.4.7 diff -C2 -d -r1.133.4.6 -r1.133.4.7 *** python20.wse 4 Dec 2003 20:43:18 -0000 1.133.4.6 --- python20.wse 18 Dec 2003 19:18:55 -0000 1.133.4.7 *************** *** 2,6 **** item: Global Version=9.0 ! Title=Python 2.3.3c1 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 --- 2,6 ---- item: Global Version=9.0 ! Title=Python 2.3.3 Flags=00010100 Languages=65 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 *************** *** 21,27 **** MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.3c1.exe Dialogs Version=8 ! Version File=2.3.3c1 Version Description=Python Programming Language Version Copyright=©2001-2003 Python Software Foundation --- 21,27 ---- MIF PDF Version=1.0 MIF SMS Version=2.0 ! EXE Filename=Python-2.3.3.exe Dialogs Version=8 ! Version File=2.3.3 Version Description=Python Programming Language Version Copyright=©2001-2003 Python Software Foundation *************** *** 77,81 **** item: Set Variable Variable=PYVER_STRING ! Value=2.3.3c1 end item: Remark --- 77,81 ---- item: Set Variable Variable=PYVER_STRING ! Value=2.3.3 end item: Remark From fdrake at users.sourceforge.net Thu Dec 18 15:57:22 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 15:57:25 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libmsvcrt.tex, 1.5, 1.5.8.1 Message-ID: <E1AX5D0-0001pz-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7055 Modified Files: Tag: release23-maint libmsvcrt.tex Log Message: minor markup adjustment; will need to re-generate 2.3.3 docs Index: libmsvcrt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmsvcrt.tex,v retrieving revision 1.5 retrieving revision 1.5.8.1 diff -C2 -d -r1.5 -r1.5.8.1 *** libmsvcrt.tex 2 Jul 2003 12:27:43 -0000 1.5 --- libmsvcrt.tex 18 Dec 2003 20:57:20 -0000 1.5.8.1 *************** *** 1,8 **** \section{\module{msvcrt} -- ! Useful routines from the MS V\Cpp{} runtime} \declaremodule{builtin}{msvcrt} \platform{Windows} ! \modulesynopsis{Miscellaneous useful routines from the MS V\Cpp{} runtime.} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 1,8 ---- \section{\module{msvcrt} -- ! Useful routines from the MS V\Cpp\ runtime} \declaremodule{builtin}{msvcrt} \platform{Windows} ! \modulesynopsis{Miscellaneous useful routines from the MS V\Cpp\ runtime.} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} From fdrake at users.sourceforge.net Thu Dec 18 15:58:36 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Thu Dec 18 15:58:39 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libmsvcrt.tex,1.5,1.6 Message-ID: <E1AX5EC-0001ui-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7353 Modified Files: libmsvcrt.tex Log Message: minor markup adjustment Index: libmsvcrt.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmsvcrt.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libmsvcrt.tex 2 Jul 2003 12:27:43 -0000 1.5 --- libmsvcrt.tex 18 Dec 2003 20:58:34 -0000 1.6 *************** *** 1,8 **** \section{\module{msvcrt} -- ! Useful routines from the MS V\Cpp{} runtime} \declaremodule{builtin}{msvcrt} \platform{Windows} ! \modulesynopsis{Miscellaneous useful routines from the MS V\Cpp{} runtime.} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} --- 1,8 ---- \section{\module{msvcrt} -- ! Useful routines from the MS V\Cpp\ runtime} \declaremodule{builtin}{msvcrt} \platform{Windows} ! \modulesynopsis{Miscellaneous useful routines from the MS V\Cpp\ runtime.} \sectionauthor{Fred L. Drake, Jr.}{fdrake@acm.org} From montanaro at users.sourceforge.net Thu Dec 18 16:53:35 2003 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Thu Dec 18 16:53:38 2003 Subject: [Python-checkins] python/dist/src/Misc python-mode.el,NONE,4.41 Message-ID: <E1AX65P-0004pJ-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv18097 Modified Files: Tag: 4.41 python-mode.el Log Message: Sync with python-mode project. Adds two changes: * in py-checker-run, fall back to read-string if read-shell-command (XEmacs-specific) is not available. * highlight variables would mask builtins as if they were keywords. --- NEW FILE: python-mode.el --- ;;; python-mode.el --- Major mode for editing Python programs ;; Copyright (C) 1992,1993,1994 Tim Peters ;; Author: 1995-2002 Barry A. Warsaw ;; 1992-1994 Tim Peters ;; Maintainer: python-mode@python.org ;; Created: Feb 1992 ;; Keywords: python languages oop (defconst py-version "$Revision: 4.41 $" "`python-mode' version number.") ;; This software is provided as-is, without express or implied ;; warranty. Permission to use, copy, modify, distribute or sell this ;; software, without fee, for any purpose and by any individual or ;; organization, is hereby granted, provided that the above copyright ;; notice and this paragraph appear in all copies. [...3729 lines suppressed...] (interactive "P") (let* ((bod (py-point 'bod)) (pps (parse-partial-sexp bod (point)))) (cond ;; are we inside a comment or on a line with only whitespace before ;; the comment start? ((or (nth 4 pps) (save-excursion (beginning-of-line) (looking-at "[ \t]*#"))) (py-fill-comment justify)) ;; are we inside a string? ((nth 3 pps) (py-fill-string (nth 8 pps))) ;; otherwise use the default (t (fill-paragraph justify))))) (provide 'python-mode) ;;; python-mode.el ends here From perky at users.sourceforge.net Thu Dec 18 20:16:05 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Dec 18 20:16:09 2003 Subject: [Python-checkins] python/dist/src/Lib/test test__locale.py, 1.3, 1.4 test_locale.py, 1.7, 1.8 Message-ID: <E1AX9FN-00076L-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26434 Modified Files: test__locale.py test_locale.py Log Message: Enable some unittests on FreeBSD. test__locale: add typical POSIX-style full locale names. test_locale: use en_US.US-ASCII on FreeBSD. Index: test__locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test__locale.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test__locale.py 10 Sep 2003 20:19:54 -0000 1.3 --- test__locale.py 19 Dec 2003 01:16:03 -0000 1.4 *************** *** 11,15 **** 'de_DE', 'sr_YU', 'br_FR', 'nl_BE', 'sv_FI', 'pl_PL', 'fr_CA', 'fo_FO', 'bs_BA', 'fr_LU', 'kl_GL', 'fa_IR', 'de_BE', 'sv_SE', 'it_CH', 'uk_UA', ! 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ'] saw_locale = 0 --- 11,16 ---- 'de_DE', 'sr_YU', 'br_FR', 'nl_BE', 'sv_FI', 'pl_PL', 'fr_CA', 'fo_FO', 'bs_BA', 'fr_LU', 'kl_GL', 'fa_IR', 'de_BE', 'sv_SE', 'it_CH', 'uk_UA', ! 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', ! 'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR'] saw_locale = 0 Index: test_locale.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_locale.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** test_locale.py 19 Feb 2003 02:35:05 -0000 1.7 --- test_locale.py 19 Dec 2003 01:16:03 -0000 1.8 *************** *** 7,13 **** oldlocale = locale.setlocale(locale.LC_NUMERIC) ! tloc = "en_US" ! if sys.platform[:3] == "win": tloc = "en" try: --- 7,16 ---- oldlocale = locale.setlocale(locale.LC_NUMERIC) ! if sys.platform.startswith("win"): tloc = "en" + elif sys.platform.startswith("freebsd"): + tloc = "en_US.US-ASCII" + else: + tloc = "en_US" try: From perky at users.sourceforge.net Thu Dec 18 20:59:58 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Thu Dec 18 21:00:02 2003 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.204, 2.205 Message-ID: <E1AX9vq-0000UC-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv1651/Objects Modified Files: unicodeobject.c Log Message: SF #859573: Reduce compiler warnings on gcc 3.2 and above. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.204 retrieving revision 2.205 diff -C2 -d -r2.204 -r2.205 *** unicodeobject.c 15 Dec 2003 18:49:19 -0000 2.204 --- unicodeobject.c 19 Dec 2003 01:59:56 -0000 2.205 *************** *** 1557,1561 **** --- 1557,1565 ---- PyObject *v; unsigned char *p; + #ifdef Py_UNICODE_WIDE int i, pairs; + #else + const int pairs = 0; + #endif /* Offsets from p for storing byte pairs in the right order. */ #ifdef BYTEORDER_IS_LITTLE_ENDIAN *************** *** 1572,1578 **** --- 1576,1584 ---- } while(0) + #ifdef Py_UNICODE_WIDE for (i = pairs = 0; i < size; i++) if (s[i] >= 0x10000) pairs++; + #endif v = PyString_FromStringAndSize(NULL, 2 * (size + pairs + (byteorder == 0))); *************** *** 1600,1607 **** --- 1606,1615 ---- Py_UNICODE ch = *s++; Py_UNICODE ch2 = 0; + #ifdef Py_UNICODE_WIDE if (ch >= 0x10000) { ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF); ch = 0xD800 | ((ch-0x10000) >> 10); } + #endif STORECHAR(ch); if (ch2) *************** *** 2204,2208 **** /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ ! if (size == 1 && *(unsigned char*)s < 256) { Py_UNICODE r = *(unsigned char*)s; return PyUnicode_FromUnicode(&r, 1); --- 2212,2216 ---- /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ ! if (size == 1) { Py_UNICODE r = *(unsigned char*)s; return PyUnicode_FromUnicode(&r, 1); *************** *** 2406,2409 **** --- 2414,2421 ---- else if (*p<1000) repsize += 2+3+1; + #ifndef Py_UNICODE_WIDE + else + repsize += 2+4+1; + #else else if (*p<10000) repsize += 2+4+1; *************** *** 2414,2417 **** --- 2426,2430 ---- else repsize += 2+7+1; + #endif } requiredsize = respos+repsize+(endp-collend); From anthonybaxter at users.sourceforge.net Thu Dec 18 21:02:32 2003 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu Dec 18 21:02:35 2003 Subject: [Python-checkins] python/dist/src/Misc/RPM python-2.3.spec, 1.2.12.5, 1.2.12.6 Message-ID: <E1AX9yK-0000dn-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc/RPM In directory sc8-pr-cvs1:/tmp/cvs-serv2452/Misc/RPM Modified Files: Tag: release23-maint python-2.3.spec Log Message: updates for release Index: python-2.3.spec =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/RPM/python-2.3.spec,v retrieving revision 1.2.12.5 retrieving revision 1.2.12.6 diff -C2 -d -r1.2.12.5 -r1.2.12.6 *** python-2.3.spec 5 Dec 2003 04:30:10 -0000 1.2.12.5 --- python-2.3.spec 19 Dec 2003 02:02:30 -0000 1.2.12.6 *************** *** 31,35 **** %define name python ! %define version 2.3.3c1 %define libvers 2.3 %define release 1pydotorg --- 31,35 ---- %define name python ! %define version 2.3.3 %define libvers 2.3 %define release 1pydotorg From anthonybaxter at users.sourceforge.net Thu Dec 18 21:06:08 2003 From: anthonybaxter at users.sourceforge.net (anthonybaxter@users.sourceforge.net) Date: Thu Dec 18 21:06:12 2003 Subject: [Python-checkins] python/dist/src/Misc NEWS,1.831.4.86,1.831.4.87 Message-ID: <E1AXA1o-0000mH-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv2933 Modified Files: Tag: release23-maint NEWS Log Message: trace fix Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.831.4.86 retrieving revision 1.831.4.87 diff -C2 -d -r1.831.4.86 -r1.831.4.87 *** NEWS 18 Dec 2003 19:16:25 -0000 1.831.4.86 --- NEWS 19 Dec 2003 02:06:06 -0000 1.831.4.87 *************** *** 14,18 **** - Removed PendingDeprecationWarning from apply(). apply() remains ! deprecated, but the nuissance warning will not be issued. What's New in Python 2.3.3c1? --- 14,23 ---- - Removed PendingDeprecationWarning from apply(). apply() remains ! deprecated, but the nuisance warning will not be issued. ! ! Library ! ------- ! ! - A couple of bugs were squished in trace.py What's New in Python 2.3.3c1? From mal at egenix.com Fri Dec 19 03:30:27 2003 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Dec 19 03:30:23 2003 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.204, 2.205 In-Reply-To: <E1AX9vq-0000UC-00@sc8-pr-cvs1.sourceforge.net> References: <E1AX9vq-0000UC-00@sc8-pr-cvs1.sourceforge.net> Message-ID: <3FE2B723.9060108@egenix.com> perky@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Objects > In directory sc8-pr-cvs1:/tmp/cvs-serv1651/Objects > > Modified Files: > unicodeobject.c > Log Message: > SF #859573: Reduce compiler warnings on gcc 3.2 and above. > > Index: unicodeobject.c > *************** > *** 2204,2208 **** > > /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ > ! if (size == 1 && *(unsigned char*)s < 256) { > Py_UNICODE r = *(unsigned char*)s; > return PyUnicode_FromUnicode(&r, 1); > --- 2212,2216 ---- > > /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ > ! if (size == 1) { > Py_UNICODE r = *(unsigned char*)s; > return PyUnicode_FromUnicode(&r, 1); This "fix" doesn't look right. Please check. > *************** > *** 2406,2409 **** > --- 2414,2421 ---- > else if (*p<1000) > repsize += 2+3+1; > + #ifndef Py_UNICODE_WIDE > + else > + repsize += 2+4+1; > + #else > else if (*p<10000) > repsize += 2+4+1; > *************** > *** 2414,2417 **** > --- 2426,2430 ---- > else > repsize += 2+7+1; > + #endif > } > requiredsize = respos+repsize+(endp-collend); -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Dec 19 2003) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From perky at i18n.org Fri Dec 19 04:23:09 2003 From: perky at i18n.org (Hye-Shik Chang) Date: Fri Dec 19 04:23:16 2003 Subject: [Python-Dev] Re: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.204, 2.205 In-Reply-To: <3FE2B723.9060108@egenix.com> References: <E1AX9vq-0000UC-00@sc8-pr-cvs1.sourceforge.net> <3FE2B723.9060108@egenix.com> Message-ID: <20031219092309.GA81703@i18n.org> On Fri, Dec 19, 2003 at 09:30:27AM +0100, M.-A. Lemburg wrote: > perky@users.sourceforge.net wrote: > >Update of /cvsroot/python/python/dist/src/Objects > >In directory sc8-pr-cvs1:/tmp/cvs-serv1651/Objects > > > >Modified Files: > > unicodeobject.c > >Log Message: > >SF #859573: Reduce compiler warnings on gcc 3.2 and above. > > > >Index: unicodeobject.c > >*************** > >*** 2204,2208 **** > > > > /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ > >! if (size == 1 && *(unsigned char*)s < 256) { > > Py_UNICODE r = *(unsigned char*)s; > > return PyUnicode_FromUnicode(&r, 1); > >--- 2212,2216 ---- > > > > /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ > >! if (size == 1) { > > Py_UNICODE r = *(unsigned char*)s; > > return PyUnicode_FromUnicode(&r, 1); > > This "fix" doesn't look right. Please check. > gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Objects/unicodeobject.o Objects/unicodeobject.c Objects/unicodeobject.c: In function `PyUnicodeUCS2_DecodeLatin1': Objects/unicodeobject.c:2214: warning: comparison is always true due to limited range of data type AFAIK, *(unsigned char*)s is always smaller than 256. Also decoding latin-1 can be done by just casting it into Py_UNICODE. I'm sorry but can you explain more? Hye-Shik From fredrik at pythonware.com Fri Dec 19 05:03:41 2003 From: fredrik at pythonware.com (Fredrik Lundh) Date: Fri Dec 19 05:10:24 2003 Subject: [Python-checkins] Re: [Python-Dev] Re: python/dist/src/Objectsunicodeobject.c, 2.204, 2.205 References: <E1AX9vq-0000UC-00@sc8-pr-cvs1.sourceforge.net><3FE2B723.9060108@egenix.com> <20031219092309.GA81703@i18n.org> Message-ID: <bruie3$m3b$1@sea.gmane.org> Hye-Shik Chang wrote: > AFAIK, *(unsigned char*)s is always smaller than 256. except when it isn't. see the ANSI C spec for details. </F> From mal at egenix.com Fri Dec 19 05:18:28 2003 From: mal at egenix.com (M.-A. Lemburg) Date: Fri Dec 19 05:18:38 2003 Subject: [Python-Dev] Re: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.204, 2.205 In-Reply-To: <20031219092309.GA81703@i18n.org> References: <E1AX9vq-0000UC-00@sc8-pr-cvs1.sourceforge.net> <3FE2B723.9060108@egenix.com> <20031219092309.GA81703@i18n.org> Message-ID: <3FE2D074.90000@egenix.com> Hye-Shik Chang wrote: > On Fri, Dec 19, 2003 at 09:30:27AM +0100, M.-A. Lemburg wrote: > >>perky@users.sourceforge.net wrote: >> >>>Update of /cvsroot/python/python/dist/src/Objects >>>In directory sc8-pr-cvs1:/tmp/cvs-serv1651/Objects >>> >>>Modified Files: >>> unicodeobject.c >>>Log Message: >>>SF #859573: Reduce compiler warnings on gcc 3.2 and above. >>> >>>Index: unicodeobject.c >>>*************** >>>*** 2204,2208 **** >>> >>> /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ >>>! if (size == 1 && *(unsigned char*)s < 256) { >>> Py_UNICODE r = *(unsigned char*)s; >>> return PyUnicode_FromUnicode(&r, 1); >>>--- 2212,2216 ---- >>> >>> /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ >>>! if (size == 1) { >>> Py_UNICODE r = *(unsigned char*)s; >>> return PyUnicode_FromUnicode(&r, 1); >> >>This "fix" doesn't look right. Please check. >> > > gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Objects/unicodeobject.o Objects/unicodeobject.c > Objects/unicodeobject.c: In function `PyUnicodeUCS2_DecodeLatin1': > Objects/unicodeobject.c:2214: warning: comparison is always true due to limited range of data type > > AFAIK, *(unsigned char*)s is always smaller than 256. > Also decoding latin-1 can be done by just casting it into Py_UNICODE. You are right. I was thinking that there was some reason we needed this to get Unicode working on Crays, but looking at the CVS log, this was probably just the result of adjusting Martin's single character sharing code to work for Latin-1 rather than just ASCII characters. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Dec 19 2003) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ ::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! :::: From 3gc6p6iqz at aol.com Fri Dec 19 11:23:03 2003 From: 3gc6p6iqz at aol.com (Nichole Villalobos) Date: Fri Dec 19 06:21:55 2003 Subject: [Python-checkins] Python-announce-list-request ocb orzmsmz fur Message-ID: <u84js932ps-3-vy4-c@ta1rtmien> Hi Python-announce-list-request , I have a picture online now. I just want someone to know me before they see me. I just feel better that way. (but believe me you wont be disappointed) Well i am 22 years old. I have a very out going personality. I love to meet new people, i am on the varsity cheerleading squad. I like the little romantic stuff and love to be swept off my feet and suprised. I am currently looking for a relationship. All around if i were to use 3 words to describe me id say Outgoing, sexy, and spontaneous :) And if u wanna chat or get to know me. If u really like what u see. youll do more than just send me a note. Talk to you soon I hope... :) Carolynn ps. my friend Maria is on with me as well. http://seeingnoone.com/confirm/?oc=52211091 I do not wish to go on any blind dates at all, now or in the future: http://seeingnoone.com/remove/?oc=1 m393nnm3m3rem wv From perky at i18n.org Fri Dec 19 06:59:52 2003 From: perky at i18n.org (Hye-Shik Chang) Date: Fri Dec 19 06:59:56 2003 Subject: [Python-checkins] Re: [Python-Dev] Re: python/dist/src/Objectsunicodeobject.c, 2.204, 2.205 In-Reply-To: <bruie3$m3b$1@sea.gmane.org> References: <20031219092309.GA81703@i18n.org> <bruie3$m3b$1@sea.gmane.org> Message-ID: <20031219115952.GA84061@i18n.org> On Fri, Dec 19, 2003 at 11:03:41AM +0100, Fredrik Lundh wrote: > Hye-Shik Chang wrote: > > > AFAIK, *(unsigned char*)s is always smaller than 256. > > except when it isn't. see the ANSI C spec for details. > Ah. I found. I'm very surprised for that. Thank you! :-) BTW, do we really support architectures with 9bits-sized char? Hye-Shik From tim.one at comcast.net Fri Dec 19 10:40:13 2003 From: tim.one at comcast.net (Tim Peters) Date: Fri Dec 19 10:40:25 2003 Subject: [Python-checkins] RE: [Python-Dev] Re: python/dist/src/Objectsunicodeobject.c, 2.204, 2.205 In-Reply-To: <20031219115952.GA84061@i18n.org> Message-ID: <LNBBLJKPBEHFEDALKOLCCEFEHOAB.tim.one@comcast.net> [Hye-Shik Chang] > BTW, do we really support architectures with 9bits-sized char? I don't think so. There are assumptions that a char is 8 bits scattered throughout Python's code, not so much in the context of using characters *as* characters, but more indirectly by assuming that the number of *bits* in an object of a non-char type T can be computed as sizeof(T)*8. Skip's idea of making config smarter about this is a good one, but instead of trying to "fix stuff" for a case that's probably never going to arise, and that can't really be tested anyway until it does, I'd add a block like this everywhere we know we're relying on 8-bit char: #ifdef HAS_FUNNY_SIZE_CHAR #error "The following code needs rework when a char isn't 8 bits" #endif /* A comment explaining why the following code needs rework * when a char isn't 8 bits. */ Crays are a red herring here. It's true that some Cray *hardware* can't address anything smaller than 64 bits, and that's also true of some other architectures. char is nevertheless 8 bits on all such 64-bit boxes I know of (and since I worked in a 64-bit world for 15 years, I know about most of them <wink>). On Crays, this is achieved (albeit at major expense) in software: by *software* convention, a pointer-to-char stores the byte offset in the *most*-significant 3 bits of a pointer, and long-winded generated coded picks that part at runtime, loading or storing 8 bytes at a time (the HW can't do less than that), shifting and masking and or'ing to give the illusion of byte addressing for char. Some Alphas do something similar, but that HW's loads and stores simply ignore the last 3 bits of a memory address, and the CPU has special-purpose instructions to help generated code do the subsequent extraction and insertion of 8-bit chunks efficiently and succinctly. From doerwalter at users.sourceforge.net Fri Dec 19 13:15:21 2003 From: doerwalter at users.sourceforge.net (doerwalter@users.sourceforge.net) Date: Fri Dec 19 13:15:25 2003 Subject: [Python-checkins] python/dist/src/Lib mimetypes.py,1.29,1.30 Message-ID: <E1AXP9l-0001zr-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv7556/Lib Modified Files: mimetypes.py Log Message: Remove self from the arguments for the function add_type(). Backport candidate. Index: mimetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetypes.py,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** mimetypes.py 20 Oct 2003 14:01:50 -0000 1.29 --- mimetypes.py 19 Dec 2003 18:15:10 -0000 1.30 *************** *** 269,273 **** return guess_extension(type, strict) ! def add_type(self, type, ext, strict=True): """Add a mapping between a type and an extension. --- 269,273 ---- return guess_extension(type, strict) ! def add_type(type, ext, strict=True): """Add a mapping between a type and an extension. From rhettinger at users.sourceforge.net Sat Dec 20 15:16:14 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 20 15:16:20 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex, 1.196.8.14, 1.196.8.15 Message-ID: <E1AXnWH-00049d-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv15948 Modified Files: Tag: release23-maint tut.tex Log Message: Undo one backport too many. Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.196.8.14 retrieving revision 1.196.8.15 diff -C2 -d -r1.196.8.14 -r1.196.8.15 *** tut.tex 7 Dec 2003 11:15:16 -0000 1.196.8.14 --- tut.tex 20 Dec 2003 20:16:11 -0000 1.196.8.15 *************** *** 2160,2178 **** \end{verbatim} - To loop over a sequence in reverse, first specify the sequence - in a forward direction and then call the \function{reversed()} - function. - - \begin{verbatim} - >>> for i in reversed(xrange(1,10,2)): - ... print i - ... - 9 - 7 - 5 - 3 - 1 - \end{verbatim} - \section{More on Conditions \label{conditions}} --- 2160,2163 ---- From rhettinger at users.sourceforge.net Sat Dec 20 15:31:10 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 20 15:31:14 2003 Subject: [Python-checkins] python/dist/src/Lib mimetypes.py, 1.28.8.1, 1.28.8.2 Message-ID: <E1AXnkk-0006mA-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv26042 Modified Files: Tag: release23-maint mimetypes.py Log Message: Backport rev 1.30 removing 'self' from the arg list for add_type() Index: mimetypes.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/mimetypes.py,v retrieving revision 1.28.8.1 retrieving revision 1.28.8.2 diff -C2 -d -r1.28.8.1 -r1.28.8.2 *** mimetypes.py 20 Oct 2003 14:34:45 -0000 1.28.8.1 --- mimetypes.py 20 Dec 2003 20:31:08 -0000 1.28.8.2 *************** *** 269,273 **** return guess_extension(type, strict) ! def add_type(self, type, ext, strict=True): """Add a mapping between a type and an extension. --- 269,273 ---- return guess_extension(type, strict) ! def add_type(type, ext, strict=True): """Add a mapping between a type and an extension. From rhettinger at users.sourceforge.net Sat Dec 20 15:53:33 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sat Dec 20 15:53:36 2003 Subject: [Python-checkins] python/dist/src/Doc/commontex license.tex, 1.1, 1.2 Message-ID: <E1AXo6P-00022R-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/commontex In directory sc8-pr-cvs1:/tmp/cvs-serv7822 Modified Files: license.tex Log Message: Add the first of (hopefully) many third-party licenses and acknowledgements. Index: license.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/commontex/license.tex,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** license.tex 27 Sep 2003 07:11:17 -0000 1.1 --- license.tex 20 Dec 2003 20:53:31 -0000 1.2 *************** *** 279,280 **** --- 279,339 ---- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + + + \section{Licenses and Acknowledgements for Incorporated Software} + + This section is an incomplete, but growing list of licenses and + acknowledgements for third-party software incorporated in the + Python distribution. + + + \subsection{Mersenne Twister} + + The \module{_random} module includes code based on a download from + \url{http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html}. + The following are the verbatim comments from the original code: + + \begin{verbatim} + A C-program for MT19937, with initialization improved 2002/1/26. + Coded by Takuji Nishimura and Makoto Matsumoto. + + Before using, initialize the state by using init_genrand(seed) + or init_by_array(init_key, key_length). + + Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. 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. + + 3. The names of its contributors may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 THE COPYRIGHT OWNER 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. + + + Any feedback is very welcome. + http://www.math.keio.ac.jp/matumoto/emt.html + email: matumoto@math.keio.ac.jp + \end{verbatim} + + From fdrake at users.sourceforge.net Sat Dec 20 16:30:17 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Sat Dec 20 16:30:30 2003 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.9, 2.74.4.10 Message-ID: <E1AXofx-0005rH-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv22509 Modified Files: Tag: release23-maint patchlevel.h Log Message: Post-release version bumpage. Index: patchlevel.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/patchlevel.h,v retrieving revision 2.74.4.9 retrieving revision 2.74.4.10 diff -C2 -d -r2.74.4.9 -r2.74.4.10 *** patchlevel.h 18 Dec 2003 15:06:58 -0000 2.74.4.9 --- patchlevel.h 20 Dec 2003 21:30:14 -0000 2.74.4.10 *************** *** 22,31 **** #define PY_MAJOR_VERSION 2 #define PY_MINOR_VERSION 3 ! #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.3.3" /* 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 3 ! #define PY_MICRO_VERSION 4 ! #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ ! #define PY_VERSION "2.3.4a0" /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. From theller at users.sourceforge.net Sat Dec 20 17:29:05 2003 From: theller at users.sourceforge.net (theller@users.sourceforge.net) Date: Sat Dec 20 17:29:08 2003 Subject: [Python-checkins] python/dist/src/PCbuild BUILDno.txt,1.55,1.56 Message-ID: <E1AXpar-0000Qq-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PCbuild In directory sc8-pr-cvs1:/tmp/cvs-serv1651 Modified Files: BUILDno.txt Log Message: Python 2.3.3 Window build number and release date. Index: BUILDno.txt =================================================================== RCS file: /cvsroot/python/python/dist/src/PCbuild/BUILDno.txt,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** BUILDno.txt 4 Dec 2003 20:36:53 -0000 1.55 --- BUILDno.txt 20 Dec 2003 22:29:03 -0000 1.56 *************** *** 34,37 **** --- 34,39 ---- Windows Python BUILD numbers ---------------------------- + 51 2.3.3 + 19-Dec-2003 50 2.3.3c1 5-Dec-2003 From anthony at interlink.com.au Sat Dec 20 22:14:03 2003 From: anthony at interlink.com.au (Anthony Baxter) Date: Sat Dec 20 22:14:36 2003 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.9, 2.74.4.10 In-Reply-To: <E1AXofx-0005rH-00@sc8-pr-cvs1.sourceforge.net> Message-ID: <200312210314.hBL3E3ZU017703@localhost.localdomain> >>> fdrake@users.sourceforge.net wrote > Update of /cvsroot/python/python/dist/src/Include > In directory sc8-pr-cvs1:/tmp/cvs-serv22509 > > Modified Files: > Tag: release23-maint > patchlevel.h > Log Message: > Post-release version bumpage. Argh! Nonononononono! Please leave the branch at 2.3.3 for Jack to cut the Mac versions! Anthony -- Anthony Baxter <anthony@interlink.com.au> It's never too late to have a happy childhood. From fdrake at acm.org Sun Dec 21 00:12:00 2003 From: fdrake at acm.org (Fred L. Drake, Jr.) Date: Sun Dec 21 00:12:12 2003 Subject: [Python-checkins] python/dist/src/Include patchlevel.h, 2.74.4.9, 2.74.4.10 In-Reply-To: <200312210314.hBL3E3ZU017703@localhost.localdomain> References: <E1AXofx-0005rH-00@sc8-pr-cvs1.sourceforge.net> <200312210314.hBL3E3ZU017703@localhost.localdomain> Message-ID: <16357.11168.459937.182871@sftp.fdrake.net> Anthony Baxter writes: > Argh! Nonononononono! Please leave the branch at 2.3.3 for Jack to cut > the Mac versions! Oops, sorry; forgot about that. It was triggered by a change that Raymond made to the docs, properly removing material that leaked from the 2.4 tutorial. I've outdated the change to correct the version numbers. Not sure what the right thing to do about the docs is; let's just leave it alone, since it was a valuable correction. -Fred -- Fred L. Drake, Jr. <fdrake at acm.org> PythonLabs at Zope Corporation From rhettinger at users.sourceforge.net Sun Dec 21 17:19:11 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Sun Dec 21 17:19:14 2003 Subject: [Python-checkins] python/dist/src/Lib UserDict.py,1.25,1.26 Message-ID: <E1AYBup-0006Tu-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv24489 Modified Files: UserDict.py Log Message: Make sure the UserDict copies do not share the same underlying dictionary as the original. This parallels MvL's change to Lib/os.py 1.56. Backport candidate. Index: UserDict.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/UserDict.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** UserDict.py 4 Dec 2003 20:04:09 -0000 1.25 --- UserDict.py 21 Dec 2003 22:19:08 -0000 1.26 *************** *** 23,27 **** def copy(self): if self.__class__ is UserDict: ! return UserDict(self.data) import copy data = self.data --- 23,27 ---- def copy(self): if self.__class__ is UserDict: ! return UserDict(self.data.copy()) import copy data = self.data From perky at users.sourceforge.net Sun Dec 21 20:31:16 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Dec 21 20:31:18 2003 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.205, 2.206 Message-ID: <E1AYEui-0006yP-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26442 Modified Files: unicodeobject.c Log Message: Fix broken xmlcharrefreplace by rev 2.204. (Pointy hat goes to perky) Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.205 retrieving revision 2.206 diff -C2 -d -r2.205 -r2.206 *** unicodeobject.c 19 Dec 2003 01:59:56 -0000 2.205 --- unicodeobject.c 22 Dec 2003 01:31:13 -0000 2.206 *************** *** 2414,2423 **** else if (*p<1000) repsize += 2+3+1; #ifndef Py_UNICODE_WIDE else ! repsize += 2+4+1; #else - else if (*p<10000) - repsize += 2+4+1; else if (*p<100000) repsize += 2+5+1; --- 2414,2423 ---- else if (*p<1000) repsize += 2+3+1; + else if (*p<10000) + repsize += 2+4+1; #ifndef Py_UNICODE_WIDE else ! repsize += 2+5+1; #else else if (*p<100000) repsize += 2+5+1; From perky at users.sourceforge.net Sun Dec 21 20:33:11 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Dec 21 20:33:14 2003 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.206, 2.207 Message-ID: <E1AYEwZ-00075q-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26934 Modified Files: unicodeobject.c Log Message: (forced commit) Previous revision was a fix for a problem by not 2.204 but 2.205. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.206 retrieving revision 2.207 diff -C2 -d -r2.206 -r2.207 From montanaro at users.sourceforge.net Mon Dec 22 11:31:43 2003 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Dec 22 11:31:47 2003 Subject: [Python-checkins] python/dist/src/Include Python.h,2.58,2.59 Message-ID: <E1AYSy7-0003wl-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv14738/Include Modified Files: Python.h Log Message: There are places in Python which assume bytes have 8-bits. Formalize that a bit by checking the value of UCHAR_MAX in Include/Python.h. There was a check in Objects/stringobject.c. Remove that. (Note that we don't define UCHAR_MAX if it's not defined as the old test did.) Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.58 retrieving revision 2.59 diff -C2 -d -r2.58 -r2.59 *** Python.h 16 Nov 2003 16:17:48 -0000 2.58 --- Python.h 22 Dec 2003 16:31:33 -0000 2.59 *************** *** 22,25 **** --- 22,33 ---- #endif + #ifndef UCHAR_MAX + #error "Something's broken. UCHAR_MAX should be defined in limits.h." + #endif + + #if UCHAR_MAX != 255 + #error "Python's source code currently assumes 8-bit characters." + #endif + #if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) #define _SGI_MP_SOURCE From montanaro at users.sourceforge.net Mon Dec 22 11:31:43 2003 From: montanaro at users.sourceforge.net (montanaro@users.sourceforge.net) Date: Mon Dec 22 11:31:51 2003 Subject: [Python-checkins] python/dist/src/Objects stringobject.c, 2.215, 2.216 Message-ID: <E1AYSy7-0003wt-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv14738/Objects Modified Files: stringobject.c Log Message: There are places in Python which assume bytes have 8-bits. Formalize that a bit by checking the value of UCHAR_MAX in Include/Python.h. There was a check in Objects/stringobject.c. Remove that. (Note that we don't define UCHAR_MAX if it's not defined as the old test did.) Index: stringobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/stringobject.c,v retrieving revision 2.215 retrieving revision 2.216 diff -C2 -d -r2.215 -r2.216 *** stringobject.c 15 Dec 2003 18:49:19 -0000 2.215 --- stringobject.c 22 Dec 2003 16:31:41 -0000 2.216 *************** *** 9,16 **** #endif - #if !defined(HAVE_LIMITS_H) && !defined(UCHAR_MAX) - #define UCHAR_MAX 255 - #endif - static PyStringObject *characters[UCHAR_MAX + 1]; static PyStringObject *nullstring; --- 9,12 ---- From tim_one at users.sourceforge.net Mon Dec 22 13:10:54 2003 From: tim_one at users.sourceforge.net (tim_one@users.sourceforge.net) Date: Mon Dec 22 13:10:57 2003 Subject: [Python-checkins] python/dist/src/Include Python.h,2.59,2.60 Message-ID: <E1AYUW6-0000nD-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv2609/Include Modified Files: Python.h Log Message: Changed the UCHAR_MAX error msg a bit: we don't really assume anything about "characters", we assume something about C's char type (which is an integral type). Index: Python.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/Python.h,v retrieving revision 2.59 retrieving revision 2.60 diff -C2 -d -r2.59 -r2.60 *** Python.h 22 Dec 2003 16:31:33 -0000 2.59 --- Python.h 22 Dec 2003 18:10:51 -0000 2.60 *************** *** 27,31 **** #if UCHAR_MAX != 255 ! #error "Python's source code currently assumes 8-bit characters." #endif --- 27,31 ---- #if UCHAR_MAX != 255 ! #error "Python's source code assumes C's unsigned char is an 8-bit type." #endif From perky at users.sourceforge.net Tue Dec 23 04:10:19 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Tue Dec 23 04:10:25 2003 Subject: [Python-checkins] python/dist/src/Objects unicodeobject.c, 2.207, 2.208 Message-ID: <E1AYiYV-00076Z-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv26828/Objects Modified Files: unicodeobject.c Log Message: Fix unicode.rsplit()'s bug that ignores separater on the end of string when using specialized splitter for 1 char sep. Index: unicodeobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v retrieving revision 2.207 retrieving revision 2.208 diff -C2 -d -r2.207 -r2.208 *** unicodeobject.c 22 Dec 2003 01:33:08 -0000 2.207 --- unicodeobject.c 23 Dec 2003 09:10:16 -0000 2.208 *************** *** 4295,4299 **** i--; } ! if (j >= 0) { SPLIT_INSERT(self->str, 0, j + 1); } --- 4295,4299 ---- i--; } ! if (j >= -1) { SPLIT_INSERT(self->str, 0, j + 1); } From perky at users.sourceforge.net Tue Dec 23 04:10:18 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Tue Dec 23 04:10:30 2003 Subject: [Python-checkins] python/dist/src/Lib/test string_tests.py, 1.35, 1.36 Message-ID: <E1AYiYU-00076T-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv26828/Lib/test Modified Files: string_tests.py Log Message: Fix unicode.rsplit()'s bug that ignores separater on the end of string when using specialized splitter for 1 char sep. Index: string_tests.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/string_tests.py,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** string_tests.py 15 Dec 2003 18:49:19 -0000 1.35 --- string_tests.py 23 Dec 2003 09:10:16 -0000 1.36 *************** *** 209,212 **** --- 209,214 ---- self.checkequal(['', ''], 'abcd', 'rsplit', 'abcd') self.checkequal([u'a b', u'c', u'd'], 'a b c d', 'rsplit', u' ', 2) + self.checkequal(['', ' endcase'], '| endcase', 'rsplit', '|') + self.checkequal(['', ' endcase'], 'test endcase', 'rsplit', 'test') def test_strip(self): From akuchling at users.sourceforge.net Tue Dec 23 11:33:30 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 11:33:34 2003 Subject: [Python-checkins] python/dist/src/Lib os.py,1.73,1.74 Message-ID: <E1AYpTO-0001u2-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv6956 Modified Files: os.py Log Message: [Bug #829532] Invoking os.makedirs() with an argument that contains a directory name with a single dot fails. The patch skips creating directories named os.curdir. (Patch by Bram Moolenaar) 2.3 bugfix candidate. Index: os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/os.py,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** os.py 2 Dec 2003 12:33:01 -0000 1.73 --- os.py 23 Dec 2003 16:33:28 -0000 1.74 *************** *** 153,156 **** --- 153,158 ---- if head and tail and not path.exists(head): makedirs(head, mode) + if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists + return mkdir(name, mode) From akuchling at users.sourceforge.net Tue Dec 23 11:36:18 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 11:36:39 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_os.py,1.19,1.20 Message-ID: <E1AYpW6-00021K-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv7678 Modified Files: test_os.py Log Message: As part of fixing bug #829532, add a test case that exercises os.makedirs Index: test_os.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_os.py,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** test_os.py 20 Oct 2003 14:01:51 -0000 1.19 --- test_os.py 23 Dec 2003 16:36:11 -0000 1.20 *************** *** 302,305 **** --- 302,339 ---- os.rmdir(test_support.TESTFN) + class MakedirTests (unittest.TestCase): + def setUp(self): + os.mkdir(test_support.TESTFN) + + def test_makedir(self): + base = test_support.TESTFN + path = os.path.join(base, 'dir1', 'dir2', 'dir3') + os.makedirs(path) # Should work + path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4') + os.makedirs(path) + + # Try paths with a '.' in them + self.failUnlessRaises(OSError, os.makedirs, os.curdir) + path = os.path.join(base, 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', os.curdir) + os.makedirs(path) + path = os.path.join(base, 'dir1', os.curdir, 'dir2', 'dir3', 'dir4', + 'dir5', 'dir6') + os.makedirs(path) + + + + + def tearDown(self): + path = os.path.join(test_support.TESTFN, 'dir1', 'dir2', 'dir3', + 'dir4', 'dir5', 'dir6') + # If the tests failed, the bottom-most directory ('../dir6') + # may not have been created, so we look for the outermost directory + # that exists. + while not os.path.exists(path) and path != test_support.TESTFN: + path = os.path.dirname(path) + + os.removedirs(path) + + def test_main(): test_support.run_unittest( *************** *** 307,311 **** StatAttributeTests, EnvironTests, ! WalkTests ) --- 341,346 ---- StatAttributeTests, EnvironTests, ! WalkTests, ! MakedirTests, ) From akuchling at users.sourceforge.net Tue Dec 23 11:46:44 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 11:46:48 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex, 1.163, 1.164 Message-ID: <E1AYpgC-0002VR-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv9630 Modified Files: whatsnew23.tex Log Message: Fix silly typo Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.163 retrieving revision 1.164 diff -C2 -d -r1.163 -r1.164 *** whatsnew23.tex 23 Oct 2003 18:08:03 -0000 1.163 --- whatsnew23.tex 23 Dec 2003 16:46:41 -0000 1.164 *************** *** 1415,1419 **** corresponding \module{zlib}-compressed data. (Contributed by Gustavo Niemeyer.) ! \item A set of standard date/type types has been added in the new \module{datetime} module. See the following section for more details. --- 1415,1419 ---- corresponding \module{zlib}-compressed data. (Contributed by Gustavo Niemeyer.) ! \item A set of standard date/time types has been added in the new \module{datetime} module. See the following section for more details. From akuchling at users.sourceforge.net Tue Dec 23 11:47:47 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 11:47:50 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew23.tex, 1.159.4.2, 1.159.4.3 Message-ID: <E1AYphD-0002YO-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv9809 Modified Files: Tag: release23-maint whatsnew23.tex Log Message: [Bug #864029] Fix silly typo Index: whatsnew23.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew23.tex,v retrieving revision 1.159.4.2 retrieving revision 1.159.4.3 diff -C2 -d -r1.159.4.2 -r1.159.4.3 *** whatsnew23.tex 21 Sep 2003 23:42:16 -0000 1.159.4.2 --- whatsnew23.tex 23 Dec 2003 16:47:44 -0000 1.159.4.3 *************** *** 1415,1419 **** corresponding \module{zlib}-compressed data. (Contributed by Gustavo Niemeyer.) ! \item A set of standard date/type types has been added in the new \module{datetime} module. See the following section for more details. --- 1415,1419 ---- corresponding \module{zlib}-compressed data. (Contributed by Gustavo Niemeyer.) ! \item A set of standard date/time types has been added in the new \module{datetime} module. See the following section for more details. From akuchling at users.sourceforge.net Tue Dec 23 11:53:37 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 11:53:40 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.158,1.159 Message-ID: <E1AYpmr-0002pR-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10868 Modified Files: libfuncs.tex Log Message: [Bug #857821] Remove mention of deprecated string.{atol,atof} functions. (Patch from Gerrit Holl) Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.158 retrieving revision 1.159 diff -C2 -d -r1.158 -r1.159 *** libfuncs.tex 17 Dec 2003 20:43:32 -0000 1.158 --- libfuncs.tex 23 Dec 2003 16:53:34 -0000 1.159 *************** *** 428,433 **** Convert a string or a number to floating point. If the argument is a string, it must contain a possibly signed decimal or floating point ! number, possibly embedded in whitespace; this behaves identical to ! \code{string.atof(\var{x})}. Otherwise, the argument may be a plain or long integer or a floating point number, and a floating point number with the same value (within Python's floating point --- 428,432 ---- Convert a string or a number to floating point. If the argument is a string, it must contain a possibly signed decimal or floating point ! number, possibly embedded in whitespace. Otherwise, the argument may be a plain or long integer or a floating point number, and a floating point number with the same value (within Python's floating point *************** *** 613,618 **** Convert a string or number to a long integer. If the argument is a string, it must contain a possibly signed number of ! arbitrary size, possibly embedded in whitespace; ! this behaves identical to \code{string.atol(\var{x})}. The \var{radix} argument is interpreted in the same way as for \function{int()}, and may only be given when \var{x} is a string. --- 612,616 ---- Convert a string or number to a long integer. If the argument is a string, it must contain a possibly signed number of ! arbitrary size, possibly embedded in whitespace. The \var{radix} argument is interpreted in the same way as for \function{int()}, and may only be given when \var{x} is a string. From akuchling at users.sourceforge.net Tue Dec 23 12:01:40 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 12:01:44 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libpopen2.tex,1.19,1.20 Message-ID: <E1AYpue-0003F8-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv12457 Modified Files: libpopen2.tex Log Message: [Bug #850818] Accept Gregory H. Ball's suggested rewrite of a confusing description Index: libpopen2.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpopen2.tex,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** libpopen2.tex 6 Feb 2003 18:04:43 -0000 1.19 --- libpopen2.tex 23 Dec 2003 17:01:38 -0000 1.20 *************** *** 107,113 **** \begin{memberdesc}{childerr} ! Where the standard error from the child process goes is ! \var{capturestderr} was true for the constructor, or \code{None}. ! This will always be \code{None} for \class{Popen4} instances. \end{memberdesc} --- 107,114 ---- \begin{memberdesc}{childerr} ! A file object that provides error output from the child process, if ! \var{capturestderr} was true for the constructor, otherwise ! \code{None}. This will always be \code{None} for \class{Popen4} ! instances. \end{memberdesc} From akuchling at users.sourceforge.net Tue Dec 23 12:04:37 2003 From: akuchling at users.sourceforge.net (akuchling@users.sourceforge.net) Date: Tue Dec 23 12:04:41 2003 Subject: [Python-checkins] python/dist/src/Doc README,1.52,1.53 Message-ID: <E1AYpxV-0003OV-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc In directory sc8-pr-cvs1:/tmp/cvs-serv13043 Modified Files: README Log Message: [Bug #850823] Fix broken link Index: README =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/README,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** README 27 Sep 2003 19:32:04 -0000 1.52 --- README 23 Dec 2003 17:04:35 -0000 1.53 *************** *** 52,56 **** First, check that the bug is present in the development version of the ! documentation at <http://python.sourceforge.net/devel-docs/>; we may have already fixed it. --- 52,56 ---- First, check that the bug is present in the development version of the ! documentation at <http://www.python.org/dev/doc/devel/>; we may have already fixed it. From aimacintyre at users.sourceforge.net Thu Dec 25 08:25:22 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 08:25:27 2003 Subject: [Python-checkins] python/dist/src/PC/os2emx Makefile,1.15,1.16 Message-ID: <E1AZVUQ-0001Zm-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/PC/os2emx In directory sc8-pr-cvs1:/tmp/cvs-serv6053 Modified Files: Makefile Log Message: add definitions required for expat 1.95.7 Index: Makefile =================================================================== RCS file: /cvsroot/python/python/dist/src/PC/os2emx/Makefile,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Makefile 2 Dec 2003 12:21:20 -0000 1.15 --- Makefile 25 Dec 2003 13:25:20 -0000 1.16 *************** *** 471,475 **** EXPAT.INC= -I../../Modules/expat EXPAT.DEF= -DHAVE_EXPAT_H -DXML_NS=1 -DXML_DTD=1 -DXML_BYTE_ORDER=12 \ ! -DXML_CONTENT_BYTES=1024 EXPAT.SRC= $(addprefix ../../Modules/expat/, \ xmlparse.c \ --- 471,475 ---- EXPAT.INC= -I../../Modules/expat EXPAT.DEF= -DHAVE_EXPAT_H -DXML_NS=1 -DXML_DTD=1 -DXML_BYTE_ORDER=12 \ ! -DXML_CONTENT_BYTES=1024 -DHAVE_MEMMOVE=1 -DHAVE_BCOPY=1 EXPAT.SRC= $(addprefix ../../Modules/expat/, \ xmlparse.c \ From aimacintyre at users.sourceforge.net Thu Dec 25 08:27:22 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 08:27:25 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.170,2.171 Message-ID: <E1AZVWM-0001cy-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv6247 Modified Files: listobject.c Log Message: Performance of list([]) in 2.3 came up in a thread on comp.lang.python, which can be reviewed via http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-12/1011.html Duncan Booth investigated, and discovered that an "optimisation" was in fact a pessimisation for small numbers of elements in a source list, compared to not having the optimisation, although with large numbers of elements in the source list the optimisation was quite beneficial. He posted his change to comp.lang.python (but not to SF). Further research has confirmed his assessment that the optimisation only becomes a net win when the source list has more than 100 elements. I also found that the optimisation could apply to tuples as well, but the gains only arrive with source tuples larger than about 320 elements and are nowhere near as significant as the gains with lists, (~95% gain @ 10000 elements for lists, ~20% gain @ 10000 elements for tuples) so I haven't proceeded with this. The code as it was applied the optimisation to list subclasses as well, and this also appears to be a net loss for all reasonable sized sources (~80-100% for up to 100 elements, ~20% for more than 500 elements; I tested up to 10000 elements). Duncan also suggested special casing empty lists, which I've extended to all empty sequences. On the basis that list_fill() is only ever called with a list for the result argument, testing for the source being the destination has now happens before testing source types. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.170 retrieving revision 2.171 diff -C2 -d -r2.170 -r2.171 *** listobject.c 17 Dec 2003 20:43:33 -0000 2.170 --- listobject.c 25 Dec 2003 13:27:20 -0000 2.171 *************** *** 2235,2238 **** --- 2235,2245 ---- } + /* empirically determined threshold for activating an optimisation + * in list_fill() - 100 seems close to optimum for current CPUs and + * compilers, as of December '03. + * see also comment in list_fill(). + */ + #define LISTFILL_OPT_THRESHOLD 100 + /* Adapted from newer code by Tim */ static int *************** *** 2243,2254 **** int i; n = result->ob_size; ! /* Special-case list(a_list), for speed. */ ! if (PyList_Check(v)) { ! if (v == (PyObject *)result) ! return 0; /* source is destination, we're done */ ! return list_ass_slice(result, 0, n, v); ! } /* Empty previous contents */ --- 2250,2276 ---- int i; + /* if source is destination, we're done. */ + if (v == (PyObject *)result) + return 0; + n = result->ob_size; ! /* Special-case list(a_list), for speed: ! * - if the source has 0 elements, there's nothing to copy. ! * - if the source has more than a threshold number of elements ! * slice assignment is a faster way of filling the target ! * (the exact threshold is subject to empirical determination). ! * Also special case any other zero length sequence, including ! * subclasses of list, there being nothing to copy. ! */ ! if (PyList_CheckExact(v)) { ! i = ((PyListObject*)v)->ob_size; ! if (i == 0) ! return 0; ! if (i > LISTFILL_OPT_THRESHOLD) ! return list_ass_slice(result, 0, n, v); ! } else ! if (PySequence_Check(v) && PySequence_Size(v) == 0) ! return 0; /* Empty previous contents */ From aimacintyre at users.sourceforge.net Thu Dec 25 08:28:51 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 08:28:54 2003 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.254, 1.255 NEWS, 1.915, 1.916 Message-ID: <E1AZVXn-0001gR-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv6382 Modified Files: ACKS NEWS Log Message: Performance of list([]) in 2.3 came up in a thread on comp.lang.python, which can be reviewed via http://coding.derkeiler.com/Archive/Python/comp.lang.python/2003-12/1011.html Duncan Booth investigated, and discovered that an "optimisation" was in fact a pessimisation for small numbers of elements in a source list, compared to not having the optimisation, although with large numbers of elements in the source list the optimisation was quite beneficial. He posted his change to comp.lang.python (but not to SF). Further research has confirmed his assessment that the optimisation only becomes a net win when the source list has more than 100 elements. I also found that the optimisation could apply to tuples as well, but the gains only arrive with source tuples larger than about 320 elements and are nowhere near as significant as the gains with lists, (~95% gain @ 10000 elements for lists, ~20% gain @ 10000 elements for tuples) so I haven't proceeded with this. The code as it was applied the optimisation to list subclasses as well, and this also appears to be a net loss for all reasonable sized sources (~80-100% for up to 100 elements, ~20% for more than 500 elements; I tested up to 10000 elements). Duncan also suggested special casing empty lists, which I've extended to all empty sequences. On the basis that list_fill() is only ever called with a list for the result argument, testing for the source being the destination has now happens before testing source types. Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** ACKS 10 Nov 2003 06:44:44 -0000 1.254 --- ACKS 25 Dec 2003 13:28:48 -0000 1.255 *************** *** 63,66 **** --- 63,67 ---- Matthew Boedicker David Bolen + Duncan Booth Jurjen Bos Peter Bosch Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.915 retrieving revision 1.916 diff -C2 -d -r1.915 -r1.916 *** NEWS 17 Dec 2003 20:43:32 -0000 1.915 --- NEWS 25 Dec 2003 13:28:48 -0000 1.916 *************** *** 119,122 **** --- 119,130 ---- working towards the beginning. See SF feature request 801847. + - in a thread on comp.lang.python, several people noted that list() + was much slower than in 2.1 and earlier versions of Python, when used + to create new lists from existing lists. Duncan Booth did some + research that uncovered an optimisation that, for lists below + about 100 elements, was actually slower than the normal case. The + special case criteria have been tightened to rectify the performance + regression. + Extension modules ----------------- From aimacintyre at users.sourceforge.net Thu Dec 25 18:57:55 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 18:58:00 2003 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.34,1.35 Message-ID: <E1AZfMZ-0005EA-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv20083 Modified Files: concrete.tex Log Message: The semantics of PyList_Check() and PyDict_Check() changed at 2.2, along with most other concrete object checks, but the docs weren't brought into line. PyList_CheckExact() was added at 2.2 but never documented. backport candidate. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** concrete.tex 13 Dec 2003 19:48:41 -0000 1.34 --- concrete.tex 25 Dec 2003 23:57:52 -0000 1.35 *************** *** 1671,1675 **** \begin{cfuncdesc}{int}{PyList_Check}{PyObject *p} ! Returns true if its argument is a \ctype{PyListObject}. \end{cfuncdesc} --- 1671,1683 ---- \begin{cfuncdesc}{int}{PyList_Check}{PyObject *p} ! Returns true if \var{p} is a list object or an instance of a ! subtype of the list type. ! \versionchanged[Allowed subtypes to be accepted]{2.2} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyList_CheckExact}{PyObject *p} ! Return true if \var{p} is a list object, but not an instance of a ! subtype of the list type. ! \versionadded{2.2} \end{cfuncdesc} *************** *** 1791,1795 **** \begin{cfuncdesc}{int}{PyDict_Check}{PyObject *p} ! Returns true if its argument is a \ctype{PyDictObject}. \end{cfuncdesc} --- 1799,1805 ---- \begin{cfuncdesc}{int}{PyDict_Check}{PyObject *p} ! Returns true if \var{p} is a dict object or an instance of a ! subtype of the dict type. ! \versionchanged[Allowed subtypes to be accepted]{2.2} \end{cfuncdesc} From aimacintyre at users.sourceforge.net Thu Dec 25 19:00:34 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 19:00:40 2003 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex, 1.6.6.6, 1.6.6.7 Message-ID: <E1AZfP8-0005Mx-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv20589 Modified Files: Tag: release22-maint concrete.tex Log Message: backport of concrete.tex v1.35: The semantics of PyList_Check() and PyDict_Check() changed at 2.2, along with most other concrete object checks, but the docs weren't brought into line. PyList_CheckExact() was added at 2.2 but never documented. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.6.6.6 retrieving revision 1.6.6.7 diff -C2 -d -r1.6.6.6 -r1.6.6.7 *** concrete.tex 22 Oct 2002 20:21:06 -0000 1.6.6.6 --- concrete.tex 26 Dec 2003 00:00:29 -0000 1.6.6.7 *************** *** 1603,1607 **** \begin{cfuncdesc}{int}{PyList_Check}{PyObject *p} ! Returns true if its argument is a \ctype{PyListObject}. \end{cfuncdesc} --- 1603,1615 ---- \begin{cfuncdesc}{int}{PyList_Check}{PyObject *p} ! Returns true if \var{p} is a list object or an instance of a ! subtype of the list type. ! \versionchanged[Allowed subtypes to be accepted]{2.2} ! \end{cfuncdesc} ! ! \begin{cfuncdesc}{int}{PyList_CheckExact}{PyObject *p} ! Return true if \var{p} is a list object, but not an instance of a ! subtype of the list type. ! \versionadded{2.2} \end{cfuncdesc} *************** *** 1721,1725 **** \begin{cfuncdesc}{int}{PyDict_Check}{PyObject *p} ! Returns true if its argument is a \ctype{PyDictObject}. \end{cfuncdesc} --- 1729,1735 ---- \begin{cfuncdesc}{int}{PyDict_Check}{PyObject *p} ! Returns true if \var{p} is a dict object or an instance of a ! subtype of the dict type. ! \versionchanged[Allowed subtypes to be accepted]{2.2} \end{cfuncdesc} From aimacintyre at users.sourceforge.net Thu Dec 25 19:02:25 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 19:02:28 2003 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.28,2.29 Message-ID: <E1AZfQv-0005UM-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv21089 Modified Files: dictobject.h Log Message: The semantics of PyList_Check() and PyDict_Check() changed at 2.2, along with most other concrete object checks, but the docs weren't brought into line. PyList_CheckExact() was added at 2.2 but never documented. backport candidate. Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.28 retrieving revision 2.29 diff -C2 -d -r2.28 -r2.29 *** dictobject.h 25 Nov 2003 21:12:14 -0000 2.28 --- dictobject.h 26 Dec 2003 00:02:23 -0000 2.29 *************** *** 88,91 **** --- 88,92 ---- #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) + #define PyList_CheckExact(op) ((op)->ob_type == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); From aimacintyre at users.sourceforge.net Thu Dec 25 19:07:53 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 19:07:56 2003 Subject: [Python-checkins] python/dist/src/Doc/api concrete.tex,1.35,1.36 Message-ID: <E1AZfWD-0005gN-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/api In directory sc8-pr-cvs1:/tmp/cvs-serv21831 Modified Files: concrete.tex Log Message: At 2.2, the Py<type>_Check() family of API functions (macros) changed semantics to include subtypes. Most concrete object APIs then had a Py<type>_CheckExact() macro added to test for an object's type not including subtypes. The PyDict_CheckExact() macro wasn't created at that time, so I've added it for API completeness/symmetry - even though nobody has complained about its absence in the time since 2.2 was released. Not a backport candidate. Index: concrete.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/api/concrete.tex,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** concrete.tex 25 Dec 2003 23:57:52 -0000 1.35 --- concrete.tex 26 Dec 2003 00:07:51 -0000 1.36 *************** *** 1804,1807 **** --- 1804,1813 ---- \end{cfuncdesc} + \begin{cfuncdesc}{int}{PyDict_CheckExact}{PyObject *p} + Return true if \var{p} is a dict object, but not an instance of a + subtype of the dict type. + \versionadded{2.4} + \end{cfuncdesc} + \begin{cfuncdesc}{PyObject*}{PyDict_New}{} Returns a new empty dictionary, or \NULL{} on failure. From aimacintyre at users.sourceforge.net Thu Dec 25 19:09:06 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 19:09:10 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.171,2.172 Message-ID: <E1AZfXO-0005ir-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv21959 Modified Files: listobject.c Log Message: use the correct macro to access list size Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.171 retrieving revision 2.172 diff -C2 -d -r2.171 -r2.172 *** listobject.c 25 Dec 2003 13:27:20 -0000 2.171 --- listobject.c 26 Dec 2003 00:09:04 -0000 2.172 *************** *** 2265,2269 **** */ if (PyList_CheckExact(v)) { ! i = ((PyListObject*)v)->ob_size; if (i == 0) return 0; --- 2265,2269 ---- */ if (PyList_CheckExact(v)) { ! i = PyList_GET_SIZE(v); if (i == 0) return 0; From aimacintyre at users.sourceforge.net Thu Dec 25 19:19:30 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 19:19:34 2003 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.29,2.30 Message-ID: <E1AZfhS-00064A-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv23304 Modified Files: dictobject.h Log Message: reverting 2.29: the patch was Ok, but the commit msg wrong Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.29 retrieving revision 2.30 diff -C2 -d -r2.29 -r2.30 *** dictobject.h 26 Dec 2003 00:02:23 -0000 2.29 --- dictobject.h 26 Dec 2003 00:19:28 -0000 2.30 *************** *** 88,92 **** #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) - #define PyList_CheckExact(op) ((op)->ob_type == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); --- 88,91 ---- From aimacintyre at users.sourceforge.net Thu Dec 25 19:20:55 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Thu Dec 25 19:21:03 2003 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.30,2.31 Message-ID: <E1AZfip-0006As-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv23724 Modified Files: dictobject.h Log Message: At 2.2, the Py<type>_Check() family of API functions (macros) changed semantics to include subtypes. Most concrete object APIs then had a Py<type>_CheckExact() macro added to test for an object's type not including subtypes. The PyDict_CheckExact() macro wasn't created at that time, so I've added it for API completeness/symmetry - even though nobody has complained about its absence in the time since 2.2 was released. Not a backport candidate. Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.30 retrieving revision 2.31 diff -C2 -d -r2.30 -r2.31 *** dictobject.h 26 Dec 2003 00:19:28 -0000 2.30 --- dictobject.h 26 Dec 2003 00:20:53 -0000 2.31 *************** *** 88,91 **** --- 88,92 ---- #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) + #define PyList_CheckExact(op) ((op)->ob_type == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); From andymac at bullseye.apana.org.au Thu Dec 25 19:40:48 2003 From: andymac at bullseye.apana.org.au (Andrew MacIntyre) Date: Thu Dec 25 19:43:27 2003 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.29,2.30 In-Reply-To: <E1AZfhS-00064A-00@sc8-pr-cvs1.sourceforge.net> References: <E1AZfhS-00064A-00@sc8-pr-cvs1.sourceforge.net> Message-ID: <20031226113921.N3218@bullseye.apana.org.au> On Thu, 25 Dec 2003 aimacintyre@users.sourceforge.net wrote: > Update of /cvsroot/python/python/dist/src/Include > In directory sc8-pr-cvs1:/tmp/cvs-serv23304 > > Modified Files: > dictobject.h > Log Message: > reverting 2.29: the patch was Ok, but the commit msg wrong I've since found the entry in the CVS FAQ about cvs admin -m. Apologies for the screwup. Andrew I MacIntyre "These thoughts are mine alone..." E-mail: andymac@bullseye.apana.org.au (pref) | Snail: PO Box 370 andymac@pcug.org.au (alt) | Belconnen ACT 2616 Web: http://www.andymac.org/ | Australia From jhylton at users.sourceforge.net Fri Dec 26 12:17:52 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri Dec 26 12:17:56 2003 Subject: [Python-checkins] python/dist/src/Include dictobject.h,2.31,2.32 Message-ID: <E1AZvay-0004S7-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Include In directory sc8-pr-cvs1:/tmp/cvs-serv17110 Modified Files: dictobject.h Log Message: Fix name problem in previous checkin: Dict not List Index: dictobject.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Include/dictobject.h,v retrieving revision 2.31 retrieving revision 2.32 diff -C2 -d -r2.31 -r2.32 *** dictobject.h 26 Dec 2003 00:20:53 -0000 2.31 --- dictobject.h 26 Dec 2003 17:17:49 -0000 2.32 *************** *** 88,92 **** #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) ! #define PyList_CheckExact(op) ((op)->ob_type == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); --- 88,92 ---- #define PyDict_Check(op) PyObject_TypeCheck(op, &PyDict_Type) ! #define PyDict_CheckExact(op) ((op)->ob_type == &PyDict_Type) PyAPI_FUNC(PyObject *) PyDict_New(void); From jhylton at users.sourceforge.net Fri Dec 26 14:05:07 2003 From: jhylton at users.sourceforge.net (jhylton@users.sourceforge.net) Date: Fri Dec 26 14:05:28 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.172,2.173 Message-ID: <E1AZxGl-0008So-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv32521 Modified Files: listobject.c Log Message: Revert previous two checkins to repair test failure. The special-case code that was removed could return a value indicating success but leave an exception set. test_fileinput failed in a debug build as a result. Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.172 retrieving revision 2.173 diff -C2 -d -r2.172 -r2.173 *** listobject.c 26 Dec 2003 00:09:04 -0000 2.172 --- listobject.c 26 Dec 2003 19:05:04 -0000 2.173 *************** *** 2235,2245 **** } - /* empirically determined threshold for activating an optimisation - * in list_fill() - 100 seems close to optimum for current CPUs and - * compilers, as of December '03. - * see also comment in list_fill(). - */ - #define LISTFILL_OPT_THRESHOLD 100 - /* Adapted from newer code by Tim */ static int --- 2235,2238 ---- *************** *** 2256,2276 **** n = result->ob_size; ! /* Special-case list(a_list), for speed: ! * - if the source has 0 elements, there's nothing to copy. ! * - if the source has more than a threshold number of elements ! * slice assignment is a faster way of filling the target ! * (the exact threshold is subject to empirical determination). ! * Also special case any other zero length sequence, including ! * subclasses of list, there being nothing to copy. ! */ ! if (PyList_CheckExact(v)) { ! i = PyList_GET_SIZE(v); ! if (i == 0) ! return 0; ! if (i > LISTFILL_OPT_THRESHOLD) ! return list_ass_slice(result, 0, n, v); ! } else ! if (PySequence_Check(v) && PySequence_Size(v) == 0) ! return 0; /* Empty previous contents */ --- 2249,2258 ---- n = result->ob_size; ! /* Special-case list(a_list), for speed. */ ! if (PyList_Check(v)) { ! if (v == (PyObject *)result) ! return 0; /* source is destination, we're done */ ! return list_ass_slice(result, 0, n, v); ! } /* Empty previous contents */ From nnorwitz at users.sourceforge.net Fri Dec 26 16:08:46 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Fri Dec 26 16:08:49 2003 Subject: [Python-checkins] python/dist/src/Python symtable.c, 2.10.8.16, 2.10.8.17 Message-ID: <E1AZzCQ-00054b-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv19371/Python Modified Files: Tag: ast-branch symtable.c Log Message: ste_varargs & ste_varkeywords need to be initialized, not sure these should always be false here, though Index: symtable.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v retrieving revision 2.10.8.16 retrieving revision 2.10.8.17 diff -C2 -d -r2.10.8.16 -r2.10.8.17 *** symtable.c 2 Dec 2003 07:04:51 -0000 2.10.8.16 --- symtable.c 26 Dec 2003 21:08:43 -0000 2.10.8.17 *************** *** 42,45 **** --- 42,47 ---- ste->ste_type = block; ste->ste_optimized = 0; + ste->ste_varargs = 0; + ste->ste_varkeywords = 0; ste->ste_opt_lineno = 0; ste->ste_lineno = lineno; From nnorwitz at users.sourceforge.net Sat Dec 27 11:14:08 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Dec 27 11:14:12 2003 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.36,1.1.2.37 Message-ID: <E1AaH4q-00035m-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv11872/Python Modified Files: Tag: ast-branch ast.c Log Message: Add a FIXME Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.36 retrieving revision 1.1.2.37 diff -C2 -d -r1.1.2.36 -r1.1.2.37 *** ast.c 2 Dec 2003 06:54:28 -0000 1.1.2.36 --- ast.c 27 Dec 2003 16:14:05 -0000 1.1.2.37 *************** *** 176,179 **** --- 176,184 ---- return Interactive(stmts); } + case encoding_decl: + /* XXX need to handle */ + fprintf(stderr, "error in PyAST_FromNode()" + " need to handle encoding\n"); + break; default: goto error; From nnorwitz at users.sourceforge.net Sat Dec 27 11:20:26 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sat Dec 27 11:20:30 2003 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.57, 1.1.2.58 Message-ID: <E1AaHAw-0003M8-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv12392/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Fix several problems (some from #752911): * add known limitation that file encoding doesn't work * create lambdas with keyword arguments properly * fix nested for loops * fix while loops * fix chained comparisons (needs to be cleaned up) * fix calling functions with keyword args (like foo(a=1, b=2)) Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.57 retrieving revision 1.1.2.58 diff -C2 -d -r1.1.2.57 -r1.1.2.58 *** newcompile.c 2 Dec 2003 07:01:20 -0000 1.1.2.57 --- newcompile.c 27 Dec 2003 16:20:23 -0000 1.1.2.58 *************** *** 9,12 **** --- 9,19 ---- int Py_OptimizeFlag = 0; + /* + KNOWN BUGS: + using coding statement, such as in getopt: + # -*- coding: iso-8859-1 -*- + generates: SystemError + */ + /* fblockinfo tracks the current frame block. *************** *** 95,98 **** --- 102,106 ---- static PyCodeObject *compiler_mod(struct compiler *, mod_ty); static int compiler_visit_stmt(struct compiler *, stmt_ty); + static int compiler_visit_keyword(struct compiler *, keyword_ty); static int compiler_visit_expr(struct compiler *, expr_ty); static int compiler_augassign(struct compiler *, stmt_ty); *************** *** 780,784 **** /* XXX closure */ ADDOP_O(c, LOAD_CONST, (PyObject *)co, consts); ! ADDOP_I(c, MAKE_FUNCTION, c->u->u_argcount); Py_DECREF(name); --- 788,792 ---- /* XXX closure */ ADDOP_O(c, LOAD_CONST, (PyObject *)co, consts); ! ADDOP_I(c, MAKE_FUNCTION, asdl_seq_LEN(args->defaults)); Py_DECREF(name); *************** *** 882,886 **** VISIT_SEQ(c, stmt, s->v.For.body); ADDOP_JABS(c, JUMP_ABSOLUTE, start); ! compiler_use_block(c, cleanup); ADDOP(c, POP_BLOCK); compiler_pop_fblock(c, LOOP, start); --- 890,894 ---- VISIT_SEQ(c, stmt, s->v.For.body); ADDOP_JABS(c, JUMP_ABSOLUTE, start); ! compiler_use_next_block(c, cleanup); ADDOP(c, POP_BLOCK); compiler_pop_fblock(c, LOOP, start); *************** *** 919,926 **** if there is no else clause ? */ - if (orelse == -1) - compiler_use_block(c, end); - else - compiler_use_block(c, orelse); ADDOP(c, POP_TOP); ADDOP(c, POP_BLOCK); --- 927,930 ---- *************** *** 1591,1599 **** int i, n, cleanup = -1; VISIT(c, expr, e->v.Compare.left); n = asdl_seq_LEN(e->v.Compare.ops); assert(n > 0); ! if (n > 1) cleanup = compiler_new_block(c); for (i = 1; i < n; i++) { ADDOP(c, DUP_TOP); --- 1595,1606 ---- int i, n, cleanup = -1; + /* XXX the logic can be cleaned up for 1 or multiple comparisons */ VISIT(c, expr, e->v.Compare.left); n = asdl_seq_LEN(e->v.Compare.ops); assert(n > 0); ! if (n > 1) { cleanup = compiler_new_block(c); + VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, 0)); + } for (i = 1; i < n; i++) { ADDOP(c, DUP_TOP); *************** *** 1605,1608 **** --- 1612,1617 ---- NEXT_BLOCK(c); ADDOP(c, POP_TOP); + if (i < (n - 1)) + VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, i)); } VISIT(c, expr, asdl_seq_GET(e->v.Compare.comparators, n - 1)); *************** *** 1628,1631 **** --- 1637,1644 ---- VISIT(c, expr, e->v.Call.func); n = asdl_seq_LEN(e->v.Call.args); + if (e->v.Call.keywords) { + VISIT_SEQ(c, keyword, e->v.Call.keywords); + n |= asdl_seq_LEN(e->v.Call.keywords) << 8; + } if (e->v.Call.starargs) { VISIT(c, expr, e->v.Call.starargs); *************** *** 1731,1734 **** --- 1744,1755 ---- } c->u->u_tmp = NULL; + return 1; + } + + static int + compiler_visit_keyword(struct compiler *c, keyword_ty k) + { + ADDOP_O(c, LOAD_CONST, k->arg, consts); + VISIT(c, expr, k->value); return 1; } From aimacintyre at users.sourceforge.net Sun Dec 28 02:42:34 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sun Dec 28 02:42:40 2003 Subject: [Python-checkins] python/dist/src/Objects listobject.c,2.173,2.174 Message-ID: <E1AaVZK-0000w6-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv3586 Modified Files: listobject.c Log Message: complete backout of listobject.c v2.171 Index: listobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v retrieving revision 2.173 retrieving revision 2.174 diff -C2 -d -r2.173 -r2.174 *** listobject.c 26 Dec 2003 19:05:04 -0000 2.173 --- listobject.c 28 Dec 2003 07:42:31 -0000 2.174 *************** *** 2243,2250 **** int i; - /* if source is destination, we're done. */ - if (v == (PyObject *)result) - return 0; - n = result->ob_size; --- 2243,2246 ---- From aimacintyre at users.sourceforge.net Sun Dec 28 02:43:59 2003 From: aimacintyre at users.sourceforge.net (aimacintyre@users.sourceforge.net) Date: Sun Dec 28 02:44:02 2003 Subject: [Python-checkins] python/dist/src/Misc ACKS, 1.255, 1.256 NEWS, 1.916, 1.917 Message-ID: <E1AaVah-0000xu-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Misc In directory sc8-pr-cvs1:/tmp/cvs-serv3686 Modified Files: ACKS NEWS Log Message: complete backout of listobject.c v2.171 Index: ACKS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/ACKS,v retrieving revision 1.255 retrieving revision 1.256 diff -C2 -d -r1.255 -r1.256 *** ACKS 25 Dec 2003 13:28:48 -0000 1.255 --- ACKS 28 Dec 2003 07:43:56 -0000 1.256 *************** *** 63,67 **** Matthew Boedicker David Bolen - Duncan Booth Jurjen Bos Peter Bosch --- 63,66 ---- Index: NEWS =================================================================== RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v retrieving revision 1.916 retrieving revision 1.917 diff -C2 -d -r1.916 -r1.917 *** NEWS 25 Dec 2003 13:28:48 -0000 1.916 --- NEWS 28 Dec 2003 07:43:56 -0000 1.917 *************** *** 119,130 **** working towards the beginning. See SF feature request 801847. - - in a thread on comp.lang.python, several people noted that list() - was much slower than in 2.1 and earlier versions of Python, when used - to create new lists from existing lists. Duncan Booth did some - research that uncovered an optimisation that, for lists below - about 100 elements, was actually slower than the normal case. The - special case criteria have been tightened to rectify the performance - regression. - Extension modules ----------------- --- 119,122 ---- From jackjansen at users.sourceforge.net Sun Dec 28 16:52:24 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:52:27 2003 Subject: [Python-checkins] python/dist/src/Mac/Distributions/(vise) Python 2.3.vct, 1.6.12.1, 1.6.12.2 Message-ID: <E1Aaipk-0003ce-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Distributions/(vise) In directory sc8-pr-cvs1:/tmp/cvs-serv13794/MacPython/Mac/Distributions/(vise) Modified Files: Tag: release23-maint Python 2.3.vct Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: Python 2.3.vct =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/(vise)/Attic/Python 2.3.vct,v retrieving revision 1.6.12.1 retrieving revision 1.6.12.2 diff -C2 -d -r1.6.12.1 -r1.6.12.2 Binary files /tmp/cvsUUFSJ1 and /tmp/cvsIfHkzZ differ From jackjansen at users.sourceforge.net Sun Dec 28 16:52:28 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:52:34 2003 Subject: [Python-checkins] python/dist/src/Mac/Distributions src.exclude, 1.8, 1.8.12.1 Message-ID: <E1Aaipo-0003dT-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory sc8-pr-cvs1:/tmp/cvs-serv13937/MacPython/Mac/Distributions Modified Files: Tag: release23-maint src.exclude Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: src.exclude =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/Attic/src.exclude,v retrieving revision 1.8 retrieving revision 1.8.12.1 diff -C2 -d -r1.8 -r1.8.12.1 *** src.exclude 8 Jan 2003 16:27:38 -0000 1.8 --- src.exclude 28 Dec 2003 21:52:26 -0000 1.8.12.1 *************** *** 21,22 **** --- 21,23 ---- PyIDE-src [(]*[)] + (vise) From jackjansen at users.sourceforge.net Sun Dec 28 16:52:32 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:52:42 2003 Subject: [Python-checkins] python/dist/src/Mac/Distributions src.include, 1.8.12.1, 1.8.12.2 Message-ID: <E1Aaips-0003dn-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory sc8-pr-cvs1:/tmp/cvs-serv13988/MacPython/Mac/Distributions Modified Files: Tag: release23-maint src.include Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: src.include =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/Attic/src.include,v retrieving revision 1.8.12.1 retrieving revision 1.8.12.2 diff -C2 -d -r1.8.12.1 -r1.8.12.2 *** src.include 4 Aug 2003 22:49:43 -0000 1.8.12.1 --- src.include 28 Dec 2003 21:52:30 -0000 1.8.12.2 *************** *** 40,43 **** --- 40,44 ---- (':Mac:Demo', '') (':Mac:Distributions:(vise)', None) + (':Mac:Distributions:.DS_Store', None) (':Mac:Distributions:68k-shared.exclude', None) (':Mac:Distributions:68k-shared.include', None) *************** *** 75,78 **** --- 76,80 ---- (':Mac:Tools:bruce', None) (':Mac:Tools:macfreeze', '') + (':Mac:Unsupported:unshar.py', '') (':Mac:Wastemods', '') (':Mac:_checkversion.py', None) *************** *** 121,124 **** --- 123,127 ---- (':Tools:scripts', '') (':Tools:unicode:makeunicodedata.py', '') + (':Tools:unicode:mkstringprep.py', '') (':Tools:versioncheck', '') (':Tools:webchecker', '') *************** *** 136,140 **** (':setup.py', None) (':site-packages', None) ! (':Mac:Distributions:.DS_Store', None) ! (':Mac:Unsupported:unshar.py', '') ! (':Tools:unicode:mkstringprep.py', '') --- 139,141 ---- (':setup.py', None) (':site-packages', None) ! (':aclocal.m4', '') From jackjansen at users.sourceforge.net Sun Dec 28 16:52:39 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:52:47 2003 Subject: [Python-checkins] python/dist/src/Mac/Distributions binary.include, 1.23.12.1, 1.23.12.2 Message-ID: <E1Aaipz-0003eB-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory sc8-pr-cvs1:/tmp/cvs-serv14012/MacPython/Mac/Distributions Modified Files: Tag: release23-maint binary.include Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: binary.include =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/Attic/binary.include,v retrieving revision 1.23.12.1 retrieving revision 1.23.12.2 diff -C2 -d -r1.23.12.1 -r1.23.12.2 *** binary.include 4 Aug 2003 22:49:43 -0000 1.23.12.1 --- binary.include 28 Dec 2003 21:52:37 -0000 1.23.12.2 *************** *** 158,161 **** --- 158,162 ---- (':Modules', None) (':Objects:Icon', None) + (':Objects:dictnotes.txt', None) (':Objects:listsort.txt', None) (':PC', None) *************** *** 190,193 **** --- 191,195 ---- (':Tools:scripts', '') (':Tools:unicode:makeunicodedata.py', '') + (':Tools:unicode:mkstringprep.py', '') (':Tools:versioncheck', '') (':Tools:webchecker', '') *************** *** 205,208 **** (':setup.py', None) (':site-packages', None) ! (':Tools:unicode:mkstringprep.py', '') ! (':Objects:dictnotes.txt', None) --- 207,209 ---- (':setup.py', None) (':site-packages', None) ! (':aclocal.m4', None) From jackjansen at users.sourceforge.net Sun Dec 28 16:52:47 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:52:54 2003 Subject: [Python-checkins] python/dist/src/Mac/Distributions dev.include, 1.29.10.1, 1.29.10.2 Message-ID: <E1Aaiq7-0003ed-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Distributions In directory sc8-pr-cvs1:/tmp/cvs-serv14040/MacPython/Mac/Distributions Modified Files: Tag: release23-maint dev.include Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: dev.include =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Distributions/Attic/dev.include,v retrieving revision 1.29.10.1 retrieving revision 1.29.10.2 diff -C2 -d -r1.29.10.1 -r1.29.10.2 *** dev.include 4 Aug 2003 22:49:43 -0000 1.29.10.1 --- dev.include 28 Dec 2003 21:52:45 -0000 1.29.10.2 *************** *** 242,245 **** --- 242,248 ---- (':Mac:Build:_Win.mcp.exp', None) (':Mac:Build:_Win.mcp.xml', None) + (':Mac:Build:_csv.carbon.mcp', None) + (':Mac:Build:_csv.carbon.mcp.exp', None) + (':Mac:Build:_csv.carbon.mcp.xml', None) (':Mac:Build:_dummy_tkinter.mcp', None) (':Mac:Build:_dummy_tkinter.mcp.exp', None) *************** *** 452,455 **** --- 455,459 ---- (':Modules:_bsddb.c', None) (':Modules:_codecsmodule.c', None) + (':Modules:_csv.c', None) (':Modules:_curses_panel.c', None) (':Modules:_cursesmodule.c', None) *************** *** 617,620 **** --- 621,625 ---- (':Tools:scripts', None) (':Tools:unicode:makeunicodedata.py', '') + (':Tools:unicode:mkstringprep.py', '') (':Tools:versioncheck', None) (':Tools:webchecker', None) *************** *** 633,639 **** (':setup.py', None) (':site-packages', None) ! (':Tools:unicode:mkstringprep.py', '') ! (':Modules:_csv.c', None) ! (':Mac:Build:_csv.carbon.mcp.xml', None) ! (':Mac:Build:_csv.carbon.mcp.exp', None) ! (':Mac:Build:_csv.carbon.mcp', None) --- 638,641 ---- (':setup.py', None) (':site-packages', None) ! (':aclocal.m4', None) ! (':Modules:gc_weakref.txt', None) From jackjansen at users.sourceforge.net Sun Dec 28 16:52:52 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:52:58 2003 Subject: [Python-checkins] python/dist/src/Mac ReadMe,1.48.8.1,1.48.8.2 Message-ID: <E1AaiqC-0003ez-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac In directory sc8-pr-cvs1:/tmp/cvs-serv14058/MacPython/Mac Modified Files: Tag: release23-maint ReadMe Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: ReadMe =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Attic/ReadMe,v retrieving revision 1.48.8.1 retrieving revision 1.48.8.2 diff -C2 -d -r1.48.8.1 -r1.48.8.2 *** ReadMe 4 Aug 2003 22:49:42 -0000 1.48.8.1 --- ReadMe 28 Dec 2003 21:52:50 -0000 1.48.8.2 *************** *** 1,3 **** ! How to install MacPython-OS9 2.3 on your Macintosh -------------------------------------------------- --- 1,3 ---- ! How to install MacPython-OS9 2.3.3 on your Macintosh -------------------------------------------------- *************** *** 19,24 **** only modules that are not shared with MacPython-OSX 2.3. - macfs is now a pure Python wrapper module around various modules in the ! Carbon package. For 2.3a2 only this wrapping is incomplete: fsspec.SetDates() ! does not work yet. If you encounter any other problems please report them. ------ --- 19,23 ---- only modules that are not shared with MacPython-OSX 2.3. - macfs is now a pure Python wrapper module around various modules in the ! Carbon package. ------ *************** *** 83,91 **** test_tarfile fails, this problem is being investigated. ! Three tests will fail on MacOS9 with MemoryErrors: test_longexp, test_sha and test_zlib (on MacOSX these should pass). ! If you increase the PythonInterpreter memory partition size they will ! pass (but for longexp you have to increase it by an incredible amount, 400MB is rumoured). It will, however, print some messages about optional features not supported. You should not worry about these, --- 82,92 ---- test_tarfile fails, this problem is being investigated. ! Four tests may fail on MacOS9 with MemoryErrors: test_import, test_longexp, test_sha and test_zlib (on MacOSX these should pass). + If test_import fails various later tests will also fail, increase + memory size to 64MB or so to make it pass. ! If you increase the PythonInterpreter memory partition size the tests will ! all pass (but for longexp you have to increase it by an incredible amount, 400MB is rumoured). It will, however, print some messages about optional features not supported. You should not worry about these, *************** *** 93,98 **** platforms. Also, if you didn't run compileall before autotesting you may run out of memory the first time you run the tests. test_socket ! may also fail if you have no internet connection. Please also read the ! Relnotes file for other minor problems with this distribution. Using Python is most easily done from the IDE, which has a builtin --- 94,98 ---- platforms. Also, if you didn't run compileall before autotesting you may run out of memory the first time you run the tests. test_socket ! may also fail if you have no internet connection. Using Python is most easily done from the IDE, which has a builtin *************** *** 127,131 **** Up to three items are installed in the MacOS 8 or 9 system folder: the interpreter shared library PythonCore lives in the Extensions ! folder and the "Python 2.3a2 Preferences" file in the Python subfolder in the Preferences folder. All the rest of Python lives in the folder you installed in. --- 127,131 ---- Up to three items are installed in the MacOS 8 or 9 system folder: the interpreter shared library PythonCore lives in the Extensions ! folder and the "Python 2.3.3 Preferences" file in the Python subfolder in the Preferences folder. All the rest of Python lives in the folder you installed in. *************** *** 171,177 **** are lost and you have to set them again. ! After you are satisfied that 2.3a2 works as expected you can trash anything in the system folder that has "python" in the name and not ! "2.3a2". The ConfigurePython applet will try to detect incompatible --- 171,177 ---- are lost and you have to set them again. ! After you are satisfied that 2.3.3 works as expected you can trash anything in the system folder that has "python" in the name and not ! "2.3.3". The ConfigurePython applet will try to detect incompatible From jackjansen at users.sourceforge.net Sun Dec 28 16:52:56 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:53:02 2003 Subject: [Python-checkins] python/dist/src/Mac/mwerks mwerks_pyexpat_config.h, 1.2, 1.2.12.1 Message-ID: <E1AaiqG-0003fK-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/mwerks In directory sc8-pr-cvs1:/tmp/cvs-serv14081/MacPython/Mac/mwerks Modified Files: Tag: release23-maint mwerks_pyexpat_config.h Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: mwerks_pyexpat_config.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/mwerks/Attic/mwerks_pyexpat_config.h,v retrieving revision 1.2 retrieving revision 1.2.12.1 diff -C2 -d -r1.2 -r1.2.12.1 *** mwerks_pyexpat_config.h 21 Feb 2003 22:33:53 -0000 1.2 --- mwerks_pyexpat_config.h 28 Dec 2003 21:52:54 -0000 1.2.12.1 *************** *** 8,9 **** --- 8,10 ---- #define BYTEORDER 4321 #define XML_CONTEXT_BYTES 1024 + #define HAVE_MEMMOVE From jackjansen at users.sourceforge.net Sun Dec 28 16:53:00 2003 From: jackjansen at users.sourceforge.net (jackjansen@users.sourceforge.net) Date: Sun Dec 28 16:53:08 2003 Subject: [Python-checkins] python/dist/src/Mac/Include macbuildno.h, 1.27.10.1, 1.27.10.2 Message-ID: <E1AaiqK-0003fm-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Mac/Include In directory sc8-pr-cvs1:/tmp/cvs-serv14107/MacPython/Mac/Include Modified Files: Tag: release23-maint macbuildno.h Log Message: (Tentative) files used for MacPython-OS9 2.3.3 distribution. Index: macbuildno.h =================================================================== RCS file: /cvsroot/python/python/dist/src/Mac/Include/Attic/macbuildno.h,v retrieving revision 1.27.10.1 retrieving revision 1.27.10.2 diff -C2 -d -r1.27.10.1 -r1.27.10.2 *** macbuildno.h 4 Aug 2003 22:49:43 -0000 1.27.10.1 --- macbuildno.h 28 Dec 2003 21:52:58 -0000 1.27.10.2 *************** *** 1 **** ! #define BUILD 155 --- 1 ---- ! #define BUILD 156 From perky at users.sourceforge.net Sun Dec 28 20:36:04 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Dec 28 20:36:10 2003 Subject: [Python-checkins] python/dist/src/Objects unicodectype.c,2.13,2.14 Message-ID: <E1AamKC-0004Gt-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv16253/Objects Modified Files: unicodectype.c Log Message: Fix gcc 3.3 warnings related to Py_UNICODE_WIDE. Index: unicodectype.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/unicodectype.c,v retrieving revision 2.13 retrieving revision 2.14 diff -C2 -d -r2.13 -r2.14 *** unicodectype.c 18 Oct 2002 16:40:36 -0000 2.13 --- unicodectype.c 29 Dec 2003 01:36:01 -0000 2.14 *************** *** 37,43 **** int index; if (code >= 0x110000) index = 0; ! else { index = index1[(code>>SHIFT)]; index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))]; --- 37,46 ---- int index; + #ifdef Py_UNICODE_WIDE if (code >= 0x110000) index = 0; ! else ! #endif ! { index = index1[(code>>SHIFT)]; index = index2[(index<<SHIFT)+(code&((1<<SHIFT)-1))]; From perky at users.sourceforge.net Sun Dec 28 20:36:04 2003 From: perky at users.sourceforge.net (perky@users.sourceforge.net) Date: Sun Dec 28 20:36:15 2003 Subject: [Python-checkins] python/dist/src/Python codecs.c,2.21,2.22 Message-ID: <E1AamKC-0004Gw-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv16253/Python Modified Files: codecs.c Log Message: Fix gcc 3.3 warnings related to Py_UNICODE_WIDE. Index: codecs.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/codecs.c,v retrieving revision 2.21 retrieving revision 2.22 diff -C2 -d -r2.21 -r2.22 *** codecs.c 19 Mar 2003 00:35:35 -0000 2.21 --- codecs.c 29 Dec 2003 01:36:01 -0000 2.22 *************** *** 564,567 **** --- 564,571 ---- else if (*p<10000) ressize += 2+4+1; + #ifndef Py_UNICODE_WIDE + else + ressize += 2+5+1; + #else else if (*p<100000) ressize += 2+5+1; *************** *** 570,573 **** --- 574,578 ---- else ressize += 2+7+1; + #endif } /* allocate replacement */ *************** *** 601,604 **** --- 606,615 ---- base = 1000; } + #ifndef Py_UNICODE_WIDE + else { + digits = 5; + base = 10000; + } + #else else if (*p<100000) { digits = 5; *************** *** 613,616 **** --- 624,628 ---- base = 1000000; } + #endif while (digits-->0) { *outp++ = '0' + c/base; *************** *** 656,662 **** startp = PyUnicode_AS_UNICODE(object); for (p = startp+start, ressize = 0; p < startp+end; ++p) { if (*p >= 0x00010000) ressize += 1+1+8; ! else if (*p >= 0x100) { ressize += 1+1+4; } --- 668,677 ---- startp = PyUnicode_AS_UNICODE(object); for (p = startp+start, ressize = 0; p < startp+end; ++p) { + #ifdef Py_UNICODE_WIDE if (*p >= 0x00010000) ressize += 1+1+8; ! else ! #endif ! if (*p >= 0x100) { ressize += 1+1+4; } *************** *** 671,674 **** --- 686,690 ---- Py_UNICODE c = *p; *outp++ = '\\'; + #ifdef Py_UNICODE_WIDE if (c >= 0x00010000) { *outp++ = 'U'; *************** *** 680,684 **** *outp++ = hexdigits[(c>>8)&0xf]; } ! else if (c >= 0x100) { *outp++ = 'u'; *outp++ = hexdigits[(c>>12)&0xf]; --- 696,702 ---- *outp++ = hexdigits[(c>>8)&0xf]; } ! else ! #endif ! if (c >= 0x100) { *outp++ = 'u'; *outp++ = hexdigits[(c>>12)&0xf]; From nnorwitz at users.sourceforge.net Sun Dec 28 22:48:13 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 28 22:48:16 2003 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.37,1.1.2.38 Message-ID: <E1AaoO5-0000HW-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv1003/Python Modified Files: Tag: ast-branch ast.c Log Message: Ignore encoding_decls for now Fix problem with bare print (no args) Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.37 retrieving revision 1.1.2.38 diff -C2 -d -r1.1.2.37 -r1.1.2.38 *** ast.c 27 Dec 2003 16:14:05 -0000 1.1.2.37 --- ast.c 29 Dec 2003 03:48:11 -0000 1.1.2.38 *************** *** 177,184 **** } case encoding_decl: ! /* XXX need to handle */ ! fprintf(stderr, "error in PyAST_FromNode()" ! " need to handle encoding\n"); ! break; default: goto error; --- 177,186 ---- } case encoding_decl: ! /* XXX need to handle properlyi, ignore for now */ ! stmts = asdl_seq_new(1); ! if (!stmts) ! return NULL; ! asdl_seq_SET(stmts, 0, Pass(n->n_lineno)); ! return Interactive(stmts); default: goto error; *************** *** 1330,1334 **** REQ(n, print_stmt); ! if (TYPE(CHILD(n, 1)) == RIGHTSHIFT) { dest = ast_for_expr(CHILD(n, 2)); if (!dest) --- 1332,1336 ---- REQ(n, print_stmt); ! if (NCH(n) >= 2 && TYPE(CHILD(n, 1)) == RIGHTSHIFT) { dest = ast_for_expr(CHILD(n, 2)); if (!dest) From nnorwitz at users.sourceforge.net Sun Dec 28 22:49:45 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Sun Dec 28 22:49:48 2003 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.58, 1.1.2.59 Message-ID: <E1AaoPZ-0000JZ-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv1097/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Doc the known bugs better Start adding a few placeholders for encoding Try to fix while loops (jumped to wrong place) Fix calls to functions with keyword args (positional args go before keywords) Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.58 retrieving revision 1.1.2.59 diff -C2 -d -r1.1.2.58 -r1.1.2.59 *** newcompile.c 27 Dec 2003 16:20:23 -0000 1.1.2.58 --- newcompile.c 29 Dec 2003 03:49:43 -0000 1.1.2.59 *************** *** 11,17 **** /* KNOWN BUGS: using coding statement, such as in getopt: # -*- coding: iso-8859-1 -*- ! generates: SystemError */ --- 11,28 ---- /* KNOWN BUGS: + + 1: using coding statement, such as in getopt: # -*- coding: iso-8859-1 -*- ! needs to be implemented (see also Python/ast.c encoding_decl) ! ! 2: ! LOAD_NAME is output instead of LOAD_GLOBAL ! ! 3: ! Get this err msg: XXX rd_object called with exception set ! From Python/marshal.c::PyMarshal_ReadLastObjectFromFile() ! This looks like it may be related to #1. ! */ *************** *** 73,76 **** --- 84,88 ---- struct compiler_unit *u; PyObject *c_stack; + char *c_encoding; /* source encoding (a borrowed reference) */ }; *************** *** 201,204 **** --- 213,219 ---- fprintf(stderr, "symtable %s\n", filename); + /* XXX initialize to NULL for now, need to handle */ + c.c_encoding = NULL; + co = compiler_mod(&c, mod); *************** *** 901,908 **** compiler_while(struct compiler *c, stmt_ty s) { ! int loop, orelse, end; loop = compiler_new_block(c); end = compiler_new_block(c); ! if (loop < 0 || end < 0) return 0; if (s->v.While.orelse) { --- 916,924 ---- compiler_while(struct compiler *c, stmt_ty s) { ! int loop, orelse, end, anchor; loop = compiler_new_block(c); end = compiler_new_block(c); ! anchor = compiler_new_block(c); ! if (loop < 0 || end < 0 || anchor < 0) return 0; if (s->v.While.orelse) { *************** *** 919,923 **** return 0; VISIT(c, expr, s->v.While.test); ! ADDOP_JREL(c, JUMP_IF_FALSE, orelse == -1 ? end : orelse); ADDOP(c, POP_TOP); VISIT_SEQ(c, stmt, s->v.While.body); --- 935,939 ---- return 0; VISIT(c, expr, s->v.While.test); ! ADDOP_JREL(c, JUMP_IF_FALSE, anchor); ADDOP(c, POP_TOP); VISIT_SEQ(c, stmt, s->v.While.body); *************** *** 927,930 **** --- 943,947 ---- if there is no else clause ? */ + compiler_use_block(c, anchor); ADDOP(c, POP_TOP); ADDOP(c, POP_BLOCK); *************** *** 1637,1640 **** --- 1654,1658 ---- VISIT(c, expr, e->v.Call.func); n = asdl_seq_LEN(e->v.Call.args); + VISIT_SEQ(c, expr, e->v.Call.args); if (e->v.Call.keywords) { VISIT_SEQ(c, keyword, e->v.Call.keywords); *************** *** 1649,1653 **** code |= 2; } - VISIT_SEQ(c, expr, e->v.Call.args); switch (code) { case 0: --- 1667,1670 ---- From nnorwitz at users.sourceforge.net Mon Dec 29 17:10:44 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon Dec 29 17:10:52 2003 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.59, 1.1.2.60 Message-ID: <E1Ab5b2-0006Gs-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv23913/Python Modified Files: Tag: ast-branch newcompile.c Log Message: Add a few more known problems Fix nested if statements Fix for statements Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.59 retrieving revision 1.1.2.60 diff -C2 -d -r1.1.2.59 -r1.1.2.60 *** newcompile.c 29 Dec 2003 03:49:43 -0000 1.1.2.59 --- newcompile.c 29 Dec 2003 22:10:41 -0000 1.1.2.60 *************** *** 18,28 **** 2: - LOAD_NAME is output instead of LOAD_GLOBAL - - 3: Get this err msg: XXX rd_object called with exception set From Python/marshal.c::PyMarshal_ReadLastObjectFromFile() This looks like it may be related to #1. */ --- 18,33 ---- 2: Get this err msg: XXX rd_object called with exception set From Python/marshal.c::PyMarshal_ReadLastObjectFromFile() This looks like it may be related to #1. + 3: + LOAD_NAME is output instead of LOAD_GLOBAL + + 4: + typing Ctrl-C seg faults + + 5: + line numbers are off */ *************** *** 856,884 **** if (end < 0) return 0; ! for (;;) { ! next = compiler_new_block(c); ! if (next < 0) ! return 0; ! VISIT(c, expr, s->v.If.test); ! ADDOP_JREL(c, JUMP_IF_FALSE, next); ! ADDOP(c, POP_TOP); ! VISIT_SEQ(c, stmt, s->v.If.body); ! ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_next_block(c, next); ! ADDOP(c, POP_TOP); ! if (s->v.If.orelse) { ! stmt_ty t = asdl_seq_GET(s->v.If.orelse, 0); ! if (t->kind == If_kind) { ! s = t; ! c->u->u_lineno = t->lineno; ! } ! else { ! VISIT_SEQ(c, stmt, s->v.If.orelse); ! break; ! } ! } ! else ! break; ! } compiler_use_next_block(c, end); return 1; --- 861,876 ---- if (end < 0) return 0; ! next = compiler_new_block(c); ! if (next < 0) ! return 0; ! VISIT(c, expr, s->v.If.test); ! ADDOP_JREL(c, JUMP_IF_FALSE, next); ! ADDOP(c, POP_TOP); ! VISIT_SEQ(c, stmt, s->v.If.body); ! ADDOP_JREL(c, JUMP_FORWARD, end); ! compiler_use_next_block(c, next); ! ADDOP(c, POP_TOP); ! if (s->v.If.orelse) ! VISIT_SEQ(c, stmt, s->v.If.orelse); compiler_use_next_block(c, end); return 1; *************** *** 905,909 **** VISIT_SEQ(c, stmt, s->v.For.body); ADDOP_JABS(c, JUMP_ABSOLUTE, start); ! compiler_use_next_block(c, cleanup); ADDOP(c, POP_BLOCK); compiler_pop_fblock(c, LOOP, start); --- 897,901 ---- VISIT_SEQ(c, stmt, s->v.For.body); ADDOP_JABS(c, JUMP_ABSOLUTE, start); ! compiler_use_block(c, cleanup); ADDOP(c, POP_BLOCK); compiler_pop_fblock(c, LOOP, start); From nnorwitz at users.sourceforge.net Mon Dec 29 17:11:35 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Mon Dec 29 17:11:39 2003 Subject: [Python-checkins] python/dist/src/Python ast.c,1.1.2.38,1.1.2.39 Message-ID: <E1Ab5br-0006JZ-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv24258/Python Modified Files: Tag: ast-branch ast.c Log Message: try to plug some memory leaks and doc places that may need fixes Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.38 retrieving revision 1.1.2.39 diff -C2 -d -r1.1.2.38 -r1.1.2.39 *** ast.c 29 Dec 2003 03:48:11 -0000 1.1.2.38 --- ast.c 29 Dec 2003 22:11:32 -0000 1.1.2.39 *************** *** 652,656 **** listcomps = asdl_seq_new(n_fors); if (!listcomps) { ! /* XXX free elt? */ return NULL; } --- 652,656 ---- listcomps = asdl_seq_new(n_fors); if (!listcomps) { ! /* XXX free(elt); */ return NULL; } *************** *** 667,670 **** --- 667,671 ---- if (!t) { asdl_seq_free(listcomps); + /* XXX free(elt); */ return NULL; } *************** *** 672,675 **** --- 673,677 ---- if (!expression) { asdl_seq_free(listcomps); + /* XXX free(elt); */ return NULL; } *************** *** 682,685 **** --- 684,688 ---- if (!c) { asdl_seq_free(listcomps); + /* XXX free(elt); */ return NULL; } *************** *** 693,696 **** --- 696,700 ---- if (n_ifs == -1) { asdl_seq_free(listcomps); + /* XXX free(elt); */ return NULL; } *************** *** 698,703 **** ifs = asdl_seq_new(n_ifs); if (!ifs) { - /* XXX free elt? */ asdl_seq_free(listcomps); return NULL; } --- 702,707 ---- ifs = asdl_seq_new(n_ifs); if (!ifs) { asdl_seq_free(listcomps); + /* XXX free(elt); */ return NULL; } *************** *** 1087,1092 **** if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { expr_ty f = ast_for_expr(CHILD(n, NCH(n) - 1)); ! if (!f) return NULL; return BinOp(e, Pow, f); } --- 1091,1098 ---- if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { expr_ty f = ast_for_expr(CHILD(n, NCH(n) - 1)); ! if (!f) { ! /* XXX free(e); */ return NULL; + } return BinOp(e, Pow, f); } *************** *** 1100,1105 **** new = ast_for_call(CHILD(ch, 1), new); ! if (!new) return NULL; } else if (TYPE(CHILD(ch, 0)) == LSQB) { --- 1106,1113 ---- new = ast_for_call(CHILD(ch, 1), new); ! if (!new) { ! /* XXX free(e); */ return NULL; + } } else if (TYPE(CHILD(ch, 0)) == LSQB) { *************** *** 1108,1117 **** if (NCH(ch) <= 2) { slice_ty slc = ast_for_slice(CHILD(ch, 0)); ! if (!slc) return NULL; new = Subscript(e, slc, Load); ! if (!new) return NULL; } else { --- 1116,1130 ---- if (NCH(ch) <= 2) { slice_ty slc = ast_for_slice(CHILD(ch, 0)); ! if (!slc) { ! /* XXX free(e); */ return NULL; + } new = Subscript(e, slc, Load); ! if (!new) { ! /* XXX free(e); */ ! /* XXX free(slc); */ return NULL; + } } else { *************** *** 1119,1134 **** slice_ty slc; asdl_seq *slices = asdl_seq_new(NCH(ch) / 2); ! if (!slices) return NULL; for (j = 0; j < NCH(ch); j += 2) { slc = ast_for_slice(CHILD(ch, j)); ! if (!slc) return NULL; asdl_seq_SET(slices, j / 2, slc); } new = Subscript(e, ExtSlice(slices), Load); ! if (!new) return NULL; } } --- 1132,1155 ---- slice_ty slc; asdl_seq *slices = asdl_seq_new(NCH(ch) / 2); ! if (!slices) { ! /* XXX free(e); */ return NULL; + } for (j = 0; j < NCH(ch); j += 2) { slc = ast_for_slice(CHILD(ch, j)); ! if (!slc) { ! /* XXX free(e); */ ! asdl_seq_free(slices); return NULL; + } asdl_seq_SET(slices, j / 2, slc); } new = Subscript(e, ExtSlice(slices), Load); ! if (!new) { ! /* XXX free(e); */ ! asdl_seq_free(slices); return NULL; + } } } *************** *** 1136,1141 **** assert(TYPE(CHILD(ch, 0)) == DOT); new = Attribute(e, NEW_IDENTIFIER(CHILD(ch, 1)), Load); ! if (!new) return NULL; } e = new; --- 1157,1164 ---- assert(TYPE(CHILD(ch, 0)) == DOT); new = Attribute(e, NEW_IDENTIFIER(CHILD(ch, 1)), Load); ! if (!new) { ! /* XXX free(e); */ return NULL; + } } e = new; *************** *** 1343,1348 **** for (i = start; i < NCH(n); i += 2) { expression = ast_for_expr(CHILD(n, i)); ! if (!expression) return NULL; asdl_seq_APPEND(seq, expression); --- 1366,1373 ---- for (i = start; i < NCH(n); i += 2) { expression = ast_for_expr(CHILD(n, i)); ! if (!expression) { ! asdl_seq_free(seq); return NULL; + } asdl_seq_APPEND(seq, expression); *************** *** 2090,2095 **** } s = ast_for_suite(CHILD(n, 6)); ! if (!s) return NULL; return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, s, LINENO(n)); } --- 2115,2122 ---- } s = ast_for_suite(CHILD(n, 6)); ! if (!s) { ! asdl_seq_free(bases); /* XXX is this right for Tuples??? */ return NULL; + } return ClassDef(NEW_IDENTIFIER(CHILD(n, 1)), bases, s, LINENO(n)); } From gvanrossum at users.sourceforge.net Tue Dec 30 01:06:37 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 01:06:42 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench - New directory Message-ID: <E1AbD1Z-0000bA-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv2293/parrotbench Log Message: Directory /cvsroot/python/python/nondist/sandbox/parrotbench added to the repository From gvanrossum at users.sourceforge.net Tue Dec 30 01:12:59 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 01:13:11 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b0.py, NONE, 1.1 b1.py, NONE, 1.1 b2.py, NONE, 1.1 out0, NONE, 1.1 out1, NONE, 1.1 out2, NONE, 1.1 Message-ID: <E1AbD7j-0000pZ-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv3189 Added Files: b0.py b1.py b2.py out0 out1 out2 Log Message: Very preliminary work on the Parrot benchmark. Ideas for making it nastier welcome. --- NEW FILE: b0.py --- def check(b, msg=None): if not b: raise AssertionError(msg) def proto___new__(cls, name): if name in cls.name2num: return cls.name2num[name] cls.name2num[name] = obj = int.__new__(cls, cls.next) cls.num2name[obj] = name cls.next += 1 return obj def proto___repr__(self): return self.__class__.num2name[self] class MetaToken(type): def __new__(metacls, name, bases, vars): cls = type.__new__(metacls, name, bases, vars) cls.__new__ = staticmethod(proto___new__) cls.__repr__ = cls.__str__ = proto___repr__ cls.next = 0 cls.name2num = {} cls.num2name = {} return cls Token = MetaToken('Token', (int,), {}) EOF = Token('EOF') INDENT = Token('INDENT') DEDENT = Token('DEDENT') NEWLINE = Token('NEWLINE') NAME = Token('NAME') NUMBER = Token('NUMBER') STRING = Token('STRING') OPERATOR = Token('OPERATOR') ##print INDENT, DEDENT class Scanner(object): # A vaguely Pythonic tokenizer def __init__(self, getc): self.getc = getc self.indents = [0] def tokenize(self, eolchars = ('', '\r', '\n'), quotes = ('"', '\''), hspaces = (' ', '\t'), longops = dict.fromkeys( ('<<', '>>', '<=', '>=', '==', '!=', '//', '**'))): # A generator yielding successive tokens to the parser # Each token is a (tokentype, value) pair getc = self.getc nextc = getc() while True: col = 0 while nextc.isspace(): if nextc == '\t': col = ((col//8) + 1)*8 elif nextc == ' ': col += 1 else: col = 0 # \f, \v, \r, \n all reset the column nextc = getc() if nextc == '#': while nextc not in eolchars: nextc = getc() continue if col != self.indents[-1]: while col < self.indents[-1]: yield DEDENT, '' del self.indents[-1] # This will yield DEDENT + INDENT for inconsistent dedent if col > self.indents[-1]: yield INDENT, '' self.indents.append(col) while nextc not in eolchars: if nextc.isalpha() or nextc == '_': name = '' while nextc.isalnum() or nextc == '_': name += nextc nextc = getc() yield NAME, name elif nextc.isdigit(): number = '' while nextc.isdigit(): number += nextc nextc = getc() yield NUMBER, number elif nextc in quotes: quote = nextc s = nextc nextc = getc() while nextc != quote: if nextc in eolchars: if not nextc: raise SyntaxError("EOF in string") raise SyntaxError("unescaped %r in string" % nextc) s += nextc if nextc == '\\': nextc = getc() s += nextc nextc = getc() s += nextc nextc = getc() yield STRING, s elif nextc == '#': while nextc not in eolchars: nextc = getc() elif nextc in hspaces: nextc = getc() else: c1 = nextc nextc = getc() if c1+nextc in longops: c2 = nextc nextc = getc() yield OPERATOR, c1+c2 else: yield OPERATOR, c1 yield NEWLINE, '' nextc = getc() if not nextc: while self.indents[-1]: yield DEDENT, '' del self.indents[-1] break yield EOF, '' class Link(object): __slots__ = ['value', 'next'] def __init__(self): self.value = None self.next = None class Clone(object): __slots__ = ['link', 'itnext'] def __init__(self, it, link=None): if isinstance(it, Clone): self.itnext = it.itnext self.link = it.link else: self.itnext = it.next self.link = Link() def __iter__(self): return self def next(self): next = self.link.next if next is None: self.link.value = value = self.itnext() self.link.next = next = Link() else: value = self.link.value self.link = next return value def getcFromString(s): for c in s: yield c while True: yield '' sample = ''' def pi(): # Compute digits of Pi. Algorithm due to LGLT Meertens. k, a, b, a1, b1 = 2, 4, 1, 12, 4 while 1: p, q, k = k*k, 2*k+1, k+1 a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 d, d1 = a//b, a1//b1 while d == d1: yield d a, a1 = 10*(a%b), 10*(a1%b1) d, d1 = a//b, a1//b1 def strhash(s): if s == '': return 0 x = ord(s[0])<<7 for c in s: x = ((1000003*x) ^ ord(c)) & 4294967295 # 0xffffffff return x^len(s) ''' s = Scanner(getcFromString(sample).next) it = Clone(s.tokenize()) it2 = Clone(it) L = [] for pair in it: L.append(pair) L2 = list(it2) check(L == L2) operators = { '<': 1, '<=': 1, '==': 1, '!=': 1, '>': 1, '>=': 1, '|': 2, '^': 3, '&': 4, '<<': 5, '>>': 5, '+': 6, '-': 6, '*': 7, '/': 7, '//': 7, '%': 7, '**': 8, } dispatch = { '<': lambda x, y: x < y, '<=': lambda x, y: x <= y, '==': lambda x, y: x == y, '!=': lambda x, y: x != y, '>': lambda x, y: x > y, '>=': lambda x, y: x >= y, '|': lambda x, y: x | y, '^': lambda x, y: x ^ y, '&': lambda x, y: x & y, '<<': lambda x, y: x << y, '>>': lambda x, y: x >> y, '+': lambda x, y: x + y, '-': lambda x, y: x - y, '*': lambda x, y: x * y, '/': lambda x, y: x / y, '%': lambda x, y: x % y, '//': lambda x, y: x // y, '**': lambda x, y: x ** y, } class DoReturn(Exception): def __init__(self, value=None): self.value = value def eval(body, globals, locals): for stmt in body: stmt.eval(globals, locals) def geneval(body, globals, locals): for stmt in body: for value in stmt.geneval(globals, locals): yield value def isgenerator(body): for stmt in body: if stmt.isgenerator(): return True return False class Function(object): def __init__(self, name, args, body, globals): self.name = name self.args = args self.body = body self.globals = globals def __call__(self, *args): check(len(args) == len(self.args)) locals = dict(zip(self.args, args)) try: eval(self.body, self.globals, locals) except DoReturn, exc: return exc.value class Generator(Function): def __call__(self, *args): check(len(args) == len(self.args)) locals = dict(zip(self.args, args)) try: for value in geneval(self.body, self.globals, locals): yield value except DoReturn, exc: if exc.value is not None: raise RuntimeError("'return' with argument in generator") return class Node(object): def isgenerator(self): return False def geneval(self, globals, locals): self.eval(globals, locals) if False: yield None class Define(Node): def __init__(self, name, args, body): self.name = name self.args = args self.body = body def __repr__(self): return "%s(%r, %r, ...)" % (self.__class__.__name__, self.name, self.args) def eval(self, globals, locals): if isgenerator(self.body): obj = Generator(self.name, self.args, self.body, globals) else: obj = Function(self.name, self.args, self.body, globals) globals[self.name] = obj class For(Node): def __init__(self, var, seq, body): self.var = var self.seq = seq self.body = body def __repr__(self): return "%s(%r, %r, ...)" % (self.__class__.__name__, self.var, self.seq) def eval(self, globals, locals): for value in self.seq.eval(globals, locals): self.var.assign(value, globals, locals) eval(self.body, globals, locals) def geneval(self, globals, locals): for value in self.seq.eval(globals, locals): self.var.assign(value, globals, locals) for v in geneval(self.body, globals, locals): yield v class While(Node): def __init__(self, test, body): self.test = test self.body = body def __repr__(self): return "%s(%r, ...)" % (self.__class__.__name__, self.test) def isgenerator(self): return isgenerator(self.body) def eval(self, globals, locals): while self.test.eval(globals, locals): eval(self.body, globals, locals) def geneval(self, globals, locals): while self.test.eval(globals, locals): for value in geneval(self.body, globals, locals): yield value class If(Node): def __init__(self, test, body): self.test = test self.body = body def __repr__(self): return "%s(%r, ...)" % (self.__class__.__name__, self.test) def isgenerator(self): return isgenerator(self.body) def eval(self, globals, locals): if self.test.eval(globals, locals): eval(self.body, globals, locals) def geneval(self, globals, locals): if self.test.eval(globals, locals): for value in geneval(self.body, globals, locals): yield value class Return(Node): def __init__(self, expr=None): self.expr = expr def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.expr) def eval(self, globals, locals): if self.expr is None: value = None else: value = self.expr.eval(globals, locals) raise DoReturn(value) class Yield(Node): def __init__(self, expr): self.expr = expr def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.expr) def isgenerator(self): return True def geneval(self, globals, locals): if self.expr is None: value = None else: value = self.expr.eval(globals, locals) yield value class Print(Node): def __init__(self, exprs): if not isinstance(exprs, list): exprs = [exprs] self.exprs = exprs def eval(self, globals, locals): for e in self.exprs: print e.eval(globals, locals), print class Assign(Node): def __init__(self, lhs, expr): self.lhs = lhs self.expr = expr def __repr__(self): return "%s(%r, %r)" % (self.__class__.__name__, self.lhs, self.expr) def eval(self, globals, locals): value = self.expr.eval(globals, locals) for v in self.lhs: v.assign(value, globals, locals) class Exprs(Node): def __init__(self, exprs): self.exprs = exprs def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.exprs) def eval(self, globals, locals): return tuple([e.eval(globals, locals) for e in self.exprs]) def assign(self, value, globals, locals): if len(self.exprs) != len(value): raise TypeError("multi-assign length mismatch") for e, v in zip(self.exprs, value): e.assign(v, globals, locals) class Binop(Node): def __init__(self, left, op, right): self.left = left self.op = op self.right = right self.opeval = dispatch[self.op] def __repr__(self): return "%s(%r, %r, %r)" % (self.__class__.__name__, self.left, self.op, self.right) def eval(self, globals, locals): return self.opeval(self.left.eval(globals, locals), self.right.eval(globals, locals)) class Attribute(Node): def __init__(self, expr, name): self.expr = expr self.name = name def __repr__(self): return "%s(%r, %r)" % (self.__class__.__name__, self.expr, self.name) def eval(self, globals, locals): v = self.expr.eval(globals, locals) return getattr(v, self.name) class Index(Node): def __init__(self, expr, index): self.expr = expr self.index = index def __repr__(self): return "%s(%r, %r)" % (self.__class__.__name__, self.expr, self.index) def eval(self, globals, locals): v = self.expr.eval(globals, locals) return v[self.index.eval(globals, locals)] class Call(Node): def __init__(self, expr, args): if not isinstance(args, list): args = [args] self.expr = expr self.args = args def __repr__(self): return "%s(%r, %r)" % (self.__class__.__name__, self.expr, self.args) def eval(self, globals, locals): f = self.expr.eval(globals, locals) args = [a.eval(globals, locals) for a in self.args] return f(*args) class Literal(Node): def __init__(self, literal): self.literal = literal self.value = self.evalit() def eval(self, globals, locals): return self.value def __repr__(self): return "%s(%r)" % (self.__class__.__name__, self.literal) simple_escapes = {"a": "\a", "b": "\b", "f": "\f", "n": "\n", "r": "\r", "t": "\t", "v": "\v", "'": "'", '"': '"', "\\": "\\"} class String(Literal): def evalit(self, octals='01234567'): s = self.literal[1:-1] if '\\' not in s: return s L = [] it = iter(range(len(s))) for i in it: c = s[i] if c != '\\': L.append(c) else: i = it.next() c = s[i] if c == 'x': if i+2 >= len(s): raise ValueError("incomplete \\x escape in string") d1 = s[it.next()] d2 = s[it.next()] L.append(chr(int(d1+d2, 16))) elif c in octals: if i+1 < len(s) and s[i+1] in octals: c += s[it.next()] if i+2 < len(s) and s[i+2] in octals: c += s[it.next()] L.append(chr(int(c, 8))) else: L.append(simple_escapes.get(c, '\\' + c)) return "".join(L) class Number(Literal): def evalit(self): return int(self.literal) class Name(Node): def __init__(self, name): self.name = name def __repr__(self): return "Name(%r)" % self.name def eval(self, globals, locals): if self.name in locals: return locals[self.name] if self.name in globals: return globals[self.name] if self.name == 'ord': return ord if self.name == 'len': return len raise NameError(self.name) def assign(self, value, globals, locals): locals[self.name] = value class Parser(object): def __init__(self, scanner): self.scanner = scanner self.nexttoken() def nexttoken(self): self.token, self.value = rv = self.scanner.next() ##print rv return rv def expect(self, token, value=None): if self.token != token: raise SyntaxError if value is not None and self.value != value: raise SyntaxError value = self.value self.nexttoken() return value def parse(self): stmts = [] while self.token != EOF: stmts.append(self.parse_stmt()) return stmts def parse_stmt(self, keywords=('def', 'for', 'while', 'if', 'print', 'return', 'yield')): if self.value in keywords: return getattr(self, 'parse_' + self.value)() else: return self.parse_simple() def parse_def(self): self.expect(NAME, 'def') name = self.expect(NAME) self.expect(OPERATOR, '(') args = [] if self.value != ')': args.append(self.expect(NAME)) while self.value == ',': self.nexttoken() arg.append(self.expect(NAME)) self.expect(OPERATOR, ')') self.expect(OPERATOR, ':') self.expect(NEWLINE) body = self.parse_body() return Define(name, args, body) def parse_for(self): self.expect(NAME, 'for') var = self.parse_expr() self.expect(NAME, 'in') seq = self.parse_expr() self.expect(OPERATOR, ':') self.expect(NEWLINE) body = self.parse_body() return For(var, seq, body) def parse_while(self): self.expect(NAME, 'while') test = self.parse_expr() self.expect(OPERATOR, ':') self.expect(NEWLINE) body = self.parse_body() return While(test, body) def parse_if(self): self.expect(NAME, 'if') test = self.parse_expr() self.expect(OPERATOR, ':') self.expect(NEWLINE) body = self.parse_body() return If(test, body) def parse_body(self): self.expect(INDENT) body = [self.parse_stmt()] while self.token != DEDENT: body.append(self.parse_stmt()) self.expect(DEDENT) return body def parse_print(self): self.expect(NAME, 'print') exprs = self.parse_exprs() self.expect(NEWLINE) return Print(exprs) def parse_return(self): self.expect(NAME, 'return') if self.token == NEWLINE: e = None else: e = self.parse_exprs() self.expect(NEWLINE) return Return(e) def parse_yield(self): self.expect(NAME, 'yield') e = self.parse_exprs() self.expect(NEWLINE) return Yield(e) def parse_simple(self): e = self.parse_exprs() if self.value == '=': lhs = [] while self.value == '=': self.nexttoken() lhs.append(e) e = self.parse_exprs() self.expect(NEWLINE) return Assign(lhs, e) else: self.expect(NEWLINE) return e def parse_exprs(self): e = self.parse_expr() if self.value != ',': return e exprs = [e] while self.value == ',': self.nexttoken() exprs.append(self.parse_expr()) return Exprs(exprs) def parse_expr(self, prio=0): left = self.parse_term() while self.value in operators and operators[self.value] > prio: op = self.expect(OPERATOR) right = self.parse_expr(operators[op]) left = Binop(left, op, right) return left def parse_term(self): t = self.parse_atom() while self.value in ('.', '[', '('): if self.value == '.': self.nexttoken() name = self.expect(NAME) t = Attribute(t, name) elif self.value == '[': self.nexttoken() index = self.parse_exprs() self.expect(OPERATOR, ']') t = Index(t, index) elif self.value == '(': self.nexttoken() args = self.parse_exprs() self.expect(OPERATOR, ')') t = Call(t, args) else: raise AssertionError("shouldn't get here") return t def parse_atom(self): if self.value == '(': self.nexttoken() exprs = self.parse_exprs() self.expect(OPERATOR, ')') return exprs if self.token is STRING: return String(self.expect(STRING)) if self.token is NAME: return Name(self.expect(NAME)) if self.token is NUMBER: return Number(self.expect(NUMBER)) raise SyntaxError scanner = Scanner(getcFromString(sample).next).tokenize() parser = Parser(scanner) root = parser.parse() indent = "" def writeln(s): print s def instrumentClass(cls): for name in cls.__dict__: descr = getattr(cls, name) if hasattr(descr, '__get__'): setattr(cls, name, instrumentDescriptor(name, descr)) class instrumentDescriptor(object): def __init__(self, name, obj): self.name = name self.obj = obj def __get__(self, *args): result = self.obj.__get__(*args) if not hasattr(result, '__call__'): return result return instrumentCall(self.name, result) class instrumentCall(object): def __init__(self, name, obj): self.name = name self.obj = obj def __call__(self, *args, **kwds): global indent oldindent = indent try: indent = indent + " " if kwds: writeln(indent + "%s(*%r, **%r)" % (self.name, args, kwds)) elif len(args) == 1: writeln(indent + "%s(%r)" % (self.name, args[0])) else: writeln(indent + "%s%r" % (self.name, args)) try: result = self.obj(*args, **kwds) except Exception, exc: writeln(indent + "raise %r" % (exc,)) raise else: if result is None: writeln(indent + "return") else: writeln(indent + "return %r" % (result,)) return result finally: indent = oldindent scanner = Scanner(getcFromString(sample).next).tokenize() parser = Parser(scanner) instrumentClass(Parser) root = parser.parse() env = {} eval(root, env, env) g = env['pi']() for i in range(1000): print g.next(), print strhash = env['strhash'] def myhash(s): if not s: return 0 x = ord(s[0])<<7 for c in s: x = ((1000003*x) ^ ord(c)) & 0xffffffffL return x^len(s) for x in '', 'x', 'abc', 'abc'*100: a, b, c = strhash(x), myhash(x), hash(x) & 0xffffffffL if a == b == c: print a else: print a, b, c --- NEW FILE: b1.py --- def depth0(n): try: n = depth0(n+1) except RuntimeError: pass return n print depth0(0) def depth1(n, pea): p = (pea, pea) for i in xrange(n): p = (p, pea) try: n, p = depth1(n+1, p) except RuntimeError: pass return n, p pea = [] base, p = depth1(0, pea) print base pea.append(p) while p[1] is not pea: q = p[1] n = 0 while p[1] is q: n += 1 p = p[0] if n != base+1: raise RuntimeError, (n, base) base -= 1 print base del pea[:] --- NEW FILE: b2.py --- def izip(*args): args = map(iter, args) while 1: yield tuple([x.next() for x in args]) class PI(object): def __iter__(self): k, a, b, a1, b1 = 2, 4, 1, 12, 4 while 1: p, q, k = k*k, 2*k+1, k+1 a, b, a1, b1 = a1, b1, p*a+q*a1, p*b+q*b1 d, d1 = a//b, a1//b1 while d == d1: yield d a, a1 = 10*(a%b), 10*(a1%b1) d, d1 = a//b, a1//b1 self.a1 = a1 pi = PI() tests = { 99: 44251238236192885942548145627920559612834490019477028496725657079267312460031559302172150714110203307954379217477379106929168768496503354540899921113305213841256909892518928098307564463751633347248940009920269109969147590732355948788056064000000000000000000000000000000000, 199: 1000596230862142822590229503409372398669386421051058756167623955196210292140473223995201364067656314884093070923379776058593112593572415388874119773448702613069929696236969954099574382312021625484547051647005317079077091903572365445691946982207111619679684359784089545801152269560862321544414943514190096631259179363627029133476495865659666812167626608236901769581685802712761140555948794720353924341042650072696819415055421183957924869318180281662429407332762869255321912813711898750492786968744984544308467386273640507277517829133760299081875243110913120665600000000000000000000000000000000000000000000000000000000000000000, 299: 21435887192948215614003242240833359745116667655295850182859413191163731683078952650094326080502769326477126925083216343548170734614172935170340269921309820711302999200539819947867212813551107194027554006207604344128185286047718105667902068109038526051946371288160859880626765253522805513232333491975220030085760604224065673379016506268781757490866758397031010384977255107445504115787686395015630645137203786798858795200871880590717053675063928230569710372699708910775901232998621866511805494494875255496291270721486641615650345940568291905806263698337995119757061129615716444504290546816572960918445558805410505143000167480199333531897643812998836381668261331434305825321676717544726859895857274900170645624087291170408290210800888136650695682668742663263729788760787553650802761860581841523193434651375248115751262481847514479478467508156570863734207165375573520453327647345580868727572348946580766720000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 399: 8561869806834798989612544773400323313179941907807794568262440743112858898989689026704576126118595731944427372856665962019724479801384062969795859298394962551328689077803363555807984316902252940902014889926277022833163566635584197843427728248130112186455323888931447608868707068434776186855353396855833436850229162071581300162579548898284489248532968742303181986647234058212952485789589428331561779973912890270787218670895308761530690791268509970600822462460658693835169935042766248145148420454545182598329186640466821688459819069501551463819641554408111110110151692239551586768176506251155525099233988638762885805917822379263713549352362861698409524070686169569736102177070749091831233867352657647277185192372387156966362270318951122024815096048593017226290871189781143762422618457018186519922454408157004798904710507709224018924427721086955924703838793251170380074666507887931281809304737450536142489860864008197549841329444837980614206463968734383477281485253049376604442937718053220015067951581390345559841730246517326234188422995410478560583662283465682728995404843025593838691776410644612449087517702830166590175727603809091974002341560317871295071902646575676785149353532452189474547463794343581915053692213809212940949327454179290314595392041251528682462248960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 499: 76766108631940210937325132198465864457610296920889901883030849944249491732767613231460026747961565950406551576277982908797232709115573397680840144587889878137072051513231549168224623486940739011824470282874235014299280185292476357855772342908560617765615433859648152443400651562464645577267133565969609608350684571285655853054712724572601634219899681603288076555568556603519768176952205317390973803424356164269999588467102540378584128532600037700811666341008358928602746642205050531572408717173194538376392544677893444983399212894400285344939556094505296780409965886324800278706769664438849417755796690865276144102933659458633433715362955199895852120250371111523601408509601075849463319256275384860431711268141908667883149791804139967338545358206127158990156425480764804297397170597657279674744907448120365194723760375846968550637839625396799787981542068069955660525855300927415620426941417314885401820985001913260101401230309399239801959598342546866307638278153091955749126275448041244876145703346573865766318100310570772620069178810413227974410262538853025115028173981758758325369986648321051017250246765567173447382346682177940131720445933725662183060319023268847648849199144024316405375647697684691770109145226746285626861260128121857903981514928439560981950894568063766637808949718925624322085933716705575498276564370619232206346293654148202964613950060056885972213718288213503135634713342418000998239413319648014225323725957085146390629354204147053598603318165064363587092287902579232811848133423379877761425679796787506376625832936596918827500201870173625427859893528696839243761272981017048564872611531028386533983068887010900245332623360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 599: 2120272365916624093549573503339645760249925590629691905298380620826238336680485250775748238851715242513568106491781607325637843266230182543159994052803483210198817868787245904539293723939615230218367927170630181008508608682473786334989642773309671087946382125393064054429291378005365307369932354974406782493586482693959468507929142578311374952191246685196652549840632791830721769718961140786765636611636126263231624375986806336404014991356931344468888703169171934706250411475009307785661110741777527324954571089817794240318090318731138065871311050896639596947512824176632981670282022349794742982306588866780679141100000979482012703431996529614153969006965379857532250140411692707925832547131496348527554204126276904033851312192294719407040113066259294928824359144110570802157647067643172691886034509485269315724734491380423529629749223874238867299576969461404272650055836211201773406419214625694511195241201118512536217548368603119794507877569790693417734860149658615068452866115479874379764219274786787905887717695084355702688921163181942859261931462396527992761425892799259213253073620895655262890187342553757398412577032172382168869416402722279336223791913538036339921582169629706204936615017408331600286347593291767969984872197163003714688529499720018226023559039421196525971154371211007274491079331581462202803270308044945895467086216358487714539723075423709132632711104176237158591348264918119231549610638101215271635751068862184966089290055162842592702917037089658541420657556777630476720227083286444062812384078931053717097690428021828828314330897267550018034334466896893522629282170940447351039396227633740743904716345874216287187030893375694818646093977919289909500326805873535353890952168548557367192114315242338374030375201461534835392764765715654233759268109399742689152068054720118040413609079726305828412608467329058007828176699982184798481881032984952414016677410029974950886156526807807461864142760141455419659333722571838033134676308170730229830331659493070917764742995587861083129433623003009634591950055674021412864000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 699: 54571787430958399400005671895793395810514965360222657069233155257869831245514703898329984842599345345797192550495348877752750716462799995262238897879189712362792599540276947290240369738995122870036473426596166137781512133732841079442335809215673962548136751501962395101508082458022910749004870763777751025686143054266560789699467897488208314352497922931109255090615845989365253963697070552088326927571730238674587343725408556548847027815257453311184273200959063948470485405418687785822617652671609706936044865165112267634536255942342137737568633616435112070199187087675353099732490445262584463118808715533880843287282323502172455874549895164201021082781039664171931972950867328706112021059604060340338606871763348783573247509755207096610318069014034226371127241365822041636184401808035853347524245498756203483212762819194058857286022123510755206330238728338540936417830717262921800876426685863489447721974523840880601732138137563579815785444094205972614263669956513740906383728059662729451143837852557411654864608820606495589950458165214874335528071914274226508583618548221498046257433189345079263951024381261213067438755400772554918420156611989161275819373340626340095277962552853128100524758416265525218190626769969209796740560920753972479878773975562043659464796071536492340776053077906431346958246988865607675041671683462291933241209943247185229400300531069434821908210393754215270727867860747889887039965048681895147820192799637449521165944356200714071125353390157596677223069290303004608406259263260481747075716421783084148765931010321931117509077808771925529544210503591442107960112359151446110353540208471607107935843590192610650273333834161753099980189676608843057569018657095864002224328579690446259626925339472680838762568611923981193711770106009098171810029820020455115170724929203588390317815053369572788421300357832205199443876759544538582639402241883694827090801385537555747373037489025563879252287165075989079784157761408131323383708336366882662138204724992104184118234360573248835518448645547172342375665655653335218281979099552819760633230580536381778069677840715358530867566196795457417775340310424672192141977398974880862555283206621628790868960591215870136675469162920111812154003932444777532696287441691534774646863311895804406055064912499462089287403059782748799895590902455779428144219297715674077436643273687702239680646741926247202392605642085420467071089682849156330161168666278561180452156752478501391564800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 799: 1165019969951028145448474870606694745628445847100063691175045426809524271280385211025149309439736889668431363205043295468478227885516089826430304252028412665878074268391689531376676369814346541259212014204219732753532556283167763492813491981617042686520428375483043823229347180225027527767892288494222400268347648277077085092324780438909293027666621101974271603717458184633691745699246613625445708958093814173789616468299755424767037016330877693069425266688538600904598289113523091543776886739998104937757229618512461155015780709364046160704463608630709906484636013448672656426886594747044346764985843639265457373603772739772415706169602575546300922342271055004256781082363315561913547648640954959000371679492600850323235849380042831378495135583566599574416729516620087245906062795758387578224336805373895492794645806096068657974185136831114580747646909717985162654700150389838526549868770885629372149350446773860669388038471776557526515910033467628431871878316408982723876203877207112913665539371348724351835198296871265983857890498623536324848877236019869092878781427110113542625110041789002286754615039920319343770043455657828924442170211652589212117516714709894518726603532996156030790024814913146519305169722564850597797774298352669973544466122022123500758687471133096300448171087716127901248915474363042779227724255413335477296839171260050411230913787907606725169016351209025747882086625397286625248376528998919634710302520393941530723973487259019187136668425367426482695231240294671376146585312211926447150542843171266291876037378067256463777431998792250381914496818845072319002851834894280540179694233589184751221721345515353061996569633890293841751623667699605067183984407638732497881628999347219982736106675680165842644133894916782230987223224828685930858657631697327168501437432678530579280064943872275218623486567776580213001821563007802859121520206862366831214550454660201924592069971928484116327345227633650931220240412989380696156101840018564700065411677388328804161110162279193672651278988425644004188569635636717470803677943610275223854671409519817008772946235477341217799495629951132446716193818794636841421507151304976152511616538200203214016457449981017869162192339882870379247422061597402496664647115346984746108902369843975335083490551753570803795438395111351577474760022446140821780548147639308232794984562286077490121188360571079033300272391145791202144846667875284539709679647945779713567130240017333648976286204155043105228295725874012316502327195124092416348347162737242449541649547547864777887315161229040122603297586496999009079092644539172087825680666618082263897443172558909377634579572489890372823889386192559147381373832288039653312458442917119615324859008094386594830981911977813106096806546361863080294950465184145762955879704231094550954751577536624215411479046060449038350499002129406780206980907086223769600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 899: 1961047400783793689152743738482061418112144594775859100963826903299941791245038595034363753615746408049289952725779309407444199325053710536522401903643581802543713504158806047235695705896380364921365885372696677158825553172792575130365677811577035805389273355225725863414284665498055318575649394451227797767110728923709058788425788790167032831982217805891947591307310391793051324726126078967699521915868839204118521519682024094610098117626863292184721906092521438801341497303557767071828077146885364536554032450624100316867547877010778603956083487035270791818649067384276377414249363983383717773036457804718062695046059095787213719308297709919175747285036636352990899483938970896812239613605956608649083554411609657838220544027128950682327843798882711829991989817881303883990647876969994768271897974773455464646523348820392471256024577102382204328939384060235197563409904986708133897802121211859685551906620747824874847127776411443039694389051592145124635490844378130255642752765693890407120283111284316765000645749180288822505352501861257195960128525960418404774436619529817773459198268065709767064598308082608109337158602927125644880036055446842995394476366770872364117175239884406760485305848864493739499504392963295387516098554438251252486287315978444632100288391159069513665622892184147377430660017269064216314044538754986908504965776567592061950572488346266774840439392992871099154439658791611017807192708601473794082677034875991711712839230126426791071352984543648012937947037753575375040046764495862676093683555226439651695465214815214564045671683209573744703248122302073524235222782011551736047484049940566608761314884952385623657426286984431299387264223494331247251695035920997630045288051985796581735253031855095734994702323372767680434320372371358208514386161807824094211406017077057681618563506824462507672499213262962050653636150604636813302357401076353456780306366770399402263353459513732101609057936629596760862766436204974584026785745826067150601651416509653311312257323521470962454567693169469818165574943846754385013710385609445073226065759614555740278029180864101039640157003847772681461933766608520730602890319871123179941870008811420475967031993019721292183133758093949406939652398599519672662411049142220315039805474111098855767170048770783560759174013367296946638271656238787420981851702619053744806332012493178141602213898668388712998512756036771357385206948329239298807516694953814693720048229647293048056331265195037121054022115441868442670280473506498551412297880384312473713380564764159899942048060356745863908010902230964075673990385182437331505988923117412916700150241837983775128046411352228138119876809545584444570443347872856695813698044037133648970190072128464354669077148179236958137004869599834164764747494805309536229934978506910688264436888356383974787838537387187841566823557909442831563769727985839249267304457033791105118767948473474042809317178565809335268316324420040570235176099114072999727457879465811886218940986224633055296998229833996940360896329868864364653862830780554332074293100857235815847819975826812991652016737242925678140172314816371649578265526072666356756752517107018796020915298198762366163369556351250086487862926783601433251979292229580324497550784524234395521051827588464289592550437275513651200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, 999: 51421204237426754719741262879558095745353570680465295990005607280393992759309313043417054432903002299144227267946681775379682646481441184984878051192262603785286501319910886769028368118572705415132969475266997058807303812945930068988142620857043364738252015410062109557537048105374131205551289070131067641702104206291269602159585410011716588325959509072295414578340882094129449369050539722183971427768493446582776526148926808216744196972229231300146452844798957170562743924910341252019551586744505512178746646209409281714276837540692337365091849265903691838950705920069247812720998641002393637705464518833183499641523989489319666798606026274099063316447636791376824977802426300098229217109293397613448627314578264206176863819689114000733923661247770659874248361262500335796860850821012664671771458632988533081782215409765802283312397639531087374886914931818336434018365581917786263986184421404682182700668580256406614910005588986105283922797115795753457032007852784163484117726758402807095937775274740959221797164713537199602017041055883470864790221601914448307560964005337053911966953966628791679568034533608103498461484413180826592737887173295962464948084846329227317763485710127958570474521805846289864427724437000806760496738191498562549124089519328261857651962598014067174275024135581089311586662613800674556590447284302589227994020980213920576606410812288774224985213146245744417408945081781113854100049114396677026962371599785096891808223814416164195820685147641538762223075545475947323585115274444998974587593729824337921226549035616388426184445157848256274480718496342976431693624096685162227580762036981450014151173230060384257039659147964264276717849828738171682245892581306830589179887337090011464839646134568754370139845055418256890860940757057604372114023858733686778293659768364688584313980891657494820666567128494973417651689810011217228920255038016092697827501659126864128552793815957798765294279442644144781212010235659076921083028766195306983520086051010702064687047067852692614939864275238659313772070485512507854113183292498557795177864634776519676116960767383666934404120846954899842398644565635321658409635828642860494805612307530127024621301271374503453503593598678825472356837105710187840164939100381680149781533530971702548427150353351891790289793371198307811983920633373141553344786366833632629827394060040022660478432725820719166178073536817127815814516804684768909331366393380845665808090480804683597798069345611863676423593435458367296114919445047864192204991424873907600867560652360433332333460605503950202643081773051851931329700798978585023149558510051756813823934151345468518744914658396602698567997395883907886162856223081161171378840724659535879555133476804981500946142310178618715717330537589699297655080875880600325195469690780842623951417080052370551017667164713224427292680078173002890766115232008277162207593058978389851005689429106305813929315214127108126116277803514751388254341941007906487414087391653272683247248144900228323654135725469516828248483753155121402474188091072172874050555155865413230544137360090574915682856355897339880759959552597891337880610141176123727002295219377091215365686168970240859719317085650982416219558886127398895904298964883158265272486775477666044730446436805318892171895199489563024683292416174451463979862792856107202456073408125335089494339729358670332578718476101211422277469149701783270075855888742583964446418851379385457754248170422546014640203546645610651326807707725840711263654208439193695249007802516372736393165515067274768773964565908592407847748333876331474804846330009526035593873778287836699826905094860721603742076784651700242126831347444508393439010605679605183038164877451729777036414156800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, } checks = {} for x, y in izip(xrange(1000), pi): print y, if x in tests: checks[x] = pi.a1 if tests != checks: raise RuntimeError --- NEW FILE: out0 --- parse() parse_stmt() parse_def() expect(NAME, 'def') nexttoken() return (NAME, 'pi') return 'def' expect(NAME) nexttoken() return (OPERATOR, '(') return 'pi' expect(OPERATOR, '(') nexttoken() return (OPERATOR, ')') return '(' expect(OPERATOR, ')') nexttoken() return (OPERATOR, ':') return ')' [...1316 lines suppressed...] return Binop(Name('x'), '^', Call(Name('len'), [Name('s')])) expect(NEWLINE) nexttoken() return (DEDENT, '') return '' return Return(Binop(Name('x'), '^', Call(Name('len'), [Name('s')]))) return Return(Binop(Name('x'), '^', Call(Name('len'), [Name('s')]))) expect(DEDENT) nexttoken() return (EOF, '') return '' return [If(Binop(Name('s'), '==', String("''")), ...), Assign([Name('x')], Binop(Call(Name('ord'), [Index(Name('s'), Number('0'))]), '<<', Number('7'))), For(Name('c'), Name('s'), ...), Return(Binop(Name('x'), '^', Call(Name('len'), [Name('s')])))] return Define('strhash', ['s'], ...) return Define('strhash', ['s'], ...) return [Define('pi', [], ...), Define('strhash', ['s'], ...)] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 0 2475144313 2694041763 817196332 --- NEW FILE: out1 --- 998 998 0 --- NEW FILE: out2 --- 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 From loewis at users.sourceforge.net Tue Dec 30 06:14:07 2003 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Dec 30 06:14:12 2003 Subject: [Python-checkins] python/dist/src/Modules socketmodule.c, 1.280, 1.281 Message-ID: <E1AbHp9-000369-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Modules In directory sc8-pr-cvs1:/tmp/cvs-serv11758 Modified Files: socketmodule.c Log Message: Add IPV6_ socket options from RFCs 3493 and 3542. Fixes #867012. Index: socketmodule.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v retrieving revision 1.280 retrieving revision 1.281 diff -C2 -d -r1.280 -r1.281 *** socketmodule.c 17 Dec 2003 09:40:23 -0000 1.280 --- socketmodule.c 30 Dec 2003 11:14:01 -0000 1.281 *************** *** 3965,3968 **** --- 3965,4033 ---- PyModule_AddIntConstant(m, "IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS); #endif + /* Additional IPV6 socket options, defined in RFC 3493 */ + #ifdef IPV6_V6ONLY + PyModule_AddIntConstant(m, "IPV6_V6ONLY", IPV6_V6ONLY); + #endif + /* Advanced IPV6 socket options, from RFC 3542 */ + #ifdef IPV6_CHECKSUM + PyModule_AddIntConstant(m, "IPV6_CHECKSUM", IPV6_CHECKSUM); + #endif + #ifdef IPV6_DONTFRAG + PyModule_AddIntConstant(m, "IPV6_DONTFRAG", IPV6_DONTFRAG); + #endif + #ifdef IPV6_DSTOPTS + PyModule_AddIntConstant(m, "IPV6_DSTOPTS", IPV6_DSTOPTS); + #endif + #ifdef IPV6_HOPLIMIT + PyModule_AddIntConstant(m, "IPV6_HOPLIMIT", IPV6_HOPLIMIT); + #endif + #ifdef IPV6_HOPOPTS + PyModule_AddIntConstant(m, "IPV6_HOPOPTS", IPV6_HOPOPTS); + #endif + #ifdef IPV6_NEXTHOP + PyModule_AddIntConstant(m, "IPV6_NEXTHOP", IPV6_NEXTHOP); + #endif + #ifdef IPV6_PATHMTU + PyModule_AddIntConstant(m, "IPV6_PATHMTU", IPV6_PATHMTU); + #endif + #ifdef IPV6_PKTINFO + PyModule_AddIntConstant(m, "IPV6_PKTINFO", IPV6_PKTINFO); + #endif + #ifdef IPV6_RECVDSTOPTS + PyModule_AddIntConstant(m, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS); + #endif + #ifdef IPV6_RECVHOPLIMIT + PyModule_AddIntConstant(m, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT); + #endif + #ifdef IPV6_RECVHOPOPTS + PyModule_AddIntConstant(m, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS); + #endif + #ifdef IPV6_RECVPKTINFO + PyModule_AddIntConstant(m, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO); + #endif + #ifdef IPV6_RECVRTHDR + PyModule_AddIntConstant(m, "IPV6_RECVRTHDR", IPV6_RECVRTHDR); + #endif + #ifdef IPV6_RECVTCLASS + PyModule_AddIntConstant(m, "IPV6_RECVTCLASS", IPV6_RECVTCLASS); + #endif + #ifdef IPV6_RTHDR + PyModule_AddIntConstant(m, "IPV6_RTHDR", IPV6_RTHDR); + #endif + #ifdef IPV6_RTHDRDSTOPTS + PyModule_AddIntConstant(m, "IPV6_RTHDRDSTOPTS", IPV6_RTHDRDSTOPTS); + #endif + #ifdef IPV6_RTHDR_TYPE_0 + PyModule_AddIntConstant(m, "IPV6_RTHDR_TYPE_0", IPV6_RTHDR_TYPE_0); + #endif + #ifdef IPV6_RECVPATHMTU + PyModule_AddIntConstant(m, "IPV6_RECVPATHMTU", IPV6_RECVPATHMTU); + #endif + #ifdef IPV6_TCLASS + PyModule_AddIntConstant(m, "IPV6_TCLASS", IPV6_TCLASS); + #endif + #ifdef IPV6_USE_MIN_MTU + PyModule_AddIntConstant(m, "IPV6_USE_MIN_MTU", IPV6_USE_MIN_MTU); + #endif /* TCP options */ *************** *** 4035,4038 **** --- 4100,4106 ---- PyModule_AddIntConstant(m, "EAI_NONAME", EAI_NONAME); #endif + #ifdef EAI_OVERFLOW + PyModule_AddIntConstant(m, "EAI_OVERFLOW", EAI_OVERFLOW); + #endif #ifdef EAI_SERVICE PyModule_AddIntConstant(m, "EAI_SERVICE", EAI_SERVICE); *************** *** 4061,4064 **** --- 4129,4135 ---- #ifdef AI_NUMERICHOST PyModule_AddIntConstant(m, "AI_NUMERICHOST", AI_NUMERICHOST); + #endif + #ifdef AI_NUMERICSERV + PyModule_AddIntConstant(m, "AI_NUMERICSERV", AI_NUMERICSERV); #endif #ifdef AI_MASK From loewis at users.sourceforge.net Tue Dec 30 10:02:45 2003 From: loewis at users.sourceforge.net (loewis@users.sourceforge.net) Date: Tue Dec 30 10:02:48 2003 Subject: [Python-checkins] python/nondist/sandbox/msi msi.py, 1.1.1.1, 1.2 msilib.py, 1.1.1.1, 1.2 Message-ID: <E1AbLOP-00042f-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/msi In directory sc8-pr-cvs1:/tmp/cvs-serv15532 Modified Files: msi.py msilib.py Log Message: Include msvcr71.dll. Include current date as sub-micro version for alpha releases. Index: msi.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/msi/msi.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** msi.py 29 Dec 2003 14:04:35 -0000 1.1.1.1 --- msi.py 30 Dec 2003 15:02:42 -0000 1.2 *************** *** 1,5 **** # Python MSI Generator # (C) 2003 Martin v. Loewis ! import msilib, schema, sequence, os, sets, glob from msilib import Feature, CAB, Directory, Dialog, Binary, add_data import uisample --- 1,5 ---- # Python MSI Generator # (C) 2003 Martin v. Loewis ! import msilib, schema, sequence, os, glob, time from msilib import Feature, CAB, Directory, Dialog, Binary, add_data import uisample *************** *** 8,12 **** msilib.Win64 = 0 current_version = "2.4.0" ! testpackage=0 srcdir = r'e:\pyinst\python' --- 8,13 ---- msilib.Win64 = 0 current_version = "2.4.0" ! alpha = 1 ! testpackage = 0 srcdir = r'e:\pyinst\python' *************** *** 24,27 **** --- 25,29 ---- '2.4.0': "{93792a5a-5bb0-43b1-904f-ba10c4f08ec8}", } + product_code = product_codes[current_version] extensions = [ *************** *** 49,53 **** 'parser.pyd', ]) ! if testpackage: --- 51,58 ---- 'parser.pyd', ]) ! ! if alpha: ! release = int(time.time()/3600/24) ! current_version += ".%d" % release if testpackage: *************** *** 58,67 **** testprefix = '' ! msilib.reset() def build_database(): db = msilib.init_database("python%s.msi" % current_version,schema, ProductName="Python "+current_version, ! ProductCode=product_codes[current_version], ProductVersion=current_version, Manufacturer=u"Martin v. L\xf6wis") --- 63,72 ---- testprefix = '' ! msilib.reset() def build_database(): db = msilib.init_database("python%s.msi" % current_version,schema, ProductName="Python "+current_version, ! ProductCode=product_code, ProductVersion=current_version, Manufacturer=u"Martin v. L\xf6wis") *************** *** 426,431 **** --- 431,458 ---- "Python test suite (Lib/test/)", 9) + def extract_msvcr71(): + import _winreg, win32api + # Find the location of the merge modules + k = _winreg.OpenKey( + _winreg.HKEY_LOCAL_MACHINE, + r"Software\Microsoft\VisualStudio\7.1\Setup\VS") + dir = _winreg.QueryValueEx(k, "MSMDir")[0] + _winreg.CloseKey(k) + files = glob.glob1(dir, "*CRT71*") + assert len(files) == 1 + file = os.path.join(dir, files[0]) + # Extract msvcr71.dll + m = msilib.MakeMerge2() + m.OpenModule(file, 0) + m.ExtractFiles(".") + m.CloseModule() + # Find the version/language of msvcr71.dll + installer = msilib.MakeInstaller() + return installer.FileVersion("msvcr71.dll", 0), \ + installer.FileVersion("msvcr71.dll", 1) + def add_files(db): cab = CAB("python") + tmpfiles = [] root = Directory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") # Create separate components for python.exe and pythonw.exe so we can *************** *** 439,443 **** --- 466,477 ---- root.start_component("TARGETDIR", default_feature) root.add_file("PCBuild/w9xpopen.exe") # XXX: separate component to only install on W9x + root.add_file("PCBuild/python%s%s.dll" % (major, minor)) # XXX separate component for system32 + # XXX determine dependencies + version, lang = extract_msvcr71() + root.add_file("msvcr71.dll", src=os.path.abspath("msvcr71.dll"), + version=version, language=lang) + tmpfiles.append("msvcr71.dll") + root.add_file("README.txt", src="README") root.add_file("NEWS.txt", src="Misc/NEWS") *************** *** 543,547 **** lib.add_file("Python%s%s.chm" % (major, minor)) ! cab.commit(db) def add_registry(db): --- 577,584 ---- lib.add_file("Python%s%s.chm" % (major, minor)) ! cab.commit(db) ! ! for f in tmpfiles: ! os.unlink(f) def add_registry(db): *************** *** 639,643 **** # XXX: System64Folder on Win64 ("Uninstall", "MENUDIR", "UNINST|Uninstall Python", "REGISTRY", ! "[SystemFolder]msiexec", "/x%s" % product_codes[current_version], None, None, None, None, None, None), ]) --- 676,680 ---- # XXX: System64Folder on Win64 ("Uninstall", "MENUDIR", "UNINST|Uninstall Python", "REGISTRY", ! "[SystemFolder]msiexec", "/x%s" % product_code, None, None, None, None, None, None), ]) Index: msilib.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/msi/msilib.py,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** msilib.py 29 Dec 2003 14:04:36 -0000 1.1.1.1 --- msilib.py 30 Dec 2003 15:02:42 -0000 1.2 *************** *** 51,55 **** def EnsureMSI(): ! win32com.client.gencache.EnsureModule('{000C1092-0000-0000-C000-000000000046}',0x409,1,0) _Installer=None --- 51,58 ---- def EnsureMSI(): ! win32com.client.gencache.EnsureModule('{000C1092-0000-0000-C000-000000000046}', 0, 1, 0) ! ! def EnsureMSM(): ! win32com.client.gencache.EnsureModule('{0ADDA82F-2C26-11D2-AD65-00A0C9AF11A6}', 0, 1, 0) _Installer=None *************** *** 62,65 **** --- 65,76 ---- return _Installer + _Merge=None + def MakeMerge2(): + global _Merge + if _Merge is None: + EnsureMSM() + _Merge = win32com.client.Dispatch("Msm.Merge2.1") + return _Merge + class Table: def __init__(self, name): *************** *** 440,444 **** return file ! def add_file(self, file, src=None): if not self.component: self.start_component(self.logical, current_feature) --- 451,455 ---- return file ! def add_file(self, file, src=None, version=None, language=None): if not self.component: self.start_component(self.logical, current_feature) *************** *** 459,464 **** full = "%s|%s" % (short, file) filesize = os.stat(absolute).st_size - version = None - language = None # constants.msidbFileAttributesVital # Compressed omitted, since it is the database default --- 470,473 ---- From theller at python.net Tue Dec 30 11:10:09 2003 From: theller at python.net (Thomas Heller) Date: Tue Dec 30 10:10:52 2003 Subject: [Python-checkins] python/nondist/sandbox/msi msi.py, 1.1.1.1, 1.2 msilib.py, 1.1.1.1, 1.2 In-Reply-To: <E1AbLOP-00042f-00@sc8-pr-cvs1.sourceforge.net> (loewis@users.sourceforge.net's message of "Tue, 30 Dec 2003 07:02:45 -0800") References: <E1AbLOP-00042f-00@sc8-pr-cvs1.sourceforge.net> Message-ID: <y8sui8wu.fsf@python.net> loewis@users.sourceforge.net writes: > Update of /cvsroot/python/python/nondist/sandbox/msi > In directory sc8-pr-cvs1:/tmp/cvs-serv15532 > > Modified Files: > msi.py msilib.py > root.start_component("TARGETDIR", default_feature) > root.add_file("PCBuild/w9xpopen.exe") # XXX: separate component to only install on W9x Currently in the Wise script, w9xpopen.exe is also installed on NT/2k/XP, and I would like to leave it this way. py2exe needs it to create programs using popen that also run on w9x. Thomas From fdrake at users.sourceforge.net Tue Dec 30 11:12:30 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 11:12:36 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libdifflib.tex,1.15,1.16 Message-ID: <E1AbMTu-000764-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27275 Modified Files: libdifflib.tex Log Message: - update Tim's email address - remove spurious blank lines Index: libdifflib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdifflib.tex,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** libdifflib.tex 11 Jun 2003 07:50:44 -0000 1.15 --- libdifflib.tex 30 Dec 2003 16:12:27 -0000 1.16 *************** *** 4,9 **** \declaremodule{standard}{difflib} \modulesynopsis{Helpers for computing differences between objects.} ! \moduleauthor{Tim Peters}{tim.one@home.com} ! \sectionauthor{Tim Peters}{tim.one@home.com} % LaTeXification by Fred L. Drake, Jr. <fdrake@acm.org>. --- 4,9 ---- \declaremodule{standard}{difflib} \modulesynopsis{Helpers for computing differences between objects.} ! \moduleauthor{Tim Peters}{tim_one@users.sourceforge.net} ! \sectionauthor{Tim Peters}{tim_one@users.sourceforge.net} % LaTeXification by Fred L. Drake, Jr. <fdrake@acm.org>. *************** *** 56,60 **** \optional{, fromfiledate\optional{, tofiledate\optional{, n \optional{, lineterm}}}}}}} - Compare \var{a} and \var{b} (lists of strings); return a delta (a generator generating the delta lines) in context diff --- 56,59 ---- *************** *** 189,193 **** \optional{, fromfiledate\optional{, tofiledate\optional{, n \optional{, lineterm}}}}}}} - Compare \var{a} and \var{b} (lists of strings); return a delta (a generator generating the delta lines) in unified diff --- 188,191 ---- From fdrake at users.sourceforge.net Tue Dec 30 11:15:37 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 11:15:44 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libtabnanny.tex, 1.3, 1.4 libweakref.tex, 1.21, 1.22 Message-ID: <E1AbMWv-0007Ey-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv27822/lib Modified Files: libtabnanny.tex libweakref.tex Log Message: use consistent email address for Tim Index: libtabnanny.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtabnanny.tex,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** libtabnanny.tex 5 Apr 2002 02:21:09 -0000 1.3 --- libtabnanny.tex 30 Dec 2003 16:15:35 -0000 1.4 *************** *** 8,12 **** \modulesynopsis{Tool for detecting white space related problems in Python source files in a directory tree.} ! \moduleauthor{Tim Peters}{tim_one@email.msn.com} \sectionauthor{Peter Funk}{pf@artcom-gmbh.de} --- 8,12 ---- \modulesynopsis{Tool for detecting white space related problems in Python source files in a directory tree.} ! \moduleauthor{Tim Peters}{tim_one@users.sourceforge.net} \sectionauthor{Peter Funk}{pf@artcom-gmbh.de} Index: libweakref.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libweakref.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** libweakref.tex 27 Nov 2003 19:48:03 -0000 1.21 --- libweakref.tex 30 Dec 2003 16:15:35 -0000 1.22 *************** *** 230,234 **** do. ! % Example contributed by Tim Peters <tim_one@msn.com>. \begin{verbatim} import weakref --- 230,234 ---- do. ! % Example contributed by Tim Peters. \begin{verbatim} import weakref From fdrake at users.sourceforge.net Tue Dec 30 11:15:38 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 11:15:48 2003 Subject: [Python-checkins] python/dist/src/Doc/tut tut.tex,1.220,1.221 Message-ID: <E1AbMWw-0007F3-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/tut In directory sc8-pr-cvs1:/tmp/cvs-serv27822/tut Modified Files: tut.tex Log Message: use consistent email address for Tim Index: tut.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v retrieving revision 1.220 retrieving revision 1.221 diff -C2 -d -r1.220 -r1.221 *** tut.tex 17 Dec 2003 21:38:26 -0000 1.220 --- tut.tex 30 Dec 2003 16:15:35 -0000 1.221 *************** *** 4940,4944 **** \chapter{Floating Point Arithmetic: Issues and Limitations\label{fp-issues}} ! \sectionauthor{Tim Peters}{tim_one@email.msn.com} Floating-point numbers are represented in computer hardware as --- 4940,4944 ---- \chapter{Floating Point Arithmetic: Issues and Limitations\label{fp-issues}} ! \sectionauthor{Tim Peters}{tim_one@users.sourceforge.net} Floating-point numbers are represented in computer hardware as From fdrake at users.sourceforge.net Tue Dec 30 11:18:25 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 11:18:28 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libhtmlparser.tex, 1.5, 1.6 Message-ID: <E1AbMZd-0007OJ-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv28406 Modified Files: libhtmlparser.tex Log Message: - remove crufty markup that's no longer needed to make the presentation work right (and didn't work anyway) - fix minor typo Index: libhtmlparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libhtmlparser.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** libhtmlparser.tex 7 Dec 2003 12:46:16 -0000 1.5 --- libhtmlparser.tex 30 Dec 2003 16:18:23 -0000 1.6 *************** *** 110,115 **** This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{{-}{-}} and \samp{{-}{-}} delimiters, but not the delimiters ! themselves. For example, the comment \samp{<!{-}{-}text{-}{-}>} will cause this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class --- 110,115 ---- This method is called when a comment is encountered. The \var{comment} argument is a string containing the text between the ! \samp{--} and \samp{--} delimiters, but not the delimiters ! themselves. For example, the comment \samp{<!--text-->} will cause this method to be called with the argument \code{'text'}. It is intended to be overridden by a derived class; the base class *************** *** 133,137 **** \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instruction. An XHTML processing instruction using the trailing \character{?} will cause the \character{?} to be included in \var{data}.} --- 133,137 ---- \note{The \class{HTMLParser} class uses the SGML syntactic rules for ! processing instructions. An XHTML processing instruction using the trailing \character{?} will cause the \character{?} to be included in \var{data}.} From fdrake at users.sourceforge.net Tue Dec 30 11:19:31 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 11:19:35 2003 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.143,1.144 Message-ID: <E1AbMah-0007Rx-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv28616 Modified Files: python.perl Log Message: - make "--" in code text not get converted to "-" - fix minor typo in comment Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.143 retrieving revision 1.144 diff -C2 -d -r1.143 -r1.144 *** python.perl 26 Nov 2003 20:55:49 -0000 1.143 --- python.perl 30 Dec 2003 16:19:28 -0000 1.144 *************** *** 156,159 **** --- 156,167 ---- } + # Helper used in many places that arbitrary code-like text appears: + + sub codetext($){ + my $text = "$_[0]"; + $text =~ s/--/-\&#45;/go; + return $text; + } + sub use_wrappers($$$){ local($_,$before,$after) = @_; *************** *** 162,165 **** --- 170,179 ---- } + sub use_code_wrappers($$$){ + local($_,$before,$after) = @_; + my $stuff = codetext(next_argument()); + return $before . $stuff . $after . $_; + } + $IN_DESC_HANDLER = 0; sub do_cmd_optional{ *************** *** 182,186 **** return use_wrappers($_[0], '<span class="makevar">', '</span>'); } sub do_cmd_code{ ! return use_wrappers($_[0], '<code>', '</code>'); } sub do_cmd_module{ return use_wrappers($_[0], '<tt class="module">', '</tt>'); } --- 196,200 ---- return use_wrappers($_[0], '<span class="makevar">', '</span>'); } sub do_cmd_code{ ! return use_code_wrappers($_[0], '<code>', '</code>'); } sub do_cmd_module{ return use_wrappers($_[0], '<tt class="module">', '</tt>'); } *************** *** 206,212 **** return use_wrappers($_[0], '<tt class="ctype">', '</tt>'); } sub do_cmd_regexp{ ! return use_wrappers($_[0], '<tt class="regexp">', '</tt>'); } sub do_cmd_character{ ! return use_wrappers($_[0], '"<tt class="character">', '</tt>"'); } sub do_cmd_program{ return use_wrappers($_[0], '<b class="program">', '</b>'); } --- 220,226 ---- return use_wrappers($_[0], '<tt class="ctype">', '</tt>'); } sub do_cmd_regexp{ ! return use_code_wrappers($_[0], '<tt class="regexp">', '</tt>'); } sub do_cmd_character{ ! return use_code_wrappers($_[0], '"<tt class="character">', '</tt>"'); } sub do_cmd_program{ return use_wrappers($_[0], '<b class="program">', '</b>'); } *************** *** 233,237 **** return do_cmd_file($_[0]); } sub do_cmd_samp{ ! return use_wrappers($_[0], '"<tt class="samp">', '</tt>"'); } sub do_cmd_kbd{ return use_wrappers($_[0], '<kbd>', '</kbd>'); } --- 247,251 ---- return do_cmd_file($_[0]); } sub do_cmd_samp{ ! return use_code_wrappers($_[0], '"<tt class="samp">', '</tt>"'); } sub do_cmd_kbd{ return use_wrappers($_[0], '<kbd>', '</kbd>'); } *************** *** 618,622 **** define_indexing_macro('ttindex'); sub idx_cmd_ttindex($){ ! my $str = next_argument(); my $entry = $str . get_indexsubitem(); add_index_entry($entry, $_[0]); --- 632,636 ---- define_indexing_macro('ttindex'); sub idx_cmd_ttindex($){ ! my $str = codetext(next_argument()); my $entry = $str . get_indexsubitem(); add_index_entry($entry, $_[0]); *************** *** 2050,2057 **** }; $open_tags_R = [ @keep_open_tags ]; ! $_; } ! # List of all filenames produced ny do_cmd_verbatiminput() %VerbatimFiles = (); @VerbatimOutputs = (); --- 2064,2071 ---- }; $open_tags_R = [ @keep_open_tags ]; ! return codetext($_); } ! # List of all filenames produced my do_cmd_verbatiminput() %VerbatimFiles = (); @VerbatimOutputs = (); From gvanrossum at users.sourceforge.net Tue Dec 30 11:28:29 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 11:28:43 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b0.py, 1.1, 1.2 out0, 1.1, 1.2 Message-ID: <E1AbMjN-0008HE-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv31809 Modified Files: b0.py out0 Log Message: New version. Better approach to self-checking and debugging. Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b0.py 30 Dec 2003 06:12:57 -0000 1.1 --- b0.py 30 Dec 2003 16:28:25 -0000 1.2 *************** *** 1,5 **** ! def check(b, msg=None): ! if not b: ! raise AssertionError(msg) def proto___new__(cls, name): --- 1,7 ---- ! def check(a, b): ! if not a == b: ! print (a, b) ! if __debug__: ! raise AssertionError("%r != %r" % (a, b)) def proto___new__(cls, name): *************** *** 35,40 **** OPERATOR = Token('OPERATOR') - ##print INDENT, DEDENT - class Scanner(object): --- 37,40 ---- *************** *** 176,179 **** --- 176,180 ---- d, d1 = a//b, a1//b1 def strhash(s): + # Python 2.x string hash algorithm if s == '': return 0 *************** *** 191,195 **** L.append(pair) L2 = list(it2) ! check(L == L2) operators = { --- 192,196 ---- L.append(pair) L2 = list(it2) ! check(L, L2) operators = { *************** *** 265,269 **** self.globals = globals def __call__(self, *args): ! check(len(args) == len(self.args)) locals = dict(zip(self.args, args)) try: --- 266,270 ---- self.globals = globals def __call__(self, *args): ! check(len(args), len(self.args)) locals = dict(zip(self.args, args)) try: *************** *** 274,278 **** class Generator(Function): def __call__(self, *args): ! check(len(args) == len(self.args)) locals = dict(zip(self.args, args)) try: --- 275,279 ---- class Generator(Function): def __call__(self, *args): ! check(len(args), len(self.args)) locals = dict(zip(self.args, args)) try: *************** *** 523,527 **** def nexttoken(self): self.token, self.value = rv = self.scanner.next() - ##print rv return rv def expect(self, token, value=None): --- 524,527 ---- *************** *** 675,686 **** root = parser.parse() indent = "" ! def writeln(s): ! print s def instrumentClass(cls): for name in cls.__dict__: descr = getattr(cls, name) if hasattr(descr, '__get__'): ! setattr(cls, name, instrumentDescriptor(name, descr)) class instrumentDescriptor(object): def __init__(self, name, obj): --- 675,728 ---- root = parser.parse() + class List(list): + __setitem__ = list.__setitem__ + __getitem__ = list.__getitem__ + + class Str(str): + __getitem__ = str.__getitem__ + + class OutputFile(object): + data = [] + def write(self, s): + self.data.append(s) + def getvalue(self): + r = "".join(self.data) + self.data = List() + return r + + output = OutputFile() + def write(s): + s = str(s) + i = s.find(' at 0x') + while i > 0: + j = s.find('>', i+6) + if j < 0: + break + digits = s[i+4:j] + try: + number = int(digits, 0) + except ValueError: + break + else: + s = s[:i+5] + s[j:] + i = s.find(' at 0x') + if __debug__: + print s, + print >>output, s, + def writeln(s=''): + write(str(s) + '\n') indent = "" ! OutputFile.softspace = True def instrumentClass(cls): + cname = cls.__name__ + '.' for name in cls.__dict__: descr = getattr(cls, name) if hasattr(descr, '__get__'): ! setattr(cls, name, instrumentDescriptor(cname+name, descr)) ! def unInstrumentClass(cls): ! for name in cls.__dict__: ! descr = getattr(cls, name) ! if isinstance(descr, instrumentDescriptor): ! setattr(cls, name, descr.obj) class instrumentDescriptor(object): def __init__(self, name, obj): *************** *** 725,737 **** instrumentClass(Parser) root = parser.parse() - env = {} - eval(root, env, env) - g = env['pi']() - for i in range(1000): - print g.next(), - print - strhash = env['strhash'] ! def myhash(s): if not s: return 0 --- 767,772 ---- instrumentClass(Parser) root = parser.parse() ! def myhash(s, ord=ord): if not s: return 0 *************** *** 741,748 **** return x^len(s) for x in '', 'x', 'abc', 'abc'*100: ! a, b, c = strhash(x), myhash(x), hash(x) & 0xffffffffL ! if a == b == c: ! print a ! else: ! print a, b, c --- 776,854 ---- return x^len(s) + def checkoutput(n=0): + outputtext = output.getvalue() + check(strhash(outputtext), n) + + strhash = myhash + + checkoutput(1365277872) + + env = {} + eval(root, env, env) + g = env['pi']() + for i in range(1000): + write(g.next()) + writeln('') + strhash = env['strhash'] + for x in '', 'x', 'abc', 'abc'*100: ! check(strhash(x), myhash(x)) ! ! strhash = myhash ! checkoutput(3960406533) ! ! ##unInstrumentClass(Parser) ! it = Clone(getcFromString(unicode(sample, "utf8"))) ! it2 = Clone(it) ! scanner = Scanner(it.next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! checkoutput(2293472643) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(1000): ! write(g.next()) ! writeln() ! checkoutput(3960406533) ! ! def instrumentTree(base): ! instrumentClass(base) ! for cls in base.__subclasses__(): ! instrumentTree(cls) ! def unInstrumentTree(base): ! unInstrumentClass(base) ! for cls in base.__subclasses__(): ! unInstrumentTree(cls) ! ! instrumentTree(Node) ! scanner = Clone(Scanner(it2.next).tokenize()) ! scanner2 = Clone(scanner) ! parser = Parser(scanner) ! root = parser.parse() ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(10): ! write(g.next()) ! writeln() ! out = output.getvalue() ! ! unInstrumentTree(Node) ! unInstrumentClass(Parser) ! parser = Parser(scanner2) ! root = parser.parse() ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(10): ! write(g.next()) ! writeln() ! out2 = output.getvalue() ! check(out, out2) ! check(strhash(out[:1000]), 773700721) ! check(strhash(out[100000:101000]), 3131788725) ! check(strhash(out[200000:201000]), 3508888315) ! check(strhash(out[300000:301000]), 199799004) ! check(strhash(out[400000:401000]), 84251599) ! check(strhash(out[-1000:]), 620844360) Index: out0 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** out0 30 Dec 2003 06:12:57 -0000 1.1 --- out0 30 Dec 2003 16:28:25 -0000 1.2 *************** *** 1,42 **** ! parse() ! parse_stmt() ! parse_def() ! expect(NAME, 'def') ! nexttoken() return (NAME, 'pi') return 'def' ! expect(NAME) ! nexttoken() return (OPERATOR, '(') [...16941 lines suppressed...] ! Exprs.assign((3L, 3L), {u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 4L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! Name.assign(3L, {u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 4L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return ! Name.assign(3L, {u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return ! return ! return ! While.geneval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return <generator object at 0> ! Binop.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! Name.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return 3L ! Name.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return 3L ! return True ! Yield.geneval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return <generator object at 0> ! Name.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) ! return 3L ! 3 From fdrake at users.sourceforge.net Tue Dec 30 11:44:47 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 11:44:52 2003 Subject: [Python-checkins] python/dist/src/Doc/perl python.perl,1.144,1.145 Message-ID: <E1AbMz9-0000aS-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/perl In directory sc8-pr-cvs1:/tmp/cvs-serv2253 Modified Files: python.perl Log Message: remove ancient cruft Index: python.perl =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/perl/python.perl,v retrieving revision 1.144 retrieving revision 1.145 diff -C2 -d -r1.144 -r1.145 *** python.perl 30 Dec 2003 16:19:28 -0000 1.144 --- python.perl 30 Dec 2003 16:44:45 -0000 1.145 *************** *** 146,153 **** } - #sub do_cmd_developer{ do_cmd_author($_[0]); } - #sub do_cmd_developers{ do_cmd_author($_[0]); } - #sub do_cmd_developersaddress{ do_cmd_authoraddress($_[0]); } - sub do_cmd_hackscore{ local($_) = @_; --- 146,149 ---- From bwarsaw at users.sourceforge.net Tue Dec 30 11:49:42 2003 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue Dec 30 11:49:45 2003 Subject: [Python-checkins] python/dist/src/Lib/email __init__.py,1.30,1.31 Message-ID: <E1AbN3u-0000nz-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv3089 Modified Files: __init__.py Log Message: Bump version number to 2.5.5 Index: __init__.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/__init__.py,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** __init__.py 19 Aug 2003 04:05:25 -0000 1.30 --- __init__.py 30 Dec 2003 16:49:40 -0000 1.31 *************** *** 5,9 **** """ ! __version__ = '2.5.4' __all__ = [ --- 5,9 ---- """ ! __version__ = '2.5.5' __all__ = [ From bwarsaw at users.sourceforge.net Tue Dec 30 11:52:29 2003 From: bwarsaw at users.sourceforge.net (bwarsaw@users.sourceforge.net) Date: Tue Dec 30 11:52:34 2003 Subject: [Python-checkins] python/dist/src/Lib/email Charset.py,1.13,1.14 Message-ID: <E1AbN6b-0000yT-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1:/tmp/cvs-serv3738 Modified Files: Charset.py Log Message: Fixes to support CJKCodecs as per SF bug #852347. Actually, this patch removes dependencies on the old unsupported KoreanCodecs package and the alternative JapaneseCodecs package. Since both of those provide aliases for their codecs, this removal just makes the generic codec names work. We needed to make slight changes to __init__() as well. This will be backported to Python 2.3 when its branch freeze is over. Index: Charset.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Charset.py 6 Mar 2003 05:16:29 -0000 1.13 --- Charset.py 30 Dec 2003 16:52:25 -0000 1.14 *************** *** 2,5 **** --- 2,16 ---- # Author: che@debian.org (Ben Gertzfield), barry@zope.com (Barry Warsaw) + # Python 2.3 doesn't come with any Asian codecs by default. Two packages are + # currently available and supported as of this writing (30-Dec-2003): + # + # CJKCodecs + # http://cjkpython.i18n.org + # This package contains Chinese, Japanese, and Korean codecs + + # JapaneseCodecs + # http://www.asahi-net.or.jp/~rd6t-kjym/python + # Some Japanese users prefer this codec package + from types import UnicodeType from email.Encoders import encode_7or8bit *************** *** 89,113 **** } - # Map charsets to their Unicode codec strings. Note that Python doesn't come - # with any Asian codecs by default. Here's where to get them: - # - # Japanese -- http://www.asahi-net.or.jp/~rd6t-kjym/python - # Korean -- http://sf.net/projects/koco - # Chinese -- http://sf.net/projects/python-codecs - # - # Note that these codecs have their own lifecycle and may be in varying states - # of stability and useability. CODEC_MAP = { ! 'euc-jp': 'japanese.euc-jp', ! 'iso-2022-jp': 'japanese.iso-2022-jp', ! 'shift_jis': 'japanese.shift_jis', ! 'euc-kr': 'korean.euc-kr', ! 'ks_c_5601-1987': 'korean.cp949', ! 'iso-2022-kr': 'korean.iso-2022-kr', ! 'johab': 'korean.johab', ! 'gb2132': 'eucgb2312_cn', 'big5': 'big5_tw', - 'utf-8': 'utf-8', # Hack: We don't want *any* conversion for stuff marked us-ascii, as all # sorts of garbage might be sent to us in the guise of 7-bit us-ascii. --- 100,108 ---- } + # Map charsets to their Unicode codec strings. CODEC_MAP = { ! 'gb2312': 'eucgb2312_cn', 'big5': 'big5_tw', # Hack: We don't want *any* conversion for stuff marked us-ascii, as all # sorts of garbage might be sent to us in the guise of 7-bit us-ascii. *************** *** 221,224 **** --- 216,221 ---- henc, benc, conv = CHARSETS.get(self.input_charset, (SHORTEST, BASE64, None)) + if not conv: + conv = self.input_charset # Set the attributes, allowing the arguments to override the default. self.header_encoding = henc *************** *** 230,234 **** self.input_charset) self.output_codec = CODEC_MAP.get(self.output_charset, ! self.input_codec) def __str__(self): --- 227,231 ---- self.input_charset) self.output_codec = CODEC_MAP.get(self.output_charset, ! self.output_charset) def __str__(self): From fdrake at users.sourceforge.net Tue Dec 30 12:16:43 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 12:16:46 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew20.tex, 1.49, 1.50 Message-ID: <E1AbNU3-0002CX-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv8446 Modified Files: whatsnew20.tex Log Message: markup fix Index: whatsnew20.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew20.tex,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** whatsnew20.tex 20 Oct 2003 14:01:48 -0000 1.49 --- whatsnew20.tex 30 Dec 2003 17:16:41 -0000 1.50 *************** *** 526,531 **** is compiled, if you can't afford even a tiny speed penalty or suspect that the cycle collection is buggy, by specifying the ! \samp{--without-cycle-gc} switch when running the \file{configure} ! script. Several people tackled this problem and contributed to a solution. An --- 526,531 ---- is compiled, if you can't afford even a tiny speed penalty or suspect that the cycle collection is buggy, by specifying the ! \longprogramopt{without-cycle-gc} switch when running the ! \program{configure} script. Several people tackled this problem and contributed to a solution. An From fdrake at users.sourceforge.net Tue Dec 30 12:17:20 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 12:17:22 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.146, 1.147 Message-ID: <E1AbNUe-0002Fb-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8647 Modified Files: libstdtypes.tex Log Message: markup fix Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** libstdtypes.tex 17 Dec 2003 20:43:32 -0000 1.146 --- libstdtypes.tex 30 Dec 2003 17:17:17 -0000 1.147 *************** *** 1557,1562 **** \begin{memberdesc}[file]{newlines} ! If Python was built with the \code{--with-universal-newlines} option ! (the default) this read-only attribute exists, and for files opened in universal newline read mode it keeps track of the types of newlines encountered while reading the file. The values it can take are --- 1557,1563 ---- \begin{memberdesc}[file]{newlines} ! If Python was built with the \longprogramopt{with-universal-newlines} ! option to \program{configure} (the default) this read-only attribute ! exists, and for files opened in universal newline read mode it keeps track of the types of newlines encountered while reading the file. The values it can take are From fdrake at users.sourceforge.net Tue Dec 30 15:36:23 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 15:36:27 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libdatetime.tex, 1.51, 1.52 Message-ID: <E1AbQbH-0004ib-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv18132 Modified Files: libdatetime.tex Log Message: lots of markup adjustments Index: libdatetime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdatetime.tex,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** libdatetime.tex 6 Sep 2003 05:36:13 -0000 1.51 --- libdatetime.tex 30 Dec 2003 20:36:20 -0000 1.52 *************** *** 107,111 **** The distinction between naive and aware doesn't apply to ! \code{timedelta} objects. Subclass relationships: --- 107,111 ---- The distinction between naive and aware doesn't apply to ! \class{timedelta} objects. Subclass relationships: *************** *** 125,133 **** between two dates or times. ! \begin{classdesc}{timedelta}{days=0, seconds=0, microseconds=0, ! milliseconds=0, minutes=0, hours=0, weeks=0} ! ! All arguments are optional. Arguments may be ints, longs, or floats, ! and may be positive or negative. Only \var{days}, \var{seconds} and \var{microseconds} are stored --- 125,133 ---- between two dates or times. ! \begin{classdesc}{timedelta}{\optional{days\optional{, seconds\optional{, ! microseconds\optional{, milliseconds\optional{, ! minutes\optional{, hours\optional{, weeks}}}}}}}} ! All arguments are optional and default to \code{0}. Arguments may ! be ints, longs, or floats, and may be positive or negative. Only \var{days}, \var{seconds} and \var{microseconds} are stored *************** *** 210,215 **** \lineii{\var{t1} = \var{t2} - \var{t3}} {Difference of \var{t2} and \var{t3}. ! Afterwards \var{t1} == \var{t2} - \var{t3} and \var{t2} == \var{t1} + \var{t3} are ! true. (1)} \lineii{\var{t1} = \var{t2} * \var{i} or \var{t1} = \var{i} * \var{t2}} --- 210,215 ---- \lineii{\var{t1} = \var{t2} - \var{t3}} {Difference of \var{t2} and \var{t3}. ! Afterwards \var{t1} == \var{t2} - \var{t3} and ! \var{t2} == \var{t1} + \var{t3} are true. (1)} \lineii{\var{t1} = \var{t2} * \var{i} or \var{t1} = \var{i} * \var{t2}} *************** *** 353,357 **** Supported operations: - % XXX rewrite to be a table \begin{tableii}{c|l}{code}{Operation}{Result} \lineii{\var{date2} = \var{date1} + \var{timedelta}} --- 353,356 ---- *************** *** 367,371 **** {(3)} ! \lineii{\var{date1}<\var{date2}} {\var{date1} is considered less than \var{date2} when \var{date1} precedes \var{date2} in time. (4)} --- 366,370 ---- {(3)} ! \lineii{\var{date1} < \var{date2}} {\var{date1} is considered less than \var{date2} when \var{date1} precedes \var{date2} in time. (4)} *************** *** 521,527 **** Constructor: ! \begin{classdesc}{datetime}{year, month, day, ! hour=0, minute=0, second=0, microsecond=0, ! tzinfo=None} The year, month and day arguments are required. \var{tzinfo} may be \code{None}, or an instance of a \class{tzinfo} subclass. The --- 520,527 ---- Constructor: ! \begin{classdesc}{datetime}{year, month, day\optional{, ! hour\optional{, minute\optional{, ! second\optional{, microsecond\optional{, ! tzinfo}}}}}} The year, month and day arguments are required. \var{tzinfo} may be \code{None}, or an instance of a \class{tzinfo} subclass. The *************** *** 551,555 **** \end{methoddesc} ! \begin{methoddesc}{now(tz=None)}{} Return the current local date and time. If optional argument \var{tz} is \code{None} or not specified, this is like --- 551,555 ---- \end{methoddesc} ! \begin{methoddesc}{now}{\optional{tz}} Return the current local date and time. If optional argument \var{tz} is \code{None} or not specified, this is like *************** *** 573,577 **** \end{methoddesc} ! \begin{methoddesc}{fromtimestamp}{timestamp, tz=None} Return the local date and time corresponding to the \POSIX{} timestamp, such as is returned by \function{time.time()}. --- 573,577 ---- \end{methoddesc} ! \begin{methoddesc}{fromtimestamp}{timestamp\optional{, tz}} Return the local date and time corresponding to the \POSIX{} timestamp, such as is returned by \function{time.time()}. *************** *** 781,786 **** \end{methoddesc} ! \begin{methoddesc}{replace}{year=, month=, day=, hour=, minute=, second=, ! microsecond=, tzinfo=} Return a datetime with the same members, except for those members given new values by whichever keyword arguments are specified. Note that --- 781,788 ---- \end{methoddesc} ! \begin{methoddesc}{replace}{\optional{year\optional{, month\optional{, ! day\optional{, hour\optional{, minute\optional{, ! second\optional{, microsecond\optional{, ! tzinfo}}}}}}}}} Return a datetime with the same members, except for those members given new values by whichever keyword arguments are specified. Note that *************** *** 912,916 **** \end{methoddesc} ! \begin{methoddesc}{isoformat}{sep='T'} Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm --- 914,918 ---- \end{methoddesc} ! \begin{methoddesc}{isoformat}{\optional{sep}} Return a string representing the date and time in ISO 8601 format, YYYY-MM-DDTHH:MM:SS.mmmmmm *************** *** 968,973 **** particular day, and subject to adjustment via a \class{tzinfo} object. ! \begin{classdesc}{time}{hour=0, minute=0, second=0, microsecond=0, ! tzinfo=None} All arguments are optional. \var{tzinfo} may be \code{None}, or an instance of a \class{tzinfo} subclass. The remaining arguments --- 970,975 ---- particular day, and subject to adjustment via a \class{tzinfo} object. ! \begin{classdesc}{time}{hour\optional{, minute\optional{, second\optional{, ! microsecond\optional{, tzinfo}}}}} All arguments are optional. \var{tzinfo} may be \code{None}, or an instance of a \class{tzinfo} subclass. The remaining arguments *************** *** 982,986 **** If an argument outside those ranges is given, ! \exception{ValueError} is raised. \end{classdesc} --- 984,989 ---- If an argument outside those ranges is given, ! \exception{ValueError} is raised. All default to \code{0} except ! \var{tzinfo}, which defaults to \constant{None}. \end{classdesc} *************** *** 1058,1062 **** Instance methods: ! \begin{methoddesc}{replace}(hour=, minute=, second=, microsecond=, tzinfo=) Return a \class{time} with the same value, except for those members given new values by whichever keyword arguments are specified. Note that --- 1061,1067 ---- Instance methods: ! \begin{methoddesc}{replace}{\optional{hour\optional{, minute\optional{, ! second\optional{, microsecond\optional{, ! tzinfo}}}}}} Return a \class{time} with the same value, except for those members given new values by whichever keyword arguments are specified. Note that *************** *** 1184,1188 **** must return the same result for every \class{datetime} \var{dt} ! with \code{\var{dt}.tzinfo==\var{tz}} For sane \class{tzinfo} subclasses, this expression yields the time zone's "standard offset", which should not depend on the date or the time, but only on geographic --- 1189,1193 ---- must return the same result for every \class{datetime} \var{dt} ! with \code{\var{dt}.tzinfo == \var{tz}} For sane \class{tzinfo} subclasses, this expression yields the time zone's "standard offset", which should not depend on the date or the time, but only on geographic *************** *** 1198,1213 **** \begin{verbatim} ! return timedelta(0) # a fixed-offset class: doesn't account for DST or ! # Code to set dston and dstoff to the time zone's DST transition ! # times based on the input dt.year, and expressed in standard local ! # time. Then ! if dston <= dt.replace(tzinfo=None) < dstoff: ! return timedelta(hours=1) ! else: ! return timedelta(0) \end{verbatim} --- 1203,1223 ---- \begin{verbatim} ! def dst(self): ! # a fixed-offset class: doesn't account for DST ! return timedelta(0) ! \end{verbatim} or ! \begin{verbatim} ! def dst(self): ! # Code to set dston and dstoff to the time zone's DST ! # transition times based on the input dt.year, and expressed ! # in standard local time. Then ! if dston <= dt.replace(tzinfo=None) < dstoff: ! return timedelta(hours=1) ! else: ! return timedelta(0) \end{verbatim} *************** *** 1322,1326 **** to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, so \code{astimezone(Eastern)} won't deliver a result with ! \code{hour==2} on the day DST begins. In order for \method{astimezone()} to make this guarantee, the \method{rzinfo.dst()} method must consider times --- 1332,1336 ---- to 3:00. A wall time of the form 2:MM doesn't really make sense on that day, so \code{astimezone(Eastern)} won't deliver a result with ! \code{hour == 2} on the day DST begins. In order for \method{astimezone()} to make this guarantee, the \method{rzinfo.dst()} method must consider times *************** *** 1399,1401 **** varies across platforms. Regardless of platform, years before 1900 cannot be used. - --- 1409,1410 ---- From fdrake at users.sourceforge.net Tue Dec 30 15:49:01 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 15:49:04 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.159,1.160 Message-ID: <E1AbQnV-0005II-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv20332 Modified Files: libfuncs.tex Log Message: fix markup errors Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.159 retrieving revision 1.160 diff -C2 -d -r1.159 -r1.160 *** libfuncs.tex 23 Dec 2003 16:53:34 -0000 1.159 --- libfuncs.tex 30 Dec 2003 20:48:59 -0000 1.160 *************** *** 885,891 **** \end{funcdesc} ! \begin{funcdesc}{sorted(\var{iterable}\optional{, \var{cmp}=None ! \optional{, \var{key}=None ! \optional{, \var{reverse}=False}}})} Return a new sorted list from the items in \var{iterable}. The optional arguments \var{cmp}, \var{key}, and \var{reverse} --- 885,890 ---- \end{funcdesc} ! \begin{funcdesc}{sorted}{iterable\optional{, cmp\optional{, ! key\optional{, reverse}}}} Return a new sorted list from the items in \var{iterable}. The optional arguments \var{cmp}, \var{key}, and \var{reverse} From fdrake at users.sourceforge.net Tue Dec 30 17:17:20 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 17:17:24 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libcopyreg.tex,1.11,1.12 Message-ID: <E1AbSAy-0001Bn-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv4565 Modified Files: libcopyreg.tex Log Message: work around whitespace bugs in the HTML version Index: libcopyreg.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcopyreg.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** libcopyreg.tex 19 Mar 2002 03:33:33 -0000 1.11 --- libcopyreg.tex 30 Dec 2003 22:17:16 -0000 1.12 *************** *** 7,13 **** The \module{copy_reg} module provides support for the ! \refmodule{pickle}\refstmodindex{pickle} and ! \refmodule{cPickle}\refbimodindex{cPickle} modules. The ! \refmodule{copy}\refstmodindex{copy} module is likely to use this in the future as well. It provides configuration information about object constructors which are not classes. Such constructors may be factory --- 7,13 ---- The \module{copy_reg} module provides support for the ! \refmodule{pickle}\refstmodindex{pickle}\ and ! \refmodule{cPickle}\refbimodindex{cPickle}\ modules. The ! \refmodule{copy}\refstmodindex{copy}\ module is likely to use this in the future as well. It provides configuration information about object constructors which are not classes. Such constructors may be factory From fdrake at users.sourceforge.net Tue Dec 30 17:21:21 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 17:21:25 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.147, 1.148 Message-ID: <E1AbSEr-0001Mo-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv5238 Modified Files: libstdtypes.tex Log Message: fix a variety of markup bugs Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.147 retrieving revision 1.148 diff -C2 -d -r1.147 -r1.148 *** libstdtypes.tex 30 Dec 2003 17:17:17 -0000 1.147 --- libstdtypes.tex 30 Dec 2003 22:21:18 -0000 1.148 *************** *** 698,702 **** Return a list of the words in the string, using \var{sep} as the delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} ! splits are done, the \em{rightmost} ones. If \var{sep} is not specified or \code{None}, any whitespace string is a separator. \versionadded{2.4} --- 698,702 ---- Return a list of the words in the string, using \var{sep} as the delimiter string. If \var{maxsplit} is given, at most \var{maxsplit} ! splits are done, the \emph{rightmost} ones. If \var{sep} is not specified or \code{None}, any whitespace string is a separator. \versionadded{2.4} *************** *** 804,808 **** If \var{format} requires a single argument, \var{values} may be a ! single non-tuple object. \footnote{To format only a tuple you should therefore provide a singleton tuple whose only element is the tuple to be formatted.} Otherwise, \var{values} must be a tuple with --- 804,808 ---- If \var{format} requires a single argument, \var{values} may be a ! single non-tuple object.\footnote{To format only a tuple you should therefore provide a singleton tuple whose only element is the tuple to be formatted.} Otherwise, \var{values} must be a tuple with *************** *** 929,933 **** Additional string operations are defined in standard modules ! \refmodule{string}\refstmodindex{string} and \refmodule{re}.\refstmodindex{re} --- 929,933 ---- Additional string operations are defined in standard modules ! \refmodule{string}\refstmodindex{string}\ and \refmodule{re}.\refstmodindex{re} *************** *** 935,943 **** \subsubsection{XRange Type \label{typesseq-xrange}} ! The xrange\obindex{xrange} type is an immutable sequence which is ! commonly used for looping. The advantage of the xrange type is that an ! xrange object will always take the same amount of memory, no matter the ! size of the range it represents. There are no consistent performance ! advantages. XRange objects have very little behavior: they only support indexing, --- 935,943 ---- \subsubsection{XRange Type \label{typesseq-xrange}} ! The \class{xrange}\obindex{xrange} type is an immutable sequence which ! is commonly used for looping. The advantage of the \class{xrange} ! type is that an \class{xrange} object will always take the same amount ! of memory, no matter the size of the range it represents. There are ! no consistent performance advantages. XRange objects have very little behavior: they only support indexing, *************** *** 986,991 **** \lineiii{\var{s}.reverse()} {reverses the items of \var{s} in place}{(7)} ! \lineiii{\var{s}.sort(\optional{\var{cmp}=None\optional{, \var{key}=None ! \optional{, \var{reverse}=False}}})} {sort the items of \var{s} in place}{(7), (8), (9), (10)} \end{tableiii} --- 986,991 ---- \lineiii{\var{s}.reverse()} {reverses the items of \var{s} in place}{(7)} ! \lineiii{\var{s}.sort(\optional{\var{cmp}\optional{, ! \var{key}\optional{, \var{reverse}}}})} {sort the items of \var{s} in place}{(7), (8), (9), (10)} \end{tableiii} *************** *** 1061,1069 **** \versionchanged[Support for \code{None} as an equivalent to omitting ! \var{cmpfunc} was added]{2.3} \versionchanged[Support for \var{key} and \var{reverse} was added]{2.4} ! \item[(9)] Starting with Python 2.3, the \method{sort()} method is guaranteed to be stable. A sort is stable if it guarantees not to change the relative order of elements that compare equal --- this is --- 1061,1069 ---- \versionchanged[Support for \code{None} as an equivalent to omitting ! \var{cmp} was added]{2.3} \versionchanged[Support for \var{key} and \var{reverse} was added]{2.4} ! \item[(9)] Starting with Python 2.3, the \method{sort()} method is guaranteed to be stable. A sort is stable if it guarantees not to change the relative order of elements that compare equal --- this is *************** *** 1072,1079 **** \item[(10)] While a list is being sorted, the effect of attempting to ! mutate, or even inspect, the list is undefined. The C implementation ! of Python 2.3 makes the list appear empty for the duration, and raises ! \exception{ValueError} if it can detect that the list has been ! mutated during a sort. \end{description} --- 1072,1079 ---- \item[(10)] While a list is being sorted, the effect of attempting to ! mutate, or even inspect, the list is undefined. The C ! implementation of Python 2.3 and newer makes the list appear empty ! for the duration, and raises \exception{ValueError} if it can detect ! that the list has been mutated during a sort. \end{description} *************** *** 1348,1353 **** \ref{built-in-funcs}, ``Built-in Functions.''\footnote{\function{file()} is new in Python 2.2. The older built-in \function{open()} is an ! alias for \function{file()}.} ! File objects are also returned by some other built-in functions and methods, such as \function{os.popen()} and \function{os.fdopen()} and the --- 1348,1352 ---- \ref{built-in-funcs}, ``Built-in Functions.''\footnote{\function{file()} is new in Python 2.2. The older built-in \function{open()} is an ! alias for \function{file()}.} File objects are also returned by some other built-in functions and methods, such as \function{os.popen()} and \function{os.fdopen()} and the *************** *** 1429,1433 **** \begin{methoddesc}[file]{readline}{\optional{size}} Read one entire line from the file. A trailing newline character is ! kept in the string\footnote{ The advantage of leaving the newline on is that returning an empty string is then an unambiguous \EOF{} --- 1428,1433 ---- \begin{methoddesc}[file]{readline}{\optional{size}} Read one entire line from the file. A trailing newline character is ! kept in the string (but may be absent when a file ends with an ! incomplete line).\footnote{ The advantage of leaving the newline on is that returning an empty string is then an unambiguous \EOF{} *************** *** 1437,1442 **** to tell whether the last line of a file ended in a newline or not (yes this happens!). ! } (but may be absent when a file ends with an ! incomplete line). If the \var{size} argument is present and non-negative, it is a maximum byte count (including the trailing newline) and an incomplete line may be returned. --- 1437,1441 ---- to tell whether the last line of a file ended in a newline or not (yes this happens!). ! } If the \var{size} argument is present and non-negative, it is a maximum byte count (including the trailing newline) and an incomplete line may be returned. *************** *** 1460,1464 **** This method returns the same thing as \code{iter(f)}. \versionadded{2.1} ! \deprecated{2.3}{Use \code{for line in file} instead.} \end{methoddesc} --- 1459,1463 ---- This method returns the same thing as \code{iter(f)}. \versionadded{2.1} ! \deprecated{2.3}{Use \samp{for \var{line} in \var{file}} instead.} \end{methoddesc} *************** *** 1607,1611 **** 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: --- 1606,1611 ---- 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__ = \{\}}). Modifying \member{__dict__} directly ! is not recommended. Modules built into the interpreter are written like this: *************** *** 1725,1729 **** Type objects represent the various object types. An object's type is accessed by the built-in function \function{type()}. There are no special ! operations on types. The standard module \module{types} defines names for all standard built-in types. \bifuncindex{type} --- 1725,1729 ---- Type objects represent the various object types. An object's type is accessed by the built-in function \function{type()}. There are no special ! operations on types. The standard module \refmodule{types} defines names for all standard built-in types. \bifuncindex{type} From fdrake at users.sourceforge.net Tue Dec 30 17:51:34 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 17:51:40 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libsite.tex,1.24,1.25 Message-ID: <E1AbSi6-0002rl-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv10995 Modified Files: libsite.tex Log Message: - we *really* don't care about Python 1.5 alphas any more! - note the interpreter's -S option Index: libsite.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsite.tex,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** libsite.tex 30 Dec 2002 03:08:27 -0000 1.24 --- libsite.tex 30 Dec 2003 22:51:32 -0000 1.25 *************** *** 7,17 **** \strong{This module is automatically imported during initialization.} ! In earlier versions of Python (up to and including 1.5a3), scripts or ! modules that needed to use site-specific modules would place ! \samp{import site} somewhere near the top of their code. This is no ! longer necessary. ! ! This will append site-specific paths to the module search path. \indexiii{module}{search}{path} --- 7,15 ---- \strong{This module is automatically imported during initialization.} + The automatic import can be suppressed using the interpreter's + \programopt{-S} option. ! Importing this module will append site-specific paths to the module ! search path. \indexiii{module}{search}{path} From fdrake at users.sourceforge.net Tue Dec 30 18:01:23 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 18:01:30 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libuser.tex,1.17,1.18 Message-ID: <E1AbSrb-0003dx-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv13979 Modified Files: libuser.tex Log Message: minor cleanup of example Index: libuser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libuser.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libuser.tex 6 Jul 2001 20:30:11 -0000 1.17 --- libuser.tex 30 Dec 2003 23:01:19 -0000 1.18 *************** *** 49,57 **** \begin{verbatim} import user ! try: ! verbose = user.spam_verbose # user's verbosity preference ! except AttributeError: ! verbose = 0 # default verbosity \end{verbatim} Programs with extensive customization needs are better off reading a --- 49,59 ---- \begin{verbatim} import user ! ! verbose = bool(getattr(user, "spam_verbose", 0)) \end{verbatim} + + (The three-argument form of \function{getattr()} is used in case + the user has not defined \code{spam_verbose} in their + \file{.pythonrc.py} file.) Programs with extensive customization needs are better off reading a From fdrake at users.sourceforge.net Tue Dec 30 18:08:18 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 18:08:26 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libstring.tex,1.55,1.56 Message-ID: <E1AbSyI-000423-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15481 Modified Files: libstring.tex Log Message: fix truly evil markup typo Index: libstring.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstring.tex,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** libstring.tex 17 Dec 2003 02:49:03 -0000 1.55 --- libstring.tex 30 Dec 2003 23:08:14 -0000 1.56 *************** *** 222,226 **** optional third argument \var{maxsplit} is explicitly specified and nonzero. When \var{maxsplit} is nonzero, at most \var{maxsplit} ! number of splits -- the \em{rightmost} ones -- occur, and the remainder of the string is returned as the first element of the list (thus, the list will have at most \code{\var{maxsplit}+1} elements). --- 222,226 ---- optional third argument \var{maxsplit} is explicitly specified and nonzero. When \var{maxsplit} is nonzero, at most \var{maxsplit} ! number of splits -- the \emph{rightmost} ones -- occur, and the remainder of the string is returned as the first element of the list (thus, the list will have at most \code{\var{maxsplit}+1} elements). From gvanrossum at users.sourceforge.net Tue Dec 30 19:10:37 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 19:10:51 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b.py, NONE, 1.1 b3.py, NONE, 1.1 out3, NONE, 1.1 b0.py, 1.2, 1.3 Message-ID: <E1AbTwb-0007g5-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv29507 Modified Files: b0.py Added Files: b.py b3.py out3 Log Message: Add driver. Add sorting experiment. --- NEW FILE: b.py --- import b0 import b1 import b2 import b3 --- NEW FILE: b3.py --- class Random: def __init__(self, x, y, z): self._seed = (x, y, z) def random(self): x, y, z = self._seed x = (171 * x) % 30269 y = (172 * y) % 30307 z = (170 * z) % 30323 self._seed = x, y, z return (x/30269.0 + y/30307.0 + z/30323.0) % 1.0 def uniform(self, a, b): return a + (b-a) * self.random() def randint(self, a, b): return a + int((b+1-a) * self.random()) def choice(self, seq): return seq[int(self.random() * len(seq))] rgen = Random(57, 86, 708 % 650) compares = 0 T = int class TT(T): def __repr__(self): return "T(%d)" % self class Int(TT): def __new__(cls, value=None): if value is None: value = rgen.randint(0, 0x7ffffffe) return TT.__new__(cls, value) def icmp(a, b): global compares compares += 1 return T.__cmp__(a, b) N = 20000 K = 1 if __debug__: import time def sortum(data, cmp=None): global compares compares = 0 data = data[:] if __debug__: t0 = time.time() if cmp is None: print "using None" data.sort() else: print "using", cmp.__name__ data.sort(cmp) if __debug__: t1 = time.time() print "Z", data[:K], data[N//2:N//2+K], data[-K:] print compares, if __debug__: print "%.3f" % (t1-t0), print def main(): if __debug__: t0 = time.time() data = [Int() for x in xrange(N)] if __debug__: t1 = time.time() if __debug__: print "%.3f" % (t1-t0) print "A", data[:K], data[N//2:N//2+K], data[-K:] sortum(data) sortum(data, cmp) sortum(data, icmp) TT.__cmp__ = icmp sortum(data) TT.__cmp__ = T.__cmp__ sortum(data) main() --- NEW FILE: out3 --- 0.277 A [T(290448019)] [T(606178844)] [T(186360231)] using None Z [T(387083)] [T(1077158269)] [T(2146971462)] 0 0.013 using cmp Z [T(387083)] [T(1077158269)] [T(2146971462)] 0 0.055 using icmp Z [T(387083)] [T(1077158269)] [T(2146971462)] 119885 0.265 using None Z [T(387083)] [T(1077158269)] [T(2146971462)] 119885 0.331 using None Z [T(387083)] [T(1077158269)] [T(2146971462)] 0 0.025 Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b0.py 30 Dec 2003 16:28:25 -0000 1.2 --- b0.py 31 Dec 2003 00:10:34 -0000 1.3 *************** *** 693,697 **** output = OutputFile() def write(s): ! s = str(s) i = s.find(' at 0x') while i > 0: --- 693,697 ---- output = OutputFile() def write(s): ! s = str(s).replace('<b0.', '<__main__.') i = s.find(' at 0x') while i > 0: From gvanrossum at users.sourceforge.net Tue Dec 30 19:12:14 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 19:12:17 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b3.py, 1.1, 1.2 out3, 1.1, 1.2 Message-ID: <E1AbTyA-0007kX-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv29787 Modified Files: b3.py out3 Log Message: Oops, disable timings. Index: b3.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b3.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b3.py 31 Dec 2003 00:10:34 -0000 1.1 --- b3.py 31 Dec 2003 00:12:12 -0000 1.2 *************** *** 45,49 **** K = 1 ! if __debug__: import time def sortum(data, cmp=None): --- 45,49 ---- K = 1 ! ##if __debug__: import time def sortum(data, cmp=None): *************** *** 51,55 **** compares = 0 data = data[:] ! if __debug__: t0 = time.time() if cmp is None: print "using None" --- 51,55 ---- compares = 0 data = data[:] ! ##if __debug__: t0 = time.time() if cmp is None: print "using None" *************** *** 58,72 **** print "using", cmp.__name__ data.sort(cmp) ! if __debug__: t1 = time.time() print "Z", data[:K], data[N//2:N//2+K], data[-K:] print compares, ! if __debug__: print "%.3f" % (t1-t0), print def main(): ! if __debug__: t0 = time.time() data = [Int() for x in xrange(N)] ! if __debug__: t1 = time.time() ! if __debug__: print "%.3f" % (t1-t0) print "A", data[:K], data[N//2:N//2+K], data[-K:] sortum(data) --- 58,72 ---- print "using", cmp.__name__ data.sort(cmp) ! ##if __debug__: t1 = time.time() print "Z", data[:K], data[N//2:N//2+K], data[-K:] print compares, ! ##if __debug__: print "%.3f" % (t1-t0), print def main(): ! ##if __debug__: t0 = time.time() data = [Int() for x in xrange(N)] ! ##if __debug__: t1 = time.time() ! ##if __debug__: print "%.3f" % (t1-t0) print "A", data[:K], data[N//2:N//2+K], data[-K:] sortum(data) Index: out3 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** out3 31 Dec 2003 00:10:34 -0000 1.1 --- out3 31 Dec 2003 00:12:12 -0000 1.2 *************** *** 1,17 **** ! 0.277 ! A [T(290448019)] [T(606178844)] [T(186360231)] using None ! Z [T(387083)] [T(1077158269)] [T(2146971462)] ! 0 0.013 using cmp ! Z [T(387083)] [T(1077158269)] [T(2146971462)] ! 0 0.055 using icmp ! Z [T(387083)] [T(1077158269)] [T(2146971462)] ! 119885 0.265 using None ! Z [T(387083)] [T(1077158269)] [T(2146971462)] ! 119885 0.331 using None ! Z [T(387083)] [T(1077158269)] [T(2146971462)] ! 0 0.025 --- 1,16 ---- ! A [T(290448019)] [T(1487478786)] [T(159903786)] using None ! Z [T(387083)] [T(1080738845)] [T(2147439074)] ! 0 using cmp ! Z [T(387083)] [T(1080738845)] [T(2147439074)] ! 0 using icmp ! Z [T(387083)] [T(1080738845)] [T(2147439074)] ! 259811 using None ! Z [T(387083)] [T(1080738845)] [T(2147439074)] ! 259811 using None ! Z [T(387083)] [T(1080738845)] [T(2147439074)] ! 0 From gvanrossum at users.sourceforge.net Tue Dec 30 20:33:11 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 20:33:15 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b4.py, NONE, 1.1 out4, NONE, 1.1 b.py, 1.1, 1.2 b0.py, 1.3, 1.4 out0, 1.2, 1.3 Message-ID: <E1AbVEV-0002tl-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv11112 Modified Files: b.py b0.py out0 Added Files: b4.py out4 Log Message: Another test, based on heapq.py. Fixed and updated b0.py and out0. --- NEW FILE: b4.py --- sample = ''' def heappush(heap, item): heap.append(item) _siftdown(heap, 0, len(heap)-1) def heappop(heap): lastelt = heap.pop() # raises appropriate IndexError if heap is empty if heap: returnitem = heap[0] heap[0] = lastelt _siftup(heap, 0) else: returnitem = lastelt return returnitem def heapreplace(heap, item): returnitem = heap[0] # raises appropriate IndexError if heap is empty heap[0] = item _siftup(heap, 0) return returnitem def heapify(x): n = len(x) for i in xrange(n//2 - 1, 0-1, 0-1): _siftup(x, i) def _siftdown(heap, startpos, pos): newitem = heap[pos] while pos > startpos: parentpos = (pos - 1) >> 1 parent = heap[parentpos] if parent <= newitem: break heap[pos] = parent pos = parentpos heap[pos] = newitem def _siftup(heap, pos): endpos = len(heap) startpos = pos newitem = heap[pos] # Bubble up the smaller child until hitting a leaf. childpos = 2*pos + 1 # leftmost child position while childpos < endpos: # Set childpos to index of smaller child. rightpos = childpos + 1 if rightpos < endpos: if heap[rightpos] <= heap[childpos]: childpos = rightpos # Move the smaller child up. heap[pos] = heap[childpos] pos = childpos childpos = 2*pos + 1 # The leaf at pos is empty now. Put newitem there, and bubble it up # to its final resting place (by sifting its parents down). heap[pos] = newitem _siftdown(heap, startpos, pos) ''' from b0 import Parser, Scanner, getcFromString, eval, instrumentTree, Node scanner = Scanner(getcFromString(sample).next).tokenize() parser = Parser(scanner) root = parser.parse() instrumentTree(Node) env = {} eval(root, env, env) heappush = env['heappush'] heappop = env['heappop'] # Simple sanity test heap = [] data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] for item in data: heappush(heap, item) sort = [] while heap: sort.append(heappop(heap)) print sort --- NEW FILE: out4 --- Define.eval({}, {}) Node.isgenerator() return False Node.isgenerator() return False return Define.eval({'heappush': <__main__.Function object at 0>}, {'heappush': <__main__.Function object at 0>}) Node.isgenerator() return False If.isgenerator() Node.isgenerator() return False Node.isgenerator() return False Node.isgenerator() return False Node.isgenerator() return False return False [...3670 lines suppressed...] return <built-in method pop of list object at 0> return 9 Name.assign(9, {'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'heap': []}) return return If.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) return [] Assign.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) return 9 Name.assign(9, {'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) return return return Return.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}) Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}) return 9 raise <__main__.DoReturn instance at 0> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] Index: b.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b.py 31 Dec 2003 00:10:34 -0000 1.1 --- b.py 31 Dec 2003 01:33:07 -0000 1.2 *************** *** 3,4 **** --- 3,5 ---- import b2 import b3 + import b4 Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** b0.py 31 Dec 2003 00:10:34 -0000 1.3 --- b0.py 31 Dec 2003 01:33:07 -0000 1.4 *************** *** 1,7 **** def check(a, b): if not a == b: ! print (a, b) ! if __debug__: ! raise AssertionError("%r != %r" % (a, b)) def proto___new__(cls, name): --- 1,5 ---- def check(a, b): if not a == b: ! raise AssertionError("%.30r != %.30r" % (a, b)) def proto___new__(cls, name): *************** *** 185,197 **** ''' - s = Scanner(getcFromString(sample).next) - it = Clone(s.tokenize()) - it2 = Clone(it) - L = [] - for pair in it: - L.append(pair) - L2 = list(it2) - check(L, L2) - operators = { '<': 1, --- 183,186 ---- *************** *** 244,247 **** --- 233,239 ---- self.value = value + class DoBreak(Exception): + pass + def eval(body, globals, locals): for stmt in body: *************** *** 317,326 **** for value in self.seq.eval(globals, locals): self.var.assign(value, globals, locals) ! eval(self.body, globals, locals) def geneval(self, globals, locals): for value in self.seq.eval(globals, locals): self.var.assign(value, globals, locals) ! for v in geneval(self.body, globals, locals): ! yield v class While(Node): def __init__(self, test, body): --- 309,324 ---- for value in self.seq.eval(globals, locals): self.var.assign(value, globals, locals) ! try: ! eval(self.body, globals, locals) ! except DoBreak: ! break def geneval(self, globals, locals): for value in self.seq.eval(globals, locals): self.var.assign(value, globals, locals) ! try: ! for v in geneval(self.body, globals, locals): ! yield v ! except DoBreak: ! break class While(Node): def __init__(self, test, body): *************** *** 333,356 **** def eval(self, globals, locals): while self.test.eval(globals, locals): ! eval(self.body, globals, locals) def geneval(self, globals, locals): while self.test.eval(globals, locals): ! for value in geneval(self.body, globals, locals): ! yield value class If(Node): ! def __init__(self, test, body): self.test = test self.body = body def __repr__(self): return "%s(%r, ...)" % (self.__class__.__name__, self.test) def isgenerator(self): ! return isgenerator(self.body) def eval(self, globals, locals): if self.test.eval(globals, locals): eval(self.body, globals, locals) def geneval(self, globals, locals): if self.test.eval(globals, locals): for value in geneval(self.body, globals, locals): yield value class Return(Node): def __init__(self, expr=None): --- 331,367 ---- def eval(self, globals, locals): while self.test.eval(globals, locals): ! try: ! eval(self.body, globals, locals) ! except DoBreak: ! break def geneval(self, globals, locals): while self.test.eval(globals, locals): ! try: ! for value in geneval(self.body, globals, locals): ! yield value ! except DoBreak: ! break class If(Node): ! def __init__(self, test, body, elsebody=None): self.test = test self.body = body + self.elsebody = elsebody def __repr__(self): return "%s(%r, ...)" % (self.__class__.__name__, self.test) def isgenerator(self): ! return isgenerator(self.body) or (self.elsebody is not None and ! isgenerator(self.elsebody)) def eval(self, globals, locals): if self.test.eval(globals, locals): eval(self.body, globals, locals) + elif self.elsebody is not None: + eval(self.elsebody, globals, locals) def geneval(self, globals, locals): if self.test.eval(globals, locals): for value in geneval(self.body, globals, locals): yield value + elif self.elsebody is not None: + for value in geneval(self.elsebody, globals, locals): + yield value class Return(Node): def __init__(self, expr=None): *************** *** 377,380 **** --- 388,396 ---- value = self.expr.eval(globals, locals) yield value + class Break(Node): + def __repr__(self): + return "%s()" % (self.__class__.__name__,) + def eval(self, globals, locals): + raise DoBreak() class Print(Node): def __init__(self, exprs): *************** *** 438,441 **** --- 454,460 ---- v = self.expr.eval(globals, locals) return v[self.index.eval(globals, locals)] + def assign(self, value, globals, locals): + v = self.expr.eval(globals, locals) + v[self.index.eval(globals, locals)] = value class Call(Node): def __init__(self, expr, args): *************** *** 524,527 **** --- 543,547 ---- def nexttoken(self): self.token, self.value = rv = self.scanner.next() + ##print rv return rv def expect(self, token, value=None): *************** *** 540,544 **** def parse_stmt(self, keywords=('def', 'for', 'while', 'if', ! 'print', 'return', 'yield')): if self.value in keywords: return getattr(self, 'parse_' + self.value)() --- 560,564 ---- def parse_stmt(self, keywords=('def', 'for', 'while', 'if', ! 'print', 'return', 'yield', 'break')): if self.value in keywords: return getattr(self, 'parse_' + self.value)() *************** *** 554,558 **** while self.value == ',': self.nexttoken() ! arg.append(self.expect(NAME)) self.expect(OPERATOR, ')') self.expect(OPERATOR, ':') --- 574,578 ---- while self.value == ',': self.nexttoken() ! args.append(self.expect(NAME)) self.expect(OPERATOR, ')') self.expect(OPERATOR, ':') *************** *** 582,586 **** self.expect(NEWLINE) body = self.parse_body() ! return If(test, body) def parse_body(self): self.expect(INDENT) --- 602,613 ---- self.expect(NEWLINE) body = self.parse_body() ! if self.value != 'else': ! elsebody = None ! else: ! self.expect(NAME, 'else') ! self.expect(OPERATOR, ':') ! self.expect(NEWLINE) ! elsebody = self.parse_body() ! return If(test, body, elsebody) def parse_body(self): self.expect(INDENT) *************** *** 608,611 **** --- 635,642 ---- self.expect(NEWLINE) return Yield(e) + def parse_break(self): + self.expect(NAME, 'break') + self.expect(NEWLINE) + return Break() def parse_simple(self): e = self.parse_exprs() *************** *** 651,655 **** elif self.value == '(': self.nexttoken() ! args = self.parse_exprs() self.expect(OPERATOR, ')') t = Call(t, args) --- 682,691 ---- elif self.value == '(': self.nexttoken() ! if self.value == ')': ! args = [] ! else: ! args = self.parse_exprs() ! if isinstance(args, Exprs): ! args = args.exprs self.expect(OPERATOR, ')') t = Call(t, args) *************** *** 671,678 **** raise SyntaxError - scanner = Scanner(getcFromString(sample).next).tokenize() - parser = Parser(scanner) - root = parser.parse() - class List(list): __setitem__ = list.__setitem__ --- 707,710 ---- *************** *** 692,695 **** --- 724,728 ---- output = OutputFile() + def write(s): s = str(s).replace('<b0.', '<__main__.') *************** *** 710,717 **** print s, print >>output, s, def writeln(s=''): write(str(s) + '\n') ! indent = "" OutputFile.softspace = True def instrumentClass(cls): cname = cls.__name__ + '.' --- 743,768 ---- print s, print >>output, s, + def writeln(s=''): write(str(s) + '\n') ! ! def myhash(s, ord=ord): ! if not s: ! return 0 ! x = ord(s[0])<<7 ! for c in s: ! x = ((1000003*x) ^ ord(c)) & 0xffffffffL ! return x^len(s) ! ! def checkoutput(n=0): ! outputtext = output.getvalue() ! check(strhash(outputtext), n) ! ! strhash = myhash ! OutputFile.softspace = True + + indent = "" + def instrumentClass(cls): cname = cls.__name__ + '.' *************** *** 720,728 **** if hasattr(descr, '__get__'): setattr(cls, name, instrumentDescriptor(cname+name, descr)) def unInstrumentClass(cls): for name in cls.__dict__: ! descr = getattr(cls, name) if isinstance(descr, instrumentDescriptor): setattr(cls, name, descr.obj) class instrumentDescriptor(object): def __init__(self, name, obj): --- 771,781 ---- if hasattr(descr, '__get__'): setattr(cls, name, instrumentDescriptor(cname+name, descr)) + def unInstrumentClass(cls): for name in cls.__dict__: ! descr = cls.__dict__[name] if isinstance(descr, instrumentDescriptor): setattr(cls, name, descr.obj) + class instrumentDescriptor(object): def __init__(self, name, obj): *************** *** 734,737 **** --- 787,791 ---- return result return instrumentCall(self.name, result) + class instrumentCall(object): def __init__(self, name, obj): *************** *** 763,784 **** indent = oldindent scanner = Scanner(getcFromString(sample).next).tokenize() parser = Parser(scanner) - instrumentClass(Parser) root = parser.parse() ! def myhash(s, ord=ord): ! if not s: ! return 0 ! x = ord(s[0])<<7 ! for c in s: ! x = ((1000003*x) ^ ord(c)) & 0xffffffffL ! return x^len(s) ! ! def checkoutput(n=0): ! outputtext = output.getvalue() ! check(strhash(outputtext), n) ! ! strhash = myhash checkoutput(1365277872) --- 817,847 ---- indent = oldindent + def instrumentTree(base): + instrumentClass(base) + for cls in base.__subclasses__(): + instrumentTree(cls) + + def unInstrumentTree(base): + unInstrumentClass(base) + for cls in base.__subclasses__(): + unInstrumentTree(cls) + + s = Scanner(getcFromString(sample).next) + it = Clone(s.tokenize()) + it2 = Clone(it) + L = [] + for pair in it: + L.append(pair) + L2 = list(it2) + check(L, L2) + scanner = Scanner(getcFromString(sample).next).tokenize() parser = Parser(scanner) root = parser.parse() ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! instrumentClass(Parser) ! root = parser.parse() checkoutput(1365277872) *************** *** 798,802 **** checkoutput(3960406533) - ##unInstrumentClass(Parser) it = Clone(getcFromString(unicode(sample, "utf8"))) it2 = Clone(it) --- 861,864 ---- *************** *** 813,825 **** checkoutput(3960406533) - def instrumentTree(base): - instrumentClass(base) - for cls in base.__subclasses__(): - instrumentTree(cls) - def unInstrumentTree(base): - unInstrumentClass(base) - for cls in base.__subclasses__(): - unInstrumentTree(cls) - instrumentTree(Node) scanner = Clone(Scanner(it2.next).tokenize()) --- 875,878 ---- *************** *** 827,837 **** parser = Parser(scanner) root = parser.parse() env = {} eval(root, env, env) g = env['pi']() for i in range(10): ! write(g.next()) ! writeln() ! out = output.getvalue() unInstrumentTree(Node) --- 880,892 ---- parser = Parser(scanner) root = parser.parse() + checkoutput(111416090) env = {} eval(root, env, env) g = env['pi']() + digits = [] for i in range(10): ! digits.append(g.next()) ! checkoutput(1793452098) ! print "".join(map(str, digits)) unInstrumentTree(Node) *************** *** 839,854 **** parser = Parser(scanner2) root = parser.parse() env = {} eval(root, env, env) g = env['pi']() for i in range(10): ! write(g.next()) ! writeln() out2 = output.getvalue() - check(out, out2) - check(strhash(out[:1000]), 773700721) - check(strhash(out[100000:101000]), 3131788725) - check(strhash(out[200000:201000]), 3508888315) - check(strhash(out[300000:301000]), 199799004) - check(strhash(out[400000:401000]), 84251599) - check(strhash(out[-1000:]), 620844360) --- 894,904 ---- parser = Parser(scanner2) root = parser.parse() + checkoutput(0) env = {} eval(root, env, env) g = env['pi']() + digits = [] for i in range(10): ! digits.append(g.next()) ! print "".join(map(str, digits)) out2 = output.getvalue() Index: out0 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** out0 30 Dec 2003 16:28:25 -0000 1.2 --- out0 31 Dec 2003 01:33:07 -0000 1.3 *************** *** 5895,12368 **** return "Number(u'0')" return "Return(Number(u'0'))" ! If.__init__(Binop(Name(u's'), u'==', String(u"''")), [Return(Number(u'0'))]) ! return ! If.__repr__() ! Binop.__repr__() ! Name.__repr__() ! return "Name(u's')" ! Literal.__repr__() ! return 'String(u"\'\'")' [...6577 lines suppressed...] return 5L ! 5 Node.geneval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 14007054816000L, u'q': 25, u'b': 2787459998400L, u'd': 5L, u'k': 13, u'a1': 455729992416000L, u'p': 144, u'b1': 84139894238400L, u'd1': 5L}) return <generator object at 0> Assign.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 14007054816000L, u'q': 25, u'b': 2787459998400L, u'd': 5L, u'k': 13, u'a1': 455729992416000L, u'p': 144, u'b1': 84139894238400L, u'd1': 5L}) --- 8871,8875 ---- Name.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 14007054816000L, u'q': 25, u'b': 2787459998400L, u'd': 5L, u'k': 13, u'a1': 455729992416000L, u'p': 144, u'b1': 84139894238400L, u'd1': 5L}) return 5L ! Node.geneval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 14007054816000L, u'q': 25, u'b': 2787459998400L, u'd': 5L, u'k': 13, u'a1': 455729992416000L, u'p': 144, u'b1': 84139894238400L, u'd1': 5L}) return <generator object at 0> Assign.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 14007054816000L, u'q': 25, u'b': 2787459998400L, u'd': 5L, u'k': 13, u'a1': 455729992416000L, u'p': 144, u'b1': 84139894238400L, u'd1': 5L}) *************** *** 15642,15644 **** Name.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) return 3L ! 3 --- 9173,9176 ---- Name.eval({u'strhash': <__main__.Function object at 0>, u'pi': <__main__.Generator object at 0>}, {u'a': 9576126383040000L, u'q': 29, u'b': 2742857884166400L, u'd': 3L, u'k': 15, u'a1': 346367486707200000L, u'p': 196, u'b1': 96034297911552000L, u'd1': 3L}) return 3L ! 3141592653 ! 3141592653 From rhettinger at users.sourceforge.net Tue Dec 30 20:59:20 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 30 20:59:23 2003 Subject: [Python-checkins] python/dist/src/Doc/whatsnew whatsnew24.tex, 1.21, 1.22 Message-ID: <E1AbVdo-000425-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/whatsnew In directory sc8-pr-cvs1:/tmp/cvs-serv14684 Modified Files: whatsnew24.tex Log Message: Various fixups: * Add comment on the future of the sets module. * Change a variable from "input" to "data" to avoid shadowing a builtin. * Added possible applications for str.rsplit() and itertools.tee(). * Repaired the example for sorted(). * Cleaned-up the example for operator.itemgetter(). Index: whatsnew24.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/whatsnew/whatsnew24.tex,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** whatsnew24.tex 18 Dec 2003 13:28:13 -0000 1.21 --- whatsnew24.tex 31 Dec 2003 01:59:18 -0000 1.22 *************** *** 71,74 **** --- 71,78 ---- % XXX what happens to the sets module? + % The current thinking is that the sets module will be left alone. + % That way, existing code will continue to run without alteration. + % Also, the module provides an autoconversion feature not supported by set() + % and frozenset(). \begin{seealso} *************** *** 106,111 **** \begin{verbatim} ! >>> input = open('/etc/passwd', 'r') ! >>> for line in reversed(list(input)): ... print line ... --- 110,115 ---- \begin{verbatim} ! >>> data = open('/etc/passwd', 'r') ! >>> for line in reversed(list(data)): ... print line ... *************** *** 133,137 **** \item Strings also gained an \method{rsplit()} method that ! works like the \method{split()} method but splits from the end of the string. \begin{verbatim} --- 137,143 ---- \item Strings also gained an \method{rsplit()} method that ! works like the \method{split()} method but splits from the end of ! the string. Possible applications include splitting a filename ! from a path or a domain name from URL. \begin{verbatim} *************** *** 170,174 **** The last example, which uses the \var{cmp} parameter, is the old way ! to perform a case-insensitive sort. It works, but is slower than using a \var{key} parameter. Using \var{key} results in calling the \method{lower()} method once for each element in the list while using --- 176,180 ---- The last example, which uses the \var{cmp} parameter, is the old way ! to perform a case-insensitive sort. It works but is slower than using a \var{key} parameter. Using \var{key} results in calling the \method{lower()} method once for each element in the list while using *************** *** 231,235 **** \item The \function{zip()} built-in function and \function{itertools.izip()} now return an empty list instead of raising a \exception{TypeError} ! exception if called with no arguments. This makes the functions more suitable for use with variable length argument lists: --- 237,241 ---- \item The \function{zip()} built-in function and \function{itertools.izip()} now return an empty list instead of raising a \exception{TypeError} ! exception if called with no arguments. This makes the function more suitable for use with variable length argument lists: *************** *** 320,337 **** \begin{verbatim} >>> word = 'abracadabra' ! >>> letters = sorted(word) # Turn string into sorted list of letters >>> letters ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r'] ! >>> [k for k, g in groupby(word)] # List unique letters ['a', 'b', 'c', 'd', 'r'] ! >>> [(k, len(list(g))) for k, g in groupby(word)] # Count letter occurences [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] ! >>> [k for k, g in groupby(word) if len(list(g)) > 1] # List duplicate letters ['a', 'b', 'r'] \end{verbatim} ! \item \module{itertools} also gained a function named \function{tee(\var{iterator}, \var{N})} that returns \var{N} independent iterators ! that replicate \var{iterator}. If \var{N} is omitted, the default is ! 2. \begin{verbatim} --- 326,344 ---- \begin{verbatim} >>> word = 'abracadabra' ! >>> letters = sorted(word) # Turn string into a sorted list of letters >>> letters ['a', 'a', 'a', 'a', 'a', 'b', 'b', 'c', 'd', 'r', 'r'] ! >>> [k for k, g in groupby(letters)] # List unique letters ['a', 'b', 'c', 'd', 'r'] ! >>> [(k, len(list(g))) for k, g in groupby(letters)] # Count letter occurences [('a', 5), ('b', 2), ('c', 1), ('d', 1), ('r', 2)] ! >>> [k for k, g in groupby(letters) if len(list(g)) > 1] # List duplicated letters ['a', 'b', 'r'] \end{verbatim} ! \item \module{itertools} also gained a function named ! \function{tee(\var{iterator}, \var{N})} that returns \var{N} independent ! iterators that replicate \var{iterator}. If \var{N} is omitted, the ! default is 2. \begin{verbatim} *************** *** 340,353 **** >>> i1,i2 (<itertools.tee object at 0x402c2080>, <itertools.tee object at 0x402c2090>) ! >>> list(i1) [1, 2, 3] ! >>> list(i2) [1, 2, 3] >\end{verbatim} Note that \function{tee()} has to keep copies of the values returned ! by the iterator; in the worst case it may need to keep all of them. ! This should therefore be used carefully if \var{iterator} ! returns a very large stream of results. \item A new \function{getsid()} function was added to the --- 347,364 ---- >>> i1,i2 (<itertools.tee object at 0x402c2080>, <itertools.tee object at 0x402c2090>) ! >>> list(i1) # Run the first iterator to exhaustion [1, 2, 3] ! >>> list(i2) # Run the second iterator to exhaustion [1, 2, 3] >\end{verbatim} Note that \function{tee()} has to keep copies of the values returned ! by the iterator; in the worst case, it may need to keep all of them. ! This should therefore be used carefully if there the leading iterator ! can run far ahead of the trailing iterator in a long stream of inputs. ! If the separation is large, then it becomes preferrable to use ! \function{list()} instead. When the iterators track closely with one ! another, \function{tee()} is ideal. Possible applications include ! bookmarking, windowing, or lookahead iterators. \item A new \function{getsid()} function was added to the *************** *** 358,374 **** \function{attrgetter(\var{attr})} and \function{itemgetter(\var{index})}. Both functions return callables that take a single argument and return ! the corresponding attribute or item; these callables are handy for use ! with \function{map()} or \function{list.sort()}. For example, here's a simple ! us \begin{verbatim} ! >>> L = [('c', 2), ('d', 1), ('a', '4'), ('b', 3)] >>> map(operator.itemgetter(0), L) ['c', 'd', 'a', 'b'] >>> map(operator.itemgetter(1), L) ! [2, 1, '4', 3] ! >>> L.sort(key=operator.itemgetter(1)) # Sort list by second item in tuples ! >>> L ! [('d', 1), ('c', 2), ('b', 3), ('a', '4')] \end{verbatim} --- 369,384 ---- \function{attrgetter(\var{attr})} and \function{itemgetter(\var{index})}. Both functions return callables that take a single argument and return ! the corresponding attribute or item; these callables make excellent ! data extractors when used with \function{map()} or \function{sorted()}. ! For example: \begin{verbatim} ! >>> L = [('c', 2), ('d', 1), ('a', 4), ('b', 3)] >>> map(operator.itemgetter(0), L) ['c', 'd', 'a', 'b'] >>> map(operator.itemgetter(1), L) ! [2, 1, 4, 3] ! >>> sorted(L, key=operator.itemgetter(1)) # Sort list by second tuple item ! [('d', 1), ('c', 2), ('b', 3), ('a', 4)] \end{verbatim} *************** *** 377,381 **** \method{randrange()} method, making it possible to efficiently generate arbitrarily large random numbers (suitable for prime number generation in ! RSA applications). \item The regular expression language accepted by the \module{re} module --- 387,391 ---- \method{randrange()} method, making it possible to efficiently generate arbitrarily large random numbers (suitable for prime number generation in ! RSA applications for example). \item The regular expression language accepted by the \module{re} module From rhettinger at users.sourceforge.net Tue Dec 30 21:01:39 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Tue Dec 30 21:01:44 2003 Subject: [Python-checkins] python/dist/src/Lib/test test_set.py,1.8,1.9 Message-ID: <E1AbVg3-0004Ar-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib/test In directory sc8-pr-cvs1:/tmp/cvs-serv16030 Modified Files: test_set.py Log Message: Strengthen the test for hash effectiveness Index: test_set.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/test/test_set.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_set.py 17 Dec 2003 20:43:32 -0000 1.8 --- test_set.py 31 Dec 2003 02:01:33 -0000 1.9 *************** *** 390,399 **** def test_hash_effectiveness(self): n = 13 - rng = range(n) hashvalues = set() for i in xrange(2**n): ! combination = [j for j in rng if (1<<j)&i] ! hashvalues.add(hash(self.thetype(combination))) ! self.assert_(len(hashvalues) >= 2**(n-2)) class FrozenSetSubclass(frozenset): --- 390,399 ---- def test_hash_effectiveness(self): n = 13 hashvalues = set() + addhashvalue = hashvalues.add + elemmasks = [(i+1, 1<<i) for i in range(n)] for i in xrange(2**n): ! addhashvalue(hash(frozenset([e for e, m in elemmasks if m&i]))) ! self.assertEqual(len(hashvalues), 2**n) class FrozenSetSubclass(frozenset): From gvanrossum at users.sourceforge.net Tue Dec 30 21:04:26 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 21:04:29 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b.py, 1.2, 1.3 b0.py, 1.4, 1.5 out0, 1.3, 1.4 out4, 1.1, 1.2 Message-ID: <E1AbVik-0004Hf-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv16453 Modified Files: b.py b0.py out0 out4 Log Message: Reduce output volume somewhat. Index: b.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b.py 31 Dec 2003 01:33:07 -0000 1.2 --- b.py 31 Dec 2003 02:04:20 -0000 1.3 *************** *** 1,3 **** ! import b0 import b1 import b2 --- 1,3 ---- ! import b0; b0.main() import b1 import b2 Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** b0.py 31 Dec 2003 01:33:07 -0000 1.4 --- b0.py 31 Dec 2003 02:04:20 -0000 1.5 *************** *** 792,808 **** self.name = name self.obj = obj ! def __call__(self, *args, **kwds): global indent oldindent = indent try: indent = indent + " " ! if kwds: ! writeln(indent + "%s(*%r, **%r)" % (self.name, args, kwds)) ! elif len(args) == 1: ! writeln(indent + "%s(%r)" % (self.name, args[0])) ! else: ! writeln(indent + "%s%r" % (self.name, args)) try: ! result = self.obj(*args, **kwds) except Exception, exc: writeln(indent + "raise %r" % (exc,)) --- 792,809 ---- self.name = name self.obj = obj ! def __call__(self, *args): global indent oldindent = indent try: indent = indent + " " ! argreprs = map(repr, args) ! for i, s in enumerate(argreprs): ! s = s.replace('<b0.', '<__main__.') ! if len(s) >= 45: ! s = s[:20] + "..." + s[-20:] ! argreprs[i] = s ! writeln(indent + "%s(%r)" % (self.name, ", ".join(argreprs))) try: ! result = self.obj(*args) except Exception, exc: writeln(indent + "raise %r" % (exc,)) *************** *** 827,904 **** unInstrumentTree(cls) ! s = Scanner(getcFromString(sample).next) ! it = Clone(s.tokenize()) ! it2 = Clone(it) ! L = [] ! for pair in it: ! L.append(pair) ! L2 = list(it2) ! check(L, L2) ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! instrumentClass(Parser) ! root = parser.parse() ! checkoutput(1365277872) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(1000): ! write(g.next()) ! writeln('') ! strhash = env['strhash'] ! for x in '', 'x', 'abc', 'abc'*100: ! check(strhash(x), myhash(x)) ! strhash = myhash ! checkoutput(3960406533) ! it = Clone(getcFromString(unicode(sample, "utf8"))) ! it2 = Clone(it) ! scanner = Scanner(it.next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! checkoutput(2293472643) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(1000): ! write(g.next()) ! writeln() ! checkoutput(3960406533) ! instrumentTree(Node) ! scanner = Clone(Scanner(it2.next).tokenize()) ! scanner2 = Clone(scanner) ! parser = Parser(scanner) ! root = parser.parse() ! checkoutput(111416090) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! digits = [] ! for i in range(10): ! digits.append(g.next()) ! checkoutput(1793452098) ! print "".join(map(str, digits)) ! unInstrumentTree(Node) ! unInstrumentClass(Parser) ! parser = Parser(scanner2) ! root = parser.parse() ! checkoutput(0) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! digits = [] ! for i in range(10): ! digits.append(g.next()) ! print "".join(map(str, digits)) ! out2 = output.getvalue() --- 828,909 ---- unInstrumentTree(cls) ! def main(): ! s = Scanner(getcFromString(sample).next) ! it = Clone(s.tokenize()) ! it2 = Clone(it) ! L = [] ! for pair in it: ! L.append(pair) ! L2 = list(it2) ! check(L, L2) ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! instrumentClass(Parser) ! root = parser.parse() ! checkoutput(1413352820) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(1000): ! write(g.next()) ! writeln('') ! strhash = env['strhash'] ! for x in '', 'x', 'abc', 'abc'*100: ! check(strhash(x), myhash(x)) ! strhash = myhash ! checkoutput(3960406533) ! it = Clone(getcFromString(unicode(sample, "utf8"))) ! it2 = Clone(it) ! scanner = Scanner(it.next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! checkoutput(1308798191) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! for i in range(1000): ! write(g.next()) ! writeln() ! checkoutput(3960406533) ! instrumentTree(Node) ! scanner = Clone(Scanner(it2.next).tokenize()) ! scanner2 = Clone(scanner) ! parser = Parser(scanner) ! root = parser.parse() ! checkoutput(2037684980) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! digits = [] ! for i in range(10): ! digits.append(g.next()) ! checkoutput(4201300315) ! print "".join(map(str, digits)) ! unInstrumentTree(Node) ! unInstrumentClass(Parser) ! parser = Parser(scanner2) ! root = parser.parse() ! checkoutput(0) ! env = {} ! eval(root, env, env) ! g = env['pi']() ! digits = [] ! for i in range(10): ! digits.append(g.next()) ! print "".join(map(str, digits)) ! out2 = output.getvalue() ! ! if __name__ == '__main__': ! main() Index: out0 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** out0 31 Dec 2003 01:33:07 -0000 1.3 --- out0 31 Dec 2003 02:04:20 -0000 1.4 *************** *** 1,42 **** ! Parser.parse() ! Parser.parse_stmt() ! Parser.parse_def() ! Parser.expect(NAME, 'def') ! Parser.nexttoken() return (NAME, 'pi') return 'def' ! Parser.expect(NAME) ! Parser.nexttoken() return (OPERATOR, '(') [...18271 lines suppressed...] ! Exprs.assign("(3L, 3L), {u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") ! Name.assign("3L, {u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return ! Name.assign("3L, {u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return return return ! While.geneval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return <generator object at 0> ! Binop.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") ! Name.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return 3L ! Name.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return 3L return True ! Yield.geneval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return <generator object at 0> ! Name.eval("{u'strhash': <__main...ject at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return 3L 3141592653 Index: out4 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out4,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** out4 31 Dec 2003 01:33:07 -0000 1.1 --- out4 31 Dec 2003 02:04:20 -0000 1.2 *************** *** 1,3709 **** - Define.eval({}, {}) - Node.isgenerator() - return False - Node.isgenerator() - return False - return - Define.eval({'heappush': <__main__.Function object at 0>}, {'heappush': <__main__.Function object at 0>}) - Node.isgenerator() - return False - If.isgenerator() [...3680 lines suppressed...] - return 9 - Name.assign(9, {'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'heap': []}) - return - return - If.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) - Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) - return [] - Assign.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) - Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) - return 9 - Name.assign(9, {'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'heap': []}) - return - return - return - Return.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}) - Name.eval({'heappop': <__main__.Function object at 0>, '_siftup': <__main__.Function object at 0>, 'heapify': <__main__.Function object at 0>, 'heappush': <__main__.Function object at 0>, '_siftdown': <__main__.Function object at 0>, 'heapreplace': <__main__.Function object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}) - return 9 - raise <__main__.DoReturn instance at 0> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] --- 1 ---- From gvanrossum at users.sourceforge.net Tue Dec 30 21:05:11 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Tue Dec 30 21:05:31 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench out4,1.2,1.3 Message-ID: <E1AbVjT-0004Jh-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv16589 Modified Files: out4 Log Message: ...But not *that much* :-) Index: out4 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out4,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** out4 31 Dec 2003 02:04:20 -0000 1.2 --- out4 31 Dec 2003 02:05:08 -0000 1.3 *************** *** 1 **** --- 1,3709 ---- + Define.eval('{}, {}') + Node.isgenerator('') + return False + Node.isgenerator('') + return False + return + Define.eval("{'heappush': <__main...ject at 0>}, {'heappush': <__main...ject at 0>}") + Node.isgenerator('') + return False [...3680 lines suppressed...] + return <built-in method pop of list object at 0> + return 9 + Name.assign("9, {'heappop': <__main_...ject at 0>}, {'heap': []}") + return + return + If.eval("{'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'heap': []}") + Name.eval("{'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'heap': []}") + return [] + Assign.eval("{'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'heap': []}") + Name.eval("{'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'heap': []}") + return 9 + Name.assign("9, {'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'heap': []}") + return + return + return + Return.eval("{'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}") + Name.eval("{'heappop': <__main_...ject at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}") + return 9 + raise <__main__.DoReturn instance at 0> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] From fdrake at users.sourceforge.net Tue Dec 30 23:34:52 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 23:34:57 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libunittest.tex, 1.17, 1.18 Message-ID: <E1AbY4K-0001aL-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv6085 Modified Files: libunittest.tex Log Message: - add a "See also" reference to the doctest module - slightly simplify a couple of examples - clean up some markup Index: libunittest.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libunittest.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libunittest.tex 7 Dec 2003 10:48:03 -0000 1.17 --- libunittest.tex 31 Dec 2003 04:34:50 -0000 1.18 *************** *** 83,86 **** --- 83,88 ---- \begin{seealso} + \seemodule{doctest}{Another test-support module with a very + different flavor.} \seetitle[http://pyunit.sourceforge.net/]{PyUnit Web Site}{The source for further information on PyUnit.} *************** *** 129,135 **** \end{verbatim} ! A testcase is created by subclassing \code{unittest.TestCase}. The three individual tests are defined with methods whose names start with ! the letters \code{test}. This naming convention informs the test runner about which methods represent tests. --- 131,137 ---- \end{verbatim} ! A testcase is created by subclassing \class{unittest.TestCase}. The three individual tests are defined with methods whose names start with ! the letters \samp{test}. This naming convention informs the test runner about which methods represent tests. *************** *** 145,151 **** example, \method{setUp()} was used to create a fresh sequence for each test. ! The final block shows a simple way to run the tests. \code{unittest.main()} ! provides a command line interface to the test script. When run from the ! command line, the above script produces an output that looks like this: \begin{verbatim} --- 147,154 ---- example, \method{setUp()} was used to create a fresh sequence for each test. ! The final block shows a simple way to run the tests. ! \function{unittest.main()} provides a command line interface to the ! test script. When run from the command line, the above script ! produces an output that looks like this: \begin{verbatim} *************** *** 157,161 **** \end{verbatim} ! Instead of \code{unittest.main()}, there are other ways to run the tests with a finer level of control, less terse output, and no requirement to be run from the command line. For example, the last two lines may be replaced --- 160,164 ---- \end{verbatim} ! Instead of \function{unittest.main()}, there are other ways to run the tests with a finer level of control, less terse output, and no requirement to be run from the command line. For example, the last two lines may be replaced *************** *** 163,168 **** \begin{verbatim} ! suite = unittest.TestSuite() ! suite.addTest(unittest.makeSuite(TestSequenceFunctions)) unittest.TextTestRunner(verbosity=2).run(suite) \end{verbatim} --- 166,170 ---- \begin{verbatim} ! suite = unittest.makeSuite(TestSequenceFunctions) unittest.TextTestRunner(verbosity=2).run(suite) \end{verbatim} *************** *** 363,372 **** Since it is a common pattern to create a \class{TestCase} subclass with many similarly named test functions, there is a convenience ! function called \function{makeSuite()} provided in the ! \refmodule{unittest} module that constructs a test suite that ! comprises all of the test cases in a test case class: \begin{verbatim} ! suite = unittest.makeSuite(WidgetTestCase,'test') \end{verbatim} --- 365,373 ---- Since it is a common pattern to create a \class{TestCase} subclass with many similarly named test functions, there is a convenience ! function called \function{makeSuite()} that constructs a test suite ! that comprises all of the test cases in a test case class: \begin{verbatim} ! suite = unittest.makeSuite(WidgetTestCase) \end{verbatim} *************** *** 518,522 **** In some cases, the existing tests may have be written using the ! \module{doctest} module. If so, that module provides a \class{DocTestSuite} class that can automatically build \class{unittest.TestSuite} instances from the existing test code. --- 519,523 ---- In some cases, the existing tests may have be written using the ! \refmodule{doctest} module. If so, that module provides a \class{DocTestSuite} class that can automatically build \class{unittest.TestSuite} instances from the existing test code. *************** *** 559,563 **** \begin{methoddesc}[TestCase]{run}{\optional{result}} Run the test, collecting the result into the test result object ! passed as \var{result}. If \var{result} is omitted or \code{None}, a temporary result object is created and used, but is not made available to the caller. This is equivalent to simply calling the --- 560,564 ---- \begin{methoddesc}[TestCase]{run}{\optional{result}} Run the test, collecting the result into the test result object ! passed as \var{result}. If \var{result} is omitted or \constant{None}, a temporary result object is created and used, but is not made available to the caller. This is equivalent to simply calling the *************** *** 579,583 **** Signal a test failure if \var{expr} is false; the explanation for the error will be \var{msg} if given, otherwise it will be ! \code{None}. \end{methoddesc} --- 580,584 ---- Signal a test failure if \var{expr} is false; the explanation for the error will be \var{msg} if given, otherwise it will be ! \constant{None}. \end{methoddesc} *************** *** 586,590 **** Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()}: the default value for \var{msg} can be --- 587,591 ---- Test that \var{first} and \var{second} are equal. If the values do not compare equal, the test will fail with the explanation given by ! \var{msg}, or \constant{None}. Note that using \method{failUnlessEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()}: the default value for \var{msg} can be *************** *** 597,601 **** Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by ! \var{msg}, or \code{None}. Note that using \method{failIfEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be --- 598,602 ---- Test that \var{first} and \var{second} are not equal. If the values do compare equal, the test will fail with the explanation given by ! \var{msg}, or \constant{None}. Note that using \method{failIfEqual()} improves upon doing the comparison as the first parameter to \method{failUnless()} is that the default value for \var{msg} can be *************** *** 613,617 **** is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \code{None}. \end{methoddesc} --- 614,618 ---- is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \constant{None}. \end{methoddesc} *************** *** 625,629 **** is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \code{None}. \end{methoddesc} --- 626,630 ---- is not the same as comparing a given number of significant digits. If the values do not compare equal, the test will fail with the explanation ! given by \var{msg}, or \constant{None}. \end{methoddesc} *************** *** 641,650 **** The inverse of the \method{failUnless()} method is the \method{failIf()} method. This signals a test failure if \var{expr} ! is true, with \var{msg} or \code{None} for the error message. \end{methoddesc} \begin{methoddesc}[TestCase]{fail}{\optional{msg}} Signals a test failure unconditionally, with \var{msg} or ! \code{None} for the error message. \end{methoddesc} --- 642,651 ---- The inverse of the \method{failUnless()} method is the \method{failIf()} method. This signals a test failure if \var{expr} ! is true, with \var{msg} or \constant{None} for the error message. \end{methoddesc} \begin{methoddesc}[TestCase]{fail}{\optional{msg}} Signals a test failure unconditionally, with \var{msg} or ! \constant{None} for the error message. \end{methoddesc} *************** *** 681,688 **** \begin{methoddesc}[TestCase]{shortDescription}{} ! Returns a one-line description of the test, or \code{None} if no description has been provided. The default implementation of this method returns the first line of the test method's docstring, if ! available, or \code{None}. \end{methoddesc} --- 682,689 ---- \begin{methoddesc}[TestCase]{shortDescription}{} ! Returns a one-line description of the test, or \constant{None} if no description has been provided. The default implementation of this method returns the first line of the test method's docstring, if ! available, or \constant{None}. \end{methoddesc} *************** *** 892,896 **** Function to be used to compare method names when sorting them in \method{getTestCaseNames()}. The default value is the built-in ! \function{cmp()} function; it can be set to \code{None} to disable the sort. \end{memberdesc} --- 893,897 ---- Function to be used to compare method names when sorting them in \method{getTestCaseNames()}. The default value is the built-in ! \function{cmp()} function; it can be set to \constant{None} to disable the sort. \end{memberdesc} From fdrake at users.sourceforge.net Tue Dec 30 23:41:49 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 23:41:53 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libxreadlines.tex, 1.4, 1.5 Message-ID: <E1AbYB3-0001oE-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv6951 Modified Files: libxreadlines.tex Log Message: - use the same markup for the deprecation as for that of file.xreadlines() Index: libxreadlines.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libxreadlines.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libxreadlines.tex 6 Aug 2002 17:01:28 -0000 1.4 --- libxreadlines.tex 31 Dec 2003 04:41:47 -0000 1.5 *************** *** 7,11 **** \versionadded{2.1} ! \deprecated{2.3}{Use \code{for line in file} instead.} This module defines a new object type which can efficiently iterate --- 7,11 ---- \versionadded{2.1} ! \deprecated{2.3}{Use \samp{for \var{line} in \var{file}} instead.} This module defines a new object type which can efficiently iterate From fdrake at users.sourceforge.net Tue Dec 30 23:51:58 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 23:52:01 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libcalendar.tex, 1.17, 1.18 Message-ID: <E1AbYKs-00026c-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8092 Modified Files: libcalendar.tex Log Message: - update description of isleap() - add link to the datetime module Index: libcalendar.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcalendar.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libcalendar.tex 25 Dec 2002 16:37:19 -0000 1.17 --- libcalendar.tex 31 Dec 2003 04:51:56 -0000 1.18 *************** *** 43,47 **** \begin{funcdesc}{isleap}{year} ! Returns \code{1} if \var{year} is a leap year, otherwise \code{0}. \end{funcdesc} --- 43,48 ---- \begin{funcdesc}{isleap}{year} ! Returns \constant{True} if \var{year} is a leap year, otherwise ! \constant{False}. \end{funcdesc} *************** *** 109,112 **** --- 110,116 ---- \begin{seealso} + \seemodule{datetime}{Object-oriented interface to dates and times + with similar functionality to the + \refmodule{time} module.} \seemodule{time}{Low-level time related functions.} \end{seealso} From fdrake at users.sourceforge.net Tue Dec 30 23:52:38 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Tue Dec 30 23:52:46 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libtime.tex,1.61,1.62 Message-ID: <E1AbYLW-00028I-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv8190 Modified Files: libtime.tex Log Message: - add link to the datetime module Index: libtime.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libtime.tex,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** libtime.tex 8 Sep 2003 18:52:18 -0000 1.61 --- libtime.tex 31 Dec 2003 04:52:36 -0000 1.62 *************** *** 427,430 **** --- 427,431 ---- \begin{seealso} + \seemodule{datetime}{More object-oriented interface to dates and times.} \seemodule{locale}{Internationalization services. The locale settings can affect the return values for some of From fdrake at users.sourceforge.net Wed Dec 31 00:01:25 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 31 00:01:28 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libcmd.tex,1.14,1.15 Message-ID: <E1AbYU1-0002T8-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv9486 Modified Files: libcmd.tex Log Message: general markup improvements Index: libcmd.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcmd.tex,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** libcmd.tex 6 Feb 2003 05:02:39 -0000 1.14 --- libcmd.tex 31 Dec 2003 05:01:23 -0000 1.15 *************** *** 12,16 **** later be wrapped in a more sophisticated interface. ! \begin{classdesc}{Cmd}{\optional{completekey},\optional{stdin},\optional{stdout}} A \class{Cmd} instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate --- 12,17 ---- later be wrapped in a more sophisticated interface. ! \begin{classdesc}{Cmd}{\optional{completekey\optional{, ! stdin\optional{, stdout}}}} A \class{Cmd} instance or subclass instance is a line-oriented interpreter framework. There is no good reason to instantiate *************** *** 21,25 **** The optional argument \var{completekey} is the \refmodule{readline} name of a completion key; it defaults to \kbd{Tab}. If \var{completekey} is ! not \code{None} and \module{readline} is available, command completion is done automatically. --- 22,26 ---- The optional argument \var{completekey} is the \refmodule{readline} name of a completion key; it defaults to \kbd{Tab}. If \var{completekey} is ! not \constant{None} and \refmodule{readline} is available, command completion is done automatically. *************** *** 45,49 **** first prompt (this overrides the \member{intro} class member). ! If the \module{readline} module is loaded, input will automatically inherit \program{bash}-like history-list editing (e.g. \kbd{Control-P} scrolls back to the last command, \kbd{Control-N} forward to the next --- 46,50 ---- first prompt (this overrides the \member{intro} class member). ! If the \refmodule{readline} module is loaded, input will automatically inherit \program{bash}-like history-list editing (e.g. \kbd{Control-P} scrolls back to the last command, \kbd{Control-N} forward to the next *************** *** 185,190 **** if false, \method{sys.stdout.write()} and \method{sys.stdin.readline()} are used. (This means that by ! importing \module{readline}, on systems that support it, the ! interpreter will automatically support Emacs-like line editing and command-history keystrokes.) \end{memberdesc} --- 186,191 ---- if false, \method{sys.stdout.write()} and \method{sys.stdin.readline()} are used. (This means that by ! importing \refmodule{readline}, on systems that support it, the ! interpreter will automatically support \program{Emacs}-like line editing and command-history keystrokes.) \end{memberdesc} From fdrake at users.sourceforge.net Wed Dec 31 00:18:49 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 31 00:18:52 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libshlex.tex,1.17,1.18 Message-ID: <E1AbYkq-00037E-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11976 Modified Files: libshlex.tex Log Message: - general markup cleanup - rearrange so two small sections become one; this avoids an extra page in the HTML format Index: libshlex.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libshlex.tex,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** libshlex.tex 8 Sep 2003 18:52:18 -0000 1.17 --- libshlex.tex 31 Dec 2003 05:18:46 -0000 1.18 *************** *** 13,42 **** The \class{shlex} class makes it easy to write lexical analyzers for simple syntaxes resembling that of the \UNIX{} shell. This will often ! be useful for writing minilanguages, (e.g. in run control files for ! Python applications) or for parsing quoted strings. ! ! \begin{seealso} ! \seemodule{ConfigParser}{Parser for configuration files similar to the ! Windows \file{.ini} files.} ! \end{seealso} ! ! ! \subsection{Module Contents} The \module{shlex} module defines the following functions: ! \begin{funcdesc}{split}{s\optional{, comments=\code{False}}} Split the string \var{s} using shell-like syntax. If \var{comments} is ! \code{False}, the parsing of comments in the given string will be ! disabled (setting the \member{commenters} member of the \class{shlex} ! instance to the empty string). This function operates in \POSIX{} mode. \versionadded{2.3} \end{funcdesc} ! The \module{shlex} module defines the following classes: ! \begin{classdesc}{shlex}{\optional{instream=\code{sys.stdin}\optional{, ! infile=\code{None}\optional{, ! posix=\code{False}}}}} A \class{shlex} instance or subclass instance is a lexical analyzer object. The initialization argument, if present, specifies where to --- 13,34 ---- The \class{shlex} class makes it easy to write lexical analyzers for simple syntaxes resembling that of the \UNIX{} shell. This will often ! be useful for writing minilanguages, (for example, in run control ! files for Python applications) or for parsing quoted strings. The \module{shlex} module defines the following functions: ! \begin{funcdesc}{split}{s\optional{, comments}} Split the string \var{s} using shell-like syntax. If \var{comments} is ! \constant{False} (the default), the parsing of comments in the given ! string will be disabled (setting the \member{commenters} member of the ! \class{shlex} instance to the empty string). This function operates ! in \POSIX{} mode. \versionadded{2.3} \end{funcdesc} ! The \module{shlex} module defines the following class: ! \begin{classdesc}{shlex}{\optional{instream\optional{, ! infile\optional{, posix}}}} A \class{shlex} instance or subclass instance is a lexical analyzer object. The initialization argument, if present, specifies where to *************** *** 52,58 **** operate in compatibility mode. When operating in \POSIX{} mode, \class{shlex} will try to be as close as possible to the \POSIX{} shell ! parsing rules. See~\ref{shlex-objects}. \end{classdesc} \subsection{shlex Objects \label{shlex-objects}} --- 44,56 ---- operate in compatibility mode. When operating in \POSIX{} mode, \class{shlex} will try to be as close as possible to the \POSIX{} shell ! parsing rules. See section~\ref{shlex-objects}. \end{classdesc} + \begin{seealso} + \seemodule{ConfigParser}{Parser for configuration files similar to the + Windows \file{.ini} files.} + \end{seealso} + + \subsection{shlex Objects \label{shlex-objects}} *************** *** 86,90 **** the result is an absolute pathname, or there was no previous source request in effect, or the previous source was a stream ! (e.g. \code{sys.stdin}), the result is left alone. Otherwise, if the result is a relative pathname, the directory part of the name of the file immediately before it on the source inclusion stack is prepended --- 84,88 ---- the result is an absolute pathname, or there was no previous source request in effect, or the previous source was a stream ! (such as \code{sys.stdin}), the result is left alone. Otherwise, if the result is a relative pathname, the directory part of the name of the file immediately before it on the source inclusion stack is prepended *************** *** 269,273 **** or the escape character itself. Otherwise the escape character will be considered a normal character. ! \item EOF is signaled with a \code{None} value; \item Quoted empty strings (\code{''}) are allowed; \end{itemize} --- 267,271 ---- or the escape character itself. Otherwise the escape character will be considered a normal character. ! \item EOF is signaled with a \constant{None} value; \item Quoted empty strings (\code{''}) are allowed; \end{itemize} From gvanrossum at users.sourceforge.net Wed Dec 31 00:39:58 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 00:40:01 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b5.py, NONE, 1.1 out5, NONE, 1.1 b.py, 1.3, 1.4 Message-ID: <E1AbZ5K-00041f-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv15475 Modified Files: b.py Added Files: b5.py out5 Log Message: Add rudimentary checks of builtins. --- NEW FILE: b5.py --- # Test existence and performance of builtins that aren't used elsewhere show = True def check(a, b): if __debug__: if show: print `a`, "==", `b` if not a == b: raise AssertionError("%.30r != %.30r" % (a, b)) def exception(exc, f, *args): try: f(*args) except exc: pass else: raise AssertionError("%s not raised by %s%r", exc.__name, f.__name__, args) def check_functions(): check(abs(42), 42) check(abs(-42), 42) check(abs(-12345678910), 12345678910) check(abs(-3.14), 3.14) check(abs(3j+4), 5) check(bool(1), True) check(bool(100), True) check(bool(0), False) check(bool([1,2,3]), True) check(bool([]), False) check(bool({1: 2}), True) check(bool({}), False) check(complex(3, 4), 3+4j) check(dict([(1,2), (3,4)]), {1: 2, 3: 4}) check(dict.fromkeys("abc"), {'a': None, 'b': None, 'c': None}) check(divmod(7, 4), (1, 3)) check(list(enumerate("abc")), [(0, 'a'), (1, 'b'), (2, 'c')]) check(filter(None, range(10)), range(1, 10)) check(filter(lambda x: x < 5, range(10)), range(5)) check(float("1.5"), 1.5) check(float(15), 15.0) check(float(10**100), 1e100) check(hash(42), hash(42L)) check(hash(42), hash(42.0)) check(hash(42+0j), hash(42.0)) check(hash("abc"), hash(u"abc")) check(hex(42).lower(), "0x2a") check(hex(42L).lower(), "0x2al") check(int("42"), 42) check(int("12345678910"), 12345678910) check(int("42", 0), 42) check(int("042", 0), 34) check(int("0x42", 0), 66) check(int("42", 8), 34) check(int("42", 16), 66) check(list((1, 2, 3)), [1, 2, 3]) check(list("abc"), ['a', 'b', 'c']) check(list(u"abc"), ['a', 'b', 'c']) check(long("42"), 42) check(long("12345678910"), 12345678910) check(long("42", 0), 42) check(long("042", 0), 34) check(long("0x42", 0), 66) check(long("42", 8), 34) check(long("42", 16), 66) check(map(None, range(5)), range(5)) check(map(None, range(5), range(5)), [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)]) check(map(lambda x: x+1, range(5)), range(1, 6)) check(map(len, ("", "a", "ab", "abc")), range(4)) check(min(1, 5), 1) check(min([3, 1, 2]), 1) check(min("Bac"), "B") check(min(u"aBc"), u"B") a = object() b = object() if id(a) == id(b): raise AssertionError("objects not unique") check(oct(42), '052') check(oct(42L), '052L') check(ord("a"), 97) check(ord(u"a"), 97) check(ord(u"\u1234"), 0x1234) check(pow(2, 10), 1024) check(pow(2, 100), 1L<<100) check(pow(2, 10, 100), 24) check(reduce(lambda a, b: a+b, ("a", "b", "c", "d", "e")), "abcde") check(repr(42), "42") check(repr(42L), "42L") check(repr(3.5), "3.5") check(repr(4.5j), "4.5j") check(repr(4j+3), "(3+4j)") check(repr(4j-3), "(-3+4j)") check(repr(-4j), "-4j") check(repr(3.5-0j), "(3.5+0j)") check(repr("abc"), "'abc'") check(repr("abc\012"), "'abc\\n'") check(repr(u"abc"), "u'abc'") check(repr(u"abc\u1234"), "u'abc\u1234'") check(repr(range(5)), "[0, 1, 2, 3, 4]") check(repr(('a', 'b', 'c')), "('a', 'b', 'c')") check(repr({1: 42}), "{1: 42}") for x in 42, 42L, 3.5, 4.5j, 4j+3, "abc", range(3), (1, 2, 'c'), {}: check(repr(x), `x`) check(str(42), "42") check(str(42L), "42") check(str(3.5), "3.5") check(str(4.5j), "4.5j") check(str(4j+3), "(3+4j)") check(str(4j-3), "(-3+4j)") check(str(-4j), "-4j") check(str(3.5-0j), "(3.5+0j)") check(str("abc"), "abc") check(str(range(5)), "[0, 1, 2, 3, 4]") check(str(('a', 'b', 'c')), "('a', 'b', 'c')") check(str({1: 42}), "{1: 42}") check(sum(range(1, 11)), 55) check(sum((3.5, 2, 4.5)), 10) check(tuple("abc"), ('a', 'b', 'c')) check(tuple(range(5)), (0, 1, 2, 3, 4)) check(tuple({1: 2}), (1,)) check(tuple(u"abc\u1234"), (u'a', u'b', u'c', u'\u1234')) check(type(1 == 1), bool) check(type(42), int) check(type(42L), long) check(type(3.14), float) check(type(0j), complex) check(type(''), str) check(type(u''), unicode) check(type(()), tuple) check(type(range(10)), list) check(type({}), dict) check(type(type), type) check(type(object), type) check(type(lambda: None), type(check_functions)) check(unicode("abc"), u"abc") check(unicode("abc", "ascii"), u"abc") check(unicode("abc\xff", "Latin-1"), u"abc\u00ff") check(unicode("abc\xc3\xbf", "utf8"), u"abc\xff") exception(UnicodeError, unicode, "abc\xff", "ascii") exception(UnicodeError, unicode, "abc\xff", "utf-8") check(list(xrange(10)), range(10)) check(zip("abc", "def"), [('a', 'd'), ('b', 'e'), ('c', 'f')]) check(zip("abc", "def", "ghi"), [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')]) def check_descriptors(): class C(object): def getx(self): return self._x def setx(self, x): self._x = x def delx(self): del self._x x = property(getx, setx, delx) xx = property(getx) def f(*args): return list(args) fc = classmethod(f) fs = staticmethod(f) def __repr__(self): s = super(C, self).__repr__() s = s.replace("<" + __name__ + ".", "<") i = s.index(" at ") s = s[:i] + ">" return s c1 = C() exception(AttributeError, getattr, c1, "x") exception(AttributeError, getattr, c1, "xx") exception(AttributeError, setattr, c1, "xx", 42) setattr(c1, "x", 42) check(c1.x, 42) check(c1._x, 42) check(c1.xx, 42) exception(AttributeError, delattr, c1, "xx") del c1.x exception(AttributeError, getattr, c1, "x") exception(AttributeError, getattr, c1, "xx") exception(AttributeError, delattr, c1, "x") check(c1.f(42), [c1, 42]) check(c1.fc(42), [C, 42]) check(c1.fs(42), [42]) check(repr(c1), "<C object>") def main(): global show show = True for i in range(500): check_functions() check_descriptors() show = False print "OK." if __name__ == '__main__': main() --- NEW FILE: out5 --- 42 == 42 42 == 42 12345678910L == 12345678910L 3.1400000000000001 == 3.1400000000000001 5.0 == 5 True == True True == True False == False True == True False == False True == True False == False (3+4j) == (3+4j) {1: 2, 3: 4} == {1: 2, 3: 4} {'a': None, 'c': None, 'b': None} == {'a': None, 'c': None, 'b': None} (1, 3) == (1, 3) [(0, 'a'), (1, 'b'), (2, 'c')] == [(0, 'a'), (1, 'b'), (2, 'c')] [1, 2, 3, 4, 5, 6, 7, 8, 9] == [1, 2, 3, 4, 5, 6, 7, 8, 9] [0, 1, 2, 3, 4] == [0, 1, 2, 3, 4] 1.5 == 1.5 15.0 == 15.0 1e+100 == 1e+100 42 == 42 42 == 42 42 == 42 -1600925533 == -1600925533 '0x2a' == '0x2a' '0x2al' == '0x2al' 42 == 42 12345678910L == 12345678910L 42 == 42 34 == 34 66 == 66 34 == 34 66 == 66 [1, 2, 3] == [1, 2, 3] ['a', 'b', 'c'] == ['a', 'b', 'c'] [u'a', u'b', u'c'] == ['a', 'b', 'c'] 42L == 42 12345678910L == 12345678910L 42L == 42 34L == 34 66L == 66 34L == 34 66L == 66 [0, 1, 2, 3, 4] == [0, 1, 2, 3, 4] [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] == [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] [1, 2, 3, 4, 5] == [1, 2, 3, 4, 5] [0, 1, 2, 3] == [0, 1, 2, 3] 1 == 1 1 == 1 'B' == 'B' u'B' == u'B' '052' == '052' '052L' == '052L' 97 == 97 97 == 97 4660 == 4660 1024 == 1024 1267650600228229401496703205376L == 1267650600228229401496703205376L 24 == 24 'abcde' == 'abcde' '42' == '42' '42L' == '42L' '3.5' == '3.5' '4.5j' == '4.5j' '(3+4j)' == '(3+4j)' '(-3+4j)' == '(-3+4j)' '-4j' == '-4j' '(3.5+0j)' == '(3.5+0j)' "'abc'" == "'abc'" "'abc\\n'" == "'abc\\n'" "u'abc'" == "u'abc'" "u'abc\\u1234'" == "u'abc\\u1234'" '[0, 1, 2, 3, 4]' == '[0, 1, 2, 3, 4]' "('a', 'b', 'c')" == "('a', 'b', 'c')" '{1: 42}' == '{1: 42}' '42' == '42' '42L' == '42L' '3.5' == '3.5' '4.5j' == '4.5j' '(3+4j)' == '(3+4j)' "'abc'" == "'abc'" '[0, 1, 2]' == '[0, 1, 2]' "(1, 2, 'c')" == "(1, 2, 'c')" '{}' == '{}' '42' == '42' '42' == '42' '3.5' == '3.5' '4.5j' == '4.5j' '(3+4j)' == '(3+4j)' '(-3+4j)' == '(-3+4j)' '-4j' == '-4j' '(3.5+0j)' == '(3.5+0j)' 'abc' == 'abc' '[0, 1, 2, 3, 4]' == '[0, 1, 2, 3, 4]' "('a', 'b', 'c')" == "('a', 'b', 'c')" '{1: 42}' == '{1: 42}' 55 == 55 10.0 == 10 ('a', 'b', 'c') == ('a', 'b', 'c') (0, 1, 2, 3, 4) == (0, 1, 2, 3, 4) (1,) == (1,) (u'a', u'b', u'c', u'\u1234') == (u'a', u'b', u'c', u'\u1234') <type 'bool'> == <type 'bool'> <type 'int'> == <type 'int'> <type 'long'> == <type 'long'> <type 'float'> == <type 'float'> <type 'complex'> == <type 'complex'> <type 'str'> == <type 'str'> <type 'unicode'> == <type 'unicode'> <type 'tuple'> == <type 'tuple'> <type 'list'> == <type 'list'> <type 'dict'> == <type 'dict'> <type 'type'> == <type 'type'> <type 'type'> == <type 'type'> <type 'function'> == <type 'function'> u'abc' == u'abc' u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')] [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')] == [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')] 42 == 42 42 == 42 42 == 42 [<C object>, 42] == [<C object>, 42] [<class '__main__.C'>, 42] == [<class '__main__.C'>, 42] [42] == [42] '<C object>' == '<C object>' OK. Index: b.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** b.py 31 Dec 2003 02:04:20 -0000 1.3 --- b.py 31 Dec 2003 05:39:55 -0000 1.4 *************** *** 4,5 **** --- 4,6 ---- import b3 import b4 + import b5; b5.main() From gvanrossum at users.sourceforge.net Wed Dec 31 01:16:49 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 01:16:52 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b5.py, 1.1, 1.2 out5, 1.1, 1.2 Message-ID: <E1AbZez-0005EB-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv20090 Modified Files: b5.py out5 Log Message: More fun with classes. Index: b5.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b5.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b5.py 31 Dec 2003 05:39:55 -0000 1.1 --- b5.py 31 Dec 2003 06:16:46 -0000 1.2 *************** *** 14,21 **** f(*args) except exc: ! pass else: raise AssertionError("%s not raised by %s%r", ! exc.__name, f.__name__, args) def check_functions(): --- 14,23 ---- f(*args) except exc: ! if __debug__: ! if show: ! print "%s%r raised %s" % (f.__name__, args, exc.__name__) else: raise AssertionError("%s not raised by %s%r", ! exc.__name__, f.__name__, args) def check_functions(): *************** *** 160,163 **** --- 162,176 ---- check(type(object), type) check(type(lambda: None), type(check_functions)) + class C(object): + pass + class MC(type): + pass + class D: + __metaclass__ = MC + class E(object): + __metaclass__ = MC + check(type(C), type) + check(type(D), MC) + check(type(E), MC) check(unicode("abc"), u"abc") *************** *** 176,192 **** def check_descriptors(): ! class C(object): def getx(self): ! return self._x def setx(self, x): ! self._x = x def delx(self): ! del self._x x = property(getx, setx, delx) xx = property(getx) ! def f(*args): ! return list(args) fc = classmethod(f) fs = staticmethod(f) --- 189,238 ---- def check_descriptors(): ! class C0(object): ! ! def __getattribute__(self, name): ! if name == "spam": ! raise IndexError("no way") ! return super(C0, self).__getattribute__(name) ! ! class C(C0): ! ! hello = 42 ! ! def __new__(cls, *args): ! if args: ! return None ! return super(C, cls).__new__(cls) ! ! def __init__(self): ! self.__dict__["foo"] = 42 ! self.spam = 42 ! ! def __setattr__(self, name, value): ! if name == "foo": ! raise RuntimeError("forget it") ! super(C, self).__setattr__(name, value) ! ! def __getattr__(self, name): ! if name == "bar": ! return self.foo ! raise AttributeError(name) ! ! def __getattribute__(self, name): ! if name == "hello": ! return "booh" ! return super(C, self).__getattribute__(name) def getx(self): ! return self.__x def setx(self, x): ! self.__x = x def delx(self): ! del self.__x x = property(getx, setx, delx) xx = property(getx) ! def f(*args, **kwds): ! return list(args), dict(kwds) fc = classmethod(f) fs = staticmethod(f) *************** *** 199,220 **** return s ! c1 = C() ! exception(AttributeError, getattr, c1, "x") ! exception(AttributeError, getattr, c1, "xx") ! exception(AttributeError, setattr, c1, "xx", 42) ! setattr(c1, "x", 42) ! check(c1.x, 42) ! check(c1._x, 42) ! check(c1.xx, 42) ! exception(AttributeError, delattr, c1, "xx") ! del c1.x ! exception(AttributeError, getattr, c1, "x") ! exception(AttributeError, getattr, c1, "xx") ! exception(AttributeError, delattr, c1, "x") ! check(c1.f(42), [c1, 42]) ! check(c1.fc(42), [C, 42]) ! check(c1.fs(42), [42]) ! check(repr(c1), "<C object>") def main(): --- 245,312 ---- return s ! def checks(): ! check(C(1), None) ! c1 = C() ! exception(AttributeError, getattr, c1, 'booh') ! exception(AttributeError, getattr, c1, "x") ! exception(AttributeError, getattr, c1, "xx") ! exception(AttributeError, setattr, c1, "xx", 42) ! setattr(c1, "x", 42) ! check(c1.x, 42) ! check(c1._C__x, 42) ! check(c1.xx, 42) ! exception(AttributeError, delattr, c1, "xx") ! del c1.x ! exception(AttributeError, getattr, c1, "x") ! exception(AttributeError, getattr, c1, "xx") ! check(getattr(c1, "x", None), None) ! check(getattr(c1, "xx", None), None) ! exception(AttributeError, delattr, c1, "x") ! check(c1.f(42), ([c1, 42], {})) ! check(c1.fc(42, foo=42), ([C, 42], {"foo": 42})) ! check(c1.fs(42, a=1, b=2), ([42], {'a': 1, 'b': 2})) ! check(repr(c1), "<C object>") ! ! check(getattr(c1, 'foo'), 42) ! check(getattr(c1, 'bar'), 42) ! exception(RuntimeError, setattr, c1, "foo", 42) ! c1.bar = "hello" ! check(c1.bar, "hello") ! exception(IndexError, getattr, c1, "spam") ! check(getattr(c1, "hello"), "booh") ! B = C.__bases__[-1] ! save = B.__getattribute__ ! del B.__getattribute__ ! check(c1.spam, 42) ! check(getattr(c1, "hello"), "booh") ! save2 = C.__getattribute__ ! del C.__getattribute__ ! check(c1.hello, 42) ! C.__getattribute__ = save2 ! B.__getattribute__ = save ! exception(IndexError, getattr, c1, "spam") ! exception(IndexError, getattr, c1, "spam", None) ! check(getattr(c1, "hello"), "booh") ! ! checks() ! checks() ! class A(object): ! pass ! class B(object): ! def __getattribute__(self, name): ! if name == "spam": ! raise IndexError("no way") ! return super(B, self).__getattribute__(name) ! C.__bases__ = (A, B) ! checks() ! ! c2 = C() ! c2.x = 42 ! check(c2.x, 42) ! check(c2._C__x, 42) ! c2.__class__ = C0 ! check(getattr(c2, 'x', None), None) ! check(c2._C__x, 42) def main(): Index: out5 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out5,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** out5 31 Dec 2003 05:39:55 -0000 1.1 --- out5 31 Dec 2003 06:16:46 -0000 1.2 *************** *** 116,132 **** <type 'type'> == <type 'type'> <type 'function'> == <type 'function'> u'abc' == u'abc' u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')] [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')] == [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')] 42 == 42 42 == 42 42 == 42 ! [<C object>, 42] == [<C object>, 42] ! [<class '__main__.C'>, 42] == [<class '__main__.C'>, 42] ! [42] == [42] '<C object>' == '<C object>' OK. --- 116,217 ---- <type 'type'> == <type 'type'> <type 'function'> == <type 'function'> + <type 'type'> == <type 'type'> + <class '__main__.MC'> == <class '__main__.MC'> + <class '__main__.MC'> == <class '__main__.MC'> u'abc' == u'abc' u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' + unicode('abc\xff', 'ascii') raised UnicodeError + unicode('abc\xff', 'utf-8') raised UnicodeError [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')] [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')] == [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')] + None == None + getattr(<C object>, 'booh') raised AttributeError + getattr(<C object>, 'x') raised AttributeError + getattr(<C object>, 'xx') raised AttributeError + setattr(<C object>, 'xx', 42) raised AttributeError 42 == 42 42 == 42 42 == 42 ! delattr(<C object>, 'xx') raised AttributeError ! getattr(<C object>, 'x') raised AttributeError ! getattr(<C object>, 'xx') raised AttributeError ! None == None ! None == None ! delattr(<C object>, 'x') raised AttributeError ! ([<C object>, 42], {}) == ([<C object>, 42], {}) ! ([<class '__main__.C'>, 42], {'foo': 42}) == ([<class '__main__.C'>, 42], {'foo': 42}) ! ([42], {'a': 1, 'b': 2}) == ([42], {'a': 1, 'b': 2}) '<C object>' == '<C object>' + 42 == 42 + 42 == 42 + setattr(<C object>, 'foo', 42) raised RuntimeError + 'hello' == 'hello' + getattr(<C object>, 'spam') raised IndexError + 'booh' == 'booh' + 42 == 42 + 'booh' == 'booh' + 42 == 42 + getattr(<C object>, 'spam') raised IndexError + 'booh' == 'booh' + None == None + getattr(<C object>, 'booh') raised AttributeError + getattr(<C object>, 'x') raised AttributeError + getattr(<C object>, 'xx') raised AttributeError + setattr(<C object>, 'xx', 42) raised AttributeError + 42 == 42 + 42 == 42 + 42 == 42 + delattr(<C object>, 'xx') raised AttributeError + getattr(<C object>, 'x') raised AttributeError + getattr(<C object>, 'xx') raised AttributeError + None == None + None == None + delattr(<C object>, 'x') raised AttributeError + ([<C object>, 42], {}) == ([<C object>, 42], {}) + ([<class '__main__.C'>, 42], {'foo': 42}) == ([<class '__main__.C'>, 42], {'foo': 42}) + ([42], {'a': 1, 'b': 2}) == ([42], {'a': 1, 'b': 2}) + '<C object>' == '<C object>' + 42 == 42 + 42 == 42 + setattr(<C object>, 'foo', 42) raised RuntimeError + 'hello' == 'hello' + getattr(<C object>, 'spam') raised IndexError + 'booh' == 'booh' + 42 == 42 + 'booh' == 'booh' + 42 == 42 + getattr(<C object>, 'spam') raised IndexError + 'booh' == 'booh' + None == None + getattr(<C object>, 'booh') raised AttributeError + getattr(<C object>, 'x') raised AttributeError + getattr(<C object>, 'xx') raised AttributeError + setattr(<C object>, 'xx', 42) raised AttributeError + 42 == 42 + 42 == 42 + 42 == 42 + delattr(<C object>, 'xx') raised AttributeError + getattr(<C object>, 'x') raised AttributeError + getattr(<C object>, 'xx') raised AttributeError + None == None + None == None + delattr(<C object>, 'x') raised AttributeError + ([<C object>, 42], {}) == ([<C object>, 42], {}) + ([<class '__main__.C'>, 42], {'foo': 42}) == ([<class '__main__.C'>, 42], {'foo': 42}) + ([42], {'a': 1, 'b': 2}) == ([42], {'a': 1, 'b': 2}) + '<C object>' == '<C object>' + 42 == 42 + 42 == 42 + setattr(<C object>, 'foo', 42) raised RuntimeError + 'hello' == 'hello' + getattr(<C object>, 'spam') raised IndexError + 'booh' == 'booh' + 42 == 42 + 'booh' == 'booh' + 42 == 42 + getattr(<C object>, 'spam') raised IndexError + 'booh' == 'booh' OK. From gvanrossum at users.sourceforge.net Wed Dec 31 01:17:19 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 01:17:21 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench out5,1.2,1.3 Message-ID: <E1AbZfT-0005FR-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv20170 Modified Files: out5 Log Message: More fun with classes. Index: out5 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out5,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** out5 31 Dec 2003 06:16:46 -0000 1.2 --- out5 31 Dec 2003 06:17:16 -0000 1.3 *************** *** 156,159 **** --- 156,160 ---- 42 == 42 getattr(<C object>, 'spam') raised IndexError + getattr(<C object>, 'spam', None) raised IndexError 'booh' == 'booh' None == None *************** *** 185,188 **** --- 186,190 ---- 42 == 42 getattr(<C object>, 'spam') raised IndexError + getattr(<C object>, 'spam', None) raised IndexError 'booh' == 'booh' None == None *************** *** 214,217 **** --- 216,224 ---- 42 == 42 getattr(<C object>, 'spam') raised IndexError + getattr(<C object>, 'spam', None) raised IndexError 'booh' == 'booh' + 42 == 42 + 42 == 42 + None == None + 42 == 42 OK. From gvanrossum at users.sourceforge.net Wed Dec 31 01:27:51 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 01:27:55 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench Makefile, NONE, 1.1 out, NONE, 1.1 Message-ID: <E1AbZpf-0005bE-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv21523 Added Files: Makefile out Log Message: Added a Makefile, and an overall output file. --- NEW FILE: Makefile --- time: time python -O b.py >@out cmp @out out cmp: python -O b.py >@out cmp @out out diff: python -O b.py >@out diff @out out clean: -rm -f @* times: for i in 0 1 2 3 4 5; do \ echo b$$i.py; \ time python b$$i.py >@out$$i; \ cmp @out$$i out$$i; \ done cmps: for i in 0 1 2 3 4 5; do \ echo b$$i.py; \ python b$$i.py >@out$$i; \ cmp @out$$i out$$i; \ done diffs: for i in 0 1 2 3 4 5; do \ echo b$$i.py; \ python b$$i.py >@out$$i; \ diff @out$$i out$$i; \ done all: out out0 out1 out2 out3 out4 out5 out: b.py b?.py python -O b.py >out out0: b0.py python b0.py >out0 out1: b1.py python b1.py >out1 out2: b2.py python b2.py >out2 out3: b3.py python b3.py >out3 out4: b4.py python b4.py >out4 out5: b5.py python b5.py >out5 --- NEW FILE: out --- 3141592653 3141592653 997 997 0 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 A [T(290448019)] [T(1487478786)] [T(159903786)] using None Z [T(387083)] [T(1080738845)] [T(2147439074)] 0 using cmp Z [T(387083)] [T(1080738845)] [T(2147439074)] 0 using icmp Z [T(387083)] [T(1080738845)] [T(2147439074)] 259811 using None Z [T(387083)] [T(1080738845)] [T(2147439074)] 259811 using None Z [T(387083)] [T(1080738845)] [T(2147439074)] 0 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] OK. From gvanrossum at users.sourceforge.net Wed Dec 31 01:32:40 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 01:32:43 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libstdtypes.tex, 1.148, 1.149 Message-ID: <E1AbZuK-0005ms-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv22243 Modified Files: libstdtypes.tex Log Message: Correct misrepresentation of print (it uses str(), not `...` for conversion). Hopefully I've not messed up the formatting. Index: libstdtypes.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libstdtypes.tex,v retrieving revision 1.148 retrieving revision 1.149 diff -C2 -d -r1.148 -r1.149 *** libstdtypes.tex 30 Dec 2003 22:21:18 -0000 1.148 --- libstdtypes.tex 31 Dec 2003 06:32:38 -0000 1.149 *************** *** 14,20 **** Some operations are supported by several object types; in particular, ! all objects can be compared, tested for truth value, and converted to ! a string (with the \code{`\textrm{\ldots}`} notation). The latter ! conversion is implicitly used when an object is written by the \keyword{print}\stindex{print} statement. (Information on \ulink{\keyword{print} statement}{../ref/print.html} --- 14,22 ---- Some operations are supported by several object types; in particular, ! practically all objects can be compared, tested for truth value, ! and converted to a string (with the \code{`\textrm{\ldots}`} notation, ! the equivalent \function{repr()} function, or the slightly different ! \function{str()} function). The latter ! function is implicitly used when an object is written by the \keyword{print}\stindex{print} statement. (Information on \ulink{\keyword{print} statement}{../ref/print.html} From gvanrossum at users.sourceforge.net Wed Dec 31 01:43:50 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 01:43:53 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b5.py, 1.2, 1.3 out5, 1.3, 1.4 Message-ID: <E1Aba58-0006CG-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv23820 Modified Files: b5.py out5 Log Message: More fun with encode() and decode(). Index: b5.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b5.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b5.py 31 Dec 2003 06:16:46 -0000 1.2 --- b5.py 31 Dec 2003 06:43:47 -0000 1.3 *************** *** 175,183 **** check(unicode("abc"), u"abc") ! check(unicode("abc", "ascii"), u"abc") check(unicode("abc\xff", "Latin-1"), u"abc\u00ff") check(unicode("abc\xc3\xbf", "utf8"), u"abc\xff") ! exception(UnicodeError, unicode, "abc\xff", "ascii") ! exception(UnicodeError, unicode, "abc\xff", "utf-8") check(list(xrange(10)), range(10)) --- 175,195 ---- check(unicode("abc"), u"abc") ! check("abc".decode(), u"abc") ! check(unicode("abc", "ASCII"), u"abc") ! check("abc".decode("646"), u"abc") check(unicode("abc\xff", "Latin-1"), u"abc\u00ff") + check("abc\xff".decode("latin-1"), u"abc\u00ff") check(unicode("abc\xc3\xbf", "utf8"), u"abc\xff") ! check("abc\xc3\xbf".decode("Utf8"), u"abc\xff") ! exception(UnicodeError, unicode, "abc\xff") ! exception(UnicodeError, "abc\xff".decode) ! exception(UnicodeError, unicode, "abc\xff", "us_ascii") ! exception(UnicodeError, "abc\xff".decode, "Ascii") ! exception(UnicodeError, unicode, "abc\xff", "UTF-8") ! exception(UnicodeError, "abc\xff".decode, "utf8") ! check(u"abc\xff".encode("utf-8"), "abc\xc3\xbf") ! check(u"abc\xff".encode("latin1"), "abc\377") ! exception(UnicodeError, u"abc\xff".encode, "Ascii") ! check(u"abc".encode("us"), "abc") check(list(xrange(10)), range(10)) Index: out5 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out5,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** out5 31 Dec 2003 06:17:16 -0000 1.3 --- out5 31 Dec 2003 06:43:47 -0000 1.4 *************** *** 121,128 **** u'abc' == u'abc' u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' ! unicode('abc\xff', 'ascii') raised UnicodeError ! unicode('abc\xff', 'utf-8') raised UnicodeError [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')] --- 121,140 ---- u'abc' == u'abc' u'abc' == u'abc' + u'abc' == u'abc' + u'abc' == u'abc' u'abc\xff' == u'abc\xff' u'abc\xff' == u'abc\xff' ! u'abc\xff' == u'abc\xff' ! u'abc\xff' == u'abc\xff' ! unicode('abc\xff',) raised UnicodeError ! decode() raised UnicodeError ! unicode('abc\xff', 'us_ascii') raised UnicodeError ! decode('Ascii',) raised UnicodeError ! unicode('abc\xff', 'UTF-8') raised UnicodeError ! decode('utf8',) raised UnicodeError ! 'abc\xc3\xbf' == 'abc\xc3\xbf' ! 'abc\xff' == 'abc\xff' ! encode('Ascii',) raised UnicodeError ! 'abc' == 'abc' [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] == [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] [('a', 'd'), ('b', 'e'), ('c', 'f')] == [('a', 'd'), ('b', 'e'), ('c', 'f')] From gvanrossum at users.sourceforge.net Wed Dec 31 01:59:44 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 01:59:48 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b0.py, 1.5, 1.6 out0, 1.4, 1.5 Message-ID: <E1AbaKW-0006mO-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv26057 Modified Files: b0.py out0 Log Message: Another game with pi(): track local assignments through a special dict. Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** b0.py 31 Dec 2003 02:04:20 -0000 1.5 --- b0.py 31 Dec 2003 06:59:41 -0000 1.6 *************** *** 252,255 **** --- 252,256 ---- class Function(object): + makeLocals = dict def __init__(self, name, args, body, globals): self.name = name *************** *** 259,263 **** def __call__(self, *args): check(len(args), len(self.args)) ! locals = dict(zip(self.args, args)) try: eval(self.body, self.globals, locals) --- 260,264 ---- def __call__(self, *args): check(len(args), len(self.args)) ! locals = self.makeLocals(zip(self.args, args)) try: eval(self.body, self.globals, locals) *************** *** 268,272 **** def __call__(self, *args): check(len(args), len(self.args)) ! locals = dict(zip(self.args, args)) try: for value in geneval(self.body, self.globals, locals): --- 269,273 ---- def __call__(self, *args): check(len(args), len(self.args)) ! locals = self.makeLocals(zip(self.args, args)) try: for value in geneval(self.body, self.globals, locals): *************** *** 905,909 **** --- 906,924 ---- print "".join(map(str, digits)) out2 = output.getvalue() + checkoutput(0) + + class TrackingDict(dict): + def __setitem__(self, *args): + writeln("%s = %.50r" % args) + super(TrackingDict, self).__setitem__(*args) + Function.makeLocals = TrackingDict + g = env['pi']() + digits = [] + for i in range(100): + digits.append(g.next()) + checkoutput(902386495) + Function.makeLocals = dict if __name__ == '__main__': main() + Index: out0 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** out0 31 Dec 2003 02:04:20 -0000 1.4 --- out0 31 Dec 2003 06:59:41 -0000 1.5 *************** *** 9175,9176 **** --- 9175,10756 ---- 3141592653 3141592653 + k = 2 + a = 4 + b = 1 + a1 = 12 + b1 = 4 + p = 4 + q = 5 [...1553 lines suppressed...] + d = 6L + d1 = 8L + p = 17161 + q = 263 + k = 132 + a = 44251238236192885942548145627920559612834490019477 + b = 53634950897741092356584376185938131188127119065994 + a1 = 13513199258755166498247119721333722230685517166948 + b1 = 17027474947792072675248882917835637732116154588448 + d = 8L + d1 = 7L + p = 17424 + q = 265 + k = 133 + a = 13513199258755166498247119721333722230685517166948 + b = 17027474947792072675248882917835637732116154588448 + a1 = 43520313785975439666984456155743242218256902033408 + b1 = 54468162456071400521620801438902299968327078885447 + d = 7L + d1 = 7L From gvanrossum at users.sourceforge.net Wed Dec 31 02:31:21 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 02:31:25 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench README.txt, NONE, 1.1 Message-ID: <E1Abap7-0007nx-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv29987 Added Files: README.txt Log Message: Beginning of an explanation. --- NEW FILE: README.txt --- Parrot benchmark ================ This is a benchmark to be run in front of a live audience at OSCON 2004 between Python and Parrot. The bytecode must be Python 2.3 bytecode frozen in December 2003 (which is almost over as I write this :-). For some more background, see the python-dev thread around http://mail.python.org/pipermail/python-dev/2003-December/040977.html The benchmark here is intended to make Dan Sugalski's life difficult: there are some standard benchmark thingies (simple random algorithms using basic data types) but also a lot of play with odd corners of the language definition, and Python's extremely dynamic object model: funky descriptors, mutable classes, that sort of thing. The benchmark is supposed to run with either Python 2.3 or Python 2.4. Brief description per file: Makefile -- Various ways of running the benchmark and sub-benchmarks. b.py -- The full benchmark output is defined as "python -O b.py". b0.py -- Lots of fun with a parser for a subset of Python (just because this is a classic OO-heavy application). b1.py -- Explore recursion. Unbounded recursion is expected to raise RuntimeError after about 1000 levels. (If Parrot supports much more, this part will be slower; the point is to be able to tweak the recursion limit.) b2.py -- Calculate PI using a generator. b3.py -- Sorting, and various ways of setting the comparison function for list.sort(). b4.py -- Another test for the code from b0.py, this time with code derived from Python 2.3's heapq.py. b5.py -- Test the standard library, including three standard Unicode codecs (ASCII, Latin-1 and UTF-8), various descriptors, and mutable classes. Note that per agreement I'm not allowed to use any built-in extension modules, not even __builtin__ or sys. This means there's no access to sys.args (so no command line arguments), sys.stdout (but we have "print >>file") or to sys.exc_info(). Dan could save some nanoseconds by not supporting tracebacks. But that would be cheating. Also cheating would be to do all the work at compile time (this is theoretically possible since the program has no input). Per agreement the following builtins are out: open(), file(), input(), raw_input(), compile(), eval(), execfile(), and the exec statement. But I assume the print statement is okay (the program must communicate its success or failure *somehow*). I'm being nice, and am voluntarily refraining from using __builtins__, basestring, callable(), __import__(), reload(), dir(), globals(), locals(), vars(), help(), apply(), buffer(), coerce(), or intern(). I'm also not digging around in the func_code attribute of function objects. --Guido van Rossum (home page: http://www.python.org/~guido/) From fdrake at users.sourceforge.net Wed Dec 31 02:41:54 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 31 02:41:57 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libdircache.tex,1.4,1.5 Message-ID: <E1AbazK-0008CW-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv31517/lib Modified Files: libdircache.tex Log Message: use conventional whitespace in interactive example Index: libdircache.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libdircache.tex,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** libdircache.tex 1 Dec 2000 15:25:23 -0000 1.4 --- libdircache.tex 31 Dec 2003 07:41:52 -0000 1.5 *************** *** 33,38 **** \begin{verbatim} >>> import dircache ! >>> a=dircache.listdir('/') ! >>> a=a[:] # Copy the return value so we can change 'a' >>> a ['bin', 'boot', 'cdrom', 'dev', 'etc', 'floppy', 'home', 'initrd', 'lib', 'lost+ --- 33,38 ---- \begin{verbatim} >>> import dircache ! >>> a = dircache.listdir('/') ! >>> a = a[:] # Copy the return value so we can change 'a' >>> a ['bin', 'boot', 'cdrom', 'dev', 'etc', 'floppy', 'home', 'initrd', 'lib', 'lost+ From gvanrossum at users.sourceforge.net Wed Dec 31 02:55:00 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 02:55:04 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b6.py, NONE, 1.1 out6, NONE, 1.1 Makefile, 1.1, 1.2 README.txt, 1.1, 1.2 b.py, 1.4, 1.5 b5.py, 1.3, 1.4 out5, 1.4, 1.5 Message-ID: <E1AbbC0-0000By-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv737 Modified Files: Makefile README.txt b.py b5.py out5 Added Files: b6.py out6 Log Message: Add some forgotten builtins. Add a mild stress test for long for loops. --- NEW FILE: b6.py --- from b5 import check def main(): L = [1]*1000000 L[-1] = 42 n = 0 for i in L: n += i check(i, 42) check(n, 1000041) n = 0 for i in xrange(1000000): n += i check(i, 999999) check(n, 999999*1000000//2) d = dict.fromkeys(xrange(1000000)) n = 0 for i in d: n += i check(n, 999999*1000000//2) if __name__ == '__main__': main() --- NEW FILE: out6 --- 42 == 42 1000041 == 1000041 999999 == 999999 499999500000L == 499999500000L 499999500000L == 499999500000L Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Makefile 31 Dec 2003 06:27:49 -0000 1.1 --- Makefile 31 Dec 2003 07:54:58 -0000 1.2 *************** *** 15,19 **** times: ! for i in 0 1 2 3 4 5; do \ echo b$$i.py; \ time python b$$i.py >@out$$i; \ --- 15,19 ---- times: ! for i in 0 1 2 3 4 5 6; do \ echo b$$i.py; \ time python b$$i.py >@out$$i; \ *************** *** 22,26 **** cmps: ! for i in 0 1 2 3 4 5; do \ echo b$$i.py; \ python b$$i.py >@out$$i; \ --- 22,26 ---- cmps: ! for i in 0 1 2 3 4 5 6; do \ echo b$$i.py; \ python b$$i.py >@out$$i; \ *************** *** 29,33 **** diffs: ! for i in 0 1 2 3 4 5; do \ echo b$$i.py; \ python b$$i.py >@out$$i; \ --- 29,33 ---- diffs: ! for i in 0 1 2 3 4 5 6; do \ echo b$$i.py; \ python b$$i.py >@out$$i; \ *************** *** 35,39 **** done ! all: out out0 out1 out2 out3 out4 out5 out: b.py b?.py --- 35,39 ---- done ! all: out out0 out1 out2 out3 out4 out5 out6 out: b.py b?.py *************** *** 57,58 **** --- 57,61 ---- out5: b5.py python b5.py >out5 + + out6: b6.py + python b6.py >out6 Index: README.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/README.txt,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** README.txt 31 Dec 2003 07:31:19 -0000 1.1 --- README.txt 31 Dec 2003 07:54:58 -0000 1.2 *************** *** 43,46 **** --- 43,48 ---- mutable classes. + b6.py -- Check speed of iterating over several common iterators. + Note that per agreement I'm not allowed to use any built-in extension modules, not even __builtin__ or sys. This means there's no access to Index: b.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** b.py 31 Dec 2003 05:39:55 -0000 1.4 --- b.py 31 Dec 2003 07:54:58 -0000 1.5 *************** *** 5,6 **** --- 5,7 ---- import b4 import b5; b5.main() + import b6; b6.main() Index: b5.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b5.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** b5.py 31 Dec 2003 06:43:47 -0000 1.3 --- b5.py 31 Dec 2003 07:54:58 -0000 1.4 *************** *** 80,83 **** --- 80,113 ---- check(long("42", 16), 66) + check(isinstance(42, int), True) + check(isinstance(42, long), False) + check(isinstance(42L, int), False) + check(isinstance(42L, long), True) + check(isinstance(12345678910, int), False) + check(isinstance(12345678910, long), True) + check(isinstance(3.14, int), False) + check(isinstance(3.14, float), True) + check(isinstance(int, type), True) + check(isinstance(int, object), True) + check(isinstance(type, object), True) + + check(issubclass(int, object), True) + check(issubclass(int, int), True) + check(issubclass(bool, int), True) + check(issubclass(int, str), False) + check(issubclass(str, int), False) + check(issubclass(type, object), True) + + it = iter("abcdef") + for i, c in enumerate(it): + check(c, chr(ord('a') + i)) + if i == 2: + break + check(it.next(), "d") + check(it.next(), "e") + check(it.next(), "f") + exception(StopIteration, it.next) + exception(StopIteration, it.next) + check(map(None, range(5)), range(5)) check(map(None, range(5), range(5)), *************** *** 86,89 **** --- 116,124 ---- check(map(len, ("", "a", "ab", "abc")), range(4)) + check(max(1, 5), 5) + check(max([3, 1, 2]), 3) + check(max("Bac"), "c") + check(max(u"aBc"), u"c") + check(min(1, 5), 1) check(min([3, 1, 2]), 1) *************** *** 127,130 **** --- 162,169 ---- for x in 42, 42L, 3.5, 4.5j, 4j+3, "abc", range(3), (1, 2, 'c'), {}: check(repr(x), `x`) + + check(round(3.14), 3.0) + check(round(3.14, 1), 3.1) + check(round(31.4, -1), 30.0) check(str(42), "42") Index: out5 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out5,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** out5 31 Dec 2003 06:43:47 -0000 1.4 --- out5 31 Dec 2003 07:54:58 -0000 1.5 *************** *** 44,51 **** --- 44,80 ---- 34L == 34 66L == 66 + True == True + False == False + False == False + True == True + False == False + True == True + False == False + True == True + True == True + True == True + True == True + True == True + True == True + True == True + False == False + False == False + True == True + 'a' == 'a' + 'b' == 'b' + 'c' == 'c' + 'd' == 'd' + 'e' == 'e' + 'f' == 'f' + next() raised StopIteration + next() raised StopIteration [0, 1, 2, 3, 4] == [0, 1, 2, 3, 4] [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] == [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] [1, 2, 3, 4, 5] == [1, 2, 3, 4, 5] [0, 1, 2, 3] == [0, 1, 2, 3] + 5 == 5 + 3 == 3 + 'c' == 'c' + u'c' == u'c' 1 == 1 1 == 1 *************** *** 85,88 **** --- 114,120 ---- "(1, 2, 'c')" == "(1, 2, 'c')" '{}' == '{}' + 3.0 == 3.0 + 3.1000000000000001 == 3.1000000000000001 + 30.0 == 30.0 '42' == '42' '42' == '42' From gvanrossum at users.sourceforge.net Wed Dec 31 02:57:54 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 02:57:57 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b1.py, 1.1, 1.2 out, 1.1, 1.2 out1, 1.1, 1.2 Message-ID: <E1AbbEo-0000I0-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv1107 Modified Files: b1.py out out1 Log Message: Don't insist on an exact recursion limit -- just one >= 997. Index: b1.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b1.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b1.py 30 Dec 2003 06:12:57 -0000 1.1 --- b1.py 31 Dec 2003 07:57:51 -0000 1.2 *************** *** 5,9 **** pass return n ! print depth0(0) def depth1(n, pea): p = (pea, pea) --- 5,9 ---- pass return n ! print depth0(0) >= 997 def depth1(n, pea): p = (pea, pea) *************** *** 17,21 **** pea = [] base, p = depth1(0, pea) ! print base pea.append(p) while p[1] is not pea: --- 17,21 ---- pea = [] base, p = depth1(0, pea) ! print base >= 997 pea.append(p) while p[1] is not pea: Index: out =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** out 31 Dec 2003 06:27:49 -0000 1.1 --- out 31 Dec 2003 07:57:51 -0000 1.2 *************** *** 1,6 **** 3141592653 3141592653 ! 997 ! 997 0 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 A [T(290448019)] [T(1487478786)] [T(159903786)] --- 1,6 ---- 3141592653 3141592653 ! True ! True 0 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 A [T(290448019)] [T(1487478786)] [T(159903786)] Index: out1 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out1,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** out1 30 Dec 2003 06:12:57 -0000 1.1 --- out1 31 Dec 2003 07:57:51 -0000 1.2 *************** *** 1,3 **** ! 998 ! 998 0 --- 1,3 ---- ! True ! True 0 From gvanrossum at users.sourceforge.net Wed Dec 31 04:05:01 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 04:05:13 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b.py, 1.5, 1.6 b0.py, 1.6, 1.7 b1.py, 1.2, 1.3 b2.py, 1.1, 1.2 b3.py, 1.2, 1.3 b4.py, 1.1, 1.2 out, 1.2, 1.3 Message-ID: <E1AbcHl-0002rN-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv10974 Modified Files: b.py b0.py b1.py b2.py b3.py b4.py out Log Message: Give all module a main(), and repeat twice in b.main(). Had to fix some details of OutputFile. Index: b.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** b.py 31 Dec 2003 07:54:58 -0000 1.5 --- b.py 31 Dec 2003 09:04:57 -0000 1.6 *************** *** 1,7 **** ! import b0; b0.main() import b1 import b2 import b3 import b4 ! import b5; b5.main() ! import b6; b6.main() --- 1,25 ---- ! import b0 import b1 import b2 import b3 import b4 ! import b5 ! import b6 ! ! for i in range(2): ! print "--> iteration", i ! print "--> b0" ! b0.main() ! print "--> b1" ! b1.main() ! print "--> b2" ! b2.main() ! print "--> b3" ! b3.main() ! print "--> b4" ! b4.main() ! print "--> b5" ! b5.main() ! print "--> b6" ! b6.main() ! print "--> All done." Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** b0.py 31 Dec 2003 06:59:41 -0000 1.6 --- b0.py 31 Dec 2003 09:04:58 -0000 1.7 *************** *** 716,720 **** class OutputFile(object): ! data = [] def write(self, s): self.data.append(s) --- 716,723 ---- class OutputFile(object): ! def __init__(self): ! self.data = [] ! self.softspace = True ! reset = __init__ def write(self, s): self.data.append(s) *************** *** 762,767 **** strhash = myhash - OutputFile.softspace = True - indent = "" --- 765,768 ---- *************** *** 769,773 **** cname = cls.__name__ + '.' for name in cls.__dict__: ! descr = getattr(cls, name) if hasattr(descr, '__get__'): setattr(cls, name, instrumentDescriptor(cname+name, descr)) --- 770,776 ---- cname = cls.__name__ + '.' for name in cls.__dict__: ! if name == '__dict__': ! continue ! descr = cls.__dict__[name] if hasattr(descr, '__get__'): setattr(cls, name, instrumentDescriptor(cname+name, descr)) *************** *** 830,833 **** --- 833,838 ---- def main(): + output.reset() + s = Scanner(getcFromString(sample).next) it = Clone(s.tokenize()) *************** *** 841,848 **** scanner = Scanner(getcFromString(sample).next).tokenize() parser = Parser(scanner) - root = parser.parse() - - scanner = Scanner(getcFromString(sample).next).tokenize() - parser = Parser(scanner) instrumentClass(Parser) root = parser.parse() --- 846,849 ---- *************** *** 922,924 **** if __name__ == '__main__': main() - --- 923,924 ---- Index: b1.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b1.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b1.py 31 Dec 2003 07:57:51 -0000 1.2 --- b1.py 31 Dec 2003 09:04:58 -0000 1.3 *************** *** 5,9 **** pass return n ! print depth0(0) >= 997 def depth1(n, pea): p = (pea, pea) --- 5,9 ---- pass return n ! def depth1(n, pea): p = (pea, pea) *************** *** 15,31 **** pass return n, p ! pea = [] ! base, p = depth1(0, pea) ! print base >= 997 ! pea.append(p) ! while p[1] is not pea: ! q = p[1] ! n = 0 ! while p[1] is q: ! n += 1 ! p = p[0] ! if n != base+1: ! raise RuntimeError, (n, base) ! base -= 1 ! print base ! del pea[:] --- 15,37 ---- pass return n, p ! ! def main(): ! print depth0(0) >= 997 ! pea = [] ! base, p = depth1(0, pea) ! print base >= 997 ! pea.append(p) ! while p[1] is not pea: ! q = p[1] ! n = 0 ! while p[1] is q: ! n += 1 ! p = p[0] ! if n != base+1: ! raise RuntimeError, (n, base) ! base -= 1 ! print base ! del pea[:] ! ! if __name__ == '__main__': ! main() Index: b2.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b2.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b2.py 30 Dec 2003 06:12:57 -0000 1.1 --- b2.py 31 Dec 2003 09:04:58 -0000 1.2 *************** *** 3,6 **** --- 3,7 ---- while 1: yield tuple([x.next() for x in args]) + class PI(object): def __iter__(self): *************** *** 15,19 **** d, d1 = a//b, a1//b1 self.a1 = a1 ! pi = PI() tests = { 99: 44251238236192885942548145627920559612834490019477028496725657079267312460031559302172150714110203307954379217477379106929168768496503354540899921113305213841256909892518928098307564463751633347248940009920269109969147590732355948788056064000000000000000000000000000000000, --- 16,20 ---- d, d1 = a//b, a1//b1 self.a1 = a1 ! tests = { 99: 44251238236192885942548145627920559612834490019477028496725657079267312460031559302172150714110203307954379217477379106929168768496503354540899921113305213841256909892518928098307564463751633347248940009920269109969147590732355948788056064000000000000000000000000000000000, *************** *** 28,36 **** 999: 51421204237426754719741262879558095745353570680465295990005607280393992759309313043417054432903002299144227267946681775379682646481441184984878051192262603785286501319910886769028368118572705415132969475266997058807303812945930068988142620857043364738252015410062109557537048105374131205551289070131067641702104206291269602159585410011716588325959509072295414578340882094129449369050539722183971427768493446582776526148926808216744196972229231300146452844798957170562743924910341252019551586744505512178746646209409281714276837540692337365091849265903691838950705920069247812720998641002393637705464518833183499641523989489319666798606026274099063316447636791376824977802426300098229217109293397613448627314578264206176863819689114000733923661247770659874248361262500335796860850821012664671771458632988533081782215409765802283312397639531087374886914931818336434018365581917786263986184421404682182700668580256406614910005588986105283922797115795753457032007852784163484117726758402807095937775274740959221797164713537199602017041055883470864790221601914448307560964005337053911966953966628791679568034533608103498461484413180826592737887173295962464948084846329227317763485710127958570474521805846289864427724437000806760496738191498562549124089519328261857651962598014067174275024135581089311586662613800674556590447284302589227994020980213920576606410812288774224985213146245744417408945081781113854100049114396677026962371599785096891808223814416164195820685147641538762223075545475947323585115274444998974587593729824337921226549035616388426184445157848256274480718496342976431693624096685162227580762036981450014151173230060384257039659147964264276717849828738171682245892581306830589179887337090011464839646134568754370139845055418256890860940757057604372114023858733686778293659768364688584313980891657494820666567128494973417651689810011217228920255038016092697827501659126864128552793815957798765294279442644144781212010235659076921083028766195306983520086051010702064687047067852692614939864275238659313772070485512507854113183292498557795177864634776519676116960767383666934404120846954899842398644565635321658409635828642860494805612307530127024621301271374503453503593598678825472356837105710187840164939100381680149781533530971702548427150353351891790289793371198307811983920633373141553344786366833632629827394060040022660478432725820719166178073536817127815814516804684768909331366393380845665808090480804683597798069345611863676423593435458367296114919445047864192204991424873907600867560652360433332333460605503950202643081773051851931329700798978585023149558510051756813823934151345468518744914658396602698567997395883907886162856223081161171378840724659535879555133476804981500946142310178618715717330537589699297655080875880600325195469690780842623951417080052370551017667164713224427292680078173002890766115232008277162207593058978389851005689429106305813929315214127108126116277803514751388254341941007906487414087391653272683247248144900228323654135725469516828248483753155121402474188091072172874050555155865413230544137360090574915682856355897339880759959552597891337880610141176123727002295219377091215365686168970240859719317085650982416219558886127398895904298964883158265272486775477666044730446436805318892171895199489563024683292416174451463979862792856107202456073408125335089494339729358670332578718476101211422277469149701783270075855888742583964446418851379385457754248170422546014640203546645610651326807707725840711263654208439193695249007802516372736393165515067274768773964565908592407847748333876331474804846330009526035593873778287836699826905094860721603742076784651700242126831347444508393439010605679605183038164877451729777036414156800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, } ! checks = {} ! for x, y in izip(xrange(1000), pi): ! print y, ! if x in tests: ! checks[x] = pi.a1 ! if tests != checks: ! raise RuntimeError --- 29,43 ---- 999: 51421204237426754719741262879558095745353570680465295990005607280393992759309313043417054432903002299144227267946681775379682646481441184984878051192262603785286501319910886769028368118572705415132969475266997058807303812945930068988142620857043364738252015410062109557537048105374131205551289070131067641702104206291269602159585410011716588325959509072295414578340882094129449369050539722183971427768493446582776526148926808216744196972229231300146452844798957170562743924910341252019551586744505512178746646209409281714276837540692337365091849265903691838950705920069247812720998641002393637705464518833183499641523989489319666798606026274099063316447636791376824977802426300098229217109293397613448627314578264206176863819689114000733923661247770659874248361262500335796860850821012664671771458632988533081782215409765802283312397639531087374886914931818336434018365581917786263986184421404682182700668580256406614910005588986105283922797115795753457032007852784163484117726758402807095937775274740959221797164713537199602017041055883470864790221601914448307560964005337053911966953966628791679568034533608103498461484413180826592737887173295962464948084846329227317763485710127958570474521805846289864427724437000806760496738191498562549124089519328261857651962598014067174275024135581089311586662613800674556590447284302589227994020980213920576606410812288774224985213146245744417408945081781113854100049114396677026962371599785096891808223814416164195820685147641538762223075545475947323585115274444998974587593729824337921226549035616388426184445157848256274480718496342976431693624096685162227580762036981450014151173230060384257039659147964264276717849828738171682245892581306830589179887337090011464839646134568754370139845055418256890860940757057604372114023858733686778293659768364688584313980891657494820666567128494973417651689810011217228920255038016092697827501659126864128552793815957798765294279442644144781212010235659076921083028766195306983520086051010702064687047067852692614939864275238659313772070485512507854113183292498557795177864634776519676116960767383666934404120846954899842398644565635321658409635828642860494805612307530127024621301271374503453503593598678825472356837105710187840164939100381680149781533530971702548427150353351891790289793371198307811983920633373141553344786366833632629827394060040022660478432725820719166178073536817127815814516804684768909331366393380845665808090480804683597798069345611863676423593435458367296114919445047864192204991424873907600867560652360433332333460605503950202643081773051851931329700798978585023149558510051756813823934151345468518744914658396602698567997395883907886162856223081161171378840724659535879555133476804981500946142310178618715717330537589699297655080875880600325195469690780842623951417080052370551017667164713224427292680078173002890766115232008277162207593058978389851005689429106305813929315214127108126116277803514751388254341941007906487414087391653272683247248144900228323654135725469516828248483753155121402474188091072172874050555155865413230544137360090574915682856355897339880759959552597891337880610141176123727002295219377091215365686168970240859719317085650982416219558886127398895904298964883158265272486775477666044730446436805318892171895199489563024683292416174451463979862792856107202456073408125335089494339729358670332578718476101211422277469149701783270075855888742583964446418851379385457754248170422546014640203546645610651326807707725840711263654208439193695249007802516372736393165515067274768773964565908592407847748333876331474804846330009526035593873778287836699826905094860721603742076784651700242126831347444508393439010605679605183038164877451729777036414156800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, } ! ! def main(): ! pi = PI() ! checks = {} ! for x, y in izip(xrange(1000), pi): ! print y, ! if x in tests: ! checks[x] = pi.a1 ! if tests != checks: ! raise RuntimeError ! ! if __name__ == '__main__': ! main() Index: b3.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b3.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b3.py 31 Dec 2003 00:12:12 -0000 1.2 --- b3.py 31 Dec 2003 09:04:58 -0000 1.3 *************** *** 78,80 **** sortum(data) ! main() --- 78,81 ---- sortum(data) ! if __name__ == '__main__': ! main() Index: b4.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b4.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** b4.py 31 Dec 2003 01:33:07 -0000 1.1 --- b4.py 31 Dec 2003 09:04:58 -0000 1.2 *************** *** 59,78 **** ''' ! from b0 import Parser, Scanner, getcFromString, eval, instrumentTree, Node ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! instrumentTree(Node) ! env = {} ! eval(root, env, env) ! heappush = env['heappush'] ! heappop = env['heappop'] ! # Simple sanity test ! heap = [] ! data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] ! for item in data: ! heappush(heap, item) ! sort = [] ! while heap: ! sort.append(heappop(heap)) ! print sort --- 59,87 ---- ''' ! from b0 import Parser, Scanner, getcFromString, Node, eval ! from b0 import instrumentTree, unInstrumentTree, output, checkoutput ! ! def main(): ! output.reset() ! scanner = Scanner(getcFromString(sample).next).tokenize() ! parser = Parser(scanner) ! root = parser.parse() ! instrumentTree(Node) ! env = {} ! eval(root, env, env) ! heappush = env['heappush'] ! heappop = env['heappop'] ! # Simple sanity test ! heap = [] ! data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] ! for item in data: ! heappush(heap, item) ! sort = [] ! while heap: ! sort.append(heappop(heap)) ! print sort ! unInstrumentTree(Node) ! checkoutput(3255652498) ! ! if __name__ == '__main__': ! main() Index: out =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** out 31 Dec 2003 07:57:51 -0000 1.2 --- out 31 Dec 2003 09:04:58 -0000 1.3 *************** *** 1,8 **** 3141592653 3141592653 True True 0 ! 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 A [T(290448019)] [T(1487478786)] [T(159903786)] using None Z [T(387083)] [T(1080738845)] [T(2147439074)] --- 1,13 ---- + --> iteration 0 + --> b0 3141592653 3141592653 + --> b1 True True 0 ! --> b2 ! 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 --> b3 ! A [T(290448019)] [T(1487478786)] [T(159903786)] using None Z [T(387083)] [T(1080738845)] [T(2147439074)] *************** *** 20,23 **** --- 25,63 ---- Z [T(387083)] [T(1080738845)] [T(2147439074)] 0 + --> b4 + [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + --> b5 + OK. + --> b6 + --> iteration 1 + --> b0 + 3141592653 + 3141592653 + --> b1 + True + True + 0 + --> b2 + 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 --> b3 + A [T(468926968)] [T(1952553305)] [T(601691342)] + using None + Z [T(253993)] [T(1069740206)] [T(2147479166)] + 0 + using cmp + Z [T(253993)] [T(1069740206)] [T(2147479166)] + 0 + using icmp + Z [T(253993)] [T(1069740206)] [T(2147479166)] + 259924 + using None + Z [T(253993)] [T(1069740206)] [T(2147479166)] + 259924 + using None + Z [T(253993)] [T(1069740206)] [T(2147479166)] + 0 + --> b4 [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + --> b5 OK. + --> b6 + --> All done. From 4q89v20mku at msn.com Wed Dec 31 16:33:44 2003 From: 4q89v20mku at msn.com (Cara Curtis) Date: Wed Dec 31 08:39:11 2003 Subject: [Python-checkins] Refill your medication online! yyjw l Message-ID: <xal7mq--3l$ae$81q0vc10vjjse1@bpvn7l7.q1jfw> Rated Top Rated Online Store. HOT & NEW - Levitra/Lipitor/Nexium Weekly speciasls on all our drugs. -Zocor -Soma -Ambien -Phentermine -V1agra -Discount Generic's on ALL -MORE Next day discrete shipping on all products! http://www.rxstoreusa.biz/shopping Please, I wish to receive no more discounts on valuable items. http://www.rxstoreusa.biz/a.html jet djjdnjqj nldxi From rhettinger at users.sourceforge.net Wed Dec 31 09:09:01 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 31 09:09:05 2003 Subject: [Python-checkins] python/dist/src/Objects setobject.c,1.20,1.21 Message-ID: <E1Abh1x-0006fE-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Objects In directory sc8-pr-cvs1:/tmp/cvs-serv25420 Modified Files: setobject.c Log Message: * Simplify and speedup logic for tp_print. * Speed-up intersection whenever PyDict_Next can be used. Index: setobject.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Objects/setobject.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** setobject.c 15 Dec 2003 21:16:06 -0000 1.20 --- setobject.c 31 Dec 2003 14:08:58 -0000 1.21 *************** *** 241,245 **** { PySetObject *result; ! PyObject *item, *selfdata, *tgtdata, *it; result = (PySetObject *)make_new_set(so->ob_type, NULL); --- 241,245 ---- { PySetObject *result; ! PyObject *item, *selfdata, *tgtdata, *it, *tmp; result = (PySetObject *)make_new_set(so->ob_type, NULL); *************** *** 249,260 **** selfdata = so->data; ! if (PyAnySet_Check(other) && ! PyDict_Size(((PySetObject *)other)->data) > PyDict_Size(selfdata)) { ! selfdata = ((PySetObject *)other)->data; ! other = (PyObject *)so; ! } else if (PyDict_Check(other) && ! PyDict_Size(other) > PyDict_Size(selfdata)) { selfdata = other; ! other = so->data; } --- 249,273 ---- selfdata = so->data; ! if (PyAnySet_Check(other)) ! other = ((PySetObject *)other)->data; ! ! if (PyDict_Check(other) && PyDict_Size(other) > PyDict_Size(selfdata)) { ! tmp = selfdata; selfdata = other; ! other = tmp; ! } ! ! if (PyDict_CheckExact(other)) { ! PyObject *value; ! int pos = 0; ! while (PyDict_Next(other, &pos, &item, &value)) { ! if (PyDict_Contains(selfdata, item)) { ! if (PyDict_SetItem(tgtdata, item, Py_True) == -1) { ! Py_DECREF(result); ! return NULL; ! } ! } ! } ! return (PyObject *)result; } *************** *** 720,735 **** { PyObject *key, *value; ! int pos=0, firstpass=1; fprintf(fp, "%s([", so->ob_type->tp_name); while (PyDict_Next(so->data, &pos, &key, &value)) { ! if (firstpass) ! firstpass = 0; ! else ! fprintf(fp, ", "); if (PyObject_Print(key, fp, 0) != 0) return -1; } ! fprintf(fp, "])"); return 0; } --- 733,748 ---- { PyObject *key, *value; ! int pos=0; ! char *emit = ""; /* No separator emitted on first pass */ ! char *separator = ", "; fprintf(fp, "%s([", so->ob_type->tp_name); while (PyDict_Next(so->data, &pos, &key, &value)) { ! fputs(emit, fp); ! emit = separator; if (PyObject_Print(key, fp, 0) != 0) return -1; } ! fputs("])", fp); return 0; } *************** *** 1078,1082 **** "frozenset", /* tp_name */ sizeof(PySetObject), /* tp_basicsize */ ! 0, /* tp_itemsize */ /* methods */ (destructor)set_dealloc, /* tp_dealloc */ (printfunc)set_tp_print, /* tp_print */ --- 1091,1096 ---- "frozenset", /* tp_name */ sizeof(PySetObject), /* tp_basicsize */ ! 0, /* tp_itemsize */ ! /* methods */ (destructor)set_dealloc, /* tp_dealloc */ (printfunc)set_tp_print, /* tp_print */ From nnorwitz at users.sourceforge.net Wed Dec 31 10:00:09 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed Dec 31 10:00:34 2003 Subject: [Python-checkins] python/dist/src/Python pythonrun.c, 2.161.2.8, 2.161.2.9 Message-ID: <E1AbhpR-0000Rd-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv1674/Python Modified Files: Tag: ast-branch pythonrun.c Log Message: fix crash on Ctrl-C (and NoMemory too) Index: pythonrun.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v retrieving revision 2.161.2.8 retrieving revision 2.161.2.9 diff -C2 -d -r2.161.2.8 -r2.161.2.9 *** pythonrun.c 28 Apr 2003 17:16:47 -0000 2.161.2.8 --- pythonrun.c 31 Dec 2003 15:00:06 -0000 2.161.2.9 *************** *** 1301,1309 **** case E_INTR: PyErr_SetNone(PyExc_KeyboardInterrupt); - Py_XDECREF(v); return; case E_NOMEM: PyErr_NoMemory(); - Py_XDECREF(v); return; case E_EOF: --- 1301,1307 ---- *************** *** 1347,1351 **** err->text = NULL; } ! w = Py_BuildValue("(sO)", msg, v); Py_XDECREF(u); Py_XDECREF(v); --- 1345,1351 ---- err->text = NULL; } ! w = NULL; ! if (v != NULL) ! w = Py_BuildValue("(sO)", msg, v); Py_XDECREF(u); Py_XDECREF(v); From gvanrossum at users.sourceforge.net Wed Dec 31 11:25:30 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 11:25:33 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench Makefile, 1.2, 1.3 Message-ID: <E1AbjA2-0003yx-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv15301 Modified Files: Makefile Log Message: - Add a 'dist' target to wrap everything up in a .tgz file. - Remove more files on 'clean' (including the .tgz file). Index: Makefile =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Makefile 31 Dec 2003 07:54:58 -0000 1.2 --- Makefile 31 Dec 2003 16:25:28 -0000 1.3 *************** *** 11,16 **** diff @out out clean: ! -rm -f @* times: --- 11,19 ---- diff @out out + dist: + tar czf parrotbench.tgz README.txt Makefile b.py b?.py out out[0-9] + clean: ! -rm -f @* *~ *.pyc *.pyo parrotbench.tgz times: From gvanrossum at users.sourceforge.net Wed Dec 31 11:38:35 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 11:38:37 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench README.txt, 1.2, 1.3 Message-ID: <E1AbjMh-00051w-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv19327 Modified Files: README.txt Log Message: Notes on __debug__ and timing. Index: README.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/README.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** README.txt 31 Dec 2003 07:54:58 -0000 1.2 --- README.txt 31 Dec 2003 16:38:33 -0000 1.3 *************** *** 64,66 **** --- 64,78 ---- objects. + On the use of __debug__: this is a built-in variable, set to True + normally and to False when Python is invoked with -O. I use this to + produce verbose output without -O but minimal output with it. For the + actual benchmark, Python should use -O, and Dan can simply set + __debug__ to False in the builtins if he prefers. + + On timing: there's a requirement that the benchmark runs for at least + 30 seconds. It currently runs for nearly a minute on my home box, + which is a four-year-old 650 MHz Pentium box. If the contest hardware + is so fast that it runs under a minute, there's a number in b.py that + can be cranked up to increase the number of runs. + --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum at users.sourceforge.net Wed Dec 31 11:45:38 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 11:45:42 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench b5.py,1.4,1.5 Message-ID: <E1AbjTW-0005QM-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv20841 Modified Files: b5.py Log Message: Add some variation. Index: b5.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b5.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** b5.py 31 Dec 2003 07:54:58 -0000 1.4 --- b5.py 31 Dec 2003 16:45:36 -0000 1.5 *************** *** 21,40 **** exc.__name__, f.__name__, args) ! def check_functions(): ! check(abs(42), 42) ! check(abs(-42), 42) ! check(abs(-12345678910), 12345678910) ! check(abs(-3.14), 3.14) ! check(abs(3j+4), 5) ! check(bool(1), True) ! check(bool(100), True) ! check(bool(0), False) ! check(bool([1,2,3]), True) ! check(bool([]), False) ! check(bool({1: 2}), True) check(bool({}), False) ! check(complex(3, 4), 3+4j) check(dict([(1,2), (3,4)]), {1: 2, 3: 4}) --- 21,40 ---- exc.__name__, f.__name__, args) ! def check_functions(i=0, j=0): ! check(abs(42*i), 42*j) ! check(abs(-42*i), 42*j) ! check(abs(-12345678910*i), 12345678910*j) ! check(abs(-3.14*i), 3.14*i) ! check(abs((3j+4)*i), 5*j) ! check(bool(1+i), True) ! check(bool(100+j), True) ! check(bool(i-j), False) ! check(bool([i, j]), True) ! check(bool([i, j][i:j]), False) ! check(bool({i: j}), True) check(bool({}), False) ! check(complex(3*i, 4*j), 3*i+4j*j) check(dict([(1,2), (3,4)]), {1: 2, 3: 4}) *************** *** 49,53 **** check(float("1.5"), 1.5) ! check(float(15), 15.0) check(float(10**100), 1e100) --- 49,53 ---- check(float("1.5"), 1.5) ! check(float(15*i), 15.0*j) check(float(10**100), 1e100) *************** *** 238,242 **** [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')]) ! def check_descriptors(): class C0(object): --- 238,242 ---- [('a', 'd', 'g'), ('b', 'e', 'h'), ('c', 'f', 'i')]) ! def check_descriptors(i, j): class C0(object): *************** *** 365,370 **** show = True for i in range(500): ! check_functions() ! check_descriptors() show = False print "OK." --- 365,370 ---- show = True for i in range(500): ! check_functions(j=long(i*1000000), i=i*1000000) ! check_descriptors(j=long(i*1000000), i=i*1000000) show = False print "OK." From gvanrossum at users.sourceforge.net Wed Dec 31 11:47:39 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 11:48:01 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench out5,1.5,1.6 Message-ID: <E1AbjVT-0005WC-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv21206 Modified Files: out5 Log Message: Updated output. Index: out5 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out5,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** out5 31 Dec 2003 07:54:58 -0000 1.5 --- out5 31 Dec 2003 16:47:37 -0000 1.6 *************** *** 1,7 **** ! 42 == 42 ! 42 == 42 ! 12345678910L == 12345678910L ! 3.1400000000000001 == 3.1400000000000001 ! 5.0 == 5 True == True True == True --- 1,7 ---- ! 0 == 0L ! 0 == 0L ! 0L == 0L ! 0.0 == 0.0 ! 0.0 == 0L True == True True == True *************** *** 11,15 **** True == True False == False ! (3+4j) == (3+4j) {1: 2, 3: 4} == {1: 2, 3: 4} {'a': None, 'c': None, 'b': None} == {'a': None, 'c': None, 'b': None} --- 11,15 ---- True == True False == False ! 0j == 0j {1: 2, 3: 4} == {1: 2, 3: 4} {'a': None, 'c': None, 'b': None} == {'a': None, 'c': None, 'b': None} *************** *** 19,23 **** [0, 1, 2, 3, 4] == [0, 1, 2, 3, 4] 1.5 == 1.5 ! 15.0 == 15.0 1e+100 == 1e+100 42 == 42 --- 19,23 ---- [0, 1, 2, 3, 4] == [0, 1, 2, 3, 4] 1.5 == 1.5 ! 0.0 == 0.0 1e+100 == 1e+100 42 == 42 From gvanrossum at users.sourceforge.net Wed Dec 31 12:45:34 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 12:45:44 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench README.txt, 1.3, 1.4 Message-ID: <E1AbkPW-0008IK-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv31878 Modified Files: README.txt Log Message: Update timing info. Index: README.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/README.txt,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** README.txt 31 Dec 2003 16:38:33 -0000 1.3 --- README.txt 31 Dec 2003 17:45:32 -0000 1.4 *************** *** 74,78 **** which is a four-year-old 650 MHz Pentium box. If the contest hardware is so fast that it runs under a minute, there's a number in b.py that ! can be cranked up to increase the number of runs. --Guido van Rossum (home page: http://www.python.org/~guido/) --- 74,83 ---- which is a four-year-old 650 MHz Pentium box. If the contest hardware is so fast that it runs under a minute, there's a number in b.py that ! can be cranked up to increase the number of runs. (It takes 27 ! seconds on my recent work desktop, and on my screaming IBM T40 laptop ! it runs in 15 seconds, so I suspect that we should at least double the ! number of runs from 2 to 4.) ! ! December 31, 2003, --Guido van Rossum (home page: http://www.python.org/~guido/) From gvanrossum at users.sourceforge.net Wed Dec 31 13:13:06 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 13:13:14 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench t.py,NONE,1.1 Message-ID: <E1AbkqA-0000vv-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv3581 Added Files: t.py Log Message: test driver for Windows. --- NEW FILE: t.py --- import sys sys.setrecursionlimit(1 + sys.getrecursionlimit()) import time t0 = time.clock() import b t1 = time.clock() print >>sys.stderr, "%.3f seconds" % (t1-t0) From rhettinger at users.sourceforge.net Wed Dec 31 13:37:30 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 31 13:37:33 2003 Subject: [Python-checkins] python/dist/src/Doc/lib emailmessage.tex, 1.13, 1.14 libcfgparser.tex, 1.32, 1.33 libos.tex, 1.132, 1.133 libsmtplib.tex, 1.25, 1.26 Message-ID: <E1AblDm-0001to-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv7191 Modified Files: emailmessage.tex libcfgparser.tex libos.tex libsmtplib.tex Log Message: SF patch #859286: documentation bool change fix (Contributed by George Yoshida.) Index: emailmessage.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/emailmessage.tex,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** emailmessage.tex 31 Oct 2003 19:52:30 -0000 1.13 --- emailmessage.tex 31 Dec 2003 18:37:28 -0000 1.14 *************** *** 562,566 **** If the object's payload was already a list ! (i.e. \method{is_multipart()} returns 1), then \var{payload} is appended to the end of the existing payload list. --- 562,566 ---- If the object's payload was already a list ! (i.e. \method{is_multipart()} returns \code{True}), then \var{payload} is appended to the end of the existing payload list. Index: libcfgparser.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libcfgparser.tex,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** libcfgparser.tex 15 Dec 2003 14:38:57 -0000 1.32 --- libcfgparser.tex 31 Dec 2003 18:37:28 -0000 1.33 *************** *** 166,171 **** \begin{methoddesc}{has_option}{section, option} ! If the given section exists, and contains the given option. return 1; ! otherwise return 0. \versionadded{1.6} \end{methoddesc} --- 166,171 ---- \begin{methoddesc}{has_option}{section, option} ! If the given section exists, and contains the given option, ! return \constant{True}; otherwise return \constant{False}. \versionadded{1.6} \end{methoddesc} *************** *** 246,250 **** Remove the specified \var{option} from the specified \var{section}. If the section does not exist, raise \exception{NoSectionError}. ! If the option existed to be removed, return 1; otherwise return 0. \versionadded{1.6} \end{methoddesc} --- 246,251 ---- Remove the specified \var{option} from the specified \var{section}. If the section does not exist, raise \exception{NoSectionError}. ! If the option existed to be removed, return \constant{True}; ! otherwise return \constant{False}. \versionadded{1.6} \end{methoddesc} Index: libos.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libos.tex,v retrieving revision 1.132 retrieving revision 1.133 diff -C2 -d -r1.132 -r1.133 *** libos.tex 10 Nov 2003 06:46:15 -0000 1.132 --- libos.tex 31 Dec 2003 18:37:28 -0000 1.133 *************** *** 273,277 **** \end{funcdesc} ! % placed in this section since it relates to errno.... a little weak ;-( \begin{funcdesc}{strerror}{code} Return the error message corresponding to the error code in --- 273,277 ---- \end{funcdesc} ! % placed in this section since it relates to errno.... a little weak \begin{funcdesc}{strerror}{code} Return the error message corresponding to the error code in *************** *** 617,621 **** to test the existence of \var{path}, or it can be the inclusive OR of one or more of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to ! test permissions. Return \code{1} if access is allowed, \code{0} if not. See the \UNIX{} man page \manpage{access}{2} for more information. Availability: \UNIX, Windows. --- 617,622 ---- to test the existence of \var{path}, or it can be the inclusive OR of one or more of \constant{R_OK}, \constant{W_OK}, and \constant{X_OK} to ! test permissions. Return \constant{True} if access is allowed, ! \constant{False} if not. See the \UNIX{} man page \manpage{access}{2} for more information. Availability: \UNIX, Windows. Index: libsmtplib.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsmtplib.tex,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** libsmtplib.tex 22 Sep 2003 06:25:10 -0000 1.25 --- libsmtplib.tex 31 Dec 2003 18:37:28 -0000 1.26 *************** *** 147,152 **** \begin{methoddesc}{has_extn}{name} ! Return \code{1} if \var{name} is in the set of SMTP service extensions ! returned by the server, \code{0} otherwise. Case is ignored. \end{methoddesc} --- 147,153 ---- \begin{methoddesc}{has_extn}{name} ! Return \constant{True} if \var{name} is in the set of SMTP service ! extensions returned by the server, \constant{False} otherwise. ! Case is ignored. \end{methoddesc} From nnorwitz at users.sourceforge.net Wed Dec 31 15:26:39 2003 From: nnorwitz at users.sourceforge.net (nnorwitz@users.sourceforge.net) Date: Wed Dec 31 15:26:43 2003 Subject: [Python-checkins] python/dist/src/Python newcompile.c, 1.1.2.60, 1.1.2.61 ast.c, 1.1.2.39, 1.1.2.40 Message-ID: <E1AbmvP-0006lY-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Python In directory sc8-pr-cvs1:/tmp/cvs-serv26003/Python Modified Files: Tag: ast-branch newcompile.c ast.c Log Message: get nested list comps and list comps with ifs to work Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.60 retrieving revision 1.1.2.61 diff -C2 -d -r1.1.2.60 -r1.1.2.61 *** newcompile.c 29 Dec 2003 22:10:41 -0000 1.1.2.60 --- newcompile.c 31 Dec 2003 20:26:36 -0000 1.1.2.61 *************** *** 26,33 **** 4: ! typing Ctrl-C seg faults 5: ! line numbers are off */ --- 26,37 ---- 4: ! line numbers are off a bit (may just need to add calls to set lineno 5: ! Modules/parsermodule.c:496: warning: implicit declaration ! of function `PyParser_SimpleParseString' ! ! 6: ! while loops with try/except in them don't work */ *************** *** 935,938 **** --- 939,946 ---- if there is no else clause ? */ + + /* sometimes this needs to be compiler_use_next_block + (e.g., nested loops), but if the code is + while XXX: try: ... this is correct */ compiler_use_block(c, anchor); ADDOP(c, POP_TOP); *************** *** 1228,1233 **** int i, n; ! fprintf(stderr, "compile stmt %d lineno %d\n", ! s->kind, s->lineno); c->u->u_lineno = s->lineno; c->u->u_lineno_set = false; --- 1236,1240 ---- int i, n; ! fprintf(stderr, "compile stmt %d lineno %d\n", s->kind, s->lineno); c->u->u_lineno = s->lineno; c->u->u_lineno_set = false; *************** *** 1677,1691 **** static int ! compiler_listcomp_generator(struct compiler *c, listcomp_ty l, expr_ty elt) { /* generate code for the iterator, then each of the ifs, and then write to the element */ ! int start, anchor, skip, i, n; start = compiler_new_block(c); skip = compiler_new_block(c); anchor = compiler_new_block(c); VISIT(c, expr, l->iter); ADDOP(c, GET_ITER); --- 1684,1703 ---- static int ! compiler_listcomp_generator(struct compiler *c, ! asdl_seq *generators, int gen_index, ! expr_ty elt) { /* generate code for the iterator, then each of the ifs, and then write to the element */ ! listcomp_ty l; ! int start, anchor, skip, if_cleanup, i, n; start = compiler_new_block(c); skip = compiler_new_block(c); + if_cleanup = compiler_new_block(c); anchor = compiler_new_block(c); + l = asdl_seq_GET(generators, gen_index); VISIT(c, expr, l->iter); ADDOP(c, GET_ITER); *************** *** 1694,1718 **** NEXT_BLOCK(c); VISIT(c, expr, l->target); ! n = asdl_seq_LEN(l->ifs); for (i = 0; i < n; i++) { expr_ty e = asdl_seq_GET(l->ifs, i); VISIT(c, expr, e); ! /* XXX not anchor? */ ! ADDOP_JREL(c, JUMP_IF_FALSE, skip); NEXT_BLOCK(c); ! ADDOP(c, DUP_TOP); } ! if (!compiler_nameop(c, c->u->u_tmp, Load)) return 0; ! VISIT(c, expr, elt); ! ADDOP_I(c, CALL_FUNCTION, 1); ! ADDOP(c, POP_TOP); ! compiler_use_next_block(c, skip); ADDOP_JABS(c, JUMP_ABSOLUTE, start); compiler_use_next_block(c, anchor); ! if (!compiler_nameop(c, c->u->u_tmp, Del)) return 0; --- 1706,1745 ---- NEXT_BLOCK(c); VISIT(c, expr, l->target); ! ! /* XXX this needs to be cleaned up...a lot! */ n = asdl_seq_LEN(l->ifs); for (i = 0; i < n; i++) { expr_ty e = asdl_seq_GET(l->ifs, i); VISIT(c, expr, e); ! ADDOP_JREL(c, JUMP_IF_FALSE, if_cleanup); NEXT_BLOCK(c); ! ADDOP(c, POP_TOP); } ! if (++gen_index < asdl_seq_LEN(generators)) ! if (!compiler_listcomp_generator(c, generators, gen_index, elt)) ! return 0; ! ! /* only append after the last for generator */ ! if (gen_index >= asdl_seq_LEN(generators)) { ! if (!compiler_nameop(c, c->u->u_tmp, Load)) return 0; ! VISIT(c, expr, elt); ! ADDOP_I(c, CALL_FUNCTION, 1); ! ADDOP(c, POP_TOP); ! compiler_use_next_block(c, skip); ! } ! for (i = 0; i < n; i++) { ! ADDOP_I(c, JUMP_FORWARD, 1); ! if (i == 0) ! compiler_use_next_block(c, if_cleanup); ! ADDOP(c, POP_TOP); ! } ADDOP_JABS(c, JUMP_ABSOLUTE, start); compiler_use_next_block(c, anchor); ! /* delete the append method added to locals */ ! if (gen_index == 1) ! if (!compiler_nameop(c, c->u->u_tmp, Del)) return 0; *************** *** 1723,1727 **** compiler_listcomp(struct compiler *c, expr_ty e) { - int i; char tmpname[256]; identifier tmp; --- 1750,1753 ---- *************** *** 1746,1755 **** return 0; c->u->u_tmp = tmp; ! for (i = 0; i < asdl_seq_LEN(generators); i++) { ! if (!compiler_listcomp_generator(c, ! asdl_seq_GET(generators, i), ! e->v.ListComp.elt)) ! return 0; ! } c->u->u_tmp = NULL; return 1; --- 1772,1777 ---- return 0; c->u->u_tmp = tmp; ! if (!compiler_listcomp_generator(c, generators, 0, e->v.ListComp.elt)) ! return 0; c->u->u_tmp = NULL; return 1; *************** *** 2476,2480 **** struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; fprintf(stderr, ! "\nblock %d: order=%d used=%d alloc=%d next=%d\n", i, a.a_postorder[i], b->b_iused, b->b_ialloc, b->b_next); --- 2498,2502 ---- struct basicblock *b = c->u->u_blocks[a.a_postorder[i]]; fprintf(stderr, ! "\nblock %d: order=%d used=%d alloc=%d next=%d\n", i, a.a_postorder[i], b->b_iused, b->b_ialloc, b->b_next); Index: ast.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/ast.c,v retrieving revision 1.1.2.39 retrieving revision 1.1.2.40 diff -C2 -d -r1.1.2.39 -r1.1.2.40 *** ast.c 29 Dec 2003 22:11:32 -0000 1.1.2.39 --- ast.c 31 Dec 2003 20:26:36 -0000 1.1.2.40 *************** *** 287,290 **** --- 287,297 ---- /* XXX It's not clear why were't getting into this code, although list comps seem like one possibility. + + This occurs in at least 2 cases: + [x(i) for i in range(3)] # Call_kind (8) + [i*2 for i in range(3)] # BinOp_kind (2) + + The byte code generated seems to work fine. + Maybe there's a problem with nested list comps? */ fprintf(stderr, "can't set context for %d\n", e->kind); *************** *** 713,724 **** REQ(ch, list_if); ! asdl_seq_APPEND(ifs, CHILD(ch, 1)); if (NCH(ch) == 3) ch = CHILD(ch, 2); } - /* XXX ifs is leaked, we surely have to do something with it */ /* on exit, must guarantee that ch is a list_for */ if (TYPE(ch) == list_iter) ch = CHILD(ch, 0); } asdl_seq_APPEND(listcomps, c); --- 720,731 ---- REQ(ch, list_if); ! asdl_seq_APPEND(ifs, ast_for_expr(CHILD(ch, 1))); if (NCH(ch) == 3) ch = CHILD(ch, 2); } /* on exit, must guarantee that ch is a list_for */ if (TYPE(ch) == list_iter) ch = CHILD(ch, 0); + c->ifs = ifs; } asdl_seq_APPEND(listcomps, c); From gvanrossum at users.sourceforge.net Wed Dec 31 16:51:50 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 16:51:53 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench t.py,1.1,1.2 Message-ID: <E1AboFq-0001a2-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv6073 Modified Files: t.py Log Message: Simply set the recursion limit to 1001, since that's what we want. Index: t.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/t.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** t.py 31 Dec 2003 18:13:04 -0000 1.1 --- t.py 31 Dec 2003 21:51:48 -0000 1.2 *************** *** 1,4 **** import sys ! sys.setrecursionlimit(1 + sys.getrecursionlimit()) import time t0 = time.clock() --- 1,4 ---- import sys ! sys.setrecursionlimit(1001) import time t0 = time.clock() From gvanrossum at users.sourceforge.net Wed Dec 31 16:53:15 2003 From: gvanrossum at users.sourceforge.net (gvanrossum@users.sourceforge.net) Date: Wed Dec 31 16:53:18 2003 Subject: [Python-checkins] python/nondist/sandbox/parrotbench README.txt, 1.4, 1.5 b0.py, 1.7, 1.8 b4.py, 1.2, 1.3 out0, 1.5, 1.6 out4, 1.3, 1.4 Message-ID: <E1AboHD-0001dp-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/nondist/sandbox/parrotbench In directory sc8-pr-cvs1:/tmp/cvs-serv6302 Modified Files: README.txt b0.py b4.py out0 out4 Log Message: Attempt to fix the Mac OSX issue Dan found. Index: README.txt =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/README.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** README.txt 31 Dec 2003 17:45:32 -0000 1.4 --- README.txt 31 Dec 2003 21:53:11 -0000 1.5 *************** *** 1,4 **** ! Parrot benchmark ! ================ This is a benchmark to be run in front of a live audience at OSCON --- 1,7 ---- ! Parrot benchmark 1.0.1 ! ====================== ! ! [This is version 1.0.1, with a hopeful bugfix for the Mac OSX issue ! Dan reported.] This is a benchmark to be run in front of a live audience at OSCON Index: b0.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b0.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** b0.py 31 Dec 2003 09:04:58 -0000 1.7 --- b0.py 31 Dec 2003 21:53:11 -0000 1.8 *************** *** 729,734 **** output = OutputFile() ! def write(s): ! s = str(s).replace('<b0.', '<__main__.') i = s.find(' at 0x') while i > 0: --- 729,734 ---- output = OutputFile() ! def cleanup(s): ! s = str(s).replace('<__main__.', '<').replace('<b0.', '<') i = s.find(' at 0x') while i > 0: *************** *** 744,747 **** --- 744,751 ---- s = s[:i+5] + s[j:] i = s.find(' at 0x') + return s + + def write(s): + s = cleanup(s) if __debug__: print s, *************** *** 803,807 **** argreprs = map(repr, args) for i, s in enumerate(argreprs): ! s = s.replace('<b0.', '<__main__.') if len(s) >= 45: s = s[:20] + "..." + s[-20:] --- 807,811 ---- argreprs = map(repr, args) for i, s in enumerate(argreprs): ! s = cleanup(s) if len(s) >= 45: s = s[:20] + "..." + s[-20:] *************** *** 884,888 **** parser = Parser(scanner) root = parser.parse() ! checkoutput(2037684980) env = {} eval(root, env, env) --- 888,892 ---- parser = Parser(scanner) root = parser.parse() ! checkoutput(3257889492) env = {} eval(root, env, env) *************** *** 891,895 **** for i in range(10): digits.append(g.next()) ! checkoutput(4201300315) print "".join(map(str, digits)) --- 895,899 ---- for i in range(10): digits.append(g.next()) ! checkoutput(1177172576) print "".join(map(str, digits)) Index: b4.py =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/b4.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** b4.py 31 Dec 2003 09:04:58 -0000 1.2 --- b4.py 31 Dec 2003 21:53:11 -0000 1.3 *************** *** 82,86 **** print sort unInstrumentTree(Node) ! checkoutput(3255652498) if __name__ == '__main__': --- 82,86 ---- print sort unInstrumentTree(Node) ! checkoutput(2403574442) if __name__ == '__main__': Index: out0 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out0,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** out0 31 Dec 2003 06:59:41 -0000 1.5 --- out0 31 Dec 2003 21:53:11 -0000 1.6 *************** *** 2705,2709 **** return [Define(u'pi', [], ...), Define(u'strhash', [u's'], ...)] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 ! Parser.__init__('<__main__.Clone object at 0>') Parser.nexttoken('') return (NAME, u'def') --- 2705,2709 ---- return [Define(u'pi', [], ...), Define(u'strhash', [u's'], ...)] 3 1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0 5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2 0 8 9 9 8 6 2 8 0 3 4 8 2 5 3 4 2 1 1 7 0 6 7 9 8 2 1 4 8 0 8 6 5 1 3 2 8 2 3 0 6 6 4 7 0 9 3 8 4 4 6 0 9 5 5 0 5 8 2 2 3 1 7 2 5 3 5 9 4 0 8 1 2 8 4 8 1 1 1 7 4 5 0 2 8 4 1 0 2 7 0 1 9 3 8 5 2 1 1 0 5 5 5 9 6 4 4 6 2 2 9 4 8 9 5 4 9 3 0 3 8 1 9 6 4 4 2 8 8 1 0 9 7 5 6 6 5 9 3 3 4 4 6 1 2 8 4 7 5 6 4 8 2 3 3 7 8 6 7 8 3 1 6 5 2 7 1 2 0 1 9 0 9 1 4 5 6 4 8 5 6 6 9 2 3 4 6 0 3 4 8 6 1 0 4 5 4 3 2 6 6 4 8 2 1 3 3 9 3 6 0 7 2 6 0 2 4 9 1 4 1 2 7 3 7 2 4 5 8 7 0 0 6 6 0 6 3 1 5 5 8 8 1 7 4 8 8 1 5 2 0 9 2 0 9 6 2 8 2 9 2 5 4 0 9 1 7 1 5 3 6 4 3 6 7 8 9 2 5 9 0 3 6 0 0 1 1 3 3 0 5 3 0 5 4 8 8 2 0 4 6 6 5 2 1 3 8 4 1 4 6 9 5 1 9 4 1 5 1 1 6 0 9 4 3 3 0 5 7 2 7 0 3 6 5 7 5 9 5 9 1 9 5 3 0 9 2 1 8 6 1 1 7 3 8 1 9 3 2 6 1 1 7 9 3 1 0 5 1 1 8 5 4 8 0 7 4 4 6 2 3 7 9 9 6 2 7 4 9 5 6 7 3 5 1 8 8 5 7 5 2 7 2 4 8 9 1 2 2 7 9 3 8 1 8 3 0 1 1 9 4 9 1 2 9 8 3 3 6 7 3 3 6 2 4 4 0 6 5 6 6 4 3 0 8 6 0 2 1 3 9 4 9 4 6 3 9 5 2 2 4 7 3 7 1 9 0 7 0 2 1 7 9 8 6 0 9 4 3 7 0 2 7 7 0 5 3 9 2 1 7 1 7 6 2 9 3 1 7 6 7 5 2 3 8 4 6 7 4 8 1 8 4 6 7 6 6 9 4 0 5 1 3 2 0 0 0 5 6 8 1 2 7 1 4 5 2 6 3 5 6 0 8 2 7 7 8 5 7 7 1 3 4 2 7 5 7 7 8 9 6 0 9 1 7 3 6 3 7 1 7 8 7 2 1 4 6 8 4 4 0 9 0 1 2 2 4 9 5 3 4 3 0 1 4 6 5 4 9 5 8 5 3 7 1 0 5 0 7 9 2 2 7 9 6 8 9 2 5 8 9 2 3 5 4 2 0 1 9 9 5 6 1 1 2 1 2 9 0 2 1 9 6 0 8 6 4 0 3 4 4 1 8 1 5 9 8 1 3 6 2 9 7 7 4 7 7 1 3 0 9 9 6 0 5 1 8 7 0 7 2 1 1 3 4 9 9 9 9 9 9 8 3 7 2 9 7 8 0 4 9 9 5 1 0 5 9 7 3 1 7 3 2 8 1 6 0 9 6 3 1 8 5 9 5 0 2 4 4 5 9 4 5 5 3 4 6 9 0 8 3 0 2 6 4 2 5 2 2 3 0 8 2 5 3 3 4 4 6 8 5 0 3 5 2 6 1 9 3 1 1 8 8 1 7 1 0 1 0 0 0 3 1 3 7 8 3 8 7 5 2 8 8 6 5 8 7 5 3 3 2 0 8 3 8 1 4 2 0 6 1 7 1 7 7 6 6 9 1 4 7 3 0 3 5 9 8 2 5 3 4 9 0 4 2 8 7 5 5 4 6 8 7 3 1 1 5 9 5 6 2 8 6 3 8 8 2 3 5 3 7 8 7 5 9 3 7 5 1 9 5 7 7 8 1 8 5 7 7 8 0 5 3 2 1 7 1 2 2 6 8 0 6 6 1 3 0 0 1 9 2 7 8 7 6 6 1 1 1 9 5 9 0 9 2 1 6 4 2 0 1 9 8 ! Parser.__init__('<Clone object at 0>') Parser.nexttoken('') [...4327 lines suppressed...] ! Exprs.assign("(3L, 3L), {u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") ! Name.assign("3L, {u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return ! Name.assign("3L, {u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return return return ! While.geneval("{u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return <generator object at 0> ! Binop.eval("{u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") ! Name.eval("{u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return 3L ! Name.eval("{u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return 3L return True ! Yield.geneval("{u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return <generator object at 0> ! Name.eval("{u'strhash': <Functi...erator object at 0>}, {u'a': 9576126383040...1552000L, u'd1': 3L}") return 3L 3141592653 Index: out4 =================================================================== RCS file: /cvsroot/python/python/nondist/sandbox/parrotbench/out4,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** out4 31 Dec 2003 02:05:08 -0000 1.3 --- out4 31 Dec 2003 21:53:12 -0000 1.4 *************** *** 5,9 **** return False return ! Define.eval("{'heappush': <__main...ject at 0>}, {'heappush': <__main...ject at 0>}") Node.isgenerator('') return False --- 5,9 ---- return False return ! Define.eval("{'heappush': <Function object at 0>}, {'heappush': <Function object at 0>}") Node.isgenerator('') [...7278 lines suppressed...] return <built-in method pop of list object at 0> return 9 ! Name.assign("9, {'heappop': <Functio...nction object at 0>}, {'heap': []}") return return ! If.eval("{'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'heap': []}") ! Name.eval("{'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'heap': []}") return [] ! Assign.eval("{'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'heap': []}") ! Name.eval("{'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'heap': []}") return 9 ! Name.assign("9, {'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'heap': []}") return return return ! Return.eval("{'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}") ! Name.eval("{'heappop': <Functio...nction object at 0>}, {'lastelt': 9, 'returnitem': 9, 'heap': []}") return 9 ! raise <DoReturn instance at 0> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] From rhettinger at users.sourceforge.net Wed Dec 31 17:44:31 2003 From: rhettinger at users.sourceforge.net (rhettinger@users.sourceforge.net) Date: Wed Dec 31 17:44:34 2003 Subject: [Python-checkins] python/dist/src/Lib posixpath.py,1.63,1.64 Message-ID: <E1Abp4p-0003aM-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Lib In directory sc8-pr-cvs1:/tmp/cvs-serv13466 Modified Files: posixpath.py Log Message: SF Patch 681780: Faster commonprefix (OS independent) Improved based on discussions at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252177 http://groups.google.com/groups?th=fc7b54f11af6b24e&seekm=bss2so$om$00$1@news.t-online.com Index: posixpath.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** posixpath.py 2 Nov 2003 09:47:05 -0000 1.63 --- posixpath.py 31 Dec 2003 22:44:29 -0000 1.64 *************** *** 124,137 **** "Given a list of pathnames, returns the longest common leading component" if not m: return '' ! prefix = m[0] ! for item in m: ! for i in range(len(prefix)): ! if prefix[:i+1] != item[:i+1]: ! prefix = prefix[:i] ! if i == 0: ! return '' ! break ! return prefix ! # Get size, mtime, atime of files. --- 124,134 ---- "Given a list of pathnames, returns the longest common leading component" if not m: return '' ! s1 = min(m) ! s2 = max(m) ! n = min(len(s1), len(s2)) ! for i in xrange(n): ! if s1[i] != s2[i]: ! return s1[:i] ! return s1[:n] # Get size, mtime, atime of files. From fdrake at users.sourceforge.net Wed Dec 31 22:40:59 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 31 22:41:03 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex, 1.143.8.9, 1.143.8.10 Message-ID: <E1Abthj-0005cy-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21629 Modified Files: Tag: release23-maint libfuncs.tex Log Message: fix reference to File Object documentation closes SF bug #825810 Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.143.8.9 retrieving revision 1.143.8.10 diff -C2 -d -r1.143.8.9 -r1.143.8.10 *** libfuncs.tex 7 Dec 2003 11:03:08 -0000 1.143.8.9 --- libfuncs.tex 1 Jan 2004 03:40:57 -0000 1.143.8.10 *************** *** 353,357 **** \begin{funcdesc}{file}{filename\optional{, mode\optional{, bufsize}}} ! Return a new file object (described earlier under Built-in Types). The first two arguments are the same as for \code{stdio}'s \cfunction{fopen()}: \var{filename} is the file name to be opened, --- 353,359 ---- \begin{funcdesc}{file}{filename\optional{, mode\optional{, bufsize}}} ! Return a new file object (described in ! section~\ref{bltin-file-objects}, ``\ulink{File ! Objects}{bltin-file-objects.html}''). The first two arguments are the same as for \code{stdio}'s \cfunction{fopen()}: \var{filename} is the file name to be opened, From fdrake at users.sourceforge.net Wed Dec 31 22:41:29 2003 From: fdrake at users.sourceforge.net (fdrake@users.sourceforge.net) Date: Wed Dec 31 22:41:32 2003 Subject: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.160,1.161 Message-ID: <E1AbtiD-0005eo-00@sc8-pr-cvs1.sourceforge.net> Update of /cvsroot/python/python/dist/src/Doc/lib In directory sc8-pr-cvs1:/tmp/cvs-serv21740 Modified Files: libfuncs.tex Log Message: fix reference to File Object documentation closes SF bug #825810 Index: libfuncs.tex =================================================================== RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** libfuncs.tex 30 Dec 2003 20:48:59 -0000 1.160 --- libfuncs.tex 1 Jan 2004 03:41:27 -0000 1.161 *************** *** 353,357 **** \begin{funcdesc}{file}{filename\optional{, mode\optional{, bufsize}}} ! Return a new file object (described earlier under Built-in Types). The first two arguments are the same as for \code{stdio}'s \cfunction{fopen()}: \var{filename} is the file name to be opened, --- 353,359 ---- \begin{funcdesc}{file}{filename\optional{, mode\optional{, bufsize}}} ! Return a new file object (described in ! section~\ref{bltin-file-objects}, ``\ulink{File ! Objects}{bltin-file-objects.html}''). The first two arguments are the same as for \code{stdio}'s \cfunction{fopen()}: \var{filename} is the file name to be opened,